mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
ASoC: qcom: sc8280xp: Fix TDM hw_params error handling
Treat -ENOENT from TDM slot parsing as the optional "configuration not present" case and continue to propagate real configuration errors. Also ignore -ENOTSUPP from optional DAI format and codec sysclk callbacks, apply codec_dai_fmt to codec DAIs on TDM links, and use a signed bclk_freq variable so errors from snd_soc_tdm_params_to_bclk() are handled correctly. Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://sashiko.dev/#/patchset/20260804070307.117119-1-prasad.kumpatla@oss.qualcomm.com Signed-off-by: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com> Link: https://patch.msgid.link/20260818084655.3240284-5-prasad.kumpatla@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0a9e00d5eb
commit
8593dc5f05
|
|
@ -115,33 +115,42 @@ static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *codec_dai;
|
||||
struct qcom_snd_tdm_slot_cfg cpu_cfg;
|
||||
struct qcom_snd_tdm_slot_cfg codec_cfg;
|
||||
unsigned int bclk_freq;
|
||||
int bclk_freq;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ret = qcom_snd_get_dai_tdm_slots(rtd, &cpu_cfg, &codec_cfg);
|
||||
if (ret)
|
||||
return ret == -EINVAL ? 0 : ret;
|
||||
return ret == -ENOENT ? 0 : ret;
|
||||
|
||||
if (!cpu_cfg.slots)
|
||||
return 0;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
|
||||
if (ret)
|
||||
if (ret && ret != -ENOTSUPP)
|
||||
return ret;
|
||||
|
||||
if (data->priv->codec_dai_fmt) {
|
||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
ret = snd_soc_dai_set_fmt(codec_dai,
|
||||
data->priv->codec_dai_fmt);
|
||||
if (ret && ret != -ENOTSUPP)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = qcom_snd_apply_dai_tdm_slots_cfg(rtd, &cpu_cfg, &codec_cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
bclk_freq = snd_soc_tdm_params_to_bclk(params, cpu_cfg.slot_width, cpu_cfg.slots, 1);
|
||||
if (!bclk_freq)
|
||||
if (bclk_freq <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (data->priv->mi2s_bclk_enable) {
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_MI2S_BCLK, bclk_freq,
|
||||
SND_SOC_CLOCK_IN);
|
||||
if (ret) {
|
||||
if (ret && ret != -ENOTSUPP) {
|
||||
dev_err(rtd->dev, "%s: failed to set cpu sysclk: %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
|
|
@ -152,7 +161,7 @@ static int sc8280xp_tdm_hw_params(struct snd_pcm_substream *substream,
|
|||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, 0, bclk_freq,
|
||||
SND_SOC_CLOCK_IN);
|
||||
if (ret) {
|
||||
if (ret && ret != -ENOTSUPP) {
|
||||
dev_err(rtd->dev, "%s: failed to set codec sysclk on %s: %d\n",
|
||||
__func__, codec_dai->name, ret);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user