ASoC: wcd9306: Enable headphone over current protection
Headphone OCP detection is not enabled by default in CODEC
hardware. Update codec driver to enable detection functionality.
Change-Id: Id7c190faed58b09b2b3f5aa6fb8ac650024762cc
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
diff --git a/sound/soc/codecs/wcd9306.c b/sound/soc/codecs/wcd9306.c
index 8ae6050..a573295 100644
--- a/sound/soc/codecs/wcd9306.c
+++ b/sound/soc/codecs/wcd9306.c
@@ -2265,13 +2265,13 @@
dev_dbg(codec->dev, "%s: %s event = %d\n", __func__, w->name, event);
if (w->shift == 5) {
- e_pre_on = WCD9XXX_EVENT_PRE_HPHR_PA_ON;
- e_post_off = WCD9XXX_EVENT_POST_HPHR_PA_OFF;
- req_clsh_state = WCD9XXX_CLSH_STATE_HPHL;
- } else if (w->shift == 4) {
e_pre_on = WCD9XXX_EVENT_PRE_HPHL_PA_ON;
e_post_off = WCD9XXX_EVENT_POST_HPHL_PA_OFF;
req_clsh_state = WCD9XXX_CLSH_STATE_HPHR;
+ } else if (w->shift == 4) {
+ e_pre_on = WCD9XXX_EVENT_PRE_HPHR_PA_ON;
+ e_post_off = WCD9XXX_EVENT_POST_HPHR_PA_OFF;
+ req_clsh_state = WCD9XXX_CLSH_STATE_HPHL;
} else {
pr_err("%s: Invalid w->shift %d\n", __func__, w->shift);
return -EINVAL;
@@ -4343,11 +4343,13 @@
}
static const struct tapan_reg_mask_val tapan_codec_reg_init_val[] = {
- /* Initialize current threshold to 350MA
+ /* Initialize current threshold to 365MA
* number of wait and run cycles to 4096
*/
- {TAPAN_A_RX_HPH_OCP_CTL, 0xE1, 0x61},
+ {TAPAN_A_RX_HPH_OCP_CTL, 0xE9, 0x69},
{TAPAN_A_RX_COM_OCP_COUNT, 0xFF, 0xFF},
+ {TAPAN_A_RX_HPH_L_TEST, 0x01, 0x01},
+ {TAPAN_A_RX_HPH_R_TEST, 0x01, 0x01},
/* Initialize gain registers to use register gain */
{TAPAN_A_RX_HPH_L_GAIN, 0x20, 0x20},