Dne 22. 04. 21 v 11:08 shumingf@realtek.com napsal(a):
From: Shuming Fan shumingf@realtek.com
The DAPM event and mixer control could mute/unmute the capture directly. That will be confused that capture still works if the user settings is unmute before the capture. Therefore, this patch uses the variables to record the capture switch status of DAPM and mixer.
Signed-off-by: Shuming Fan shumingf@realtek.com
sound/soc/codecs/rt711-sdca.c | 208 +++++++++++++++++++++++++++------- sound/soc/codecs/rt711-sdca.h | 2 + 2 files changed, 167 insertions(+), 43 deletions(-)
diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index bfb7f1c8ec8f..3ab9048b4ea3 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -642,6 +642,154 @@ static int rt711_sdca_set_gain_get(struct snd_kcontrol *kcontrol, return 0; }
+static int rt711_sdca_set_fu0f_capture_ctl(struct rt711_sdca_priv *rt711) +{
- int err;
- if (rt711->fu0f_dapm_mute) {
err = regmap_write(rt711->regmap,
SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F,
RT711_SDCA_CTL_FU_MUTE, CH_L), 0x01);
if (err < 0)
return err;
err = regmap_write(rt711->regmap,
SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F,
RT711_SDCA_CTL_FU_MUTE, CH_R), 0x01);
if (err < 0)
return err;
Is possible to set both channels RT711_SDCA_CTL_FU_MUTE in one write ?
Something like:
regmap_write(rt711->regmap, SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R|CH_L), 0x01);
Anyway, this function can be recoded like (far more readable):
ch_l = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_l_mute) ? 0x01 : 0x00; ch_r = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_r_mute) ? 0x01 : 0x00: regmap_write(rt711->regmap, SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L), ch_l); regmap_write(rt711->regmap, SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R), ch_r);
... just add error checking ...
Or ideally, if both mute bits can be set together (one regmap_write):
ch_l = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_l_mute) ? 0x01 : 0x00; ch_r = (rt711->fu0f_dapm_mute || rt711->fu0f_mixer_r_mute) ? 0x01 : 0x00: regmap_write(rt711->regmap, SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L|CH_R), ch_l | (ch_r << 1));
+static int rt711_sdca_set_fu1e_capture_ctl(struct rt711_sdca_priv *rt711)
Same comments as for rt711_sdca_set_fu0f_capture_ctl().
Jaroslav