Skip to content

Commit

Permalink
ASoC: rt711-sdca: change the setting flow of GE control
Browse files Browse the repository at this point in the history
Fixup! ASoC: rt711-sdca: add GE selected mode control
This patch sets the jack type before reading detected_mode and doesn't set it
back to auto mode while the jack is unplugged.

Signed-off-by: Shuming Fan <[email protected]>
  • Loading branch information
shumingfan authored and plbossart committed Jun 20, 2024
1 parent 414bda9 commit d257880
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions sound/soc/codecs/rt711-sdca.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ static int rt711_sdca_headset_detect(struct rt711_sdca_priv *rt711)
unsigned int det_mode;
int ret;

rt711_sdca_ge_force_jack_type(rt711, rt711->ge_mode_override);

/* get detected_mode */
ret = regmap_read(rt711->regmap,
SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_DETECTED_MODE, 0),
Expand All @@ -285,15 +287,6 @@ static int rt711_sdca_headset_detect(struct rt711_sdca_priv *rt711)
break;
}

if (rt711->ge_mode_override || (det_mode == 0)) {
if ((det_mode != rt711->ge_mode_override) && det_mode) {
det_mode = rt711->ge_mode_override;
rt711->jack_type =
(rt711->jack_type == SND_JACK_HEADPHONE) ? SND_JACK_HEADSET : SND_JACK_HEADPHONE;
}
rt711_sdca_ge_force_jack_type(rt711, det_mode);
}

/* write selected_mode */
if (det_mode) {
ret = regmap_write(rt711->regmap,
Expand Down Expand Up @@ -853,7 +846,7 @@ static int rt711_sdca_ge_select_put(struct snd_kcontrol *kcontrol,
}

static const char * const rt711_sdca_ge_select[] = {
"None",
"Auto",
"Headphone",
"Headset",
};
Expand Down

0 comments on commit d257880

Please sign in to comment.