mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ASoC: wcd: disable interrupts properly and modify headphone detection
Correct disabling of analog and digital interrupts and correct headphone detection. Currently cross_conn_det function is disabling MICBIAS, due to this recording/button detection is not working if cable is inserted in recording mode. CRs-Fixed: 689558 Change-Id: I454e7e0a3cf180d0df9afdd672f1241ecfdfcdc9 Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
This commit is contained in:
parent
c70e4babb1
commit
46d2a64e56
2 changed files with 28 additions and 12 deletions
|
@ -99,14 +99,22 @@ struct wcd9xxx_spmi_map map;
|
|||
void wcd9xxx_spmi_enable_irq(int irq)
|
||||
{
|
||||
pr_debug("%s: irqno =%d\n", __func__, irq);
|
||||
if ((irq >= 0) && (irq <= 7))
|
||||
if ((irq >= 0) && (irq <= 7)) {
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_DIGITAL_INT_EN_CLR,
|
||||
(0x01 << irq), 0x00);
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_DIGITAL_INT_EN_SET,
|
||||
(0x01 << irq), (0x01 << irq));
|
||||
if ((irq > 7) && (irq <= 15))
|
||||
}
|
||||
if ((irq > 7) && (irq <= 15)) {
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_ANALOG_INT_EN_CLR,
|
||||
(0x01 << (irq - 8)), 0x00);
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_ANALOG_INT_EN_SET,
|
||||
(0x01 << (irq - 8)), (0x01 << (irq - 8)));
|
||||
}
|
||||
|
||||
if (!(map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq))))
|
||||
return;
|
||||
|
@ -120,14 +128,23 @@ void wcd9xxx_spmi_enable_irq(int irq)
|
|||
void wcd9xxx_spmi_disable_irq(int irq)
|
||||
{
|
||||
pr_debug("%s: irqno =%d\n", __func__, irq);
|
||||
if ((irq >= 0) && (irq <= 7))
|
||||
if ((irq >= 0) && (irq <= 7)) {
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_DIGITAL_INT_EN_SET,
|
||||
(0x01 << irq), 0x00);
|
||||
if ((irq > 7) && (irq <= 15))
|
||||
(0x01 << (irq)), 0x00);
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_DIGITAL_INT_EN_CLR,
|
||||
(0x01 << irq), (0x01 << irq));
|
||||
}
|
||||
|
||||
if ((irq > 7) && (irq <= 15)) {
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_ANALOG_INT_EN_SET,
|
||||
(0x01 << (irq - 8)), 0x00);
|
||||
snd_soc_update_bits(map.codec,
|
||||
MSM8X16_WCD_A_ANALOG_INT_EN_CLR,
|
||||
(0x01 << (irq - 8)), (0x01 << (irq - 8)));
|
||||
}
|
||||
|
||||
if (map.mask[BIT_BYTE(irq)] & (BYTE_BIT_MASK(irq)))
|
||||
return;
|
||||
|
|
|
@ -666,10 +666,11 @@ static bool wcd_check_cross_conn(struct wcd_mbhc *mbhc)
|
|||
u16 result1, swap_res;
|
||||
struct snd_soc_codec *codec = mbhc->codec;
|
||||
enum wcd_mbhc_plug_type plug_type = mbhc->current_plug;
|
||||
s16 reg, reg1;
|
||||
s16 reg, reg1, reg2;
|
||||
|
||||
reg = snd_soc_read(codec, MSM8X16_WCD_A_ANALOG_MBHC_FSM_CTL);
|
||||
reg1 = snd_soc_read(codec, MSM8X16_WCD_A_ANALOG_MBHC_DET_CTL_2);
|
||||
reg2 = snd_soc_read(codec, MSM8X16_WCD_A_ANALOG_MICB_2_EN);
|
||||
/*
|
||||
* Check if there is any cross connection,
|
||||
* Micbias and schmitt trigger (HPHL-HPHR)
|
||||
|
@ -695,11 +696,9 @@ static bool wcd_check_cross_conn(struct wcd_mbhc *mbhc)
|
|||
pr_debug("%s: No Cross connection found\n", __func__);
|
||||
}
|
||||
|
||||
/* Disable micbias and schmitt trigger */
|
||||
/* Disable schmitt trigger and restore micbias */
|
||||
snd_soc_write(codec, MSM8X16_WCD_A_ANALOG_MICB_2_EN, reg2);
|
||||
snd_soc_write(codec, MSM8X16_WCD_A_ANALOG_MBHC_DET_CTL_2, reg1);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM8X16_WCD_A_ANALOG_MICB_2_EN,
|
||||
0x80, 0x00);
|
||||
snd_soc_write(codec, MSM8X16_WCD_A_ANALOG_MBHC_FSM_CTL, reg);
|
||||
pr_debug("%s: leave, plug type: %d\n", __func__, plug_type);
|
||||
|
||||
|
@ -919,7 +918,7 @@ static void wcd_mbhc_detect_plug_type(struct wcd_mbhc *mbhc)
|
|||
goto exit;
|
||||
}
|
||||
} else {
|
||||
if (!result1 && !result2)
|
||||
if (!result1 && !(result2 & 0x01))
|
||||
plug_type = MBHC_PLUG_TYPE_HEADPHONE;
|
||||
else {
|
||||
plug_type = MBHC_PLUG_TYPE_INVALID;
|
||||
|
@ -1308,7 +1307,6 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
|
|||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->mbhc_sw_intr);
|
||||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->mbhc_btn_press_intr);
|
||||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->mbhc_btn_release_intr);
|
||||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->mbhc_hs_ins_rem_intr);
|
||||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->hph_left_ocp);
|
||||
wcd9xxx_spmi_enable_irq(mbhc->intr_ids->hph_right_ocp);
|
||||
pr_debug("%s: leave\n", __func__);
|
||||
|
@ -1461,6 +1459,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
|
|||
mbhc->intr_ids->mbhc_hs_ins_rem_intr);
|
||||
goto err_mbhc_hs_ins_rem_irq;
|
||||
}
|
||||
wcd9xxx_spmi_disable_irq(mbhc->intr_ids->mbhc_hs_ins_rem_intr);
|
||||
|
||||
ret = wcd9xxx_spmi_request_irq(mbhc->intr_ids->hph_left_ocp,
|
||||
wcd_mbhc_hphl_ocp_irq, "HPH_L OCP detect",
|
||||
|
|
Loading…
Reference in a new issue