All of lore.kernel.org
 help / color / mirror / Atom feed
From: <shumingf@realtek.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: oder_chiou@realtek.com, jack.yu@realtek.com,
	alsa-devel@alsa-project.org, lars@metafoo.de,
	albertchen@realtek.com, derek.fang@realtek.com,
	Shuming Fan <shumingf@realtek.com>,
	flove@realtek.com
Subject: [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power
Date: Wed, 20 Jan 2021 17:12:18 +0800	[thread overview]
Message-ID: <20210120091218.10837-1-shumingf@realtek.com> (raw)

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


             reply	other threads:[~2021-01-20  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  9:12 shumingf [this message]
2021-01-20 18:01 ` [PATCH 2/2] ASoC: rt5682: add device property to control LDO2 power Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210120091218.10837-1-shumingf@realtek.com \
    --to=shumingf@realtek.com \
    --cc=albertchen@realtek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=derek.fang@realtek.com \
    --cc=flove@realtek.com \
    --cc=jack.yu@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.