Skip to content

Commit 9351cf3

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: cs35l56: Only patch ASP registers if the DAI is part of a DAIlink
Move the ASP register patches to a separate struct and apply this from the ASP DAI probe() function so that the registers are only patched if the DAI is part of a DAI link. Some systems use the ASP as a special-purpose interconnect and on these systems the ASP registers are configured by a third party (the firmware, the BIOS, or another device using the amp's secondary host control interface). If the machine driver does not hook up the ASP DAI then the ASP registers must be omitted from the patch to prevent overwriting the third party configuration. If the machine driver includes the ASP DAI in a DAI link, this implies that the machine driver and higher components (such as alsa-ucm) are taking ownership of the ASP. In this case the ASP registers are patched to known defaults and the machine driver should configure the ASP. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20260226110137.1664562-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 11439c4 commit 9351cf3

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

include/sound/cs35l56.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ extern const char * const cs35l56_cal_set_status_text[3];
406406
extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
407407
extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
408408

409+
int cs35l56_set_asp_patch(struct cs35l56_base *cs35l56_base);
409410
int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
410411
int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
411412
int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);

sound/soc/codecs/cs35l56-shared.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "cs35l56.h"
2828

29-
static const struct reg_sequence cs35l56_patch[] = {
29+
static const struct reg_sequence cs35l56_asp_patch[] = {
3030
/*
3131
* Firmware can change these to non-defaults to satisfy SDCA.
3232
* Ensure that they are at known defaults.
@@ -43,6 +43,20 @@ static const struct reg_sequence cs35l56_patch[] = {
4343
{ CS35L56_ASP1TX2_INPUT, 0x00000000 },
4444
{ CS35L56_ASP1TX3_INPUT, 0x00000000 },
4545
{ CS35L56_ASP1TX4_INPUT, 0x00000000 },
46+
};
47+
48+
int cs35l56_set_asp_patch(struct cs35l56_base *cs35l56_base)
49+
{
50+
return regmap_register_patch(cs35l56_base->regmap, cs35l56_asp_patch,
51+
ARRAY_SIZE(cs35l56_asp_patch));
52+
}
53+
EXPORT_SYMBOL_NS_GPL(cs35l56_set_asp_patch, "SND_SOC_CS35L56_SHARED");
54+
55+
static const struct reg_sequence cs35l56_patch[] = {
56+
/*
57+
* Firmware can change these to non-defaults to satisfy SDCA.
58+
* Ensure that they are at known defaults.
59+
*/
4660
{ CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
4761
{ CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
4862
{ CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },

sound/soc/codecs/cs35l56.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,13 @@ static int cs35l56_dsp_event(struct snd_soc_dapm_widget *w,
348348
return wm_adsp_event(w, kcontrol, event);
349349
}
350350

351+
static int cs35l56_asp_dai_probe(struct snd_soc_dai *codec_dai)
352+
{
353+
struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(codec_dai->component);
354+
355+
return cs35l56_set_asp_patch(&cs35l56->base);
356+
}
357+
351358
static int cs35l56_asp_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
352359
{
353360
struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(codec_dai->component);
@@ -552,6 +559,7 @@ static int cs35l56_asp_dai_set_sysclk(struct snd_soc_dai *dai,
552559
}
553560

554561
static const struct snd_soc_dai_ops cs35l56_ops = {
562+
.probe = cs35l56_asp_dai_probe,
555563
.set_fmt = cs35l56_asp_dai_set_fmt,
556564
.set_tdm_slot = cs35l56_asp_dai_set_tdm_slot,
557565
.hw_params = cs35l56_asp_dai_hw_params,

0 commit comments

Comments
 (0)