* [GIT PATCH] backlight event support enhancements
@ 2009-09-20 17:44 Henrique de Moraes Holschuh
2009-09-20 17:44 ` [PATCH 1/2] backlight: extend event support to also support poll() Henrique de Moraes Holschuh
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-09-20 17:44 UTC (permalink / raw)
To: Matthew Garrett; +Cc: Richard Purdie, linux-acpi, ibm-acpi-devel
Matthew, Richard,
This two-patch patchset adds poll() support to Matthew's backlight event
work, and also adds backlight event support for thinkpad-acpi.
The thinkpad-acpi changes depend on a patchset I just sent to Len Brown
for merging in acpi-test.
Is there any timeframe for the backlight event support to be sent to
mainline?
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] backlight: extend event support to also support poll() 2009-09-20 17:44 [GIT PATCH] backlight event support enhancements Henrique de Moraes Holschuh @ 2009-09-20 17:44 ` Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 2/2] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh 2009-09-20 23:41 ` [GIT PATCH] backlight event support enhancements Richard Purdie 2 siblings, 0 replies; 8+ messages in thread From: Henrique de Moraes Holschuh @ 2009-09-20 17:44 UTC (permalink / raw) Cc: Richard Purdie, linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh, Matthew Garrett Extend the backlight event support to also allow the use of poll()/select() on actual_brightness. We already have the entire event hookup anyway, adding a single function call in one line to get functionality like that is a really good deal. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Matthew Garrett <mjg@redhat.com> Cc: Richard Purdie <rpurdie@rpsys.net> --- drivers/video/backlight/backlight.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 01efb2d..4d15dfe 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -91,6 +91,7 @@ static void backlight_generate_event(struct backlight_device *bd, } envp[1] = NULL; kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp); + sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); } static ssize_t backlight_show_power(struct device *dev, -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] thinkpad-acpi: issue backlight class events 2009-09-20 17:44 [GIT PATCH] backlight event support enhancements Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 1/2] backlight: extend event support to also support poll() Henrique de Moraes Holschuh @ 2009-09-20 17:44 ` Henrique de Moraes Holschuh 2009-09-20 23:41 ` [GIT PATCH] backlight event support enhancements Richard Purdie 2 siblings, 0 replies; 8+ messages in thread From: Henrique de Moraes Holschuh @ 2009-09-20 17:44 UTC (permalink / raw) Cc: Richard Purdie, linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh, Matthew Garrett Take advantage of the new events capabilities of the backlight class to notify userspace of backlight changes. This depends on "backlight: Allow drivers to update the core, and generate events on changes", by Matthew Garrett. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Matthew Garrett <mjg@redhat.com> --- Documentation/laptops/thinkpad-acpi.txt | 51 +++++++----------------------- drivers/platform/x86/thinkpad_acpi.c | 24 ++++++++++++++- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 1f46a5d..686c3ca 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt @@ -460,6 +460,8 @@ event code Key Notes For Lenovo ThinkPads with a new BIOS, it has to be handled either by the ACPI OSI, or by userspace. + The driver does the right thing, + never mess with this. 0x1011 0x10 FN+END Brightness down. See brightness up for details. @@ -582,46 +584,15 @@ with hotkey_report_mode. Brightness hotkey notes: -These are the current sane choices for brightness key mapping in -thinkpad-acpi: +Don't mess with the brightness hotkeys in a Thinkpad. If you want +notifications for OSD, use the sysfs backlight class event support. -For IBM and Lenovo models *without* ACPI backlight control (the ones on -which thinkpad-acpi will autoload its backlight interface by default, -and on which ACPI video does not export a backlight interface): - -1. Don't enable or map the brightness hotkeys in thinkpad-acpi, as - these older firmware versions unfortunately won't respect the hotkey - mask for brightness keys anyway, and always reacts to them. This - usually work fine, unless X.org drivers are doing something to block - the BIOS. In that case, use (3) below. This is the default mode of - operation. - -2. Enable the hotkeys, but map them to something else that is NOT - KEY_BRIGHTNESS_UP/DOWN or any other keycode that would cause - userspace to try to change the backlight level, and use that as an - on-screen-display hint. - -3. IF AND ONLY IF X.org drivers find a way to block the firmware from - automatically changing the brightness, enable the hotkeys and map - them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN, and feed that to - something that calls xbacklight. thinkpad-acpi will not be able to - change brightness in that case either, so you should disable its - backlight interface. - -For Lenovo models *with* ACPI backlight control: - -1. Load up ACPI video and use that. ACPI video will report ACPI - events for brightness change keys. Do not mess with thinkpad-acpi - defaults in this case. thinkpad-acpi should not have anything to do - with backlight events in a scenario where ACPI video is loaded: - brightness hotkeys must be disabled, and the backlight interface is - to be kept disabled as well. This is the default mode of operation. - -2. Do *NOT* load up ACPI video, enable the hotkeys in thinkpad-acpi, - and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN. Process - these keys on userspace somehow (e.g. by calling xbacklight). - The driver will do this automatically if it detects that ACPI video - has been disabled. +The driver will issue KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN events +automatically for the cases were userspace has to do something to +implement brightness changes. When you override these events, you will +either fail to handle properly the ThinkPads that require explicit +action to change backlight brightness, or the ThinkPads that require +that no action be taken to work properly. Bluetooth @@ -1465,3 +1436,5 @@ Sysfs interface changelog: and it is always able to disable hot keys. Very old thinkpads are properly supported. hotkey_bios_mask is deprecated and marked for removal. + +0x020600: Marker for backlight change event support. diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 51c209c..8fcc2e7 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -22,7 +22,7 @@ */ #define TPACPI_VERSION "0.23" -#define TPACPI_SYSFS_VERSION 0x020500 +#define TPACPI_SYSFS_VERSION 0x020600 /* * Changelog: @@ -6052,6 +6052,12 @@ static int brightness_get(struct backlight_device *bd) return status & TP_EC_BACKLIGHT_LVLMSK; } +static void tpacpi_brightness_notify_change(void) +{ + backlight_force_update(ibm_backlight_device, + BACKLIGHT_UPDATE_HOTKEY); +} + static struct backlight_ops ibm_backlight_data = { .get_brightness = brightness_get, .update_status = brightness_update_status, @@ -6206,6 +6212,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; backlight_update_status(ibm_backlight_device); + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, + "brightness: registering brightness hotkeys " + "as change notification\n"); + tpacpi_hotkey_driver_mask_set(hotkey_driver_mask + | TP_ACPI_HKEY_BRGHTUP_MASK + | TP_ACPI_HKEY_BRGHTDWN_MASK);; return 0; } @@ -6282,6 +6294,9 @@ static int brightness_write(char *buf) * Doing it this way makes the syscall restartable in case of EINTR */ rc = brightness_set(level); + if (!rc && ibm_backlight_device) + backlight_force_update(ibm_backlight_device, + BACKLIGHT_UPDATE_SYSFS); return (rc == -EINTR)? ERESTARTSYS : rc; } @@ -7681,6 +7696,13 @@ static struct ibm_struct fan_driver_data = { */ static void tpacpi_driver_event(const unsigned int hkey_event) { + if (ibm_backlight_device) { + switch (hkey_event) { + case TP_HKEY_EV_BRGHT_UP: + case TP_HKEY_EV_BRGHT_DOWN: + tpacpi_brightness_notify_change(); + } + } } -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [GIT PATCH] backlight event support enhancements 2009-09-20 17:44 [GIT PATCH] backlight event support enhancements Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 1/2] backlight: extend event support to also support poll() Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 2/2] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh @ 2009-09-20 23:41 ` Richard Purdie 2009-09-21 12:28 ` Henrique de Moraes Holschuh 2 siblings, 1 reply; 8+ messages in thread From: Richard Purdie @ 2009-09-20 23:41 UTC (permalink / raw) To: Henrique de Moraes Holschuh; +Cc: Matthew Garrett, linux-acpi, ibm-acpi-devel On Sun, 2009-09-20 at 14:44 -0300, Henrique de Moraes Holschuh wrote: > This two-patch patchset adds poll() support to Matthew's backlight event > work, and also adds backlight event support for thinkpad-acpi. > > The thinkpad-acpi changes depend on a patchset I just sent to Len Brown > for merging in acpi-test. > > Is there any timeframe for the backlight event support to be sent to > mainline? I'm going to try and get the event patches in this merge window if I can. I'm going to have intermittent internet access for a few days but I will send a pull request for the backlight tree over that time period. Whats the timeframe for acpi-test merging? Cheers, Richard -- Richard Purdie Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PATCH] backlight event support enhancements 2009-09-20 23:41 ` [GIT PATCH] backlight event support enhancements Richard Purdie @ 2009-09-21 12:28 ` Henrique de Moraes Holschuh 2009-09-26 19:55 ` Henrique de Moraes Holschuh 0 siblings, 1 reply; 8+ messages in thread From: Henrique de Moraes Holschuh @ 2009-09-21 12:28 UTC (permalink / raw) To: Richard Purdie; +Cc: Matthew Garrett, linux-acpi, ibm-acpi-devel On Mon, 21 Sep 2009, Richard Purdie wrote: > On Sun, 2009-09-20 at 14:44 -0300, Henrique de Moraes Holschuh wrote: > > This two-patch patchset adds poll() support to Matthew's backlight event > > work, and also adds backlight event support for thinkpad-acpi. > > > > The thinkpad-acpi changes depend on a patchset I just sent to Len Brown > > for merging in acpi-test. > > > > Is there any timeframe for the backlight event support to be sent to > > mainline? > > I'm going to try and get the event patches in this merge window if I > can. I'm going to have intermittent internet access for a few days but I > will send a pull request for the backlight tree over that time period. > > Whats the timeframe for acpi-test merging? acpi-test usually merges late, and the patchset with the prerequisites for patch 2/2 are not even merged in acpi-test yet. If you are not going to merge late, it is best to let me handle patch 2/2 and I will submit it later when both sets of prerequisites are in mainline... -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PATCH] backlight event support enhancements 2009-09-21 12:28 ` Henrique de Moraes Holschuh @ 2009-09-26 19:55 ` Henrique de Moraes Holschuh 2009-09-26 23:35 ` Richard Purdie 0 siblings, 1 reply; 8+ messages in thread From: Henrique de Moraes Holschuh @ 2009-09-26 19:55 UTC (permalink / raw) To: Richard Purdie; +Cc: Matthew Garrett, linux-acpi, ibm-acpi-devel On Mon, 21 Sep 2009, Henrique de Moraes Holschuh wrote: > > I'm going to try and get the event patches in this merge window if I > > can. I'm going to have intermittent internet access for a few days but I > > will send a pull request for the backlight tree over that time period. > > > > Whats the timeframe for acpi-test merging? > > acpi-test usually merges late, and the patchset with the prerequisites for > patch 2/2 are not even merged in acpi-test yet. Well, they got merged early :-) The patches are all in mainline already, so the thinkpad-acpi dependencies have been taken care of. Can you please merge patch 2/2 through the backlight tree? It can go in toghether with Matthew's patches. -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PATCH] backlight event support enhancements 2009-09-26 19:55 ` Henrique de Moraes Holschuh @ 2009-09-26 23:35 ` Richard Purdie 2009-09-26 23:57 ` Henrique de Moraes Holschuh 0 siblings, 1 reply; 8+ messages in thread From: Richard Purdie @ 2009-09-26 23:35 UTC (permalink / raw) To: Henrique de Moraes Holschuh; +Cc: Matthew Garrett, linux-acpi, ibm-acpi-devel On Sat, 2009-09-26 at 16:55 -0300, Henrique de Moraes Holschuh wrote: > On Mon, 21 Sep 2009, Henrique de Moraes Holschuh wrote: > > > I'm going to try and get the event patches in this merge window if I > > > can. I'm going to have intermittent internet access for a few days but I > > > will send a pull request for the backlight tree over that time period. > > > > > > Whats the timeframe for acpi-test merging? > > > > acpi-test usually merges late, and the patchset with the prerequisites for > > patch 2/2 are not even merged in acpi-test yet. > > Well, they got merged early :-) The patches are all in mainline already, so > the thinkpad-acpi dependencies have been taken care of. > > Can you please merge patch 2/2 through the backlight tree? It can go in > toghether with Matthew's patches. Matthew's patches and your 1/2 patch are in. I'll queue 2/2 in the tree now I know the other parts are there. Cheers, Richard -- Richard Purdie Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PATCH] backlight event support enhancements 2009-09-26 23:35 ` Richard Purdie @ 2009-09-26 23:57 ` Henrique de Moraes Holschuh 0 siblings, 0 replies; 8+ messages in thread From: Henrique de Moraes Holschuh @ 2009-09-26 23:57 UTC (permalink / raw) To: Richard Purdie; +Cc: Matthew Garrett, linux-acpi, ibm-acpi-devel On Sun, 27 Sep 2009, Richard Purdie wrote: > On Sat, 2009-09-26 at 16:55 -0300, Henrique de Moraes Holschuh wrote: > > On Mon, 21 Sep 2009, Henrique de Moraes Holschuh wrote: > > > > I'm going to try and get the event patches in this merge window if I > > > > can. I'm going to have intermittent internet access for a few days but I > > > > will send a pull request for the backlight tree over that time period. > > > > > > > > Whats the timeframe for acpi-test merging? > > > > > > acpi-test usually merges late, and the patchset with the prerequisites for > > > patch 2/2 are not even merged in acpi-test yet. > > > > Well, they got merged early :-) The patches are all in mainline already, so > > the thinkpad-acpi dependencies have been taken care of. > > > > Can you please merge patch 2/2 through the backlight tree? It can go in > > toghether with Matthew's patches. > > Matthew's patches and your 1/2 patch are in. I'll queue 2/2 in the tree > now I know the other parts are there. Thank you. -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-09-26 23:57 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-09-20 17:44 [GIT PATCH] backlight event support enhancements Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 1/2] backlight: extend event support to also support poll() Henrique de Moraes Holschuh 2009-09-20 17:44 ` [PATCH 2/2] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh 2009-09-20 23:41 ` [GIT PATCH] backlight event support enhancements Richard Purdie 2009-09-21 12:28 ` Henrique de Moraes Holschuh 2009-09-26 19:55 ` Henrique de Moraes Holschuh 2009-09-26 23:35 ` Richard Purdie 2009-09-26 23:57 ` Henrique de Moraes Holschuh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox