ASoC: Merge up workaround for CODECs that play noise on stopped stream

This was sent too late to actually make it for v6.6 but was sent against
v6.6 so merge it up here.
This commit is contained in:
Mark Brown 2023-10-27 22:33:15 +01:00
commit bdb7e19220
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
7 changed files with 34 additions and 11 deletions

View file

@ -370,6 +370,7 @@ struct snd_soc_dai_ops {
/* bit field */
unsigned int no_capture_mute:1;
unsigned int mute_unmute_on_trigger:1;
};
struct snd_soc_cdai_ops {

View file

@ -1203,9 +1203,6 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
break;
}
snd_soc_component_write_field(component, WSA883X_DRE_CTL_1,
WSA883X_DRE_GAIN_EN_MASK,
WSA883X_DRE_GAIN_FROM_CSR);
if (wsa883x->port_enable[WSA883X_PORT_COMP])
snd_soc_component_write_field(component, WSA883X_DRE_CTL_0,
WSA883X_DRE_OFFSET_MASK,
@ -1218,9 +1215,6 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
snd_soc_component_write_field(component, WSA883X_PDM_WD_CTL,
WSA883X_PDM_EN_MASK,
WSA883X_PDM_ENABLE);
snd_soc_component_write_field(component, WSA883X_PA_FSM_CTL,
WSA883X_GLOBAL_PA_EN_MASK,
WSA883X_GLOBAL_PA_ENABLE);
break;
case SND_SOC_DAPM_PRE_PMD:
@ -1346,6 +1340,7 @@ static const struct snd_soc_dai_ops wsa883x_dai_ops = {
.hw_free = wsa883x_hw_free,
.mute_stream = wsa883x_digital_mute,
.set_stream = wsa883x_set_sdw_stream,
.mute_unmute_on_trigger = true,
};
static struct snd_soc_dai_driver wsa883x_dais[] = {

View file

@ -1966,17 +1966,21 @@ static int fsl_easrc_probe(struct platform_device *pdev)
&fsl_easrc_dai, 1);
if (ret) {
dev_err(dev, "failed to register ASoC DAI\n");
return ret;
goto err_pm_disable;
}
ret = devm_snd_soc_register_component(dev, &fsl_asrc_component,
NULL, 0);
if (ret) {
dev_err(&pdev->dev, "failed to register ASoC platform\n");
return ret;
goto err_pm_disable;
}
return 0;
err_pm_disable:
pm_runtime_disable(&pdev->dev);
return ret;
}
static void fsl_easrc_remove(struct platform_device *pdev)

View file

@ -299,6 +299,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
if (!module->instance_id) {
ret = -ENOMEM;
kfree(module);
goto free_uuid_list;
}

View file

@ -658,6 +658,10 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
ret = soc_dai_trigger(dai, substream, cmd);
if (ret < 0)
break;
if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
snd_soc_dai_digital_mute(dai, 0, substream->stream);
soc_dai_mark_push(dai, substream, trigger);
}
break;
@ -668,6 +672,9 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
if (rollback && !soc_dai_mark_match(dai, substream, trigger))
continue;
if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
snd_soc_dai_digital_mute(dai, 1, substream->stream);
r = soc_dai_trigger(dai, substream, cmd);
if (r < 0)
ret = r; /* use last ret */

View file

@ -700,10 +700,16 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
snd_soc_runtime_deactivate(rtd, substream->stream);
/* Make sure DAI parameters cleared if the DAI becomes inactive */
for_each_rtd_dais(rtd, i, dai)
for_each_rtd_dais(rtd, i, dai) {
if (snd_soc_dai_active(dai) == 0 &&
(dai->rate || dai->channels || dai->sample_bits))
soc_pcm_set_dai_params(dai, NULL);
if (snd_soc_dai_stream_active(dai, substream->stream) == 0) {
if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
snd_soc_dai_digital_mute(dai, 1, substream->stream);
}
}
}
for_each_rtd_dais(rtd, i, dai)
@ -896,8 +902,10 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
snd_soc_dapm_stream_event(rtd, substream->stream,
SND_SOC_DAPM_STREAM_START);
for_each_rtd_dais(rtd, i, dai)
snd_soc_dai_digital_mute(dai, 0, substream->stream);
for_each_rtd_dais(rtd, i, dai) {
if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
snd_soc_dai_digital_mute(dai, 0, substream->stream);
}
out:
return soc_pcm_ret(rtd, ret);

View file

@ -145,6 +145,13 @@ static const struct dmi_system_id community_key_platforms[] = {
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"),
}
},
{
.ident = "Google firmware",
.callback = chromebook_use_community_key,
.matches = {
DMI_MATCH(DMI_BIOS_VERSION, "Google"),
}
},
{},
};