Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 501c74bf authored by Xu,Baochu's avatar Xu,Baochu
Browse files

asoc: wsa881x: Add mixer for speaker protection

Add mixer for speaker protection.

Change-Id: Ieea53dd1a3c9601373b2a8400d48abb88bb0cd60
parent 5db1ae06
Loading
Loading
Loading
Loading

asoc/codecs/wsa881x-analog.c

100644 → 100755
+34 −0
Original line number Diff line number Diff line
// 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),