All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Paulo Costa <me@paulo.costa.nom.br>
Cc: linux-leds@vger.kernel.org
Subject: Re: [RFC] ledtrig-dither: A Poor man's adjustable LED brightness.
Date: Thu, 17 Aug 2017 00:30:22 +0200	[thread overview]
Message-ID: <20170816223022.GA13540@amd> (raw)
In-Reply-To: <CADbEYbk5US=SDpwPV8SLNsZMwrYgktPcXRp8RjYpm9+6iC8HAA@mail.gmail.com>

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

On Wed 2017-08-16 00:55:04, Paulo Costa wrote:
> > Hmm. Can we simply use blinking trigger to do that?
> 
> To some extent...
> 
> If you just want to have 50% brightness, set timeon=1, timeoff=1 and
> you are done.
> 
> But, accurately seting the brightness to weird numbers is harder.
> E.g., To get 37% brightness your only chance is to set timeon=37,
> timeoff=63 (Or multiples of it).
> 
> The larger delay causes very visible flickering, which sucks.

Well, to set 37% brightness you just set timeon=1 timeoff=2 ;-).

> This trigger uses error propagation to continously adjusts the delay,
> getting a higher blink frequency and accurate average brightness.
> 
> E.g., For 37% it will alternate between 33% (timeon=1,timeoff=2) and
> 50% (timeon=1,timeoff=1)

Hmm, ok, clever.

> Unfortunately, it doesn't really help when the brightness is near 0%
> or near 100%.
> E.g., for 1% brightness, this trigger it is equivalent to
> timeon=1,timeoff=99 -- Flickering is very visible.

Hmm. You could do led=on, udelay(100), led=off. Do that 100 times a
second, and I believe you'll get quite nice low levels.

Now... nice hack. Probably can be improved. But is it suitable for
mainline?

									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:[~2017-08-16 22:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 21:35 [RFC] ledtrig-dither: A Poor man's adjustable LED brightness Paulo Costa
2017-08-15 22:34 ` Pavel Machek
2017-08-16  3:55   ` Paulo Costa
2017-08-16 22:30     ` Pavel Machek [this message]
2017-08-17  4:21       ` Paulo Costa
2017-08-28  9:10         ` Pavel Machek

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=20170816223022.GA13540@amd \
    --to=pavel@ucw.cz \
    --cc=linux-leds@vger.kernel.org \
    --cc=me@paulo.costa.nom.br \
    /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.