Fix PM8909 CONGA stereo headphone output on nokia-sparkler for a1125 (ampere)
Set CDC_A_RX_COM_OCP_CTL to 0x12 (350 mA limit instead of 0xD1), unlock CDC_D_SEC_ACCESS / CDC_A_SEC_ACCESS (0xA5) around the PERPH_RESET_CTL4 1 -> 0 soft reset in pm8916_wcd_analog_probe(), expand msm8916_wcd_digital_force_sync_ctl() across all stateful registers in msm8916_wcd_digital_reg_defaults[], and split PM8909 CONGA (CDC_D_PERPH_SUBTYPE == 0x02) from CAJON_2_0 (CDC_A_PERPH_SUBTYPE == 0x0a) in patch 0015 so CAJON-only HPH test/bias writes no longer silence right-channel HPHR output on nokia-sparkler while preserving CAJON_2_0 on nokia-beatles and existing audio/standby invariants. Rebuilt kernel/modules, updated test-audio-quality.py and docs, and rebuilt and verified all four a1125 (ampere) target images.
This commit is contained in:
1 parent
9619cc9541
commit
fa876abde1
13 files changed
+165
-91
No files matched your search
@@ -1,16 +1,17 @@
|
||||
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
index 257f780..f820437 100644
|
||||
index 257f780..5ae2e09 100644
|
||||
--- a/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
@@ -82,6 +82,7 @@
|
||||
@@ -82,6 +82,8 @@
|
||||
#define CDC_A_REVISION4 (0xf103)
|
||||
#define CDC_A_PERPH_TYPE (0xf104)
|
||||
#define CDC_A_PERPH_SUBTYPE (0xf105)
|
||||
+#define CDC_D_PERPH_SUBTYPE_CONGA 0x02
|
||||
+#define CDC_A_PERPH_SUBTYPE_CAJON 0x0a
|
||||
#define CDC_A_INT_RT_STS (0xf110)
|
||||
#define CDC_A_INT_SET_TYPE (0xf111)
|
||||
#define CDC_A_INT_POLARITY_HIGH (0xf112)
|
||||
@@ -191,6 +192,8 @@
|
||||
@@ -191,6 +193,8 @@
|
||||
CDC_A_MBHC_BTN_VREF_FINE_MASK)
|
||||
#define CDC_A_MBHC_RESULT_1 (0xf158)
|
||||
#define CDC_A_MBHC_RESULT_1_BTN_RESULT_MASK GENMASK(4, 0)
|
||||
@@ -19,7 +20,7 @@ index 257f780..f820437 100644
|
||||
#define CDC_A_TX_1_EN (0xf160)
|
||||
#define CDC_A_TX_2_EN (0xf161)
|
||||
#define CDC_A_TX_1_2_TEST_CTL_1 (0xf162)
|
||||
@@ -220,20 +223,28 @@
|
||||
@@ -220,20 +224,28 @@
|
||||
#define CDC_A_RX_HPH_BIAS_LDO_OCP (0xf195)
|
||||
#define CDC_A_RX_HPH_BIAS_CNP (0xf196)
|
||||
#define CDC_A_RX_HPH_CNP_EN (0xf197)
|
||||
@@ -48,7 +49,7 @@ index 257f780..f820437 100644
|
||||
|
||||
#define CDC_A_SPKR_DAC_CTL (0xf1B0)
|
||||
#define SPKR_DAC_CTL_DAC_RESET_MASK BIT(4)
|
||||
@@ -249,10 +260,13 @@
|
||||
@@ -249,10 +261,13 @@
|
||||
#define SPKR_DRV_BOOST_SET BIT(2)
|
||||
#define SPKR_DRV_CMFB_SET BIT(1)
|
||||
#define SPKR_DRV_GAIN_SET BIT(0)
|
||||
@@ -62,16 +63,24 @@ index 257f780..f820437 100644
|
||||
#define CDC_A_SPKR_OCP_CTL (0xf1B4)
|
||||
#define CDC_A_SPKR_PWRSTG_CTL (0xf1B5)
|
||||
#define SPKR_PWRSTG_CTL_DAC_EN_MASK BIT(0)
|
||||
@@ -314,6 +328,8 @@ struct pm8916_wcd_analog_priv {
|
||||
@@ -314,8 +329,16 @@ struct pm8916_wcd_analog_priv {
|
||||
bool audio_active;
|
||||
bool jack_inserted;
|
||||
bool s2_enabled;
|
||||
+ bool is_cajon;
|
||||
+ bool is_conga;
|
||||
+ int jack_report;
|
||||
};
|
||||
|
||||
+static inline bool pm8916_wcd_is_pm8909(const struct pm8916_wcd_analog_priv *priv)
|
||||
+{
|
||||
+ return priv->is_cajon || priv->is_conga;
|
||||
+}
|
||||
+
|
||||
static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" };
|
||||
@@ -435,6 +451,36 @@ static int pm8916_wcd_analog_enable_micbias2(struct snd_soc_dapm_widget *w,
|
||||
static const char *const rdac2_mux_text[] = { "RX1", "RX2" };
|
||||
static const char *const hph_text[] = { "ZERO", "Switch", };
|
||||
@@ -435,6 +458,36 @@ static int pm8916_wcd_analog_enable_micbias2(struct snd_soc_dapm_widget *w,
|
||||
|
||||
}
|
||||
|
||||
@@ -108,12 +117,12 @@ index 257f780..f820437 100644
|
||||
static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *component)
|
||||
{
|
||||
struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
@@ -446,19 +492,31 @@ static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *compo
|
||||
@@ -446,19 +499,31 @@ static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *compo
|
||||
if (!ret) {
|
||||
priv->s2_enabled = true;
|
||||
usleep_range(1000, 1500);
|
||||
- snd_soc_component_write(component, CDC_A_MASTER_BIAS_CTL, 0x30);
|
||||
+ if (priv->is_cajon)
|
||||
+ if (pm8916_wcd_is_pm8909(priv))
|
||||
+ pm8916_wcd_analog_apply_defaults(component, true);
|
||||
+ else
|
||||
+ snd_soc_component_write(component, CDC_A_MASTER_BIAS_CTL, 0x30);
|
||||
@@ -147,7 +156,7 @@ index 257f780..f820437 100644
|
||||
regulator_disable(priv->supplies[1].consumer);
|
||||
priv->s2_enabled = false;
|
||||
}
|
||||
@@ -698,37 +756,81 @@ static int pm8916_wcd_analog_enable_spk_pa(struct snd_soc_dapm_widget *w,
|
||||
@@ -698,37 +763,81 @@ static int pm8916_wcd_analog_enable_spk_pa(struct snd_soc_dapm_widget *w,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
@@ -164,7 +173,7 @@ index 257f780..f820437 100644
|
||||
- SPKR_PWRSTG_CTL_BBM_EN |
|
||||
- SPKR_PWRSTG_CTL_HBRDGE_EN |
|
||||
- SPKR_PWRSTG_CTL_CLAMP_EN);
|
||||
+ if (priv->is_cajon) {
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_SPKR_PWRSTG_CTL,
|
||||
+ SPKR_PWRSTG_CTL_DAC_EN_MASK,
|
||||
+ SPKR_PWRSTG_CTL_DAC_EN);
|
||||
@@ -197,7 +206,7 @@ index 257f780..f820437 100644
|
||||
- snd_soc_component_update_bits(component, CDC_A_SPKR_DRV_CTL,
|
||||
- SPKR_DRV_CTL_DEF_MASK,
|
||||
- SPKR_DRV_CTL_DEF_VAL);
|
||||
+ if (priv->is_cajon) {
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ usleep_range(1000, 1100);
|
||||
+ snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL,
|
||||
+ SPKR_DAC_CTL_DAC_RESET_MASK,
|
||||
@@ -216,7 +225,7 @@ index 257f780..f820437 100644
|
||||
SPKR_DRV_CLASSD_PA_EN_ENABLE);
|
||||
break;
|
||||
+ case SND_SOC_DAPM_PRE_PMD:
|
||||
+ if (priv->is_cajon) {
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL,
|
||||
+ SPKR_DAC_CTL_DAC_RESET_MASK,
|
||||
+ SPKR_DAC_CTL_DAC_RESET_MASK);
|
||||
@@ -230,7 +239,7 @@ index 257f780..f820437 100644
|
||||
- SPKR_PWRSTG_CTL_BBM_MASK |
|
||||
- SPKR_PWRSTG_CTL_HBRDGE_EN_MASK |
|
||||
- SPKR_PWRSTG_CTL_CLAMP_EN_MASK, 0);
|
||||
+ if (priv->is_cajon) {
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_SPKR_PWRSTG_CTL,
|
||||
+ SPKR_PWRSTG_CTL_MASK, 0);
|
||||
+ usleep_range(1000, 1100);
|
||||
@@ -246,7 +255,7 @@ index 257f780..f820437 100644
|
||||
|
||||
snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL,
|
||||
SPKR_DAC_CTL_DAC_RESET_MASK,
|
||||
@@ -745,11 +847,15 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
||||
@@ -745,11 +854,15 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
@@ -257,19 +266,19 @@ index 257f780..f820437 100644
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
- RX_EAR_CTL_PA_SEL_MASK, RX_EAR_CTL_PA_SEL);
|
||||
+ RX_EAR_CTL_PA_SEL_MASK |
|
||||
+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0),
|
||||
+ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0),
|
||||
+ RX_EAR_CTL_PA_SEL |
|
||||
+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB : 0));
|
||||
+ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB : 0));
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
@@ -762,7 +868,114 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
||||
@@ -762,14 +875,127 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
||||
/* Delay to reduce ear turn off pop */
|
||||
usleep_range(7000, 7100);
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
- RX_EAR_CTL_PA_SEL_MASK, 0);
|
||||
+ RX_EAR_CTL_PA_SEL_MASK |
|
||||
+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0),
|
||||
+ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0),
|
||||
+ 0);
|
||||
+ break;
|
||||
+ }
|
||||
@@ -297,11 +306,13 @@ index 257f780..f820437 100644
|
||||
+ RX_HPH_TEST_CAJON_CFG);
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_CNP_EN,
|
||||
+ CDC_A_RX_HPH_CNP_EN_PU_MASK, 0);
|
||||
+ snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL,
|
||||
+ 0x07, 0x07);
|
||||
+ }
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
+ RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK,
|
||||
+ RX_EAR_CTL_PA_GAIN_POS_6_DB);
|
||||
+ snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL,
|
||||
+ 0x07, 0x07);
|
||||
+ }
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_L_PA_DAC_CTL,
|
||||
+ RX_HPA_L_PA_DAC_CTL_DATA_RESET_MASK,
|
||||
@@ -312,9 +323,11 @@ index 257f780..f820437 100644
|
||||
+ RX_HPA_L_PA_DAC_CTL_DATA_RESET_MASK, 0);
|
||||
+ break;
|
||||
+ case SND_SOC_DAPM_POST_PMD:
|
||||
+ if (priv->is_cajon) {
|
||||
+ if (pm8916_wcd_is_pm8909(priv)) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
+ RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK, 0);
|
||||
+ }
|
||||
+ if (priv->is_cajon) {
|
||||
+ snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL,
|
||||
+ 0x07, 0x04);
|
||||
+ }
|
||||
@@ -351,7 +364,7 @@ index 257f780..f820437 100644
|
||||
+ struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
+ unsigned int test_reg = (w->shift == 5) ? CDC_A_RX_HPH_L_TEST : CDC_A_RX_HPH_R_TEST;
|
||||
+
|
||||
+ if (!priv->is_cajon)
|
||||
+ if (!pm8916_wcd_is_pm8909(priv))
|
||||
+ return 0;
|
||||
+
|
||||
+ switch (event) {
|
||||
@@ -369,22 +382,32 @@ index 257f780..f820437 100644
|
||||
+ case SND_SOC_DAPM_PRE_PMD:
|
||||
+ snd_soc_component_update_bits(component, test_reg,
|
||||
+ RX_HPH_TEST_PA_EN, 0);
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP,
|
||||
+ 0xF0, 0x30);
|
||||
+ if (priv->is_cajon)
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP,
|
||||
+ 0xF0, 0x30);
|
||||
+ break;
|
||||
+ case SND_SOC_DAPM_POST_PMD:
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP,
|
||||
+ 0xF0, 0x20);
|
||||
+ if (priv->is_cajon)
|
||||
+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP,
|
||||
+ 0xF0, 0x20);
|
||||
+ usleep_range(5000, 5200);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -787,10 +1000,59 @@ static const struct reg_default wcd_reg_defaults_2_0[] = {
|
||||
}
|
||||
|
||||
static const struct reg_default wcd_reg_defaults_2_0[] = {
|
||||
- {CDC_A_RX_COM_OCP_CTL, 0xD1},
|
||||
+ {CDC_A_RX_COM_OCP_CTL, 0x12},
|
||||
{CDC_A_RX_COM_OCP_COUNT, 0xFF},
|
||||
{CDC_D_SEC_ACCESS, 0xA5},
|
||||
{CDC_D_PERPH_RESET_CTL3, 0x0F},
|
||||
@@ -787,10 +1013,83 @@ static const struct reg_default wcd_reg_defaults_2_0[] = {
|
||||
{CDC_A_MASTER_BIAS_CTL, 0x30},
|
||||
};
|
||||
|
||||
+static const struct reg_default wcd_reg_defaults_cajon_2_0[] = {
|
||||
+ {CDC_A_RX_COM_OCP_CTL, 0xD1},
|
||||
+ {CDC_A_RX_COM_OCP_CTL, 0x12},
|
||||
+ {CDC_A_RX_COM_OCP_COUNT, 0xFF},
|
||||
+ {CDC_D_SEC_ACCESS, 0xA5},
|
||||
+ {CDC_D_PERPH_RESET_CTL3, 0x0F},
|
||||
@@ -403,15 +426,39 @@ index 257f780..f820437 100644
|
||||
+ {CDC_A_MASTER_BIAS_CTL, 0x30},
|
||||
+};
|
||||
+
|
||||
+static const struct reg_default wcd_reg_defaults_conga[] = {
|
||||
+ {CDC_A_RX_COM_OCP_CTL, 0x12},
|
||||
+ {CDC_A_RX_COM_OCP_COUNT, 0xFF},
|
||||
+ {CDC_D_SEC_ACCESS, 0xA5},
|
||||
+ {CDC_D_PERPH_RESET_CTL3, 0x0F},
|
||||
+ {CDC_A_SEC_ACCESS, 0xA5},
|
||||
+ {CDC_A_PERPH_RESET_CTL3, 0x0F},
|
||||
+ {CDC_A_TX_1_2_OPAMP_BIAS, 0x4C},
|
||||
+ {CDC_A_NCP_FBCTRL, 0x28},
|
||||
+ {CDC_A_SPKR_DRV_CTL, 0x69},
|
||||
+ {CDC_A_SPKR_DRV_DBG, 0x01},
|
||||
+ {CDC_A_SPKR_DAC_CTL, 0x03},
|
||||
+ {CDC_A_SPKR_OCP_CTL, 0xE1},
|
||||
+ {CDC_A_MASTER_BIAS_CTL, 0x30},
|
||||
+};
|
||||
+
|
||||
+static void pm8916_wcd_analog_apply_defaults(struct snd_soc_component *component,
|
||||
+ bool preserve_switch)
|
||||
+{
|
||||
+ struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
+ const struct reg_default *defs = priv->is_cajon ?
|
||||
+ wcd_reg_defaults_cajon_2_0 : wcd_reg_defaults_2_0;
|
||||
+ size_t count = priv->is_cajon ?
|
||||
+ ARRAY_SIZE(wcd_reg_defaults_cajon_2_0) :
|
||||
+ ARRAY_SIZE(wcd_reg_defaults_2_0);
|
||||
+ const struct reg_default *defs;
|
||||
+ size_t count;
|
||||
+
|
||||
+ if (priv->is_conga) {
|
||||
+ defs = wcd_reg_defaults_conga;
|
||||
+ count = ARRAY_SIZE(wcd_reg_defaults_conga);
|
||||
+ } else if (priv->is_cajon) {
|
||||
+ defs = wcd_reg_defaults_cajon_2_0;
|
||||
+ count = ARRAY_SIZE(wcd_reg_defaults_cajon_2_0);
|
||||
+ } else {
|
||||
+ defs = wcd_reg_defaults_2_0;
|
||||
+ count = ARRAY_SIZE(wcd_reg_defaults_2_0);
|
||||
+ }
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
@@ -440,21 +487,31 @@ index 257f780..f820437 100644
|
||||
|
||||
err = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
|
||||
if (err != 0) {
|
||||
@@ -806,16 +1068,17 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component)
|
||||
@@ -806,16 +1105,27 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component)
|
||||
snd_soc_component_set_drvdata(component, priv);
|
||||
priv->pmic_rev = snd_soc_component_read(component, CDC_D_REVISION1);
|
||||
priv->codec_version = snd_soc_component_read(component, CDC_D_PERPH_SUBTYPE);
|
||||
+ priv->is_cajon = (snd_soc_component_read(component, CDC_A_PERPH_SUBTYPE) ==
|
||||
+ priv->is_conga = (priv->codec_version == CDC_D_PERPH_SUBTYPE_CONGA);
|
||||
+ priv->is_cajon = !priv->is_conga &&
|
||||
+ (snd_soc_component_read(component, CDC_A_PERPH_SUBTYPE) ==
|
||||
+ CDC_A_PERPH_SUBTYPE_CAJON);
|
||||
|
||||
- dev_info(component->dev, "PMIC REV: %d\t CODEC Version: %d\n",
|
||||
- priv->pmic_rev, priv->codec_version);
|
||||
+ dev_info(component->dev, "PMIC REV: %d\t CODEC Version: %d%s\n",
|
||||
+ priv->pmic_rev, priv->codec_version,
|
||||
+ priv->is_cajon ? " (CAJON)" : "");
|
||||
+ priv->is_conga ? " (CONGA)" : (priv->is_cajon ? " (CAJON)" : ""));
|
||||
|
||||
+ snd_soc_component_write(component, CDC_D_SEC_ACCESS, 0xA5);
|
||||
snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x01);
|
||||
+ snd_soc_component_write(component, CDC_A_SEC_ACCESS, 0xA5);
|
||||
snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x01);
|
||||
+ usleep_range(500, 1000);
|
||||
+ snd_soc_component_write(component, CDC_D_SEC_ACCESS, 0xA5);
|
||||
+ snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x00);
|
||||
+ snd_soc_component_write(component, CDC_A_SEC_ACCESS, 0xA5);
|
||||
+ snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x00);
|
||||
+ usleep_range(500, 1000);
|
||||
|
||||
- for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_2_0); reg++)
|
||||
- snd_soc_component_write(component, wcd_reg_defaults_2_0[reg].reg,
|
||||
@@ -463,7 +520,7 @@ index 257f780..f820437 100644
|
||||
|
||||
priv->component = component;
|
||||
|
||||
@@ -824,24 +1087,21 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component)
|
||||
@@ -824,24 +1134,21 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component)
|
||||
RST_CTL_DIG_SW_RST_N_REMOVE_RESET);
|
||||
|
||||
pm8916_wcd_setup_mbhc(priv);
|
||||
@@ -501,7 +558,7 @@ index 257f780..f820437 100644
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -981,14 +1241,27 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {
|
||||
@@ -981,14 +1288,27 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_MUX("EAR_S", SND_SOC_NOPM, 0, 0, &ear_mux),
|
||||
SND_SOC_DAPM_SUPPLY("EAR CP", CDC_A_NCP_EN, 4, 0, NULL, 0),
|
||||
|
||||
@@ -535,7 +592,7 @@ index 257f780..f820437 100644
|
||||
SND_SOC_DAPM_MIXER("SPK DAC", SND_SOC_NOPM, 0, 0,
|
||||
spkr_switch, ARRAY_SIZE(spkr_switch)),
|
||||
|
||||
@@ -1094,6 +1367,14 @@ static int pm8916_wcd_analog_set_jack(struct snd_soc_component *component,
|
||||
@@ -1094,6 +1414,14 @@ static int pm8916_wcd_analog_set_jack(struct snd_soc_component *component,
|
||||
}
|
||||
|
||||
wcd->jack = jack;
|
||||
@@ -550,7 +607,7 @@ index 257f780..f820437 100644
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1164,9 +1445,14 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
@@ -1164,9 +1492,14 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
CDC_A_MBHC_DET_CTL_MECH_DET_TYPE_MASK,
|
||||
(!ins << CDC_A_MBHC_DET_CTL_MECH_DET_TYPE_SHIFT));
|
||||
|
||||
@@ -566,7 +623,7 @@ index 257f780..f820437 100644
|
||||
|
||||
mutex_lock(&priv->power_lock);
|
||||
priv->jack_inserted = true;
|
||||
@@ -1176,33 +1462,56 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
@@ -1176,33 +1509,56 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
snd_soc_component_update_bits(component, CDC_D_CDC_DIG_CLK_CTL,
|
||||
DIG_CLK_CTL_D_MBHC_CLK_EN_MASK,
|
||||
DIG_CLK_CTL_D_MBHC_CLK_EN);
|
||||
@@ -635,7 +692,7 @@ index 257f780..f820437 100644
|
||||
report = 0;
|
||||
priv->detect_accessory_type = true;
|
||||
priv->mbhc_btn0_released = false;
|
||||
@@ -1210,8 +1519,10 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
@@ -1210,8 +1566,10 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b
|
||||
snd_soc_component_write(component, CDC_D_INT_EN_CLR,
|
||||
MBHC_BUTTON_PRESS_DET |
|
||||
MBHC_BUTTON_RELEASE_DET);
|
||||
@@ -646,7 +703,7 @@ index 257f780..f820437 100644
|
||||
pm8916_wcd_analog_update_power_locked(component);
|
||||
mutex_unlock(&priv->power_lock);
|
||||
}
|
||||
@@ -1223,15 +1534,22 @@ static irqreturn_t pm8916_mbhc_switch_irq_handler(int irq, void *arg)
|
||||
@@ -1223,15 +1581,22 @@ static irqreturn_t pm8916_mbhc_switch_irq_handler(int irq, void *arg)
|
||||
{
|
||||
struct pm8916_wcd_analog_priv *priv = arg;
|
||||
struct snd_soc_component *component = priv->component;
|
||||
@@ -676,7 +733,7 @@ index 257f780..f820437 100644
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
index 81d1134..fc2520e 100644
|
||||
index 81d1134..074a319 100644
|
||||
--- a/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
@@ -85,6 +85,9 @@
|
||||
@@ -860,38 +917,16 @@ index 81d1134..fc2520e 100644
|
||||
break;
|
||||
default:
|
||||
dev_err(dai->dev, "%s: wrong format selected\n", __func__);
|
||||
@@ -1071,6 +1112,30 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = {
|
||||
@@ -1071,6 +1112,8 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = {
|
||||
|
||||
};
|
||||
|
||||
+static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map)
|
||||
+{
|
||||
+ static const unsigned int ctl_regs[] = {
|
||||
+ LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
+ LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
+ LPASS_CDC_CLK_OTHR_CTL,
|
||||
+ LPASS_CDC_RX1_B5_CTL,
|
||||
+ LPASS_CDC_RX2_B5_CTL,
|
||||
+ LPASS_CDC_RX3_B5_CTL,
|
||||
+ LPASS_CDC_TOP_CTL,
|
||||
+ LPASS_CDC_IIR1_CTL,
|
||||
+ LPASS_CDC_IIR2_CTL,
|
||||
+ LPASS_CDC_TX1_CLK_FS_CTL,
|
||||
+ LPASS_CDC_TX2_CLK_FS_CTL,
|
||||
+ };
|
||||
+ unsigned int val;
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(ctl_regs); i++) {
|
||||
+ if (regmap_read(map, ctl_regs[i], &val) == 0)
|
||||
+ regmap_write_bits(map, ctl_regs[i], ~0U, val);
|
||||
+ }
|
||||
+}
|
||||
+static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map);
|
||||
+
|
||||
static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
@@ -1079,29 +1144,30 @@ static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream,
|
||||
@@ -1079,29 +1122,30 @@ static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream,
|
||||
unsigned long mclk_rate;
|
||||
|
||||
msm8916_wcd = snd_soc_component_get_drvdata(component);
|
||||
@@ -934,7 +969,7 @@ index 81d1134..fc2520e 100644
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1155,15 +1221,139 @@ static const struct snd_soc_component_driver msm8916_wcd_digital = {
|
||||
@@ -1155,18 +1199,168 @@ static const struct snd_soc_component_driver msm8916_wcd_digital = {
|
||||
.dapm_routes = msm8916_wcd_digital_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(msm8916_wcd_digital_audio_map),
|
||||
.idle_bias_on = 0,
|
||||
@@ -1075,7 +1110,36 @@ index 81d1134..fc2520e 100644
|
||||
.cache_type = REGCACHE_FLAT,
|
||||
};
|
||||
|
||||
@@ -1195,7 +1385,11 @@ static int msm8916_wcd_digital_runtime_resume(struct device *dev)
|
||||
+static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map)
|
||||
+{
|
||||
+ unsigned int val;
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(msm8916_wcd_digital_reg_defaults); i++) {
|
||||
+ unsigned int reg = msm8916_wcd_digital_reg_defaults[i].reg;
|
||||
+
|
||||
+ switch (reg) {
|
||||
+ case LPASS_CDC_CLK_RX_RESET_CTL:
|
||||
+ case LPASS_CDC_CLK_TX_RESET_B1_CTL:
|
||||
+ case LPASS_CDC_CLK_OTHR_RESET_B1_CTL:
|
||||
+ case LPASS_CDC_TOP_GAIN_UPDATE:
|
||||
+ case LPASS_CDC_IIR1_COEF_B1_CTL:
|
||||
+ case LPASS_CDC_IIR1_COEF_B2_CTL:
|
||||
+ case LPASS_CDC_IIR2_COEF_B1_CTL:
|
||||
+ case LPASS_CDC_IIR2_COEF_B2_CTL:
|
||||
+ continue;
|
||||
+ default:
|
||||
+ if (regmap_read(map, reg, &val) == 0)
|
||||
+ regmap_write_bits(map, reg, ~0U, val);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int msm8916_wcd_digital_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct msm8916_wcd_digital_priv *priv = dev_get_drvdata(dev);
|
||||
@@ -1195,7 +1389,11 @@ static int msm8916_wcd_digital_runtime_resume(struct device *dev)
|
||||
}
|
||||
|
||||
regcache_cache_only(priv->regmap, false);
|
||||
@@ -1088,7 +1152,7 @@ index 81d1134..fc2520e 100644
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops msm8916_wcd_digital_pm_ops = {
|
||||
@@ -1209,7 +1403,6 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
|
||||
@@ -1209,7 +1407,6 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
void __iomem *base;
|
||||
struct regmap *digital_map;
|
||||
@@ -1096,7 +1160,7 @@ index 81d1134..fc2520e 100644
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -1244,8 +1437,17 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
|
||||
@@ -1244,8 +1441,17 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user