Subject: Re: [PATCH v3 1/2] ASoC: fsl: Add S/PDIF CPU DAI driver

From: Nicolin Chen <[email-masked]>
Date: Mon, 5 Aug 2013 19:28:05 +0800

Hi Philipp,

   Thanks for the comments! I'll revise it and send a v4.
   Here is my reply to some parts of your question.

On Mon, Aug 05, 2013 at 12:07:02PM +0200, Philipp Zabel wrote:
> This looks to me like a case of configuration data in the device tree.
> Couldn't the tx/rx clock source be determined automatically or at least
> the SoC specific clock sources to the mux be known to the driver, so
> that we can use clock phandles here?
> 
> What happens if a different tx-clk-source is needed for 48 kHz than for
> 44.1 kHz?

You are right about the case. I'll try to figure out a nicer way, including
for the different sample-rate.

> Do we already have anything for this in the kernel?
> It could also be done using:
> 
> 	u8 tmp = input;
> 
>         tmp = ((tmp & 0b10101010) >> 1) | ((tmp << 1) & 0b10101010);
>         tmp = ((tmp & 0b11001100) >> 2) | ((tmp << 2) & 0b11001100);
>         tmp = ((tmp & 0b11110000) >> 4) | ((tmp << 4) & 0b11110000);
> 
> 	return tmp;

I was also wondering this question but I couldn't find it.
And obviously your algorithm is better :)

> In principle, it should also be possible to let the SDMA engine only
> take the FIFOs' MSBs for S16_LE. Is this a limitation of the SDMA ROM
> script?

You are right about the idea and the inference.