asoc: wsa881x: Add mixer for speaker protection

Add mixer for speaker protection.

Change-Id: Ieea53dd1a3c9601373b2a8400d48abb88bb0cd60
This commit is contained in:
Xu,Baochu 2022-03-07 16:43:03 +08:00
commit 501c74bfd4

34
asoc/codecs/wsa881x-analog.c Normal file → Executable file
View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2016, 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/clk.h>
@ -805,7 +806,40 @@ static int wsa881x_set_visense(struct snd_kcontrol *kcontrol,
return 0;
}
static int wsa881x_get_t0_init(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct wsa881x_pdata *wsa881x =
snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
ucontrol->value.integer.value[0] = pdata->t0_init;
dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
static int wsa881x_set_t0_init(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component =
snd_soc_kcontrol_component(kcontrol);
struct wsa881x_pdata *wsa881x =
snd_soc_component_get_drvdata(component);
struct wsa881x_tz_priv *pdata = &wsa881x->tz_pdata;
pdata->t0_init = ucontrol->value.integer.value[0];
dev_dbg(component->dev, "%s: t0 init %d\n", __func__, pdata->t0_init);
return 0;
}
static const struct snd_kcontrol_new wsa881x_snd_controls[] = {
SOC_SINGLE_EXT("WSA T0 Init", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_t0_init, wsa881x_set_t0_init),
SOC_SINGLE_EXT("BOOST Switch", SND_SOC_NOPM, 0, 1, 0,
wsa881x_get_boost, wsa881x_set_boost),