All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply
@ 2022-07-28  7:10 Srinivasa Rao Mandadapu
  2022-07-28 10:49   ` Mark Brown
  2022-07-28 12:57 ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Srinivasa Rao Mandadapu @ 2022-07-28  7:10 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, quic_plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, quic_rohkumar,
	linux-arm-msm, alsa-devel, linux-kernel, swboyd, judyhsiao,
	devicetree
  Cc: Srinivasa Rao Mandadapu

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@quicinc.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-28 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28  7:10 [PATCH] ASoC: qcom: SC7280: Add support for external DMIC bias supply Srinivasa Rao Mandadapu
2022-07-28 10:49 ` Mark Brown
2022-07-28 10:49   ` Mark Brown
2022-07-28 13:06   ` Srinivasa Rao Mandadapu
2022-07-28 13:06     ` Srinivasa Rao Mandadapu
2022-07-28 12:57 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.