Skip to content

Commit f3d089e

Browse files
gordostepelwell
authored andcommitted
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 <gordoste@iinet.net.au>
1 parent 138ab1a commit f3d089e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sound/soc/codecs/pcm3168a.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct pcm3168a_priv {
6060
struct clk *scki;
6161
struct gpio_desc *gpio_rst;
6262
unsigned long sysclk;
63+
bool adc_fc, dac_fc; // Force clock consumer mode
6364

6465
struct pcm3168a_io_params io_params[2];
6566
struct snd_soc_dai_driver dai_drv[2];
@@ -478,6 +479,12 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
478479
ms = 0;
479480
}
480481

482+
// Force clock consumer mode if needed
483+
if (pcm3168a->adc_fc && dai->id == PCM3168A_DAI_ADC)
484+
ms = 0;
485+
if (pcm3168a->dac_fc && dai->id == PCM3168A_DAI_DAC)
486+
ms = 0;
487+
481488
format = io_params->format;
482489

483490
if (io_params->slot_width)
@@ -756,6 +763,11 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap)
756763

757764
pcm3168a->sysclk = clk_get_rate(pcm3168a->scki);
758765

766+
pcm3168a->adc_fc = of_property_read_bool(dev->of_node,
767+
"adc-force-cons");
768+
pcm3168a->dac_fc = of_property_read_bool(dev->of_node,
769+
"dac-force-cons");
770+
759771
for (i = 0; i < ARRAY_SIZE(pcm3168a->supplies); i++)
760772
pcm3168a->supplies[i].supply = pcm3168a_supply_names[i];
761773

0 commit comments

Comments
 (0)