Skip to content

Commit

Permalink
ASoC: rt711-sdca: add GE selected mode control
Browse files Browse the repository at this point in the history
This patch adds the 'selected mode' control which overrides the detected_mode.

Signed-off-by: Shuming Fan <[email protected]>
  • Loading branch information
shumingfan committed May 3, 2024
1 parent 661face commit c2bf13e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions sound/soc/codecs/rt711-sdca-sdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static const struct reg_default rt711_sdca_reg_defaults[] = {
{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_PDE28, RT711_SDCA_CTL_REQ_POWER_STATE, 0), 0x03 },
{ SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_SELECTED_MODE, 0), 0x00 },
{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_L), 0x01 },
{ SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_MUTE, CH_R), 0x01 },
};
Expand Down
19 changes: 19 additions & 0 deletions sound/soc/codecs/rt711-sdca.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ static int rt711_sdca_headset_detect(struct rt711_sdca_priv *rt711)
switch (det_mode) {
case 0x00:
rt711->jack_type = 0;
regmap_write(rt711->regmap,
SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_SELECTED_MODE, 0), 0);
break;
case 0x03:
rt711->jack_type = SND_JACK_HEADPHONE;
Expand Down Expand Up @@ -790,6 +792,22 @@ static int rt711_sdca_fu0f_capture_put(struct snd_kcontrol *kcontrol,
return changed;
}

static const char * const rt711_sdca_ge_select[] = {
"Unplug",
"Headphone",
"Headset",
};

static int rt711_sdca_ge_select_values[] = {
0,
3,
5,
};

static SOC_VALUE_ENUM_SINGLE_DECL(rt711_sdca_ge_mode_enum,
SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_SELECTED_MODE, 0),
0, 0x7, rt711_sdca_ge_select, rt711_sdca_ge_select_values);

static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6525, 75, 0);
static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1725, 75, 0);
static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0);
Expand Down Expand Up @@ -824,6 +842,7 @@ static const struct snd_kcontrol_new rt711_sdca_snd_controls[] = {
SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_PLATFORM_FU15, RT711_SDCA_CTL_FU_CH_GAIN, CH_R),
8, 3, 0,
rt711_sdca_set_gain_get, rt711_sdca_set_gain_put, mic_vol_tlv),
SOC_ENUM("GE49 Selected Mode", rt711_sdca_ge_mode_enum),
};

static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol,
Expand Down

0 comments on commit c2bf13e

Please sign in to comment.