diff mbox series

ASoC: codecs: ES8326: Adding new kcontrols about Headphone resistance

Message ID 20240126074512.62013-1-zhangyi@everest-semi.com
State New
Headers show
Series ASoC: codecs: ES8326: Adding new kcontrols about Headphone resistance | expand

Commit Message

Zhang Yi Jan. 26, 2024, 7:45 a.m. UTC
We get headphone detect issue.And we fix it with the new kcontrols

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
 sound/soc/codecs/es8326.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
index 608862aebd71..aa5044eef0ca 100755
--- a/sound/soc/codecs/es8326.c
+++ b/sound/soc/codecs/es8326.c
@@ -226,6 +226,29 @@  static const char *const hp_spkvol_switch[] = {
 	"HPVOL: HPL+HPR, SPKVOL: SPKL+SPKR",
 };
 
+static const char *const hp_det_resistance[] = {
+	"10K",
+	"5K",
+};
+
+static const char *const micbias_resistance[] = {
+	"5.5K",
+	"4.5K",
+	"3.6K",
+	"2.8K",
+	"2.1K",
+	"1.5K",
+	"1.0K",
+	"0.6K",
+};
+
+static const char *const button_resistance[] = {
+	"100 percent",
+	"90 percent",
+	"80 percent",
+	"70 percent",
+};
+
 static const struct soc_enum dacpol =
 	SOC_ENUM_SINGLE(ES8326_DAC_DSM, 4, 4, dacpol_txt);
 static const struct soc_enum alc_winsize =
@@ -234,6 +257,12 @@  static const struct soc_enum drc_winsize =
 	SOC_ENUM_SINGLE(ES8326_DRC_WINSIZE, 4, 16, winsize);
 static const struct soc_enum hpvol_spkvol_switch =
 	SOC_ENUM_SINGLE(ES8326_HP_MISC, 6, 4, hp_spkvol_switch);
+static const struct soc_enum hp_det =
+	SOC_ENUM_SINGLE(ES8326_ANA_MICBIAS, 7, 2, hp_det_resistance);
+static const struct soc_enum micbias_res =
+	SOC_ENUM_SINGLE(ES8326_ANA_MICBIAS, 4, 8, micbias_resistance);
+static const struct soc_enum button_res =
+	SOC_ENUM_SINGLE(ES8326_ANA_MICBIAS, 0, 4, button_resistance);
 
 static const struct snd_kcontrol_new es8326_snd_controls[] = {
 	SOC_SINGLE_TLV("DAC Playback Volume", ES8326_DACL_VOL, 0, 0xbf, 0, dac_vol_tlv),
@@ -270,6 +299,9 @@  static const struct snd_kcontrol_new es8326_snd_controls[] = {
 	SOC_SINGLE_TLV("SPKR Playback Volume", ES8326_SPKR_VOL, 0, 0xbf, 0, dac_vol_tlv),
 
 	SOC_ENUM("HPVol SPKVol Switch", hpvol_spkvol_switch),
+	SOC_ENUM("Hpdet Resistance", hp_det),
+	SOC_ENUM("Micbias Resistance", micbias_res),
+	SOC_ENUM("Button Resistance", button_res),
 };
 
 static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {