Unverified Commit 0238bcf8 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown
Browse files

ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP



There is a single McASP on OMAP4 (and OMAP5) which is configured to only
support DIT playback mode on a single serializer.

Add 0x200 offset to DAT port address as the TRM suggests it.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20210705194249.2385-4-peter.ujfalusi@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5dcd276e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ enum {
	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
	MCASP_VERSION_3,        /* TI81xx/AM33xx */
	MCASP_VERSION_4,	/* DRA7xxx */
	MCASP_VERSION_OMAP,	/* OMAP4/5 */
};

enum mcbsp_clk_input_pin {
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ config SND_SOC_DAVINCI_MCASP
	  various Texas Instruments SoCs like:
	  - daVinci devices
	  - Sitara line of SoCs (AM335x, AM438x, etc)
	  - OMAP4
	  - DRA7x devices
	  - Keystone devices
	  - K3 devices (am654, j721e)
+23 −3
Original line number Diff line number Diff line
@@ -1794,6 +1794,12 @@ static struct davinci_mcasp_pdata dra7_mcasp_pdata = {
	.version = MCASP_VERSION_4,
};

static struct davinci_mcasp_pdata omap_mcasp_pdata = {
	.tx_dma_offset = 0x200,
	.rx_dma_offset = 0,
	.version = MCASP_VERSION_OMAP,
};

static const struct of_device_id mcasp_dt_ids[] = {
	{
		.compatible = "ti,dm646x-mcasp-audio",
@@ -1811,6 +1817,10 @@ static const struct of_device_id mcasp_dt_ids[] = {
		.compatible = "ti,dra7-mcasp-audio",
		.data = &dra7_mcasp_pdata,
	},
	{
		.compatible = "ti,omap4-mcasp-audio",
		.data = &omap_mcasp_pdata,
	},
	{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
@@ -2350,10 +2360,17 @@ static int davinci_mcasp_probe(struct platform_device *pdev)

	dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
	dma_data->filter_data = "tx";
	if (dat)
	if (dat) {
		dma_data->addr = dat->start;
	else
		/*
		 * According to the TRM there should be 0x200 offset added to
		 * the DAT port address
		 */
		if (mcasp->version == MCASP_VERSION_OMAP)
			dma_data->addr += davinci_mcasp_txdma_offset(mcasp->pdata);
	} else {
		dma_data->addr = mem->start + davinci_mcasp_txdma_offset(mcasp->pdata);
	}


	/* RX is not valid in DIT mode */
@@ -2418,7 +2435,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
		ret = edma_pcm_platform_register(&pdev->dev);
		break;
	case PCM_SDMA:
		if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE)
			ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
		else
			ret = sdma_pcm_platform_register(&pdev->dev, "tx", NULL);
		break;
	case PCM_UDMA:
		ret = udma_pcm_platform_register(&pdev->dev);