aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-09-20 13:44:48 -0400
committerRichard Purdie <rpurdie@linux.intel.com>2009-12-16 06:33:45 -0500
commit6baddba4a40b4f4e37db051e84ac5e7cc454a19c (patch)
treeeae6dd02133dd310df2147f0655aef621af4a6b6 /drivers
parent8bea8672edfca7ec5f661cafb218f1205863b343 (diff)
backlight/thinkpad-acpi: issue backlight class events
Take advantage of the new events capabilities of the backlight class to notify userspace of backlight changes. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index cf61d6a8ef6f..758dc0b3ed91 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#define TPACPI_VERSION "0.23" 24#define TPACPI_VERSION "0.23"
25#define TPACPI_SYSFS_VERSION 0x020500 25#define TPACPI_SYSFS_VERSION 0x020600
26 26
27/* 27/*
28 * Changelog: 28 * Changelog:
@@ -6092,6 +6092,12 @@ static int brightness_get(struct backlight_device *bd)
6092 return status & TP_EC_BACKLIGHT_LVLMSK; 6092 return status & TP_EC_BACKLIGHT_LVLMSK;
6093} 6093}
6094 6094
6095static void tpacpi_brightness_notify_change(void)
6096{
6097 backlight_force_update(ibm_backlight_device,
6098 BACKLIGHT_UPDATE_HOTKEY);
6099}
6100
6095static struct backlight_ops ibm_backlight_data = { 6101static struct backlight_ops ibm_backlight_data = {
6096 .get_brightness = brightness_get, 6102 .get_brightness = brightness_get,
6097 .update_status = brightness_update_status, 6103 .update_status = brightness_update_status,
@@ -6246,6 +6252,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
6246 ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; 6252 ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK;
6247 backlight_update_status(ibm_backlight_device); 6253 backlight_update_status(ibm_backlight_device);
6248 6254
6255 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT,
6256 "brightness: registering brightness hotkeys "
6257 "as change notification\n");
6258 tpacpi_hotkey_driver_mask_set(hotkey_driver_mask
6259 | TP_ACPI_HKEY_BRGHTUP_MASK
6260 | TP_ACPI_HKEY_BRGHTDWN_MASK);;
6249 return 0; 6261 return 0;
6250} 6262}
6251 6263
@@ -6322,6 +6334,9 @@ static int brightness_write(char *buf)
6322 * Doing it this way makes the syscall restartable in case of EINTR 6334 * Doing it this way makes the syscall restartable in case of EINTR
6323 */ 6335 */
6324 rc = brightness_set(level); 6336 rc = brightness_set(level);
6337 if (!rc && ibm_backlight_device)
6338 backlight_force_update(ibm_backlight_device,
6339 BACKLIGHT_UPDATE_SYSFS);
6325 return (rc == -EINTR)? -ERESTARTSYS : rc; 6340 return (rc == -EINTR)? -ERESTARTSYS : rc;
6326} 6341}
6327 6342
@@ -7721,6 +7736,13 @@ static struct ibm_struct fan_driver_data = {
7721 */ 7736 */
7722static void tpacpi_driver_event(const unsigned int hkey_event) 7737static void tpacpi_driver_event(const unsigned int hkey_event)
7723{ 7738{
7739 if (ibm_backlight_device) {
7740 switch (hkey_event) {
7741 case TP_HKEY_EV_BRGHT_UP:
7742 case TP_HKEY_EV_BRGHT_DOWN:
7743 tpacpi_brightness_notify_change();
7744 }
7745 }
7724} 7746}
7725 7747
7726 7748