ASoC: rx-macro: Enable hph idle detect feature

Headset Idle detect feature powers off PAs when
there is no signal. Add widget to enable
this feature for headset path.

Change-Id: I4c88057b347e40317578b5eb014053c17d196b85
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha
2019-01-07 13:18:11 +05:30
zatwierdzone przez Meng Wang
rodzic 5bb681434b
commit 8bcc97c618

Wyświetl plik

@@ -453,6 +453,10 @@ static const struct snd_kcontrol_new rx_int2_1_vbat_mix_switch[] = {
SOC_DAPM_SINGLE("RX AUX VBAT Enable", SND_SOC_NOPM, 0, 1, 0)
};
static const char * const hph_idle_detect_text[] = {"OFF", "ON"};
static SOC_ENUM_SINGLE_EXT_DECL(hph_idle_detect_enum, hph_idle_detect_text);
RX_MACRO_DAPM_ENUM(rx_int0_2, BOLERO_CDC_RX_INP_MUX_RX_INT0_CFG1, 0,
rx_int_mix_mux_text);
RX_MACRO_DAPM_ENUM(rx_int1_2, BOLERO_CDC_RX_INP_MUX_RX_INT1_CFG1, 0,
@@ -1684,6 +1688,40 @@ static void rx_macro_hd2_control(struct snd_soc_component *component,
}
}
static int rx_macro_hph_idle_detect_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct rx_macro_priv *rx_priv = NULL;
struct device *rx_dev = NULL;
if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] =
rx_priv->idle_det_cfg.hph_idle_detect_en;
return 0;
}
static int rx_macro_hph_idle_detect_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct rx_macro_priv *rx_priv = NULL;
struct device *rx_dev = NULL;
if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_priv->idle_det_cfg.hph_idle_detect_en =
ucontrol->value.integer.value[0];
return 0;
}
static int rx_macro_get_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -2611,6 +2649,9 @@ static const struct snd_kcontrol_new rx_macro_snd_controls[] = {
SOC_SINGLE_EXT("RX_COMP2 Switch", SND_SOC_NOPM, RX_MACRO_COMP2, 1, 0,
rx_macro_get_compander, rx_macro_set_compander),
SOC_ENUM_EXT("HPH Idle Detect", hph_idle_detect_enum,
rx_macro_hph_idle_detect_get, rx_macro_hph_idle_detect_put),
SOC_ENUM_EXT("RX_EAR Mode", rx_macro_ear_mode_enum,
rx_macro_get_ear_mode, rx_macro_put_ear_mode),