All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] leds: Add support for Turris 1.x LEDs
Date: Tue, 5 Jul 2022 13:52:27 +0200	[thread overview]
Message-ID: <20220705135227.6380d6d5@thinkpad> (raw)
In-Reply-To: <20220705105609.cpabhrwozyeejwqe@pali>

On Tue, 5 Jul 2022 12:56:09 +0200
Pali Rohár <pali@kernel.org> wrote:

> > 
> > I don't consider this a problem  
> 
> I think it is a problem, to ensure that 'cat multi_intensity' for every

Misunderstanding. I meant that I don't consider the eventual
inconsistency a problem, i.e. I agree with your code.

> > Or maybe just write the value?
> > Is the register write expensive on the CPLD or why are you trying to
> > avoid it if unnecessary?  
> 
> I just do not see any reason to do unnecessary writes.

But now you do an unnecessary check. Unless the writeb() is slower than
that check. Since this isn't i2c, I am wondering how fast that writeb()
is... But this is just me wondering, we can keep it the way you wrote
it...

> > 
> > Hmm. Wouldn't it make more sense to simply have the global brightness
> > accept values from 0 to 7, instead of mapping it to 256 values? And
> > call it something like selected_brightness_index?  
> 
> All other drivers have brightness entry which operates on monotone
> brightness property.
> Brightness levels do not have to be monotone and by default are
> decreasing: 0 = brightness with higher intensity; 7 = no intensity (off)

What do you mean all other drivers? AFAIK only one driver does this
global brightness thing, and that is Omnia. The global brightness is
something different from LED cdev brightness property, the same names
are just coincidental (in fact it caused confusion when Pavel was
first reviewing Turris Omnia driver). Maybe it should have been called
global_intensity, to avoid the confusion...

> I cannot image who would like or prefer usage of such API.

One file that represents the index of the selected global intensity (as
is stored internally in the CPLD) and another file that represents the
configured intensities between which the button switches makes sense,
IMO.

> Just stick with existing APIs. "brightness" entry takes intensity value
> which is monotone, 0 the lowest, MAX (=255) the highest.

Again, the name "brightness" does not imply that it is the same thing
as "brightness" of a LED cdev. And since it even doesn't live in
/sys/class/<led>/ directory, we are proposing new API and can use
whatever makes sense.

I am not saying that the way you did it doesn't make sense. I am just
wondering if it wouldn't make more sense to be able to read the index
of what the user selected by button pressing.

Marek

  reply	other threads:[~2022-07-05 11:53 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05  0:04 [PATCH 1/2] dt-bindings: leds: Add cznic,turris1x-leds.yaml binding Pali Rohár
2022-07-05  0:04 ` [PATCH 2/2] leds: Add support for Turris 1.x LEDs Pali Rohár
2022-07-05 10:37   ` Marek Behún
2022-07-05 10:56     ` Pali Rohár
2022-07-05 11:52       ` Marek Behún [this message]
2022-07-05 12:22         ` Pali Rohár
2022-07-05 12:30           ` Marek Behún
2022-07-05 12:32             ` Pali Rohár
2022-07-05 12:38               ` Marek Behún
2022-07-05 11:36 ` [PATCH 1/2] dt-bindings: leds: Add cznic,turris1x-leds.yaml binding Krzysztof Kozlowski
2022-07-05 11:42   ` Pali Rohár
2022-07-05 11:51     ` Krzysztof Kozlowski
2022-07-05 12:15       ` Pali Rohár
2022-07-05 12:55         ` Krzysztof Kozlowski
2022-07-05 13:05           ` Pali Rohár
2022-07-05 13:07             ` Krzysztof Kozlowski
2022-07-05 11:53     ` Marek Behún
2022-07-05 13:54 ` Rob Herring
2022-07-05 15:59 ` [PATCH v2 1/2] [RFT] " Pali Rohár
2022-07-05 15:59   ` [PATCH v2 2/2] leds: Add support for Turris 1.x LEDs Pali Rohár
2022-07-05 17:30     ` Marek Behún
2022-07-05 18:40     ` Andy Shevchenko
2022-07-05 18:46       ` Pali Rohár
2022-07-05 18:58         ` Andy Shevchenko
2022-11-02  0:25     ` Pali Rohár
2022-07-05 17:51   ` [PATCH v2 1/2] [RFT] dt-bindings: leds: Add cznic,turris1x-leds.yaml binding Krzysztof Kozlowski
2022-07-05 19:18   ` Rob Herring
2022-07-06 11:15   ` Marek Behún
2022-07-06 11:19     ` Pali Rohár
2022-07-06 15:27       ` Marek Behún
2022-07-06 15:36         ` Krzysztof Kozlowski
2022-07-06 16:43           ` Marek Behún
2022-07-06 18:16             ` Krzysztof Kozlowski
2022-07-08 16:05           ` Pali Rohár
2022-07-08 16:29             ` Marek Behún
2022-07-12 21:28             ` Rob Herring

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=20220705135227.6380d6d5@thinkpad \
    --to=kabel@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pali@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.