All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power
@ 2021-01-20  9:12 shumingf
  2021-01-20 18:01 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: shumingf @ 2021-01-20  9:12 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, albertchen, derek.fang,
	Shuming Fan, flove

From: Shuming Fan <shumingf@realtek.com>

The application circuit shall provide MICVDD power.
In default, the codec driver doesn't need to enable LDO2 power.
In case, the customers use VBAT for micbias, it should enable the device property "realtek,ldo2-pow-en".

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 include/sound/rt5682.h    |  1 +
 sound/soc/codecs/rt5682.c | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index 3900a07e3935..4b4c61b48380 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -41,6 +41,7 @@ struct rt5682_platform_data {
 	unsigned int dmic_clk_rate;
 	unsigned int dmic_delay;
 	bool dmic_clk_driving_high;
+	bool ldo2_pow_en;
 
 	const char *dai_clk_names[RT5682_DAI_NUM_CLKS];
 };
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 42ad5bea86b5..68d29d71d6e4 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -1343,6 +1343,19 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
 	}
 }
 
+static int is_using_ldo2(struct snd_soc_dapm_widget *w,
+		struct snd_soc_dapm_widget *sink)
+{
+	struct snd_soc_component *component =
+		snd_soc_dapm_to_component(w->dapm);
+	struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
+
+	if (rt5682->pdata.ldo2_pow_en)
+		return 1;
+
+	return 0;
+}
+
 /* Digital Mixer */
 static const struct snd_kcontrol_new rt5682_sto1_adc_l_mix[] = {
 	SOC_DAPM_SINGLE("ADC1 Switch", RT5682_STO1_ADC_MIXER,
@@ -1854,7 +1867,7 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
 
 	{"CLKDET SYS", NULL, "CLKDET"},
 
-	{"IN1P", NULL, "LDO2"},
+	{"IN1P", NULL, "LDO2", is_using_ldo2},
 
 	{"BST1 CBJ", NULL, "IN1P"},
 
@@ -2999,6 +3012,9 @@ int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 	rt5682->pdata.dmic_clk_driving_high = device_property_read_bool(dev,
 		"realtek,dmic-clk-driving-high");
 
+	rt5682->pdata.ldo2_pow_en = device_property_read_bool(dev,
+		"realtek,ldo2-pow-en");
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt5682_parse_dt);
-- 
2.29.0


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

* Re: [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power
  2021-01-20  9:12 [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power shumingf
@ 2021-01-20 18:01 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-01-20 18:01 UTC (permalink / raw)
  To: shumingf
  Cc: oder_chiou, jack.yu, alsa-devel, lars, lgirdwood, albertchen,
	derek.fang, flove

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

On Wed, Jan 20, 2021 at 05:12:18PM +0800, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> The application circuit shall provide MICVDD power.
> In default, the codec driver doesn't need to enable LDO2 power.
> In case, the customers use VBAT for micbias, it should enable the device property "realtek,ldo2-pow-en".

Given that this is just adding a DAPM route I think we can just skip the
property and instead simply leave the LDO registered but not connected
in the DAPM graph, if a board wants to use it then it can just add a
route from the LDO to the relevant input like is currently hard coded in
the board file.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-01-20 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20  9:12 [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power shumingf
2021-01-20 18:01 ` Mark Brown

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.