All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@kernel.org>
Cc: devicetree@vger.kernel.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mfd: arizona: Update device tree regulator bindings
Date: Thu, 26 Sep 2013 16:29:41 +0100	[thread overview]
Message-ID: <20130926152941.GQ3635@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20130925183201.GT3226@sirena.org.uk>

Mark,

What are your thoughts on this approach? I basically add a way to
specify in the DAPM regulator supply widget that the supply lives
on the parent rather than the current device. If you like it I
will send it in as a proper patch.

I had considered adding something like a recursive regulator get
that works it's way up the tree but this felt rather invasive and
most places the user code does the regulator get rather than a
framework so the issue is only really likely to crop up with
regards to ASoC.

Thanks,
Charles
---
 include/sound/soc-dapm.h  |    2 ++
 sound/soc/codecs/wm5102.c |   13 +++++++------
 sound/soc/soc-dapm.c      |    7 ++++++-
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 27a72d5..f21b261 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -360,6 +360,8 @@ struct device;
 
 /* regulator widget flags */
 #define SND_SOC_DAPM_REGULATOR_BYPASS     0x1     /* bypass when disabled */
+/* use codec parent device for regulator get */
+#define SND_SOC_DAPM_REGULATOR_USE_PARENT 0x2
 
 struct snd_soc_dapm_widget;
 enum snd_soc_dapm_type;
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 8bbddc1..ee31f15 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -980,12 +980,13 @@ SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
 SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
 		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
 
-SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
-SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
-SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
-SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
-SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
-SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
+SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, SND_SOC_DAPM_REGULATOR_USE_PARENT),
+SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, SND_SOC_DAPM_REGULATOR_USE_PARENT),
+SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, SND_SOC_DAPM_REGULATOR_USE_PARENT),
+SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS |
+					   SND_SOC_DAPM_REGULATOR_USE_PARENT),
+SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, SND_SOC_DAPM_REGULATOR_USE_PARENT),
+SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, SND_SOC_DAPM_REGULATOR_USE_PARENT),
 
 SND_SOC_DAPM_SIGGEN("TONE"),
 SND_SOC_DAPM_SIGGEN("NOISE"),
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c17c14c..899bd2e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3181,7 +3181,12 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
 
 	switch (w->id) {
 	case snd_soc_dapm_regulator_supply:
-		w->regulator = devm_regulator_get(dapm->dev, w->name);
+		if (w->on_val & SND_SOC_DAPM_REGULATOR_USE_PARENT)
+			w->regulator = devm_regulator_get(dapm->dev->parent,
+							  w->name);
+		else
+			w->regulator = devm_regulator_get(dapm->dev, w->name);
+
 		if (IS_ERR(w->regulator)) {
 			ret = PTR_ERR(w->regulator);
 			dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n",
-- 
1.7.2.5

  reply	other threads:[~2013-09-26 15:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 17:47 [RFC PATCH] mfd: arizona: Update device tree regulator bindings Charles Keepax
2013-09-25 18:32 ` Mark Brown
2013-09-26 15:29   ` Charles Keepax [this message]
     [not found]     ` <20130926152941.GQ3635-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-09-26 17:58       ` Mark Brown
2013-09-26 17:58         ` Mark Brown
     [not found]         ` <20130926175843.GS19304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-28 15:53           ` Charles Keepax
2013-09-28 15:53             ` Charles Keepax
     [not found]             ` <20130928155308.GV3635-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-09-28 22:55               ` Mark Brown
2013-09-28 22:55                 ` Mark Brown
     [not found]                 ` <20130928225535.GQ19304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-29 14:11                   ` Charles Keepax
2013-09-29 14:11                     ` Charles Keepax
     [not found]                     ` <20130929141137.GW3635-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-09-29 17:52                       ` Mark Brown
2013-09-29 17:52                         ` Mark Brown
     [not found]                         ` <20130929175236.GV19304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-29 18:09                           ` Charles Keepax
2013-09-29 18:09                             ` Charles Keepax
     [not found]                             ` <20130929180906.GX3635-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-10-10 11:21                               ` Lee Jones
2013-10-10 11:21                                 ` Lee Jones

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=20130926152941.GQ3635@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.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.