devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Michal Vokáč" <michal.vokac@ysoft.com>
Cc: Song Qiang <songqiang1304521@gmail.com>,
	jacek.anaszewski@gmail.com, robh+dt@kernel.org,
	mark.rutland@arm.com, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Song Qiang <songqiang.1304521@gmail.com>
Subject: Re: [PATCH] leds: leds-gpio: Add a condition check for active low leds.
Date: Wed, 5 Sep 2018 11:52:54 +0200	[thread overview]
Message-ID: <20180905095254.GA9579@amd> (raw)
In-Reply-To: <13a8d001-a44a-51a0-146b-ba5aa3f6e621@ysoft.com>

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

On Wed 2018-09-05 09:44:04, Michal Vokáč wrote:
> Hi Song,
> On 5.9.2018 04:34, Song Qiang wrote:
> >Some leds on our board are active low leds, which means these leds
> >are lighted when the corresponding gpio line is low, while the
> >original leds-gpio driver default all leds are active high leds.
> >This patch adds a devicetree node "light-state", whose value should
> >be "high" for active high leds and "low" for active low leds.
> >The default value is "high" for compatible for the original driver.
> >
> >Signed-off-by: Song Qiang <songqiang.1304521@gmail.com>
> >---
> >  .../devicetree/bindings/leds/leds-gpio.txt    | 15 +++++++++++
> >  drivers/leds/leds-gpio.c                      | 25 +++++++++++++++++--
> >  2 files changed, 38 insertions(+), 2 deletions(-)
> >
> >diff --git a/Documentation/devicetree/bindings/leds/leds-gpio.txt b/Documentation/devicetree/bindings/leds/leds-gpio.txt
> >index a48dda268f81..0a8fad75c704 100644
> >--- a/Documentation/devicetree/bindings/leds/leds-gpio.txt
> >+++ b/Documentation/devicetree/bindings/leds/leds-gpio.txt
> >@@ -23,6 +23,9 @@ LED sub-node properties:
> >    remains up.
> >  - panic-indicator : (optional)
> >    see Documentation/devicetree/bindings/leds/common.txt
> >+- light-state: (optional) Values should be "high" or "low", which indicates
> >+	the state of the GPIO pin when the led is on.
> >+  see Documentation/devicetree/bindings/leds/common.txt
> >  Examples:
> >@@ -64,3 +67,15 @@ leds {
> >  		retain-state-suspended;
> >  	};
> >  };
> >+
> >+leds {
> >+	compatible = "gpio-leds";
> >+
> >+	led0 {
> >+		label = "led0";
> >+		gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
> 
> With this patch you are introducing one more way to invert the logic.
> If your LED is active LOW, you should use GPIO_ACTIVE_LOW in your DT.
> All should work as expected then.

Exactly, GPIO subsystem already has ways to specify active-low and
active-high.

NAK.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

      reply	other threads:[~2018-09-05  9:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05  2:34 [PATCH] leds: leds-gpio: Add a condition check for active low leds Song Qiang
2018-09-05  7:44 ` Michal Vokáč
2018-09-05  9:52   ` Pavel Machek [this message]

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=20180905095254.GA9579@amd \
    --to=pavel@ucw.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michal.vokac@ysoft.com \
    --cc=robh+dt@kernel.org \
    --cc=songqiang.1304521@gmail.com \
    --cc=songqiang1304521@gmail.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 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).