Merge "asoc: codecs: bolero: Add support to disable aux hpf"

This commit is contained in:
qctecmdr 2019-10-12 09:01:00 -07:00 • committed by Gerrit - the friendly Code Review server
commit f138524159

View file

@ -447,6 +447,7 @@ struct rx_macro_priv {
[RX_MACRO_CHILD_DEVICES_MAX];
int child_count;
int is_softclip_on;
int is_aux_hpf_on;
int softclip_clk_users;
struct rx_macro_bcl_pmic_params bcl_pmic_params;
u16 clk_id;
@ -1797,6 +1798,30 @@ static int rx_macro_config_softclip(struct snd_soc_component *component,
return 0;
}
static int rx_macro_config_aux_hpf(struct snd_soc_component *component,
struct rx_macro_priv *rx_priv,
int event)
{
dev_dbg(component->dev, "%s: event %d, enabled %d\n",
__func__, event, rx_priv->is_aux_hpf_on);
if (SND_SOC_DAPM_EVENT_ON(event)) {
/* Update Aux HPF control */
if (!rx_priv->is_aux_hpf_on)
snd_soc_component_update_bits(component,
BOLERO_CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x00);
}
if (SND_SOC_DAPM_EVENT_OFF(event)) {
/* Reset to default (HPF=ON) */
snd_soc_component_update_bits(component,
BOLERO_CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x04);
}
return 0;
}
static inline void
rx_macro_enable_clsh_block(struct rx_macro_priv *rx_priv, bool enable)
{
@ -2231,6 +2256,45 @@ static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
return 0;
}
static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
ucontrol->value.integer.value[0] = rx_priv->is_aux_hpf_on;
dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
return 0;
}
static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct device *rx_dev = NULL;
struct rx_macro_priv *rx_priv = NULL;
if (!rx_macro_get_data(component, &rx_dev, &rx_priv, __func__))
return -EINVAL;
rx_priv->is_aux_hpf_on = ucontrol->value.integer.value[0];
dev_dbg(component->dev, "%s: aux hpf enable = %d\n", __func__,
rx_priv->is_aux_hpf_on);
return 0;
}
static int rx_macro_enable_vbat(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
@ -2478,9 +2542,12 @@ static int rx_macro_enable_interp_clk(struct snd_soc_component *component,
interp_idx, event);
rx_macro_config_compander(component, rx_priv,
interp_idx, event);
if (interp_idx == INTERP_AUX)
if (interp_idx == INTERP_AUX) {
rx_macro_config_softclip(component, rx_priv,
event);
rx_macro_config_aux_hpf(component, rx_priv,
event);
}
rx_macro_config_classh(component, rx_priv,
interp_idx, event);
}
@ -2513,9 +2580,12 @@ static int rx_macro_enable_interp_clk(struct snd_soc_component *component,
interp_idx, event);
rx_macro_config_compander(component, rx_priv,
interp_idx, event);
if (interp_idx == INTERP_AUX)
if (interp_idx == INTERP_AUX) {
rx_macro_config_softclip(component, rx_priv,
event);
rx_macro_config_aux_hpf(component, rx_priv,
event);
}
rx_macro_hphdelay_lutbypass(component, rx_priv,
interp_idx, event);
if (rx_priv->hph_hd2_mode)
@ -2907,6 +2977,9 @@ static const struct snd_kcontrol_new rx_macro_snd_controls[] = {
SOC_SINGLE_EXT("RX_Softclip Enable", SND_SOC_NOPM, 0, 1, 0,
rx_macro_soft_clip_enable_get,
rx_macro_soft_clip_enable_put),
SOC_SINGLE_EXT("AUX_HPF Enable", SND_SOC_NOPM, 0, 1, 0,
rx_macro_aux_hpf_mode_get,
rx_macro_aux_hpf_mode_put),
SOC_SINGLE_SX_TLV("IIR0 INP0 Volume",
BOLERO_CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0, -84, 40,
@ -3952,6 +4025,8 @@ static int rx_macro_probe(struct platform_device *pdev)
ops.clk_id_req = rx_priv->clk_id;
ops.default_clk_id = default_clk_id;
rx_priv->is_aux_hpf_on = 1;
dev_set_drvdata(&pdev->dev, rx_priv);
mutex_init(&rx_priv->mclk_lock);
mutex_init(&rx_priv->swr_clk_lock);