diff options
author | Aditya Bavanari <abavanar@codeaurora.org> | 2020-07-13 18:19:21 +0530 |
---|---|---|
committer | Aditya Bavanari <abavanar@codeaurora.org> | 2020-07-20 14:51:18 +0530 |
commit | b333e2c52f69d1a16e6592e13878b1c6680107fd (patch) | |
tree | 55f597f4c32cb98aad51e556f8ca76b6dfb8ad85 /asoc | |
parent | fee4cc91d1c45e1c8fb4c300fdf607d83525378c (diff) | |
download | msm-extra-b333e2c52f69d1a16e6592e13878b1c6680107fd.tar.gz |
asoc: rouleur: Fix CnP issues in EAR and LO paths
Update EAR and LO power up and down sequences to
fix CnP issues in rouleur codec.
Change-Id: I7e6d1cc82e9c1358b336c32b1befb7eb1dd9b552
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
Diffstat (limited to 'asoc')
-rw-r--r-- | asoc/codecs/rouleur/rouleur-registers.h | 3 | ||||
-rw-r--r-- | asoc/codecs/rouleur/rouleur-regmap.c | 3 | ||||
-rw-r--r-- | asoc/codecs/rouleur/rouleur-tables.c | 3 | ||||
-rw-r--r-- | asoc/codecs/rouleur/rouleur.c | 53 |
4 files changed, 47 insertions, 15 deletions
diff --git a/asoc/codecs/rouleur/rouleur-registers.h b/asoc/codecs/rouleur/rouleur-registers.h index 8cc0ae47..d890a2ba 100644 --- a/asoc/codecs/rouleur/rouleur-registers.h +++ b/asoc/codecs/rouleur/rouleur-registers.h @@ -48,6 +48,7 @@ enum { #define ROULEUR_ANA_MBHC_CTL_CLK (ROULEUR_ANA_BASE_ADDR+0x06D) #define ROULEUR_ANA_MBHC_ZDET_CALIB_RESULT (ROULEUR_ANA_BASE_ADDR+0x072) #define ROULEUR_ANA_NCP_EN (ROULEUR_ANA_BASE_ADDR+0x077) +#define ROULEUR_ANA_NCP_VCTRL (ROULEUR_ANA_BASE_ADDR+0x07C) #define ROULEUR_ANA_HPHPA_CNP_CTL_1 (ROULEUR_ANA_BASE_ADDR+0x083) #define ROULEUR_ANA_HPHPA_CNP_CTL_2 (ROULEUR_ANA_BASE_ADDR+0x084) #define ROULEUR_ANA_HPHPA_PA_STATUS (ROULEUR_ANA_BASE_ADDR+0x087) @@ -58,6 +59,8 @@ enum { #define ROULEUR_SWR_HPHPA_HD2 (ROULEUR_ANA_BASE_ADDR+0x090) #define ROULEUR_ANA_SURGE_EN (ROULEUR_ANA_BASE_ADDR+0x097) #define ROULEUR_ANA_COMBOPA_CTL (ROULEUR_ANA_BASE_ADDR+0x09B) +#define ROULEUR_ANA_COMBOPA_CTL_4 (ROULEUR_ANA_BASE_ADDR+0x09F) +#define ROULEUR_ANA_COMBOPA_CTL_5 (ROULEUR_ANA_BASE_ADDR+0x0A0) #define ROULEUR_ANA_RXLDO_CTL (ROULEUR_ANA_BASE_ADDR+0x0B2) #define ROULEUR_ANA_MBIAS_EN (ROULEUR_ANA_BASE_ADDR+0x0B4) diff --git a/asoc/codecs/rouleur/rouleur-regmap.c b/asoc/codecs/rouleur/rouleur-regmap.c index 23b8ddc9..51ed46a3 100644 --- a/asoc/codecs/rouleur/rouleur-regmap.c +++ b/asoc/codecs/rouleur/rouleur-regmap.c @@ -41,6 +41,7 @@ static const struct reg_default rouleur_defaults[] = { { ROULEUR_ANA_MBHC_CTL_CLK, 0x30 }, { ROULEUR_ANA_MBHC_ZDET_CALIB_RESULT, 0x00 }, { ROULEUR_ANA_NCP_EN, 0x00 }, + { ROULEUR_ANA_NCP_VCTRL, 0xA7 }, { ROULEUR_ANA_HPHPA_CNP_CTL_1, 0x54 }, { ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x2B }, { ROULEUR_ANA_HPHPA_PA_STATUS, 0x00 }, @@ -51,6 +52,8 @@ static const struct reg_default rouleur_defaults[] = { { ROULEUR_ANA_HPHPA_SPARE_CTL, 0x02 }, { ROULEUR_ANA_SURGE_EN, 0x38 }, { ROULEUR_ANA_COMBOPA_CTL, 0x35 }, + { ROULEUR_ANA_COMBOPA_CTL_4, 0x84 }, + { ROULEUR_ANA_COMBOPA_CTL_5, 0x05 }, { ROULEUR_ANA_RXLDO_CTL, 0x86 }, { ROULEUR_ANA_MBIAS_EN, 0x00 }, { ROULEUR_DIG_SWR_CHIP_ID0, 0x00 }, diff --git a/asoc/codecs/rouleur/rouleur-tables.c b/asoc/codecs/rouleur/rouleur-tables.c index 7912267d..63604566 100644 --- a/asoc/codecs/rouleur/rouleur-tables.c +++ b/asoc/codecs/rouleur/rouleur-tables.c @@ -36,6 +36,7 @@ const u8 rouleur_reg_access_analog[ROULEUR_REG( [ROULEUR_REG(ROULEUR_ANA_MBHC_CTL_CLK)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_MBHC_ZDET_CALIB_RESULT)] = RD_REG, [ROULEUR_REG(ROULEUR_ANA_NCP_EN)] = RD_WR_REG, + [ROULEUR_REG(ROULEUR_ANA_NCP_VCTRL)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_HPHPA_CNP_CTL_1)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_HPHPA_CNP_CTL_2)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_HPHPA_PA_STATUS)] = RD_REG, @@ -46,6 +47,8 @@ const u8 rouleur_reg_access_analog[ROULEUR_REG( [ROULEUR_REG(ROULEUR_SWR_HPHPA_HD2)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_SURGE_EN)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_COMBOPA_CTL)] = RD_WR_REG, + [ROULEUR_REG(ROULEUR_ANA_COMBOPA_CTL_4)] = RD_WR_REG, + [ROULEUR_REG(ROULEUR_ANA_COMBOPA_CTL_5)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_RXLDO_CTL)] = RD_WR_REG, [ROULEUR_REG(ROULEUR_ANA_MBIAS_EN)] = RD_WR_REG, }; diff --git a/asoc/codecs/rouleur/rouleur.c b/asoc/codecs/rouleur/rouleur.c index e2c32417..8ce51a3b 100644 --- a/asoc/codecs/rouleur/rouleur.c +++ b/asoc/codecs/rouleur/rouleur.c @@ -362,6 +362,8 @@ static int rouleur_rx_clk_enable(struct snd_soc_component *component) snd_soc_component_update_bits(component, ROULEUR_ANA_HPHPA_FSM_CLK, 0x80, 0x80); snd_soc_component_update_bits(component, + ROULEUR_ANA_NCP_VCTRL, 0x07, 0x06); + snd_soc_component_update_bits(component, ROULEUR_ANA_NCP_EN, 0x01, 0x01); usleep_range(500, 510); } @@ -592,11 +594,11 @@ static int rouleur_codec_ear_lo_dac_event(struct snd_soc_dapm_widget *w, ROULEUR_DIG_SWR_CDC_RX0_CTL, 0x80, 0x00); snd_soc_component_update_bits(component, - ROULEUR_DIG_SWR_CDC_RX_GAIN_CTL, - 0x04, 0x04); - snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_CDC_RX_CLK_CTL, 0x01, 0x01); + snd_soc_component_update_bits(component, + ROULEUR_DIG_SWR_CDC_RX_GAIN_CTL, + 0x04, 0x04); break; case SND_SOC_DAPM_POST_PMD: @@ -635,7 +637,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, true); set_bit(HPH_PA_DELAY, &rouleur->status_mask); - usleep_range(5000, 5100); + usleep_range(200, 210); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL1, 0x03, 0x03); @@ -671,9 +673,8 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMD: /* - * 7ms sleep is required after PA is disabled as per - * HW requirement. If compander is disabled, then - * 20ms delay is required. + * 5ms sleep is required after PA is disabled as per + * HW requirement. */ if (test_bit(HPH_PA_DELAY, &rouleur->status_mask)) { @@ -710,7 +711,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, rouleur->rx_swr_dev->dev_num, true); set_bit(HPH_PA_DELAY, &rouleur->status_mask); - usleep_range(5000, 5100); + usleep_range(200, 210); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, 0x03, 0x03); @@ -784,20 +785,31 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, rouleur->rx_swr_dev->dev_num, true); snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_5, + 0x04, 0x00); + usleep_range(1000, 1010); + snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_4, + 0x0F, 0x0F); + usleep_range(1000, 1010); + snd_soc_component_update_bits(component, ROULEUR_ANA_COMBOPA_CTL, 0x40, 0x00); - usleep_range(5000, 5100); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, 0x03, 0x03); break; case SND_SOC_DAPM_POST_PMU: + usleep_range(5000, 5100); + snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_4, + 0x0F, 0x04); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, WCD_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); - wcd_enable_irq(&rouleur->irq_info, - ROULEUR_IRQ_HPHL_PDM_WD_INT); + wcd_enable_irq(&rouleur->irq_info, + ROULEUR_IRQ_HPHL_PDM_WD_INT); break; case SND_SOC_DAPM_PRE_PMD: wcd_disable_irq(&rouleur->irq_info, @@ -834,23 +846,34 @@ static int rouleur_codec_enable_lo_pa(struct snd_soc_dapm_widget *w, rouleur->rx_swr_dev->dev_num, true); snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_5, + 0x04, 0x00); + usleep_range(1000, 1010); + snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_4, + 0x0F, 0x0F); + usleep_range(1000, 1010); + snd_soc_component_update_bits(component, ROULEUR_ANA_COMBOPA_CTL, 0x40, 0x40); - usleep_range(5000, 5100); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, 0x03, 0x03); break; case SND_SOC_DAPM_POST_PMU: + usleep_range(5000, 5100); + snd_soc_component_update_bits(component, + ROULEUR_ANA_COMBOPA_CTL_4, + 0x0F, 0x04); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, WCD_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); - wcd_enable_irq(&rouleur->irq_info, - ROULEUR_IRQ_HPHL_PDM_WD_INT); + wcd_enable_irq(&rouleur->irq_info, + ROULEUR_IRQ_HPHL_PDM_WD_INT); break; case SND_SOC_DAPM_PRE_PMD: - wcd_disable_irq(&rouleur->irq_info, + wcd_disable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHL_PDM_WD_INT); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, |