Re: [PATCH v2 3/3] ASoC: qcom: sc8280xp: ASoC: qcom: sc8280xp: enhance machine driver for board-specific config

From: Mark Brown

Date: Mon Jun 08 2026 - 08:12:43 EST


On Mon, Jun 08, 2026 at 08:00:11AM +0530, Mohammad Rafi Shaik wrote:
> The sc8280xp machine driver is currently written with a largely
> SoC-centric view and assumes a uniform audio topology across all boards.

> +static inline int sc8280xp_get_mclk_freq(struct snd_pcm_hw_params *params)
> +{
> + int rate = params_rate(params);
> +
> + switch (rate) {
> + case SNDRV_PCM_RATE_11025:
> + case SNDRV_PCM_RATE_44100:
> + case SNDRV_PCM_RATE_88200:

rate is in Hz but these are bitmasks.

> + return I2S_MCLK_RATE(44100);
> + default:
> + break;
> + }

The function only works since it ignores invalid values.

> +static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{

> +
> + if (data->snd_soc_common_priv->codec_dai_fmt)
> + snd_soc_dai_set_fmt(codec_dai,
> + data->snd_soc_common_priv->codec_dai_fmt);

Should we error check the functions we call here?

> + if (data->snd_soc_common_priv->mi2s_mclk_enable)
> + snd_soc_dai_set_sysclk(cpu_dai,
> + LPAIF_MI2S_MCLK, mclk_freq,
> + SND_SOC_CLOCK_IN);
> +
> + if (data->snd_soc_common_priv->mi2s_bclk_enable)
> + snd_soc_dai_set_sysclk(cpu_dai,
> + LPAIF_MI2S_BCLK, bclk_freq,
> + SND_SOC_CLOCK_IN);

Is SND_SOC_CLK_IN right here? The flag sounds like it's enabling the
clock on the DAI but this is configuring the DAI to consume a clock.

> + if (data->snd_soc_common_priv->codec_sysclk_set)
> + snd_soc_dai_set_sysclk(cpu_dai,
> + 0, mclk_freq,
> + SND_SOC_CLOCK_IN);

This is configuring the CPU not CODEC.

Attachment: signature.asc
Description: PGP signature