From 7e850259f14961f52da473111ed58419e479c8c5 Mon Sep 17 00:00:00 2001 From: Stephen Gordon Date: Mon, 23 Dec 2024 10:02:41 +1100 Subject: [PATCH] soc: pcm3168a: Add DT binding to force clock consumer mode ASoC cannot configure the codec correctly when the ADC and DAC share clock lines and one of them is the clock producer. Add a DT binding that overrides ASoC and forces the component into clock consumer mode. Signed-off-by: Stephen Gordon --- sound/soc/codecs/pcm3168a.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c index fac0617ab95b65..9e7b030437404d 100644 --- a/sound/soc/codecs/pcm3168a.c +++ b/sound/soc/codecs/pcm3168a.c @@ -60,6 +60,7 @@ struct pcm3168a_priv { struct clk *scki; struct gpio_desc *gpio_rst; unsigned long sysclk; + bool adc_fc, dac_fc; // Force clock consumer mode struct pcm3168a_io_params io_params[2]; struct snd_soc_dai_driver dai_drv[2]; @@ -478,6 +479,12 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream, ms = 0; } + // 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; + format = io_params->format; if (io_params->slot_width) @@ -756,6 +763,11 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) pcm3168a->sysclk = clk_get_rate(pcm3168a->scki); + 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"); + for (i = 0; i < ARRAY_SIZE(pcm3168a->supplies); i++) pcm3168a->supplies[i].supply = pcm3168a_supply_names[i];