public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jack@antonello.org
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org, rpurdie@rpsys.net
Subject: Re: [PATCH] backlight dimmer
Date: Fri, 02 Nov 2007 00:18:20 +0100	[thread overview]
Message-ID: <472A5EBC.7030907@antonello.org> (raw)
In-Reply-To: <20071030144838.GD7742@ucw.cz>

Pavel Machek wrote:
> On Sun 2007-10-28 17:10:53, jack@antonello.org wrote:
>> Hello,
>> this patch implements a macbook like backlight dimmer on 
>> top of backlight.c.
>>
>> The dimmer is entirely in kernelspace and is suitable 
>> for an embedded context in order to avoid the overhead 
>> of a daemon controlling the backlight. Implementing this 
>> functionality in userspace has other advantages and is a 
>> perfectly reasonable alternative, so this patch is
>> not the definitive solution.
>>
>> activate dimmer:
>> echo 1 > /sys/devices/virtual/backlight/*/dimmer_control
>>
>> other attributes (britness levels & timeout):
>> /sys/devices/virtual/backlight/*/dimmer_high_level
>> /sys/devices/virtual/backlight/*/dimmer_low_level
>> /sys/devices/virtual/backlight/*/dimmer_timeout
> 
> I'd say that userspace makes sense here. I'd want backlight to go down
> slowly, for example.
> 
> But... maybe undimming should be done in kernel, so it keeps
> low,latency?
> 
> Hmm, maybe existing screen blanking infrastructure can be reused?
> 
>> --- linux-2.6.23.1/include/linux/backlight.h 2007-10-12 
>> 18:43:44.000000000 +0200
>> +++ b/include/linux/backlight.h	2007-10-28 
>> 13:45:21.000000000 +0100
>> @@ -11,6 +11,7 @@
>> #include <linux/device.h>
>> #include <linux/mutex.h>
>> #include <linux/notifier.h>
>> +#include <linux/timeout.h>
>>
>> /* Notes on locking:
> 
> Your mail client damages patches?
> 

Hi,
incremental dimming can be easily implemented on top of this patch. 
It's just about posting the timeout repeatedly. I will post something 
in the near future :).

I believe the userspace vs kernelspace argument is very arbitrary.

As i said, the dimmer can be completely coded in userspace. There are 
good reasons for that. Userspace apps can work out better than the 
kernel what the user is doing. If the user is watching a movie for 
instance, the dimmer should be stopped.

However, the patch is just a light addition to backlight.c. If the 
dimmer is stopped/unused, just a few pointers and some code are wasted.

Userspace apps can start, stop and change the timeout value for the 
dimmer on the fly, as if they were doing the dimming themselves. In 
this case, userspace only notifies the kernel to stop the dimmer 
whenever such action is deemed right. Instead when the dimmer is on, 
which is most of the time, no kernespace/userspace switch is necessary.

Changing the brightness might occur every 10 seconds or so. IMHO this 
is more of a realtime (and thus kernelspace) requirement rather than 
userspace. This also saves us from having a whole (heavyweight) 
dedicated process managing such a basic functionality.

Finally, implementing the dimmer in kernelspace delivers this 
functionality everywhere provided Linux is used. No additional 
software is necessary. This latter would usually have to be tailored 
to different audiences such as desktop, embedded, whatever.

I don't think thunderbird is breaking the patch, since i was able to 
apply it from my previous posts. However here is a web location for 
it, just in case: http://www.antonello.org/dimmer/. Please let me know 
if you can't test it!

jacopo


      reply	other threads:[~2007-11-01 23:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-28 16:10 [PATCH] backlight dimmer jack
2007-10-28 16:15 ` Samuel Tardieu
2007-10-28 21:30   ` lists
2007-10-28 21:34     ` Arjan van de Ven
2007-10-28 22:09       ` jack
2007-10-30 14:48 ` Pavel Machek
2007-11-01 23:18   ` jack [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=472A5EBC.7030907@antonello.org \
    --to=jack@antonello.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    /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