mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
ASoC: msm8916-wcd-analog: add quirk for cajon 2.0
The codec version CAJON_2_0 on the Snapdragon 670 requires touching the HPH test registers. Add the quirk so this driver can also support SDM670. Signed-off-by: Richard Acayan <mailingradian@gmail.com> Link: https://patch.msgid.link/20260730174353.108023-16-mailingradian@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4583c12453
commit
ff01bff076
|
|
@ -217,9 +217,11 @@
|
|||
#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)
|
||||
#define CDC_A_RX_HPH_L_TEST (0xf19A)
|
||||
#define CDC_A_RX_HPH_L_PA_DAC_CTL (0xf19B)
|
||||
#define RX_HPA_L_PA_DAC_CTL_DATA_RESET_MASK BIT(1)
|
||||
#define RX_HPA_L_PA_DAC_CTL_DATA_RESET_RESET BIT(1)
|
||||
#define CDC_A_RX_HPH_R_TEST (0xf19C)
|
||||
#define CDC_A_RX_HPH_R_PA_DAC_CTL (0xf19D)
|
||||
#define RX_HPH_R_PA_DAC_CTL_DATA_RESET BIT(1)
|
||||
#define RX_HPH_R_PA_DAC_CTL_DATA_RESET_MASK BIT(1)
|
||||
|
|
@ -705,6 +707,59 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int pm8916_wcd_analog_enable_hphl_pa(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(component->dev);
|
||||
|
||||
/* This quirk is not required for revisions prior to CAJON_2_0 */
|
||||
if (priv->codec_version < 4)
|
||||
return 0;
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
usleep_range(7000, 7100);
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_HPH_L_TEST,
|
||||
0x04, 0x04);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
/* wait 20 ms after the digital codec has powered down */
|
||||
msleep(20);
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_HPH_L_TEST,
|
||||
0x04, 0x00);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pm8916_wcd_analog_enable_hphr_pa(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(component->dev);
|
||||
|
||||
/* This quirk is not required for revisions prior to CAJON_2_0 */
|
||||
if (priv->codec_version < 4)
|
||||
return 0;
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
usleep_range(7000, 7100);
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_HPH_R_TEST,
|
||||
0x04, 0x04);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
msleep(20);
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_HPH_R_TEST,
|
||||
0x04, 0x00);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct reg_default wcd_reg_defaults_2_0[] = {
|
||||
{CDC_A_RX_COM_OCP_CTL, 0xD1},
|
||||
{CDC_A_RX_COM_OCP_COUNT, 0xFF},
|
||||
|
|
@ -954,11 +1009,15 @@ 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),
|
||||
|
||||
SND_SOC_DAPM_PGA("HPHL PA", CDC_A_RX_HPH_CNP_EN, 5, 0, NULL, 0),
|
||||
SND_SOC_DAPM_PGA_E("HPHL PA", CDC_A_RX_HPH_CNP_EN, 5, 0, NULL, 0,
|
||||
pm8916_wcd_analog_enable_hphl_pa,
|
||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MUX("HPHL", SND_SOC_NOPM, 0, 0, &hphl_mux),
|
||||
SND_SOC_DAPM_MIXER("HPHL DAC", CDC_A_RX_HPH_L_PA_DAC_CTL, 3, 0, NULL,
|
||||
0),
|
||||
SND_SOC_DAPM_PGA("HPHR PA", CDC_A_RX_HPH_CNP_EN, 4, 0, NULL, 0),
|
||||
SND_SOC_DAPM_PGA_E("HPHR PA", CDC_A_RX_HPH_CNP_EN, 4, 0, NULL, 0,
|
||||
pm8916_wcd_analog_enable_hphr_pa,
|
||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MUX("HPHR", SND_SOC_NOPM, 0, 0, &hphr_mux),
|
||||
SND_SOC_DAPM_MIXER("HPHR DAC", CDC_A_RX_HPH_R_PA_DAC_CTL, 3, 0, NULL,
|
||||
0),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user