[PATCH 1/3] ASoC: simple-card-utils: Fix device module clock

Sameer Pujar spujar at nvidia.com
Thu Mar 11 15:29:59 CET 2021



On 3/11/2021 4:46 PM, Michael Walle wrote:
> Am 2021-03-11 12:05, schrieb Sameer Pujar:
>
>> It would work and initially I had similar patch, see [0] and related
>> series. Suggestion is to always use "clocks" property with devices
>> only.
>
> I see. But again, I don't think it is correct to change the clock of
> the codec by default. What happens if this is for example a
> compatible = "fixed-clock"?

The codec rate won't be changed unless a corresponding "*mclk-fs" is 
provided.

>
> As you pointed out in the referred thread [0]. simple-audio-card has
> that clock and judging from the code it is exactly for this reason:
> to either change/enable it or not.
>


> With this patch you'll switch that to "always change it". Therefore,
> shouldn't there be a dt flag to indicate wheter simple-audio-card/graph
> should be in charge of the codecs clock input?

As mentioned above, it does not change always. Requires "*mclk-fs" to do so.

May be below could be a possible alternative?
- Re-order if-else of clock parsing.

    if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
        // Since you are fixing rate already via "assigned-clocks" this 
may be a duplication. OR
        // "assigned-clocks" can be parsed to understand if a fixed rate 
is expected.

        simple_dai->sysclk = val;
    } else {
        // fetch MCLK clock from device and setup sysclk
        // a. If "*mclk-fs" is given and "clocks" is found, the rate 
would be updated.
        // b. If "*mclk-fs" is not mentioned and "clocks" is found, then 
simple-card utils won't touch rate. It will just do clock enable/disable.
    }

>
> And its fetching just the first clock, doesn't it? What happens if a
> codec has two clock inputs?

Yes, it would have been more descriptive if it were specifically looking 
for clock "mclk". I think the original assumption was codec takes one 
input clock (MCLK) and uses it for sysclk.

>
> -michael
>
> [0]
> https://patchwork.kernel.org/project/alsa-devel/patch/1611944866-29373-4-git-send-email-spujar@nvidia.com/ 
>



More information about the Alsa-devel mailing list