diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-07-14 21:48:29 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-07-14 21:48:28 -0700 |
commit | 2543d2a320be1a45443a9dd39353eee57ebacd4e (patch) | |
tree | 81a32d50f8d1a248ce202146d03b0b057beb27af /sound/soc | |
parent | 6a5d5c69b6b4906ccc189e62a6dd9d272d7a5d0e (diff) | |
parent | dd7647446761c2cd469bda6f2e5b09a6276aaf52 (diff) |
Merge "ASoC: wcd: disable interrupts properly and modify headphone detection"
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/msm8916-wcd-irq.c | 27 | ||||
-rw-r--r-- | sound/soc/codecs/wcd-mbhc-v2.c | 13 |
2 files changed, 28 insertions, 12 deletions
diff --git a/sound/soc/codecs/msm8916-wcd-irq.c b/sound/soc/codecs/msm8916-wcd-irq.c index 4cc91ce32714..4b3765f49d48 100644 --- a/sound/soc/codecs/msm8916-wcd-irq.c +++ b/sound/soc/codecs/msm8916-wcd-irq.c @@ -98,14 +98,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; @@ -119,14 +127,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; diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 658514704adf..acbcf040ea87 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -604,10 +604,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) @@ -635,11 +636,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); @@ -921,7 +920,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; @@ -1310,7 +1309,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__); @@ -1463,6 +1461,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", |