[PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power
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);
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.
participants (2)
-
Mark Brown
-
shumingf@realtek.com