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-next>] [day] [month] [year] [list]
Message-ID: <1658992233-28372-1-git-send-email-quic_srivasam@quicinc.com>
Date:   Thu, 28 Jul 2022 12:40:33 +0530
From:   Srinivasa Rao Mandadapu <quic_srivasam@...cinc.com>
To:     <agross@...nel.org>, <bjorn.andersson@...aro.org>,
        <lgirdwood@...il.com>, <broonie@...nel.org>, <robh+dt@...nel.org>,
        <quic_plai@...cinc.com>, <bgoswami@...cinc.com>, <perex@...ex.cz>,
        <tiwai@...e.com>, <srinivas.kandagatla@...aro.org>,
        <quic_rohkumar@...cinc.com>, <linux-arm-msm@...r.kernel.org>,
        <alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>,
        <swboyd@...omium.org>, <judyhsiao@...omium.org>,
        <devicetree@...r.kernel.org>
CC:     Srinivasa Rao Mandadapu <quic_srivasam@...cinc.com>
Subject: [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply

Update SC7280 machine driver for enabling external mic bias supply,
Which is required for villager rev boards.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@...cinc.com>
---
 sound/soc/qcom/sc7280.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c
index da7469a..6404e94 100644
--- a/sound/soc/qcom/sc7280.c
+++ b/sound/soc/qcom/sc7280.c
@@ -33,6 +33,7 @@ struct sc7280_snd_data {
 	struct snd_soc_jack hdmi_jack;
 	bool jack_setup;
 	bool stream_prepared[LPASS_MAX_PORTS];
+	struct regulator *vdd_supply;
 };
 
 static void sc7280_jack_free(struct snd_jack *jack)
@@ -345,6 +346,24 @@ static int sc7280_snd_startup(struct snd_pcm_substream *substream)
 	return ret;
 }
 
+static int sc7280_dmic_micbias(struct snd_soc_dapm_widget *w,
+				struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_card *card = w->dapm->card;
+	struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card);
+	int ret = 0;
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		ret = regulator_enable(data->vdd_supply);
+		break;
+	case SND_SOC_DAPM_POST_PMD:
+		ret = regulator_disable(data->vdd_supply);
+		break;
+	}
+	return ret;
+}
+
 static const struct snd_soc_ops sc7280_ops = {
 	.startup = sc7280_snd_startup,
 	.hw_params = sc7280_snd_hw_params,
@@ -356,6 +375,7 @@ static const struct snd_soc_ops sc7280_ops = {
 static const struct snd_soc_dapm_widget sc7280_snd_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("PMIC BIAS", sc7280_dmic_micbias),
 };
 
 static int sc7280_snd_platform_probe(struct platform_device *pdev)
@@ -389,6 +409,10 @@ static int sc7280_snd_platform_probe(struct platform_device *pdev)
 		link->ops = &sc7280_ops;
 	}
 
+	data->vdd_supply = devm_regulator_get(dev, "vdd-dmic-bias");
+	if (IS_ERR(data->vdd_supply)
+		return PTR_ERR(data->vdd_supply);
+
 	return devm_snd_soc_register_card(dev, card);
 }
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ