ASoC: WCD9xxx: Add Micbias capless mode to platform data
Microphone Bias may or may not have an external bypass capacitor
depending on the board configurations. Add the microphone bias
capless mode setting to the platform data for codec
CRs-fixed: 363941
Change-Id: Ia949d240b3b3122bc4bd6aca02ee5b6cd785d246
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index 19530e3..f63b490 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -781,6 +781,8 @@
.cfilt2_mv = 1800,
.bias1_cfilt_sel = SITAR_CFILT1_SEL,
.bias2_cfilt_sel = SITAR_CFILT2_SEL,
+ .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
+ .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
},
.regulator = {
{
@@ -845,6 +847,8 @@
.cfilt2_mv = 1800,
.bias1_cfilt_sel = SITAR_CFILT1_SEL,
.bias2_cfilt_sel = SITAR_CFILT2_SEL,
+ .bias1_cap_mode = MICBIAS_EXT_BYP_CAP,
+ .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP,
},
.regulator = {
{
diff --git a/include/linux/mfd/wcd9xxx/pdata.h b/include/linux/mfd/wcd9xxx/pdata.h
index ba71293..1b7706b 100644
--- a/include/linux/mfd/wcd9xxx/pdata.h
+++ b/include/linux/mfd/wcd9xxx/pdata.h
@@ -16,6 +16,9 @@
#include <linux/slimbus/slimbus.h>
+#define MICBIAS_EXT_BYP_CAP 0x00
+#define MICBIAS_NO_EXT_BYP_CAP 0x01
+
#define SITAR_LDOH_1P95_V 0x0
#define SITAR_LDOH_2P35_V 0x1
#define SITAR_LDOH_2P75_V 0x2
@@ -99,10 +102,19 @@
u32 cfilt1_mv; /* in mv */
u32 cfilt2_mv; /* in mv */
u32 cfilt3_mv; /* in mv */
+ /* Different WCD9xxx series codecs may not
+ * have 4 mic biases. If a codec has fewer
+ * mic biases, some of these properties will
+ * not be used.
+ */
u8 bias1_cfilt_sel;
u8 bias2_cfilt_sel;
u8 bias3_cfilt_sel;
u8 bias4_cfilt_sel;
+ u8 bias1_cap_mode;
+ u8 bias2_cap_mode;
+ u8 bias3_cap_mode;
+ u8 bias4_cap_mode;
};
struct wcd9xxx_ocp_setting {
diff --git a/sound/soc/codecs/wcd9304.c b/sound/soc/codecs/wcd9304.c
index acf258d..70d9fa9 100644
--- a/sound/soc/codecs/wcd9304.c
+++ b/sound/soc/codecs/wcd9304.c
@@ -562,9 +562,6 @@
SOC_SINGLE_TLV("ADC2 Volume", SITAR_A_TX_1_2_EN, 1, 3, 0, analog_gain),
SOC_SINGLE_TLV("ADC3 Volume", SITAR_A_TX_3_EN, 5, 3, 0, analog_gain),
- SOC_SINGLE("MICBIAS1 CAPLESS Switch", SITAR_A_MICB_1_CTL, 4, 1, 1),
- SOC_SINGLE("MICBIAS2 CAPLESS Switch", SITAR_A_MICB_2_CTL, 4, 1, 1),
-
SOC_SINGLE_EXT("ANC Slot", SND_SOC_NOPM, 0, 0, 100, sitar_get_anc_slot,
sitar_put_anc_slot),
@@ -4678,6 +4675,12 @@
snd_soc_update_bits(codec, SITAR_A_MICB_2_CTL, 0x60,
(pdata->micbias.bias2_cfilt_sel << 5));
+ /* Set micbias capless mode */
+ snd_soc_update_bits(codec, SITAR_A_MICB_1_CTL, 0x10,
+ (pdata->micbias.bias1_cap_mode << 4));
+ snd_soc_update_bits(codec, SITAR_A_MICB_2_CTL, 0x10,
+ (pdata->micbias.bias2_cap_mode << 4));
+
for (i = 0; i < 6; j++, i += 2) {
if (flag & (0x01 << i)) {
value = (leg_mode & (0x01 << i)) ? 0x10 : 0x00;