lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240731-msm8953-msm8976-asoc-v3-8-163f23c3a28d@gmail.com>
Date: Wed, 31 Jul 2024 17:25:32 +0200
From: Adam Skladowski <a39.skl@...il.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>, 
 Banajit Goswami <bgoswami@...cinc.com>, Liam Girdwood <lgirdwood@...il.com>, 
 Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>, 
 Takashi Iwai <tiwai@...e.com>, Rob Herring <robh@...nel.org>, 
 Krzysztof Kozlowski <krzk+dt@...nel.org>, 
 Conor Dooley <conor+dt@...nel.org>, Konrad Dybcio <konradybcio@...nel.org>, 
 Stephan Gerhold <stephan@...hold.net>
Cc: alsa-devel@...a-project.org, linux-arm-msm@...r.kernel.org, 
 linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org, 
 devicetree@...r.kernel.org, Adam Skladowski <a39.skl@...il.com>, 
 Vladimir Lypak <vladimir.lypak@...il.com>
Subject: [PATCH v3 8/8] ASoC: msm8916-wcd-analog: add lineout output

From: Vladimir Lypak <vladimir.lypak@...il.com>

Add descriptions and controls to toggle lineout output

Signed-off-by: Vladimir Lypak <vladimir.lypak@...il.com>
Signed-off-by: Adam Skladowski <a39.skl@...il.com>
---
 sound/soc/codecs/msm8916-wcd-analog.c | 64 +++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
index b9325290c28d..38949556f7d9 100644
--- a/sound/soc/codecs/msm8916-wcd-analog.c
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
@@ -233,6 +233,8 @@
 #define RX_EAR_CTL_PA_SEL			BIT(7)
 
 #define CDC_A_RX_EAR_STATUS		(0xf1A1)
+#define CDC_A_RX_LO_DAC_CTL		(0xf1AC)
+#define CDC_A_RX_LO_EN_CTL		(0xf1AD)
 
 #define CDC_A_SPKR_DAC_CTL		(0xf1B0)
 #define SPKR_DAC_CTL_DAC_RESET_MASK	BIT(4)
@@ -327,6 +329,8 @@ static const struct soc_enum hph_enum = SOC_ENUM_SINGLE_VIRT(
 static const struct snd_kcontrol_new ear_mux = SOC_DAPM_ENUM("EAR_S", hph_enum);
 static const struct snd_kcontrol_new hphl_mux = SOC_DAPM_ENUM("HPHL", hph_enum);
 static const struct snd_kcontrol_new hphr_mux = SOC_DAPM_ENUM("HPHR", hph_enum);
+static const struct snd_kcontrol_new lineout_mux = SOC_DAPM_ENUM("LINEOUT",
+								 hph_enum);
 
 /* ADC2 MUX */
 static const struct soc_enum adc2_enum = SOC_ENUM_SINGLE_VIRT(
@@ -630,6 +634,46 @@ static int pm8916_wcd_analog_enable_adc(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static int pm8916_wcd_analog_enable_lineout_dac(struct snd_soc_dapm_widget *w,
+					 struct snd_kcontrol *kcontrol,
+					 int event)
+{
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_EN_CTL,
+				0x20, 0x20);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_EN_CTL,
+				0x80, 0x80);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x08, 0x08);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x40, 0x40);
+		break;
+	case SND_SOC_DAPM_POST_PMU:
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x80, 0x80);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x08, 0x00);
+		break;
+	case SND_SOC_DAPM_POST_PMD:
+		usleep_range(20000, 20100);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x80, 0x00);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x40, 0x00);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_DAC_CTL,
+				0x08, 0x00);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_EN_CTL,
+				0x80, 0x00);
+		snd_soc_component_update_bits(component, CDC_A_RX_LO_EN_CTL,
+				0x20, 0x00);
+		break;
+	}
+	return 0;
+}
+
 static int pm8916_wcd_analog_enable_spk_pa(struct snd_soc_dapm_widget *w,
 					    struct snd_kcontrol *kcontrol,
 					    int event)
@@ -917,6 +961,13 @@ static const struct snd_soc_dapm_route pm8916_wcd_analog_audio_map[] = {
 	{"SPK PA", NULL, "SPK DAC"},
 	{"SPK DAC", "Switch", "PDM_RX3"},
 
+	{"LINEOUT_OUT", NULL, "LINEOUT PA"},
+	{"LINEOUT PA", NULL, "RX_BIAS"},
+	{"LINEOUT PA", NULL, "SPKR_CLK"},
+	{"LINEOUT PA", NULL, "LINEOUT"},
+	{"LINEOUT", "Switch", "LINEOUT DAC"},
+	{"LINEOUT DAC", NULL, "PDM_RX3"},
+
 	{"MIC_BIAS1", NULL, "INT_LDO_H"},
 	{"MIC_BIAS2", NULL, "INT_LDO_H"},
 	{"MIC_BIAS1", NULL, "vdd-micbias"},
@@ -978,6 +1029,19 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("DAC_REF", CDC_A_RX_COM_BIAS_DAC, 0, 0, NULL, 0),
 	SND_SOC_DAPM_SUPPLY("RX_BIAS", CDC_A_RX_COM_BIAS_DAC, 7, 0, NULL, 0),
 
+	/* Lineout */
+	SND_SOC_DAPM_OUTPUT("LINEOUT_OUT"),
+
+	SND_SOC_DAPM_PGA_E("LINEOUT PA", CDC_A_RX_LO_EN_CTL,
+			   6, 0, NULL, 0, NULL, 0),
+
+	SND_SOC_DAPM_DAC_E("LINEOUT DAC", NULL, SND_SOC_NOPM, 0, 0,
+			   pm8916_wcd_analog_enable_lineout_dac,
+			   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
+			   SND_SOC_DAPM_POST_PMD),
+
+	SND_SOC_DAPM_MUX("LINEOUT", SND_SOC_NOPM, 0, 0, &lineout_mux),
+
 	/* TX */
 	SND_SOC_DAPM_SUPPLY("MIC_BIAS1", CDC_A_MICB_1_EN, 7, 0,
 			    pm8916_wcd_analog_enable_micbias1,

-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ