Skip to content

Commit 2daf3d9

Browse files
Bard Liaobroonie
authored andcommitted
ASoC: rt5682: add button detection mode control
We are currently using power saving mode for button detection. However, it will impact the headset recording performance. This patch will switch button detection to normal mode in capture and switch to power saving mode in the end of capture. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 424e2b4 commit 2daf3d9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sound/soc/codecs/rt5682.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,8 @@ static int rt5682_button_detect(struct snd_soc_component *component)
857857
btn_type = val & 0xfff0;
858858
snd_soc_component_write(component, RT5682_4BTN_IL_CMD_1, val);
859859
pr_debug("%s btn_type=%x\n", __func__, btn_type);
860+
snd_soc_component_update_bits(component,
861+
RT5682_SAR_IL_CMD_2, 0x10, 0x10);
860862

861863
return btn_type;
862864
}
@@ -1645,6 +1647,8 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = {
16451647
SND_SOC_DAPM_MIXER("Stereo1 ADC MIXR", RT5682_STO1_ADC_DIG_VOL,
16461648
RT5682_R_MUTE_SFT, 1, rt5682_sto1_adc_r_mix,
16471649
ARRAY_SIZE(rt5682_sto1_adc_r_mix)),
1650+
SND_SOC_DAPM_SUPPLY("BTN Detection Mode", RT5682_SAR_IL_CMD_1,
1651+
14, 1, NULL, 0),
16481652

16491653
/* ADC PGA */
16501654
SND_SOC_DAPM_PGA("Stereo1 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
@@ -1807,6 +1811,8 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
18071811
{"Stereo1 ADC MIXR", "ADC2 Switch", "Stereo1 ADC R2 Mux"},
18081812
{"Stereo1 ADC MIXR", NULL, "ADC Stereo1 Filter"},
18091813

1814+
{"ADC Stereo1 Filter", NULL, "BTN Detection Mode"},
1815+
18101816
{"Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXL"},
18111817
{"Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXR"},
18121818

0 commit comments

Comments
 (0)