On 27/01/16 20:14, Mark Brown wrote:
On Wed, Jan 27, 2016 at 05:13:09PM +0000, Damien Horsley wrote:
audio_pll is referenced exclusively by the card device
That one *may* be plausible.
i2s_mclk and dac_mclk can also be referenced by other devices. The i2s out controller references i2s_mclk, and codec devices can reference i2s_mclk/dac_mclk dependent on their system clock requirements
The clock API copes perfectly happily with this.
without a reference to i2s_mclk and dac_mclk in the card driver, it would not be possible to control the divisors and gates for these clocks in the following cases:
Simplistic codecs that do not have drivers
Codec drivers that do not call clk_set_rate and clk_enable/clk_disable
Nonsense, if there is no driver or the driver doesn't do what you want then fix that. Don't bodge things at the wrong abstraction layer, that just creates problems later on when someone comes along and does things properly or tries to use the device tree outside of your particular implementation (eg, when working with a differnet OS).
Okay. If it can be expected that the codec driver will call these then the references will not be required in the card driver for the codecs.
The i2s out controller also uses i2s_mclk, and calls clk_set_rate in hw_params at present. Would creating a set_sysclk callback for the i2s out controller, then calling snd_soc_dai_set_sysclk on the cpu dai in addition to the codec dais in the card driver be the correct way to manage this?