ASoC: codecs: jz4725b: add missed microphone widgets
authorSiarhei Volkau <lis8215@gmail.com>
Sun, 16 Oct 2022 13:26:48 +0000 (16:26 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 17 Oct 2022 11:50:31 +0000 (12:50 +0100)
Microphone input can be single ended or differential, although
known SoCs with that codec expose MIC1P only.

Also there is 20dB mic boost in the Mic1 path.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
Link: https://lore.kernel.org/r/20221016132648.3011729-8-lis8215@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/jz4725b.c

index 52b2bb9..685ba1d 100644 (file)
@@ -175,6 +175,15 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(jz4725b_out_tlv,
        12, 23, TLV_DB_SCALE_ITEM(-1050, 100, 0),
        24, 31, TLV_DB_SCALE_ITEM(  100,  50, 0),
 );
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_mic_boost_tlv, 0, 2000, 0);
+
+static const char * const jz4725b_mic_mode_texts[] = {
+       "Single Ended", "Differential",
+};
+
+static const struct soc_enum jz4725b_mic_mode_enum =
+       SOC_ENUM_SINGLE(JZ4725B_CODEC_REG_CR3, REG_CR3_MICDIFF_OFFSET,
+                       2, jz4725b_mic_mode_texts);
 
 static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
        SOC_DOUBLE_TLV("DAC Playback Volume",
@@ -219,6 +228,13 @@ static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
        SOC_SINGLE("High-Pass Filter Capture Switch",
                   JZ4725B_CODEC_REG_CR2,
                   REG_CR2_ADC_HPF_OFFSET, 1, 0),
+
+       SOC_ENUM("Mic Mode Capture Switch", jz4725b_mic_mode_enum),
+
+       SOC_SINGLE_TLV("Mic1 Boost Capture Volume",
+                      JZ4725B_CODEC_REG_PMR2,
+                      REG_PMR2_GIM_OFFSET,
+                      1, 0, jz4725b_mic_boost_tlv),
 };
 
 static const char * const jz4725b_codec_adc_src_texts[] = {