[alsa-devel] [RFC PATCH 5/5] ASoC: simplify the SSP DMA parameters settings by run-time generation

Eric Miao eric.y.miao at gmail.com
Thu Apr 23 11:28:26 CEST 2009


On Thu, Apr 23, 2009 at 5:08 PM, Mark Brown <broonie at sirena.org.uk> wrote:
> On Thu, Apr 23, 2009 at 05:02:14PM +0800, Eric Miao wrote:
>> >> + ?? ?? ?? snprintf(dma->name, 20, "SSP%d PCM %s %s", ssp->port_id,
>> >> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? stereo ? "Stereo" : "Mono", out ? "out" : "in");
>
>> > Should we change Stereo/Mono to 32-bit/16-bit here?
>
>> Depends on Mark, the dma->name and the comments below doesn't
>> actually match very well ...
>
> The change seems reasonable - the text has bitrotted with respect to
> what actually happens.
>

So that's going to change the dma->name as something below:

"SSP3 PCM 32-bit out"

Looks sane?

With the code:

+static struct pxa2xx_pcm_dma_params *
+ssp_get_dma_params(struct ssp_device *ssp, int width4, int out)
+{
+	struct pxa2xx_pcm_dma_data *dma;
+
+	dma = kzalloc(sizeof(struct pxa2xx_pcm_dma_data), GFP_KERNEL);
+	if (dma == NULL)
+		return NULL;
+
+	snprintf(dma->name, 20, "SSP%d PCM %s %s", ssp->port_id,
+			width4 ? "32-bit" : "16-bit", out ? "out" : "in");
+
+	dma->params.name = dma->name;
+	dma->params.drcmr = &DRCMR(out ? ssp->drcmr_tx : ssp->drcmr_rx);
+	dma->params.dcmd = (out ? (DCMD_INCSRCADDR | DCMD_FLOWTRG) :
+				  (DCMD_INCTRGADDR | DCMD_FLOWSRC)) |
+			(width4 ? DCMD_WIDTH4 : DCMD_WIDTH2) | DCMD_BURST16;
+	dma->params.dev_addr = ssp->phys_base + SSDR;
+
+	return &dma->params;
+}
+


More information about the Alsa-devel mailing list