From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
Cc: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Richard Purdie <rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org>,
linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 3/3] leds: leds-pwm: Add device tree bindings
Date: Fri, 07 Dec 2012 13:34:53 +0000 [thread overview]
Message-ID: <20121207133453.800C43E0B87@localhost> (raw)
In-Reply-To: <50C0913B.9070802-l0cyMroinI0@public.gmane.org>
On Thu, 6 Dec 2012 13:36:11 +0100, Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org> wrote:
> Hi Grant,
>
> On 12/06/2012 11:00 AM, Grant Likely wrote:
> > On Mon, 12 Nov 2012 15:41:10 +0100, Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org> wrote:
> >> Support for device tree booted kernel.
> >> When the kernel is booted with DeviceTree blob we support one led per
> >> leds-pwm device to have cleaner integration with the PWM subsystem.
> >>
> >> For usage see:
> >> Documentation/devicetree/bindings/leds/leds-pwm.txt
> >>
> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
> >> ---
> >> .../devicetree/bindings/leds/leds-pwm.txt | 34 ++++++
> >> drivers/leds/leds-pwm.c | 125 +++++++++++++++------
> >> 2 files changed, 127 insertions(+), 32 deletions(-)
> >> create mode 100644 Documentation/devicetree/bindings/leds/leds-pwm.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/leds/leds-pwm.txt b/Documentation/devicetree/bindings/leds/leds-pwm.txt
> >> new file mode 100644
> >> index 0000000..9fe3040
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/leds/leds-pwm.txt
> >> @@ -0,0 +1,34 @@
> >> +LED connected to PWM
> >> +
> >> +Required properties:
> >> +- compatible : should be "pwm-leds".
> >> +- pwms : PWM property, please refer to:
> >> + Documentation/devicetree/bindings/pwm/pwm.txt
> >> +- pwm-names : (optional) Name to be used by the PWM subsystem for the PWM device
> >> +- label : (optional) The label for this LED. If omitted, the label is
> >> + taken from the node name (excluding the unit address).
> >> +- max-brightness : Maximum brightness possible for the LED
> >> +- linux,default-trigger : (optional) This parameter, if present, is a
> >> + string defining the trigger assigned to the LED. Current triggers are:
> >> + "backlight" - LED will act as a back-light, controlled by the framebuffer
> >> + system
> >> + "default-on" - LED will turn on, but see "default-state" below
> >> + "heartbeat" - LED "double" flashes at a load average based rate
> >> + "ide-disk" - LED indicates disk activity
> >> + "timer" - LED flashes at a fixed, configurable rate
> >
> > The binding mostly looks good. However, it seems to be gratuitously
> > different from the gpio-leds binding and it duplicates property
> > definitions. Please match the gpio-leds behaviour with each led defined
> > as a sub node of the pwm-leds node.
>
> The GPIO and PWM bindings are substantially different. For start in pwm we do
> not have of_get_pwm* helpers. To get the PWM itself we need to use wpm_get()
That's just the implementation. I'm talking about the binding. :-)
Implementation should follow binding design, not the other way around.
Both bindings use the same pattern. There isn't a of_get_pwm helper now,
but there is nothing preventing one from being created if you need it.
in the controller:
#gpio-cells vs. #pwm-cells
in the user:
gpios = <[gpio specifier]> vs. pwms = <pwm specifier>
The PWM binding states that pwm-names is optional.
> which uses the pwms = <>; pwm-names = <>; properties on the device's main node.
> This is what I could do at the moment:
>
> twl_pwm: pwm {
> compatible = "ti,twl4030-pwm";
> #pwm-cells = <2>;
> };
>
> twl_led: pwmled {
> compatible = "ti,twl4030-pwmled";
> #pwm-cells = <2>;
> };
>
> pwmleds {
> compatible = "pwm-leds";
> pwms = <&twl_pwm 0 7812500
> &twl_pwmled 0 7812500>;
> pwm-names = "omap4::keypad",
> "omap4:green:chrg";
> kpad {
> label = "omap4::keypad";
> max-brightness = <127>;
> };
>
> charging {
> label = "omap4:green:chrg";
> max-brightness = <255>;
> };
That's just a goofy extra layer of indirection and still doesn't follow
the lead of the gpio-leds pattern. That makes it worse that your
original binding, not better.
It really needs to look like this:
pwmleds {
compatible = "pwm-leds";
kpad {
label = "omap4::keypad";
max-brightness = <127>;
pwms = <&twl_pwm 0 7812500>;
};
charging {
label = "omap4:green:chrg";
max-brightness = <255>;
pwms = <&twl_pwmled 0 7812500>;
};
};
g.
next prev parent reply other threads:[~2012-12-07 13:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 14:41 [PATCH v2 0/3] leds: leds-pwm: Device tree support Peter Ujfalusi
[not found] ` <1352731270-27534-1-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2012-11-12 14:41 ` [PATCH v2 1/3] leds: leds-pwm: Convert to use devm_get_pwm Peter Ujfalusi
2012-11-14 1:14 ` Bryan Wu
[not found] ` <CAK5ve-JDCSSOKHQG-F1RoDii62=-DiPevaD6SafndYVvOgB6Fw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-14 7:13 ` Peter Ujfalusi
2012-12-03 14:13 ` Peter Ujfalusi
2012-12-03 18:32 ` Bryan Wu
[not found] ` <CAK5ve-+1eQ3mPLAu2Qxw4LjNA85oEtJE-wZcL=YpQ0xBFJ6+hQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-04 8:11 ` Peter Ujfalusi
2012-12-04 17:34 ` Bryan Wu
2012-12-05 15:36 ` Peter Ujfalusi
2012-11-12 14:41 ` [PATCH v2 2/3] leds: leds-pwm: Preparing the driver for device tree support Peter Ujfalusi
2012-11-12 14:41 ` [PATCH v2 3/3] leds: leds-pwm: Add device tree bindings Peter Ujfalusi
[not found] ` <1352731270-27534-4-git-send-email-peter.ujfalusi-l0cyMroinI0@public.gmane.org>
2012-12-06 10:00 ` Grant Likely
2012-12-06 12:36 ` Peter Ujfalusi
[not found] ` <50C0913B.9070802-l0cyMroinI0@public.gmane.org>
2012-12-07 13:34 ` Grant Likely [this message]
2012-12-07 14:04 ` Peter Ujfalusi
2012-12-10 22:37 ` Grant Likely
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=20121207133453.800C43E0B87@localhost \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peter.ujfalusi-l0cyMroinI0@public.gmane.org \
--cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@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).