diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-09-20 14:44:48 -0300 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-12-16 11:33:45 +0000 |
commit | 6baddba4a40b4f4e37db051e84ac5e7cc454a19c (patch) | |
tree | eae6dd02133dd310df2147f0655aef621af4a6b6 /drivers | |
parent | 8bea8672edfca7ec5f661cafb218f1205863b343 (diff) | |
download | kernel_samsung_smdk4412-6baddba4a40b4f4e37db051e84ac5e7cc454a19c.tar.gz kernel_samsung_smdk4412-6baddba4a40b4f4e37db051e84ac5e7cc454a19c.tar.bz2 kernel_samsung_smdk4412-6baddba4a40b4f4e37db051e84ac5e7cc454a19c.zip |
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.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index cf61d6a8ef6..758dc0b3ed9 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: @@ -6092,6 +6092,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, @@ -6246,6 +6252,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; } @@ -6322,6 +6334,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; } @@ -7721,6 +7736,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(); + } + } } |