devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: obtaining a regulator from a phandle
Date: Mon, 5 Mar 2012 16:21:57 +0100	[thread overview]
Message-ID: <20120305152157.GA12927@avionic-0098.adnet.avionic-design.de> (raw)

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

Hi,

I'm working on getting DT support for PCIe on Tegra working. The Tegra PCIe
controller needs a specific voltage supplied by a regulator on the board that
I use (Harmony-compatible), so what I did was add DT support for the PMU
(tps6586x) to provide the corresponding regulator:

	pmu: tps6586x@34 {
		[...]
		regulators {
			...
			ldo0_reg: ldo0 {
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
			};
		};
		[...]
	};

Within the device node of the PCIe controller, I reference the ldo0 regulator
like so:

	pcie@80000000 {
		pex-clk-supply = <&ldo0_reg>;
	};

This all works well, except there seems to be no API to obtain a regulator
from the DT phandle. I'm wondering whether this is because nobody has had any
use for it or whether I'm using it wrongly.

I could possibly work around this by giving the ldo0 an explicit name via the
regulator-name property and then look up that property from the phandle and
then obtain a reference to the regulator by calling the normal regulator_get()
and passing the name. That seems wasteful, though, because I already have a
direct link to the regulator (via its struct device_node) and all I really
need is to look up the corresponding struct regulator.

So my question really is if it would be acceptable to add such a helper, or
whether I have completely misunderstood how this works. In the latter case,
could anyone point me in the right direction?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

             reply	other threads:[~2012-03-05 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 15:21 Thierry Reding [this message]
     [not found] ` <20120305152157.GA12927-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-03-05 16:44   ` obtaining a regulator from a phandle Stephen Warren
     [not found]     ` <74CDBE0F657A3D45AFBB94109FB122FF17BE861C09-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-03-05 16:55       ` Thierry Reding
     [not found]         ` <20120305165514.GA21298-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-03-06 11:39           ` Thierry Reding
     [not found]             ` <20120306113947.GA22769-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-03-06 17:21               ` Stephen Warren

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=20120305152157.GA12927@avionic-0098.adnet.avionic-design.de \
    --to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).