From: Sven Van Asbroeck <thesven73@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Pavel Machek <pavel@ucw.cz>, Rob Herring <robh+dt@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Grigoryev Denis <grigoryev@fastwel.ru>,
Axel Lin <axel.lin@ingics.com>, Dan Murphy <dmurphy@ti.com>,
Mark Rutland <mark.rutland@arm.com>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-leds@vger.kernel.org
Subject: Re: [PATCH v1 1/4] tps6105x: add optional devicetree support
Date: Mon, 18 Nov 2019 13:13:24 -0500 [thread overview]
Message-ID: <CAGngYiXLx8rkkKPyALYyCHFyst2Ft8bCkP4uqmzXAHHqXhUvkQ@mail.gmail.com> (raw)
In-Reply-To: <20191118174550.GA43585@sirena.org.uk>
On Mon, Nov 18, 2019 at 12:45 PM Mark Brown <broonie@kernel.org> wrote:
>
> So this is one device that has two separate modes? This sounds like you
> need a property specifying how the device is wired up, or possibly just
> different compatibles at the root of the device though that's not quite
> idiomatic. Splitting this up with different devices is a bit of a Linux
> specific implementation detail.
Yes, that does make sense and sounds elegant. However, bear with me:
This mfd chip can be wired up as one of the following:
- gpio only
- gpio + regulator
- gpio + led
- gpio + flash
So I need a way to indicate this in the dt.
Imagine I do this with a text/value property, like this:
i2c0 {
tps61052@33 {
compatible = "ti,tps61050";
reg = <0x33>;
mode = "regulator"; // or
mode = <TPS6105X_REGULATOR_MODE>;
};
};
in this case, there is no elegant way to specify the regulator properties in
the devicetree. Except by grabbing a reference to a subnode perhaps. And then
I'd have to somehow make sure that the sub driver's device->of_node points
at this subnode, which the mfd core doesn't do automatically.
Now imagine I use a reference property:
i2c0 {
tps61052@33 {
compatible = "ti,tps61050";
reg = <0x33>;
mode = <&tps_reg>;
tps_reg: regulator {
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
};
};
However for this to work, I need to make sure the regulator subdriver gets a
valid dev->of_node, which the mfd core doesn't do automatically. So I'd have
to follow the 'mode' node, check that its compatible is correct, and then
manually assign the of_node to the mfd child driver (not sure how to even
do that).
So I arrived at the following:
i2c0 {
tps61052@33 {
compatible = "ti,tps61050";
reg = <0x33>;
regulator {
compatible = "ti,tps6105x-regulator";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
};
};
In this case, I only need to verify that there is at most one single subnode.
And when I specify of_compatible = "ti,tps6105x-regulator" in the mfd cell,
the mfd core will automatically assign the child driver's of_node. Nice 'n
elegant?
Would you be able to suggest a way forward?
next prev parent reply other threads:[~2019-11-18 18:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 16:53 [PATCH v1 0/4] tps6105x add devicetree and leds support Sven Van Asbroeck
2019-11-18 16:53 ` [PATCH v1 1/4] tps6105x: add optional devicetree support Sven Van Asbroeck
2019-11-18 17:01 ` Mark Brown
2019-11-18 17:17 ` Sven Van Asbroeck
2019-11-18 17:45 ` Mark Brown
2019-11-18 18:13 ` Sven Van Asbroeck [this message]
2019-11-18 20:34 ` Mark Brown
2019-11-18 21:17 ` Sven Van Asbroeck
2019-11-18 16:53 ` [PATCH v1 2/4] regulator: " Sven Van Asbroeck
2019-11-18 16:53 ` [PATCH v1 3/4] leds: tps6105x: add driver for mfd chip led mode Sven Van Asbroeck
2019-11-18 16:54 ` [PATCH v1 4/4] dt-bindings: mfd: update TI tps6105x chip bindings Sven Van Asbroeck
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=CAGngYiXLx8rkkKPyALYyCHFyst2Ft8bCkP4uqmzXAHHqXhUvkQ@mail.gmail.com \
--to=thesven73@gmail.com \
--cc=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=grigoryev@fastwel.ru \
--cc=jacek.anaszewski@gmail.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.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).