[alsa-devel] Choosing the sysclk in simple-card looks broken to me.
jonsmirl at gmail.com
jonsmirl at gmail.com
Mon Aug 11 14:24:54 CEST 2014
On Mon, Aug 11, 2014 at 7:49 AM, Nicolin Chen
<Guangyu.Chen at freescale.com> wrote:
> On Mon, Aug 11, 2014 at 07:56:12AM -0400, jonsmirl at gmail.com wrote:
>> > It looks like the problem is that Simple Card also configures cpu-dai
>> > via set_sysclk() with direction SND_SOC_CLOCK_IN while it fetches the
>> > sysclk rate not from MCLK source but from 'sound-dai' -- cpu-dai node
>> > itself, when the binding for sound-dai doesn't have clock or frequency
>> > assignment, although this fetching works out for codec-dai side.
>> >
>> > In your case, Simple Card sets both sides of dai with different sysclk
>> > rates, and meanwhile the sysclk rate for cpu-dai is incorrect.
>> >
>> > Is it true?
>>
>> Yes, that is what is going on. Trying to use sgtl5000 with
>> simple-audio exposed that issue. Without removing that 'else' clause
>> there is no way to tell simple-audio just to leave the cpu-dai alone.
>
> This issue remained in Simple Card shall be fixed. But I don't think
> it's a good idea to _just_ remove that 'else' since its does work for
> codec-dai. Instead, I think you might need to check the set_sysclk()
> of cpu-dai driver as I mentioned in the last mail:
The code in that else case is just getting lucky. It is picking up the
rate from the first input clock defined in the DTS for the device.
For my cpu-dai the first input clock is the apb bus clock which is
running at 80Mhz. In this case the default did the totally wrong
thing. On my CPU you really can set the sysclk to 80Mhz and that way
exceeds the input spec for sgtl5000. I just happen to notice because I
had some debug code telling what clock rates were being set.
For the sgtl5000 the first input clock happens to be the link back to the codec.
So maybe the fix is to only run that else case for for the codec-dai?
>
> The sysclk direction is only valid when indicating MCLK as sysclk
> (FSYNC or BCLK shall follow CBS_CFS/CBM_CFM setting).So basically
> if cpu-dai driver gets sysclk configuration with SND_SOC_CLOCK_IN,
> shouldn't it just set the internal direction for MCLK's PAD and
> return the call directly? (I'm guessing there also might be some
> tiny work for your cpu-dai driver to enhance the validation part.)
>
> Best regards,
> Nicolin
--
Jon Smirl
jonsmirl at gmail.com
More information about the Alsa-devel
mailing list