thinkpad-acpi patches for the merge window (second set)
Subsystems (3)
PATCH 1/1 thinkpad-acpi patches for the merge window (second set)
Len,
This is a second set of changes for thinkpad-acpi that I would like to see merged into acpi-test for this merge window.
The patchset contains some cleanups, and an important rework of the internal hotkey event handling code which new features will depend on.
I apologise for not sending them with the first set, but they were not fully tested at that time.
Thank you!
Signature · 4 lines
"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
PATCH 1/6 thinkpad-acpi: don't leave ERR_PTR() pointers around
backlight_device_register returns ERR_PTR() in case of problems, and the current code would leave that ERR_PTR in ibm_backlight_device.
The current code paths won't touch it in that situation, but that could change. Make sure to set ibm_backlight_device to NULL in the error path.
--- drivers/platform/x86/thinkpad_acpi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
@@ -6010,8 +6010,10 @@ static int __init brightness_init(struct ibm_init_struct *iibm)TPACPI_BACKLIGHT_DEV_NAME ,NULL ,NULL , &ibm_backlight_data);if (IS_ERR (ibm_backlight_device)) { +int rc =PTR_ERR (ibm_backlight_device); + ibm_backlight_device =NULL ;printk (TPACPI_ERR "Could not register backlight device\n" ); -return PTR_ERR (ibm_backlight_device); +return rc; }vdbg_printk (TPACPI_DBG_INIT |TPACPI_DBG_BRGHT ,"brightness is supported\n" );
Signature · 1 line
1.6.3.3
PATCH 2/6 thinkpad-acpi: remove uneeded tp_features.hotkey tests in hotkey_exit
In reply to Henrique de Moraes Holschuhhotkey_exit() is only called if hotkey_init() finished sucessfully, or by direct calls inside hotkey_init(). The tp_features.hotkey test is always true, and just adds to the confusion, remove it. Also, avoid calling hotkey_mask_set() when it won't do anything useful.
--- drivers/platform/x86/thinkpad_acpi.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +8 -10
@@ -2843,16 +2843,14 @@ static void hotkey_exit(void)kfree (hotkey_keycode_map); -if (tp_features.hotkey) { -dbg_printk (TPACPI_DBG_EXIT |TPACPI_DBG_HKEY , -"restoring original hot key mask\n" ); -/* no short-circuit boolean operator below! */ -if ((hotkey_mask_set (hotkey_orig_mask) | -hotkey_status_set (false)) !=0 ) -printk (TPACPI_ERR -"failed to restore hot key mask " -"to BIOS defaults\n" ); - } +dbg_printk (TPACPI_DBG_EXIT |TPACPI_DBG_HKEY , +"restoring original hot key mask\n" ); +/* no short-circuit boolean operator below! */ +if (((tp_features.hotkey_mask &&hotkey_mask_set (hotkey_orig_mask)) + |hotkey_status_set (false)) !=0 ) +printk (TPACPI_ERR +"failed to restore hot key mask " +"to BIOS defaults\n" ); }static void __init hotkey_unmap (const unsigned int scancode)
Signature · 1 line
1.6.3.3
PATCH 3/6 thinkpad-acpi: drop HKEY event 0x5010
In reply to Henrique de Moraes HolschuhHKEY event 0x5010 is useless to us: old ThinkPads don't issue it. Newer ThinkPads won't issue it anymore. And all ThinkPads issue 0x1010 and 0x1011 events.
Just silently drop it instead of sending it to userspace.
--- Documentation/laptops/thinkpad-acpi.txt | 2 +- drivers/platform/x86/thinkpad_acpi.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +1 -1
@@ -525,6 +525,7 @@ compatibility purposes when hotkey_report_mode is set to 1. 0x2305 System is waking up from suspend to eject bay 0x2404 System is waking up from hibernation to undock 0x2405 System is waking up from hibernation to eject bay +0x5010 Brightness level changed/control event The above events are never propagated by the driver.
@@ -532,7 +533,6 @@ The above events are never propagated by the driver. 0x4003 Undocked (see 0x2x04), can sleep again 0x500B Tablet pen inserted into its storage bay 0x500C Tablet pen removed from its storage bay -0x5010 Brightness level changed (newer Lenovo BIOSes) The above events are propagated by the driver.
drivers/platform/x86/thinkpad_acpi.c +4 -4
@@ -3305,7 +3305,6 @@ static bool hotkey_notify_usrevent(const u32 hkey, *ignore_acpi_ev = false;switch (hkey) { -case 0x5010 :/* Lenovo new BIOS: brightness changed */ case 0x500b :/* X61t: tablet pen inserted into bay */ case 0x500c :/* X61t: tablet pen removed from bay */ return true;
@@ -3317,9 +3316,10 @@ static bool hotkey_notify_usrevent(const u32 hkey, *send_acpi_ev = false;return true; -case 0x5001 : -case 0x5002 : -/* LID switch events. Do not propagate */ +case 0x5001 :/* Lid close */ +case 0x5002 :/* Lid open */ +case 0x5010 :/* brightness control */ +/* do not propagate these events */ *ignore_acpi_ev = true;return true;
Signature · 1 line
1.6.3.3
PATCH 4/6 thinkpad-acpi: hotkey event driver update
In reply to Henrique de Moraes HolschuhUpdate the HKEY event driver to:
1. Handle better the second-gen firmware, which has no HKEY mask support but does report FN+F3, FN+F4 and FN+F12 without the need for NVRAM polling.
a) always make the mask-related attributes available in sysfs;
b) use DMI quirks to detect the second-gen firmware;
c) properly report that FN+F3, FN+F4 and FN+F12 are enabled,
and available even on mask-less second-gen firmware;
2. Decouple the issuing of hotkey events towards userspace from their reception from the firmware. ALSA mixer and brightness event reporting support will need this feature.
3. Clean up the mess in the hotkey driver a great deal. It is still very convoluted, and wants a full refactoring into a proper event API interface, but that is not going to happen today.
4. Fully reset firmware interface on resume (restore hotkey mask and status).
5. Stop losing polled events for no good reason when changing the mask and poll frequencies. We will still lose them when the hotkey_source_mask is changed, as well as any that happened between driver suspend and driver resume.
The hotkey subdriver now has the notion of user-space-visible hotkey event mask, as well as of the set of "hotkey" events the driver needs (because brightness/volume change reports are not just keypress reports in most ThinkPad models).
With this rewrite, the ABI level is bumped to 0x020500 should userspace need to know it is dealing with the updated hotkey subdriver.
--- Documentation/laptops/thinkpad-acpi.txt | 46 ++-- drivers/platform/x86/thinkpad_acpi.c | 478 +++++++++++++++++++------------ 2 files changed, 328 insertions(+), 196 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +26 -20
@@ -199,18 +199,22 @@ kind to allow it (and it often doesn't!). Not all bits in the mask can be modified. Not all bits that can be modified do anything. Not all hot keys can be individually controlled -by the mask. Some models do not support the mask at all, and in those -models, hot keys cannot be controlled individually. The behaviour of -the mask is, therefore, highly dependent on the ThinkPad model. +by the mask. Some models do not support the mask at all. The behaviour +of the mask is, therefore, highly dependent on the ThinkPad model. + +The driver will filter out any unmasked hotkeys, so even if the firmware +doesn't allow disabling an specific hotkey, the driver will not report +events for unmasked hotkeys. Note that unmasking some keys prevents their default behavior. For example, if Fn+F5 is unmasked, that key will no longer enable/disable -Bluetooth by itself. +Bluetooth by itself in firmware. -Note also that not all Fn key combinations are supported through ACPI. -For example, on the X40, the brightness, volume and "Access IBM" buttons -do not generate ACPI events even with this driver. They *can* be used -through the "ThinkPad Buttons" utility, see http://www.nongnu.org/tpb/ +Note also that not all Fn key combinations are supported through ACPI +depending on the ThinkPad model and firmware version. On those +ThinkPads, it is still possible to support some extra hotkeys by +polling the "CMOS NVRAM" at least 10 times per second. The driver +attempts to enables this functionality automatically when required. procfs notes:
@@ -255,18 +259,11 @@ sysfs notes: 1: does nothing hotkey_mask: - bit mask to enable driver-handling (and depending on + bit mask to enable reporting (and depending on the firmware, ACPI event generation) for each hot key (see above). Returns the current status of the hot keys mask, and allows one to modify it. - Note: when NVRAM polling is active, the firmware mask - will be different from the value returned by - hotkey_mask. The driver will retain enabled bits for - hotkeys that are under NVRAM polling even if the - firmware refuses them, and will not set these bits on - the firmware hot key mask. - hotkey_all_mask: bit mask that should enable event reporting for all supported hot keys, when echoed to hotkey_mask above.
@@ -279,7 +276,8 @@ sysfs notes: bit mask that should enable event reporting for all supported hot keys, except those which are always handled by the firmware anyway. Echo it to - hotkey_mask above, to use. + hotkey_mask above, to use. This is the default mask + used by the driver. hotkey_source_mask: bit mask that selects which hot keys will the driver
@@ -287,9 +285,10 @@ sysfs notes: based on the capabilities reported by the ACPI firmware, but it can be overridden at runtime. - Hot keys whose bits are set in both hotkey_source_mask - and also on hotkey_mask are polled for in NVRAM. Only a - few hot keys are available through CMOS NVRAM polling. + Hot keys whose bits are set in hotkey_source_mask are + polled for in NVRAM, and reported as hotkey events if + enabled in hotkey_mask. Only a few hot keys are + available through CMOS NVRAM polling. Warning: when in NVRAM mode, the volume up/down/mute keys are synthesized according to changes in the mixer,
@@ -621,6 +620,8 @@ For Lenovo models *with* ACPI backlight control: 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. Bluetooth
@@ -1459,3 +1460,8 @@ Sysfs interface changelog: 0x020400: Marker for 16 LEDs support. Also, LEDs that are known to not exist in a given model are not registered with the LED sysfs class anymore. + +0x020500: Updated hotkey driver, hotkey_mask is always available + and it is always able to disable hot keys. Very old + thinkpads are properly supported. hotkey_bios_mask + is deprecated and marked for removal.
drivers/platform/x86/thinkpad_acpi.c +302 -176
812 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 5/6 thinkpad-acpi: add internal hotkey event API
In reply to Henrique de Moraes HolschuhAdd an internal API to the driver, to allow subdrivers to request and receive HKEY 0x1000 events. This API will be used by the backlight (brightness up/down) and upcoming ALSA mixer (volume up/down/mute) subdrivers.
--- drivers/platform/x86/thinkpad_acpi.c | 48 ++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +48 -0
@@ -2014,6 +2014,9 @@ static u16 *hotkey_keycode_map;static struct attribute_set *hotkey_dev_attributes; +static void tpacpi_driver_event (const unsigned int hkey_event); +static void hotkey_driver_event (const unsigned int scancode); +/* HKEY.MHKG() return bits */ #define TP_HOTKEY_TABLET_MASK (1 << 3)
@@ -2168,6 +2171,35 @@ static int hotkey_user_mask_set(const u32 mask)return rc; } +/* +* Sets the driver hotkey mask. +* +* Can be called even if the hotkey subdriver is inactive +*/ +static int tpacpi_hotkey_driver_mask_set (const u32 mask) +{ +int rc; + +/* Do the right thing if hotkey_init has not been called yet */ +if (!tp_features.hotkey) { + hotkey_driver_mask = mask; +return 0 ; + } + +mutex_lock (&hotkey_mutex); + +HOTKEY_CONFIG_CRITICAL_START + hotkey_driver_mask = mask; + hotkey_source_mask |= (mask & ~hotkey_all_mask); +HOTKEY_CONFIG_CRITICAL_END + + rc =hotkey_mask_set ((hotkey_acpi_mask | hotkey_driver_mask) & + ~hotkey_source_mask); +mutex_unlock (&hotkey_mutex); + +return rc; +} +static int hotkey_status_get (int *status) {if (!acpi_evalf (hkey_handle, status,"DHKC" ,"d" ))
@@ -2227,6 +2259,7 @@ static void tpacpi_input_send_key(const unsigned int scancode)/* Do NOT call without validating scancode first */ static void tpacpi_input_send_key_masked (const unsigned int scancode) { +hotkey_driver_event (scancode);if (hotkey_user_mask & (1 << scancode))tpacpi_input_send_key (scancode); }
@@ -7625,6 +7658,21 @@ static struct ibm_struct fan_driver_data = {**************************************************************************** ****************************************************************************/ +/* +* HKEY event callout for other subdrivers go here +* (yes, it is ugly, but it is quick, safe, and gets the job done +*/ +static void tpacpi_driver_event (const unsigned int hkey_event) +{ +} + + + +static void hotkey_driver_event (const unsigned int scancode) +{ +tpacpi_driver_event (0x1001 + scancode); +} +/* sysfs name ---------------------------------------------------------- */ static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev, struct device_attribute *attr,
Signature · 1 line
1.6.3.3
Re: [PATCH 5/6] thinkpad-acpi: add internal hotkey event API
Hello,
Quoted 25 lines · Henrique de Moraes Holschuh
Add an internal API to the driver, to allow subdrivers to request and receive HKEY
0x1000events. This API will be used by the backlight (brightness up/down) and upcoming ALSA mixer (volume up/down/mute) subdrivers.Signed-off-by Henrique de Moraes Holschuh <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 48 ++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)drivers/platform/x86/thinkpad_acpi.c +3
-0@@ -2014,6 +2014,9 @@ static u16 *hotkey_keycode_map;static struct attribute_set *hotkey_dev_attributes; +static void tpacpi_driver_event (const unsigned int hkey_event); +static void hotkey_driver_event (const unsigned int scancode); +/* HKEY.MHKG() return bits */ #define TP_HOTKEY_TABLET_MASK (1 << 3)
drivers/platform/x86/thinkpad_acpi.c static int hotkey_user_mask_set(const u32 mask) · line 2179
Quoted 9 lines
drivers/platform/x86/thinkpad_acpi.c +6
-0@@ -2168,6 +2171,35 @@ static int hotkey_user_mask_set(const u32 mask)return rc; } +/* +* Sets the driver hotkey mask. +* +* Can be called even if the hotkey subdriver is inactive +*/ +static int tpacpi_hotkey_driver_mask_set (const u32 mask)
CC [M] drivers/platform/x86/thinkpad_acpi.odrivers/platform/x86/thinkpad_acpi.c:2225: warning: ‘tpacpi_hotkey_driver_mask_set’ defined but not used
Thanks,
--
JSR
Quoted 46 lines
drivers/platform/x86/thinkpad_acpi.c +32
-0+{ +int rc; + +/* Do the right thing if hotkey_init has not been called yet */ +if (!tp_features.hotkey) { + hotkey_driver_mask = mask; +return 0 ; + } + +mutex_lock (&hotkey_mutex); + +HOTKEY_CONFIG_CRITICAL_START + hotkey_driver_mask = mask; + hotkey_source_mask |= (mask & ~hotkey_all_mask); +HOTKEY_CONFIG_CRITICAL_END + + rc =hotkey_mask_set ((hotkey_acpi_mask | hotkey_driver_mask) & + ~hotkey_source_mask); +mutex_unlock (&hotkey_mutex); + +return rc; +} +static int hotkey_status_get (int *status) {if (!acpi_evalf (hkey_handle, status,"DHKC" ,"d" ))@@ -2227,6 +2259,7 @@ static void tpacpi_input_send_key(const unsigned int scancode)/* Do NOT call without validating scancode first */ static void tpacpi_input_send_key_masked (const unsigned int scancode) { +hotkey_driver_event (scancode);if (hotkey_user_mask & (1 << scancode))tpacpi_input_send_key (scancode); }@@ -7625,6 +7658,21 @@ static struct ibm_struct fan_driver_data = {**************************************************************************** ****************************************************************************/ +/* +* HKEY event callout for other subdrivers go here +* (yes, it is ugly, but it is quick, safe, and gets the job done +*/ +static void tpacpi_driver_event (const unsigned int hkey_event) +{ +} +
drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct fan_driver_data = { · line 7678
Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +7
-0+ + +static void hotkey_driver_event (const unsigned int scancode) +{ +tpacpi_driver_event (0x1001 + scancode); +} +/* sysfs name ---------------------------------------------------------- */ static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev, struct device_attribute *attr,
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] thinkpad-acpi: add internal hotkey event API
Quoted 11 lines · Jaswinder Singh Rajput
drivers/platform/x86/thinkpad_acpi.c static int hotkey_user_mask_set(const u32 mask) · line 2179
Quoted 6 lines
drivers/platform/x86/thinkpad_acpi.c +6
-0+/* +* Sets the driver hotkey mask. +* +* Can be called even if the hotkey subdriver is inactive +*/ +static int tpacpi_hotkey_driver_mask_set (const u32 mask)CC [M]
drivers/platform/x86/thinkpad_acpi.odrivers/platform/x86/thinkpad_acpi.c:2225: warning:
‘tpacpi_hotkey_driver_mask_set’ defined but not used
The function is used by another patch, which is waiting for its prerequisites to be merged through the backlight tree.
That patch has already been sent to linux-acpi as well.
Signature · 9 lines
"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 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Len Brown
reviewerRe: [PATCH 5/6] thinkpad-acpi: add internal hotkey event API
In reply to Henrique de Moraes Holschuhdrivers/platform/x86/thinkpad_acpi.c:2224: warning:
‘tpacpi_hotkey_driver_mask_set’ defined but not used
thanks,
Len Brown, Intel Open Source Technology Center--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] thinkpad-acpi: add internal hotkey event API
Quoted 2 lines · Len Brown
drivers/platform/x86/thinkpad_acpi.c:2224: warning:
?tpacpi_hotkey_driver_mask_set? defined but not used
Yeah, the patch that uses that lost the 2.6.32 merge window (it was to go in through the backlight tree) and ended up merged in 2.6.33.
Since it is something we need in 2.6.32-stable to help userspace, I will try to get it in through -stable. But I am waiting for the current stable queue to drain first, as there are some thinkpad-acpi bug fixes in it. When those are in, I will try to queue the backlight events patch (that uses tpacpi_hotkey_driver_mask_set()).
Signature · 4 lines
"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
PATCH 6/6 thinkpad-acpi: name event constants
In reply to Henrique de Moraes HolschuhReduce the number of magic numbers in the driver... note that they were all explained and documented already.
--- drivers/platform/x86/thinkpad_acpi.c | 92 +++++++++++++++++++++++++-------- 1 files changed, 69 insertions(+), 23 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +69 -23
@@ -145,6 +145,51 @@ enum { TP_ACPI_WGSV_STATE_UWBPWR = 0x0020, /* UWB radio enabled */ }; +/* HKEY events */ +enum tpacpi_hkey_event_t { +/* Hotkey-related */ +TP_HKEY_EV_HOTKEY_BASE =0x1001 ,/* first hotkey (FN+F1) */ +TP_HKEY_EV_BRGHT_UP =0x1010 ,/* Brightness up */ +TP_HKEY_EV_BRGHT_DOWN =0x1011 ,/* Brightness down */ +TP_HKEY_EV_VOL_UP =0x1015 ,/* Volume up or unmute */ +TP_HKEY_EV_VOL_DOWN =0x1016 ,/* Volume down or unmute */ +TP_HKEY_EV_VOL_MUTE =0x1017 ,/* Mixer output mute */ + +/* Reasons for waking up from S3/S4 */ +TP_HKEY_EV_WKUP_S3_UNDOCK =0x2304 ,/* undock requested, S3 */ +TP_HKEY_EV_WKUP_S4_UNDOCK =0x2404 ,/* undock requested, S4 */ +TP_HKEY_EV_WKUP_S3_BAYEJ =0x2305 ,/* bay ejection req, S3 */ +TP_HKEY_EV_WKUP_S4_BAYEJ =0x2405 ,/* bay ejection req, S4 */ +TP_HKEY_EV_WKUP_S3_BATLOW =0x2313 ,/* battery empty, S3 */ +TP_HKEY_EV_WKUP_S4_BATLOW =0x2413 ,/* battery empty, S4 */ + +/* Auto-sleep after eject request */ +TP_HKEY_EV_BAYEJ_ACK =0x3003 ,/* bay ejection complete */ +TP_HKEY_EV_UNDOCK_ACK =0x4003 ,/* undock complete */ + +/* Misc bay events */ +TP_HKEY_EV_OPTDRV_EJ =0x3006 ,/* opt. drive tray ejected */ + +/* User-interface events */ +TP_HKEY_EV_LID_CLOSE =0x5001 ,/* laptop lid closed */ +TP_HKEY_EV_LID_OPEN =0x5002 ,/* laptop lid opened */ +TP_HKEY_EV_TABLET_TABLET =0x5009 ,/* tablet swivel up */ +TP_HKEY_EV_TABLET_NOTEBOOK =0x500a ,/* tablet swivel down */ +TP_HKEY_EV_PEN_INSERTED =0x500b ,/* tablet pen inserted */ +TP_HKEY_EV_PEN_REMOVED =0x500c ,/* tablet pen removed */ +TP_HKEY_EV_BRGHT_CHANGED =0x5010 ,/* backlight control event */ + +/* Thermal events */ +TP_HKEY_EV_ALARM_BAT_HOT =0x6011 ,/* battery too hot */ +TP_HKEY_EV_ALARM_BAT_XHOT =0x6012 ,/* battery critically hot */ +TP_HKEY_EV_ALARM_SENSOR_HOT =0x6021 ,/* sensor too hot */ +TP_HKEY_EV_ALARM_SENSOR_XHOT =0x6022 ,/* sensor critically hot */ +TP_HKEY_EV_THM_TABLE_CHANGED =0x6030 ,/* thermal table changed */ + +/* Misc */ +TP_HKEY_EV_RFKILL_CHANGED =0x7000 ,/* rfkill switch changed */ +}; +/**************************************************************************** * Main driver */
@@ -2273,7 +2318,7 @@ static void tpacpi_hotkey_send_key(unsigned int scancode)tpacpi_input_send_key_masked (scancode);if (hotkey_report_mode <2 ) {acpi_bus_generate_proc_event (ibm_hotkey_acpidriver.device, -0x80 ,0x1001 + scancode); +0x80 ,TP_HKEY_EV_HOTKEY_BASE + scancode); } }
@@ -3420,20 +3465,20 @@ static bool hotkey_notify_wakeup(const u32 hkey, *ignore_acpi_ev = false;switch (hkey) { -case 0x2304 :/* suspend, undock */ -case 0x2404 :/* hibernation, undock */ +case TP_HKEY_EV_WKUP_S3_UNDOCK :/* suspend, undock */ +case TP_HKEY_EV_WKUP_S4_UNDOCK :/* hibernation, undock */ hotkey_wakeup_reason =TP_ACPI_WAKEUP_UNDOCK ; *ignore_acpi_ev = true;break ; -case 0x2305 :/* suspend, bay eject */ -case 0x2405 :/* hibernation, bay eject */ +case TP_HKEY_EV_WKUP_S3_BAYEJ :/* suspend, bay eject */ +case TP_HKEY_EV_WKUP_S4_BAYEJ :/* hibernation, bay eject */ hotkey_wakeup_reason =TP_ACPI_WAKEUP_BAYEJ ; *ignore_acpi_ev = true;break ; -case 0x2313 :/* Battery on critical low level (S3) */ -case 0x2413 :/* Battery on critical low level (S4) */ +case TP_HKEY_EV_WKUP_S3_BATLOW :/* Battery on critical low level/S3 */ +case TP_HKEY_EV_WKUP_S4_BATLOW :/* Battery on critical low level/S4 */ printk (TPACPI_ALERT "EMERGENCY WAKEUP: battery almost empty\n" );/* how to auto-heal: */
@@ -3463,20 +3508,20 @@ static bool hotkey_notify_usrevent(const u32 hkey, *ignore_acpi_ev = false;switch (hkey) { -case 0x500b :/* X61t: tablet pen inserted into bay */ -case 0x500c :/* X61t: tablet pen removed from bay */ +case TP_HKEY_EV_PEN_INSERTED :/* X61t: tablet pen inserted into bay */ +case TP_HKEY_EV_PEN_REMOVED :/* X61t: tablet pen removed from bay */ return true; -case 0x5009 :/* X41t-X61t: swivel up (tablet mode) */ -case 0x500a :/* X41t-X61t: swivel down (normal mode) */ +case TP_HKEY_EV_TABLET_TABLET :/* X41t-X61t: tablet mode */ +case TP_HKEY_EV_TABLET_NOTEBOOK :/* X41t-X61t: normal mode */ tpacpi_input_send_tabletsw ();hotkey_tablet_mode_notify_change (); *send_acpi_ev = false;return true; -case 0x5001 :/* Lid close */ -case 0x5002 :/* Lid open */ -case 0x5010 :/* brightness control */ +case TP_HKEY_EV_LID_CLOSE :/* Lid closed */ +case TP_HKEY_EV_LID_OPEN :/* Lid opened */ +case TP_HKEY_EV_BRGHT_CHANGED :/* brightness changed */ /* do not propagate these events */ *ignore_acpi_ev = true;return true;
@@ -3495,30 +3540,30 @@ static bool hotkey_notify_thermal(const u32 hkey, *ignore_acpi_ev = false;switch (hkey) { -case 0x6011 : +case TP_HKEY_EV_ALARM_BAT_HOT :printk (TPACPI_CRIT "THERMAL ALARM: battery is too hot!\n" );/* recommended action: warn user through gui */ return true; -case 0x6012 : +case TP_HKEY_EV_ALARM_BAT_XHOT :printk (TPACPI_ALERT "THERMAL EMERGENCY: battery is extremely hot!\n" );/* recommended action: immediate sleep/hibernate */ return true; -case 0x6021 : +case TP_HKEY_EV_ALARM_SENSOR_HOT :printk (TPACPI_CRIT "THERMAL ALARM: " "a sensor reports something is too hot!\n" );/* recommended action: warn user through gui, that */ /* some internal component is too hot */ return true; -case 0x6022 : +case TP_HKEY_EV_ALARM_SENSOR_XHOT :printk (TPACPI_ALERT "THERMAL EMERGENCY: " "a sensor reports something is extremely hot!\n" );/* recommended action: immediate sleep/hibernate */ return true; -case 0x6030 : +case TP_HKEY_EV_THM_TABLE_CHANGED :printk (TPACPI_INFO "EC reports that Thermal Table has changed\n" );/* recommended action: do nothing, we don't have
@@ -3576,7 +3621,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)break ;case 3 :/* 0x3000-0x3FFF: bay-related wakeups */ -if (hkey ==0x3003 ) { +if (hkey ==TP_HKEY_EV_BAYEJ_ACK ) { hotkey_autosleep_ack =1 ;printk (TPACPI_INFO "bay ejected\n" );
@@ -3588,7 +3633,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)break ;case 4 :/* 0x4000-0x4FFF: dock-related wakeups */ -if (hkey ==0x4003 ) { +if (hkey ==TP_HKEY_EV_UNDOCK_ACK ) { hotkey_autosleep_ack =1 ;printk (TPACPI_INFO "undocked\n" );
@@ -3610,7 +3655,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)break ;case 7 :/* 0x7000-0x7FFF: misc */ -if (tp_features.hotkey_wlsw && hkey ==0x7000 ) { +if (tp_features.hotkey_wlsw && + hkey ==TP_HKEY_EV_RFKILL_CHANGED ) {tpacpi_send_radiosw_update (); send_acpi_ev =0 ; known_ev = true;
@@ -7670,7 +7716,7 @@ static void tpacpi_driver_event(const unsigned int hkey_event)static void hotkey_driver_event (const unsigned int scancode) { -tpacpi_driver_event (0x1001 + scancode); +tpacpi_driver_event (TP_HKEY_EV_HOTKEY_BASE + scancode); }/* sysfs name ---------------------------------------------------------- */
Signature · 1 line
1.6.3.3
Len,
Thanks for merging both patchsets so fast. You rule!
Signature · 4 lines
"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