ASoC: wsa: add mixer ctl to set boost value

Add a new mixer ctl to set WSA boost value for
speaker protection v3. Boost value for different
stages are packed together.

Change-Id: Ie80d7bea4d3af00b74935f8b680e72ee967717f6
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
This commit is contained in:
Xiaojun Sang 2017-09-22 17:05:02 +08:00 committed by Gerrit - the friendly Code Review server
parent 8b1366a648
commit fa21d8cd20

View file

@ -676,6 +676,36 @@ static int wsa881x_set_visense(struct snd_kcontrol *kcontrol,
return 0;
}
static int wsa881x_set_boost_level(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
u8 wsa_boost_level = 0;
dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
__func__, ucontrol->value.integer.value[0]);
wsa_boost_level = ucontrol->value.integer.value[0];
snd_soc_update_bits(codec, WSA881X_BOOST_PRESET_OUT1,
0xff, wsa_boost_level);
return 0;
}
static int wsa881x_get_boost_level(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
u8 wsa_boost_level = 0;
wsa_boost_level = snd_soc_read(codec, WSA881X_BOOST_PRESET_OUT1);
ucontrol->value.integer.value[0] = wsa_boost_level;
dev_dbg(codec->dev, "%s: boost level = 0x%x\n", __func__,
wsa_boost_level);
return 0;
}
static const struct snd_kcontrol_new wsa881x_snd_controls[] = {
SOC_SINGLE_EXT("COMP Switch", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_compander, wsa881x_set_compander),
@ -685,6 +715,9 @@ static const struct snd_kcontrol_new wsa881x_snd_controls[] = {
SOC_SINGLE_EXT("VISENSE Switch", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_visense, wsa881x_set_visense),
SOC_SINGLE_EXT("Boost Level", SND_SOC_NOPM, 0, 0xff, 0,
wsa881x_get_boost_level, wsa881x_set_boost_level),
};
static const struct snd_kcontrol_new swr_dac_port[] = {