linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Behun <marek.behun@nic.cz>
To: Hermes Zhang <Hermes.Zhang@axis.com>
Cc: Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	kernel <kernel@axis.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver
Date: Fri, 12 Mar 2021 06:59:22 +0100	[thread overview]
Message-ID: <20210312065922.53468d07@nic.cz> (raw)
In-Reply-To: <161920e0746e4c0daff7f83163b71677@XBOX03.axis.com>

On Fri, 12 Mar 2021 04:48:52 +0000
Hermes Zhang <Hermes.Zhang@axis.com> wrote:

> > 
> > Sorry, leds-regulator has only a binary state LED.
> > 
> > Maybe you could extend leds-regulator to be able to use all regulator states?
> > 
> > Or you can extend leds-gpio driver to support N states via log N gpios,
> > instead of adding new driver.  
> 
> It seems a good idea to extend leds-gpio, so in my case, I should have such dts:
> 
>  63         leds {
>  64                 compatible = "gpio-leds";
>  65 
>  66                 recording_front {
>  67                         label = "recording_front:red";
>  68                         gpios = <&gpio 130 GPIO_ACTIVE_HIGH>, <&gpio 129 GPIO_ACTIVE_HIGH>;
>  69                         default-state = "off";
>  70                 };
>  71         };
> 
> For my case, two leds is enough, but it sill easy to extend the support number bigger than two. And the length of gpios array is not fixed, so it could compatible with exist "gpio-leds" dts, right? 
> 
> If this idea work, should I create a new commit or still in this track (V2)?

However you want :)

Look at the states property of gpio regulator:
https://www.kernel.org/doc/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml

It is possible to have a multi-GPIO LED which brightness is set via N
GPIOs and it has 2^N brightness states encoded by binary values of
those GPIOs, but it is entirely possible to have less than 2^N states,
or that the states are encoded in a different way.

In the first version though imlpemenent just the simplest case: N GPIOs
with 2^N states.

Marek

  reply	other threads:[~2021-03-12  6:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 13:04 [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver Hermes Zhang
2021-03-11 15:38 ` Marek Behun
2021-03-11 15:39   ` Marek Behun
2021-03-12  4:48     ` Hermes Zhang
2021-03-12  5:59       ` Marek Behun [this message]
2021-03-11 17:56 ` Pavel Machek
2021-03-11 18:02 ` Pavel Machek
2021-03-18  2:11   ` Hermes Zhang
2021-03-12  8:31 ` Alexander Dahl
2021-03-12  8:48   ` Hermes Zhang
2021-03-12  9:03     ` Marek Behun

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=20210312065922.53468d07@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=Hermes.Zhang@axis.com \
    --cc=dmurphy@ti.com \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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).