|
@@ -1022,6 +1022,9 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
|
|
snd_soc_component_update_bits(component,
|
|
|
WCD938X_DIGITAL_PDM_WD_CTL0,
|
|
|
0x17, 0x13);
|
|
|
+ if (!wcd938x->comp1_enable)
|
|
|
+ snd_soc_component_update_bits(component,
|
|
|
+ WCD938X_ANA_EAR_COMPANDER_CTL, 0x80, 0x80);
|
|
|
break;
|
|
|
case SND_SOC_DAPM_POST_PMU:
|
|
|
/* 6 msec delay as per HW requirement */
|
|
@@ -1065,6 +1068,9 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
|
|
|
}
|
|
|
break;
|
|
|
case SND_SOC_DAPM_POST_PMD:
|
|
|
+ if (!wcd938x->comp1_enable)
|
|
|
+ snd_soc_component_update_bits(component,
|
|
|
+ WCD938X_ANA_EAR_COMPANDER_CTL, 0x80, 0x00);
|
|
|
/* 7 msec delay as per HW requirement */
|
|
|
usleep_range(7000, 7010);
|
|
|
if (wcd938x->ear_rx_path & EAR_RX_PATH_AUX)
|
|
@@ -2126,6 +2132,48 @@ static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int wcd938x_ear_pa_gain_get(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ u8 ear_pa_gain = 0;
|
|
|
+ struct snd_soc_component *component =
|
|
|
+ snd_soc_kcontrol_component(kcontrol);
|
|
|
+
|
|
|
+ ear_pa_gain = snd_soc_component_read32(component,
|
|
|
+ WCD938X_ANA_EAR_COMPANDER_CTL);
|
|
|
+
|
|
|
+ ear_pa_gain = (ear_pa_gain & 0x7C) >> 2;
|
|
|
+
|
|
|
+ ucontrol->value.integer.value[0] = ear_pa_gain;
|
|
|
+
|
|
|
+ dev_dbg(component->dev, "%s: ear_pa_gain = 0x%x\n", __func__,
|
|
|
+ ear_pa_gain);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int wcd938x_ear_pa_gain_put(struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ u8 ear_pa_gain = 0;
|
|
|
+ struct snd_soc_component *component =
|
|
|
+ snd_soc_kcontrol_component(kcontrol);
|
|
|
+ struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
|
|
|
+
|
|
|
+ dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
|
|
|
+ __func__, ucontrol->value.integer.value[0]);
|
|
|
+
|
|
|
+ ear_pa_gain = ucontrol->value.integer.value[0] << 2;
|
|
|
+
|
|
|
+ if (!wcd938x->comp1_enable) {
|
|
|
+ snd_soc_component_update_bits(component,
|
|
|
+ WCD938X_ANA_EAR_COMPANDER_CTL,
|
|
|
+ 0x7C, ear_pa_gain);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int wcd938x_get_compander(struct snd_kcontrol *kcontrol,
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
{
|
|
@@ -2211,10 +2259,21 @@ static const char * const rx_hph_mode_mux_text_wcd9380[] = {
|
|
|
"CLS_AB_LOHIFI",
|
|
|
};
|
|
|
|
|
|
+static const char * const wcd938x_ear_pa_gain_text[] = {
|
|
|
+ "G_6_DB", "G_4P5_DB", "G_3_DB", "G_1P5_DB", "G_0_DB",
|
|
|
+ "G_M1P5_DB", "G_M3_DB", "G_M4P5_DB",
|
|
|
+ "G_M6_DB", "G_7P5_DB", "G_M9_DB",
|
|
|
+ "G_M10P5_DB", "G_M12_DB", "G_M13P5_DB",
|
|
|
+ "G_M15_DB", "G_M16P5_DB", "G_M18_DB",
|
|
|
+};
|
|
|
+
|
|
|
static const struct soc_enum rx_hph_mode_mux_enum_wcd9380 =
|
|
|
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(rx_hph_mode_mux_text_wcd9380),
|
|
|
rx_hph_mode_mux_text_wcd9380);
|
|
|
|
|
|
+static SOC_ENUM_SINGLE_EXT_DECL(wcd938x_ear_pa_gain_enum,
|
|
|
+ wcd938x_ear_pa_gain_text);
|
|
|
+
|
|
|
static const char * const rx_hph_mode_mux_text[] = {
|
|
|
"CLS_H_INVALID", "CLS_H_HIFI", "CLS_H_LP", "CLS_AB", "CLS_H_LOHIFI",
|
|
|
"CLS_H_ULP", "CLS_AB_HIFI", "CLS_AB_LP", "CLS_AB_LOHIFI",
|
|
@@ -2225,6 +2284,9 @@ static const struct soc_enum rx_hph_mode_mux_enum =
|
|
|
rx_hph_mode_mux_text);
|
|
|
|
|
|
static const struct snd_kcontrol_new wcd9380_snd_controls[] = {
|
|
|
+ SOC_ENUM_EXT("EAR PA GAIN", wcd938x_ear_pa_gain_enum,
|
|
|
+ wcd938x_ear_pa_gain_get, wcd938x_ear_pa_gain_put),
|
|
|
+
|
|
|
SOC_ENUM_EXT("RX HPH Mode", rx_hph_mode_mux_enum_wcd9380,
|
|
|
wcd938x_rx_hph_mode_get, wcd938x_rx_hph_mode_put),
|
|
|
|