Re: [PATCH v2] ASoC: pcm3168a: Add option to force clock consumer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Dec 06, 2024 at 10:54:43PM +1100, Stephen Gordon wrote:

> Scenario is that DAC's clock pins are tied to ADC's clock pins, with
> codec acting as clock producer for the I2S bus, and the CPU has a single
> pair of I2S clock pins used for both playback and capture.

>                                  ,-------------------
> ---------            ------------| LRCK     DAC
>      LRCK|-------+--/     -------| BCK   (producer)  C
> CPU      |       |       /       |                   O
>       BCK|-------|---+--/        | ----------------  D
> consumer |       \   |           |                   E
> ---------         ---------------| LRCK     ADC      C
>                      `-----------| BCK    (consumer)
>                                  `--------------------

> Both DAI links will have codec acting as a clock producer, but we need
> 
> to configure the codec so that only one of ADC/DAC drives the lines.

This looks like something that should be done in the board
configuration, not hard coded in the CODEC driver.

> Add DT options to support this configuration. adc-force-cons/dac-force-cons
> 
> cause the corresponding component to be configured in consumer mode.

Any DT bindings should documented which should be done in a separate
patch.


> +       // Force clock consumer mode if needed
> +       if (pcm3168a->adc_fc && dai->id == PCM3168A_DAI_ADC)
> +               ms = 0;
> +       if (pcm3168a->dac_fc && dai->id == PCM3168A_DAI_DAC)
> +               ms = 0;

The clock consumer mode should just be configured via the standard
set_dai_fmt() operation.

> +       if (dev->of_node) {
> +               pcm3168a->adc_fc = of_property_read_bool(dev->of_node,
> +                               "adc-force-cons");
> +               pcm3168a->dac_fc = of_property_read_bool(dev->of_node,
> +                               "dac-force-cons");
> +       }

These properties are not documented, and you don't need to query to see
if there's an OF node to query if a property is present.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux