Re: [PATCH v4 4/8] ASoC: qcom: sdm845: Set codec dai and component sysclk during startup
From: Srinivas Kandagatla
Date: Fri Sep 25 2026 - 04:31:54 EST
On 9/24/26 2:24 PM, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@xxxxxxx>
>
> 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 <david@xxxxxxx>
It was unusal to see codec needing both dai and component callbacks to
set the sysclk correctly, it could have done with one.. but did not look
into details.. Or may be its me hitting this type for first time.
Otherwise it looks good to me.
Reviewed-by: Srinivas Kandagatla<srinivas.kandagatla@xxxxxxxxxxxxxxxx>
> ---
> 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 59cfa3b26cd4d..f0fbec9c8df25 100644
> --- a/sound/soc/qcom/sdm845.c
> +++ b/sound/soc/qcom/sdm845.c
> @@ -407,16 +407,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;
>