2021/9/15

WM8974 driver : 增加一個control : mic bias

發現沒有寫,所以現在補一下..

Datasheet 上..
Datasheet P 19:

* Register R44: Input Control
* Bit 8
* Label: MBVSEL
* Default: 0
* Description: Microphone Bias Voltage Control
    0: 0.9 x AVDD
    1: 0.75 x AVDD
所以在 wm8974.c 中加一個 amixer control:
diff --git a/linux-4.14/sound/soc/codecs/wm8974.c b/linux-4.14/sound/soc/codecs/wm8974.c
index 61fbd7c55..7a1c492d2 100644
--- a/linux-4.14/sound/soc/codecs/wm8974.c
+++ b/linux-4.14/sound/soc/codecs/wm8974.c
@@ -66,6 +66,7 @@ static const char *wm8974_eq3[] = {"650Hz", "850Hz", "1.1kHz", "1.4kHz" };
 static const char *wm8974_eq4[] = {"1.8kHz", "2.4kHz", "3.2kHz", "4.1kHz" };
 static const char *wm8974_eq5[] = {"5.3kHz", "6.9kHz", "9kHz", "11.7kHz" };
 static const char *wm8974_alc[] = {"ALC", "Limiter" };
+static const char *wm8974_mbvsel[]= {"0.9", "0.75"};
 
 static const struct soc_enum wm8974_enum[] = {
        SOC_ENUM_SINGLE(WM8974_COMP, 1, 4, wm8974_companding), /* adc */
@@ -85,6 +86,7 @@ static const struct soc_enum wm8974_enum[] = {
 
        SOC_ENUM_SINGLE(WM8974_EQ5,  5, 4, wm8974_eq5),
        SOC_ENUM_SINGLE(WM8974_ALC3,  8, 2, wm8974_alc),
+       SOC_ENUM_SINGLE(WM8974_INPUT, 8, 2, wm8974_mbvsel),
 };
 
 static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" };
@@ -131,6 +133,7 @@ SOC_ENUM("Equaliser EQ4 Bandwidth", wm8974_enum[9]),
 SOC_ENUM("EQ4 Cut Off", wm8974_enum[10]),
 SOC_SINGLE_TLV("EQ4 Volume", WM8974_EQ4,  0, 24, 1, eq_tlv),
 
+
 SOC_ENUM("Equaliser EQ5 Bandwidth", wm8974_enum[11]),
 SOC_ENUM("EQ5 Cut Off", wm8974_enum[12]),
 SOC_SINGLE_TLV("EQ5 Volume", WM8974_EQ5,  0, 24, 1, eq_tlv),
@@ -151,6 +154,8 @@ SOC_SINGLE("ALC Capture Hold", WM8974_ALC2,  4, 7, 0),
 SOC_SINGLE("ALC Capture Target", WM8974_ALC2,  0, 15, 0),
 
 SOC_ENUM("ALC Capture Mode", wm8974_enum[13]),
+SOC_ENUM("MIC Bias Voltage", wm8974_enum[14]),
+
 SOC_SINGLE("ALC Capture Decay", WM8974_ALC3,  4, 15, 0),
 SOC_SINGLE("ALC Capture Attack", WM8974_ALC3,  0, 15, 0),
 
這樣就多一個
numid=38,iface=MIXER,name='MIC Bias Voltage'
cget, set
# amixer cget numid=38
numid=38,iface=MIXER,name='MIC Bias Voltage'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 '0.9'
  ; Item #1 '0.75'
  : values=1
設完後,cat register-map 來看,reg 2C bit 8 有改變。

沒有留言:

張貼留言