From: David Heidelberg <[email protected]> The cs35l36 codec needs the codec dai and component sysclk to be set during TDM startup. Set these for all codec DAIs on the QUATERNARY_TDM path, gracefully handling codecs that don't support sysclk by ignoring -ENOTSUPP returns.
Based on work of Joel Selvaraj. Signed-off-by: David Heidelberg <[email protected]> --- sound/soc/qcom/sdm845.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index 8b65aa3982d47..b2d51e472bc26 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -405,16 +405,38 @@ static int sdm845_snd_startup(struct snd_pcm_substream *substream) ret = snd_soc_dai_set_fmt( codec_dai, codec_dai_fmt); if (ret < 0) { dev_err(rtd->dev, "Right TDM slot err:%d\n", ret); return ret; } } + + /* Set codec sysclk needed by codecs like cs35l36. */ + ret = snd_soc_dai_set_sysclk(codec_dai, 0, + TDM_BCLK_RATE, + SND_SOC_CLOCK_IN); + if (ret < 0 && ret != -ENOTSUPP) { + dev_err(codec_dai->dev, + "Failed to set codec dai sysclk: %d\n", + ret); + return ret; + } + + ret = snd_soc_component_set_sysclk(codec_dai->component, + 0, 0, + TDM_BCLK_RATE, + SND_SOC_CLOCK_IN); + if (ret < 0 && ret != -ENOTSUPP) { + dev_err(codec_dai->dev, + "Failed to set codec component sysclk: %d\n", + ret); + return ret; + } } break; case SLIMBUS_0_RX...SLIMBUS_6_TX: break; default: pr_err("%s: invalid dai id 0x%x\n", __func__, cpu_dai->id); break; -- 2.53.0

