Skip to contentSkip to conversation

thinkpad-acpi queue for 2.6.30

PATCH Applied Henrique de Moraes Holschuh 4 participants 16 messages Apr 4, 2009 – Oct 29, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thinkpad-acpi queue for 2.6.30

Len,

This patchset has the changes for thinkpad-acpi that I would like to see merged for 2.6.30 (while the window is still open).

It contains the patch for
http://bugzilla.kernel.org/show_bug.cgi?id=11750, and a few enhancements.

Shortlog:

Henrique de Moraes Holschuh (12):
thinkpad-acpi: update copyright notices
thinkpad-acpi: drop ibm-acpi alias
thinkpad-acpi: documentation cleanup
thinkpad-acpi: cleanup debug helpers
thinkpad-acpi: add missing log levels
thinkpad-acpi: add new debug helpers and warn of deprecated atts
thinkpad-acpi: remove HKEY disable functionality
thinkpad-acpi: restrict access to some firmware LEDs
thinkpad-acpi: enhanced debugging messages for rfkill subdrivers
thinkpad-acpi: enhanced debugging messages for the hotkey subdriver
thinkpad-acpi: enhanced debugging messages for the fan subdriver
thinkpad-acpi: rework brightness support

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

A message that is not in the archive (sent off-list or not yet received): 1238819153-16004-1-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/[email protected]

#2 lore raw

PATCH 12/12 thinkpad-acpi: rework brightness support

Refactor and redesign the brightness control backend...

In order to fix bugzilla #11750...

Add a new brightness control mode: support direct NVRAM checkpointing of the backlight level (i.e. store directly to NVRAM without the need for UCMS calls), and use that together with the EC-based control. Disallow UCMS+EC, thus avoiding races with the SMM firmware.

Switch the models that define HBRV (EC Brightness Value) in the DSDT to the new mode. These are: T40-T43, R50-R52, R50e, R51e, X31-X41.

Change the default for all other IBM ThinkPads to UCMS-only. The Lenovo models already default to UCMS-only.

---
 Documentation/laptops/thinkpad-acpi.txt |   12 +-
 drivers/platform/x86/thinkpad_acpi.c    |  317 +++++++++++++++++++++----------
 2 files changed, 227 insertions(+), 102 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +9 -3
index 25ed43d..3d76507 100644
@@ -1157,10 +1157,15 @@ display backlight brightness control methods have 16 levels, ranging
 from 0 to 15.
 
 There are two interfaces to the firmware for direct brightness control,
-EC and CMOS.  To select which one should be used, use the
+EC and UCMS (or CMOS).  To select which one should be used, use the
 brightness_mode module parameter: brightness_mode=1 selects EC mode,
-brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
-and CMOS.  The driver tries to auto-detect which interface to use.
+brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC
+mode with NVRAM backing (so that brightness changes are remembered
+across shutdown/reboot).
+
+The driver tries to select which interface to use from a table of
+defaults for each ThinkPad model.  If it makes a wrong choice, please
+report this as a bug, so that we can fix it.
 
 When display backlight brightness controls are available through the
 standard ACPI interface, it is best to use it instead of this direct
@@ -1498,6 +1503,7 @@ to enable more than one output class, just add their values.
 				(bluetooth, WWAN, UWB...)
 	0x0008			HKEY event interface, hotkeys
 	0x0010			Fan control
+	0x0020			Backlight brightness
 
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
drivers/platform/x86/thinkpad_acpi.c +218 -99

435 lines not on this page · raw message

Signature · 4 lines
1.6.2.1


------------------------------------------------------------------------------
#3 lore raw

PATCH 1/12 thinkpad-acpi: update copyright notices

In reply to Henrique de Moraes Holschuh

It is that time of the year again...

---
 drivers/platform/x86/thinkpad_acpi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
index d99f1cd..fd6985b 100644
@@ -3,7 +3,7 @@
  *
  *
  *  Copyright (C) 2004-2005 Borislav Deianov <[email protected]>
- *  Copyright (C) 2006-2008 Henrique de Moraes Holschuh <[email protected]>
+ *  Copyright (C) 2006-2009 Henrique de Moraes Holschuh <[email protected]>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
Signature · 1 line
1.6.2.1
#4 lore raw

PATCH 2/12 thinkpad-acpi: drop ibm-acpi alias

In reply to Henrique de Moraes Holschuh

The driver was renamed two years ago, on 2.6.21. Drop the old compatibility alias, we have given everybody quite enough time to update their configs to the new name.

---
 drivers/platform/x86/thinkpad_acpi.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +0 -3
index fd6985b..5fd5549 100644
@@ -7515,9 +7515,6 @@ static int __init thinkpad_acpi_module_init(void)
 	return 0;
 }
 
-/* Please remove this in year 2009 */
-MODULE_ALIAS("ibm_acpi");
-
 MODULE_ALIAS(TPACPI_DRVR_SHORTNAME);
 
 /*
Signature · 1 line
1.6.2.1
#5 lore raw

PATCH 3/12 thinkpad-acpi: documentation cleanup

In reply to Henrique de Moraes Holschuh

Some cleanups to the documentation of the driver.

---
 Documentation/laptops/thinkpad-acpi.txt |   76 +++++++++++++++++++++----------
 1 files changed, 52 insertions(+), 24 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +52 -24
index 41bc99f..f6e6bc6 100644
@@ -20,7 +20,8 @@ moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel
 kernel 2.6.29 and release 0.22.
 
 The driver is named "thinkpad-acpi".  In some places, like module
-names, "thinkpad_acpi" is used because of userspace issues.
+names and log messages, "thinkpad_acpi" is used because of userspace
+issues.
 
 "tpacpi" is used as a shorthand where "thinkpad-acpi" would be too
 long due to length limitations on some Linux kernel versions.
@@ -37,7 +38,7 @@ detailed description):
 	- ThinkLight on and off
 	- limited docking and undocking
 	- UltraBay eject
-	- CMOS control
+	- CMOS/UCMS control
 	- LED control
 	- ACPI sounds
 	- temperature sensors
@@ -46,6 +47,7 @@ detailed description):
 	- Volume control
 	- Fan control and monitoring: fan speed, fan enable/disable
 	- WAN enable and disable
+	- UWB enable and disable
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -53,7 +55,7 @@ reports, especially if they add to or correct the compatibility table.
 Please include the following information in your report:
 
 	- ThinkPad model name
-	- a copy of your DSDT, from /proc/acpi/dsdt
+	- a copy of your ACPI tables, using the "acpidump" utility
 	- a copy of the output of dmidecode, with serial numbers
 	  and UUIDs masked off
 	- which driver features work and which don't
@@ -66,17 +68,18 @@ Installation
 ------------
 
 If you are compiling this driver as included in the Linux kernel
-sources, simply enable the CONFIG_THINKPAD_ACPI option, and optionally
-enable the CONFIG_THINKPAD_ACPI_BAY option if you want the
-thinkpad-specific bay functionality.
+sources, look for the CONFIG_THINKPAD_ACPI Kconfig option.
+It is located on the menu path: "Device Drivers" -> "X86 Platform
+Specific Device Drivers" -> "ThinkPad ACPI Laptop Extras".
+
 
 Features
 --------
 
 The driver exports two different interfaces to userspace, which can be
 used to access the features it provides.  One is a legacy procfs-based
-interface, which will be removed at some time in the distant future.
-The other is a new sysfs-based interface which is not complete yet.
+interface, which will be removed at some time in the future.  The other
+is a new sysfs-based interface which is not complete yet.
 
 The procfs interface creates the /proc/acpi/ibm directory.  There is a
 file under that directory for each feature it supports.  The procfs
@@ -111,15 +114,17 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver
 as a driver attribute (see below).
 
 Sysfs driver attributes are on the driver's sysfs attribute space,
-for 2.6.23 this is /sys/bus/platform/drivers/thinkpad_acpi/ and
+for 2.6.23+ this is /sys/bus/platform/drivers/thinkpad_acpi/ and
 /sys/bus/platform/drivers/thinkpad_hwmon/
 
 Sysfs device attributes are on the thinkpad_acpi device sysfs attribute
-space, for 2.6.23 this is /sys/devices/platform/thinkpad_acpi/.
+space, for 2.6.23+ this is /sys/devices/platform/thinkpad_acpi/.
 
 Sysfs device attributes for the sensors and fan are on the
 thinkpad_hwmon device's sysfs attribute space, but you should locate it
-looking for a hwmon device with the name attribute of "thinkpad".
+looking for a hwmon device with the name attribute of "thinkpad", or
+better yet, through libsensors.
+
 
 Driver version
 --------------
@@ -129,6 +134,7 @@ sysfs driver attribute: version
 
 The driver name and version. No commands can be written to this file.
 
+
 Sysfs interface version
 -----------------------
 
@@ -160,6 +166,7 @@ expect that an attribute might not be there, and deal with it properly
 (an attribute not being there *is* a valid way to make it clear that a
 feature is not available in sysfs).
 
+
 Hot keys
 --------
 
@@ -618,6 +625,7 @@ For Lenovo models *with* ACPI backlight control:
    and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN.  Process
    these keys on userspace somehow (e.g. by calling xbacklight).
 
+
 Bluetooth
 ---------
 
@@ -628,6 +636,9 @@ sysfs rfkill class: switch "tpacpi_bluetooth_sw"
 This feature shows the presence and current state of a ThinkPad
 Bluetooth device in the internal ThinkPad CDC slot.
 
+If the ThinkPad supports it, the Bluetooth state is stored in NVRAM,
+so it is kept across reboots and power-off.
+
 Procfs notes:
 
 If Bluetooth is installed, the following commands can be used:
@@ -652,6 +663,7 @@ Sysfs notes:
 	rfkill controller switch "tpacpi_bluetooth_sw": refer to
 	Documentation/rfkill.txt for details.
 
+
 Video output control -- /proc/acpi/ibm/video
 --------------------------------------------
 
@@ -693,11 +705,8 @@ Fn-F7 from working. This also disables the video output switching
 features of this driver, as it uses the same ACPI methods as
 Fn-F7. Video switching on the console should still work.
 
-UPDATE: There's now a patch for the X.org Radeon driver which
-addresses this issue. Some people are reporting success with the patch
-while others are still having problems. For more information:
+UPDATE: refer to https://bugs.freedesktop.org/show_bug.cgi?id=2000
 
-https://bugs.freedesktop.org/show_bug.cgi?id=2000
 
 ThinkLight control
 ------------------
@@ -720,10 +729,11 @@ The ThinkLight sysfs interface is documented by the LED class
 documentation, in Documentation/leds-class.txt.  The ThinkLight LED name
 is "tpacpi::thinklight".
 
-Due to limitations in the sysfs LED class, if the status of the thinklight
+Due to limitations in the sysfs LED class, if the status of the ThinkLight
 cannot be read or if it is unknown, thinkpad-acpi will report it as "off".
 It is impossible to know if the status returned through sysfs is valid.
 
+
 Docking / undocking -- /proc/acpi/ibm/dock
 ------------------------------------------
 
@@ -784,6 +794,7 @@ the only docking stations currently supported are the X-series
 UltraBase docks and "dumb" port replicators like the Mini Dock (the
 latter don't need any ACPI support, actually).
 
+
 UltraBay eject -- /proc/acpi/ibm/bay
 ------------------------------------
 
@@ -847,8 +858,9 @@ supported. Use "eject2" instead of "eject" for the second bay.
 Note: the UltraBay eject support on the 600e/x, A22p and A3x is
 EXPERIMENTAL and may not work as expected. USE WITH CAUTION!
 
-CMOS control
-------------
+
+CMOS/UCMS control
+-----------------
 
 procfs: /proc/acpi/ibm/cmos
 sysfs device attribute: cmos_command
@@ -882,6 +894,7 @@ The cmos command interface is prone to firmware split-brain problems, as
 in newer ThinkPads it is just a compatibility layer.  Do not use it, it is
 exported just as a debug tool.
 
+
 LED control
 -----------
 
@@ -939,6 +952,7 @@ ThinkPad indicator LED should blink in hardware accelerated mode, use the
 "timer" trigger, and leave the delay_on and delay_off parameters set to
 zero (to request hardware acceleration autodetection).
 
+
 ACPI sounds -- /proc/acpi/ibm/beep
 ----------------------------------
 
@@ -968,6 +982,7 @@ X40:
 	16 - one medium-pitched beep repeating constantly, stop with 17
 	17 - stop 16
 
+
 Temperature sensors
 -------------------
 
@@ -1115,6 +1130,7 @@ registers contain the current battery capacity, etc. If you experiment
 with this, do send me your results (including some complete dumps with
 a description of the conditions when they were taken.)
 
+
 LCD brightness control
 ----------------------
 
@@ -1124,10 +1140,9 @@ sysfs backlight device "thinkpad_screen"
 This feature allows software control of the LCD brightness on ThinkPad
 models which don't have a hardware brightness slider.
 
-It has some limitations: the LCD backlight cannot be actually turned on or
-off by this interface, and in many ThinkPad models, the "dim while on
-battery" functionality will be enabled by the BIOS when this interface is
-used, and cannot be controlled.
+It has some limitations: the LCD backlight cannot be actually turned
+on or off by this interface, it just controls the backlight brightness
+level.
 
 On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
 has eight brightness levels, ranging from 0 to 7.  Some of the levels
@@ -1201,6 +1216,7 @@ WARNING:
     and maybe reduce the life of the backlight lamps by needlessly kicking
     its level up and down at every change.
 
+
 Volume control -- /proc/acpi/ibm/volume
 ---------------------------------------
 
@@ -1217,6 +1233,11 @@ distinct. The unmute the volume after the mute command, use either the
 up or down command (the level command will not unmute the volume).
 The current volume level and mute state is shown in the file.
 
+The ALSA mixer interface to this feature is still missing, but patches
+to add it exist.  That problem should be addressed in the not so
+distant future.
+
+
 Fan control and monitoring: fan speed, fan enable/disable
 ---------------------------------------------------------
 
@@ -1383,8 +1404,11 @@ procfs: /proc/acpi/ibm/wan
 sysfs device attribute: wwan_enable (deprecated)
 sysfs rfkill class: switch "tpacpi_wwan_sw"
 
-This feature shows the presence and current state of a W-WAN (Sierra
-Wireless EV-DO) device.
+This feature shows the presence and current state of the built-in
+Wireless WAN device.
+
+If the ThinkPad supports it, the WWAN state is stored in NVRAM,
+so it is kept across reboots and power-off.
 
 It was tested on a Lenovo ThinkPad X60. It should probably work on other
 ThinkPad models which come with this module installed.
@@ -1413,6 +1437,7 @@ Sysfs notes:
 	rfkill controller switch "tpacpi_wwan_sw": refer to
 	Documentation/rfkill.txt for details.
 
+
 EXPERIMENTAL: UWB
 -----------------
 
@@ -1431,6 +1456,7 @@ Sysfs notes:
 	rfkill controller switch "tpacpi_uwb_sw": refer to
 	Documentation/rfkill.txt for details.
 
+
 Multiple Commands, Module Parameters
 ------------------------------------
 
@@ -1445,6 +1471,7 @@ for example:
 
 	modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable
 
+
 Enabling debugging output
 -------------------------
 
@@ -1467,6 +1494,7 @@ The level of debugging information output by the driver can be changed
 at runtime through sysfs, using the driver attribute debug_level.  The
 attribute takes the same bitmask as the debug module parameter above.
 
+
 Force loading of module
 -----------------------
 
Signature · 1 line
1.6.2.1
#6 lore raw

PATCH 4/12 thinkpad-acpi: cleanup debug helpers

In reply to Henrique de Moraes Holschuh

Fix the vdbg_printk macro definition to be sane when CONFIG_THINKPAD_ACPI_DEBUG is undefined, and move the mess into a file section of its own.

This doesn't change anything in the current code, but future code will need the proper behaviour.

---
 drivers/platform/x86/thinkpad_acpi.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +18 -11
index 5fd5549..0a01f76 100644
@@ -184,17 +184,6 @@ enum {
 #define TPACPI_DBG_ALL		0xffff
 #define TPACPI_DBG_INIT		0x0001
 #define TPACPI_DBG_EXIT		0x0002
-#define dbg_printk(a_dbg_level, format, arg...) \
-	do { if (dbg_level & a_dbg_level) \
-		printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \
-	} while (0)
-#ifdef CONFIG_THINKPAD_ACPI_DEBUG
-#define vdbg_printk(a_dbg_level, format, arg...) \
-	dbg_printk(a_dbg_level, format, ## arg)
-static const char *str_supported(int is_supported);
-#else
-#define vdbg_printk(a_dbg_level, format, arg...)
-#endif
 
 #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off")
 #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
@@ -326,6 +315,24 @@ static int tpacpi_uwb_emulstate;
 #endif
 
 
+/*************************************************************************
+ *  Debugging helpers
+ */
+
+#define dbg_printk(a_dbg_level, format, arg...) \
+	do { if (dbg_level & (a_dbg_level)) \
+		printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \
+	} while (0)
+
+#ifdef CONFIG_THINKPAD_ACPI_DEBUG
+#define vdbg_printk dbg_printk
+static const char *str_supported(int is_supported);
+#else
+#define vdbg_printk(a_dbg_level, format, arg...) \
+	do { } while (0)
+#endif
+
+
 /****************************************************************************
  ****************************************************************************
  *
Signature · 1 line
1.6.2.1
#7 lore raw

PATCH 5/12 thinkpad-acpi: add missing log levels

In reply to Henrique de Moraes Holschuh

Add missing log levels in a standalone commit, to avoid dependencies in future unrelated changes, just because they wanted to use one of the missing log levels.

---
 drivers/platform/x86/thinkpad_acpi.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +11 -8
index 0a01f76..c93324a 100644
@@ -172,15 +172,18 @@ enum {
 	TPACPI_RFK_UWB_SW_ID,
 };
 
-/* Debugging */
+/* printk headers */
 #define TPACPI_LOG TPACPI_FILE ": "
-#define TPACPI_ALERT	KERN_ALERT  TPACPI_LOG
-#define TPACPI_CRIT	KERN_CRIT   TPACPI_LOG
-#define TPACPI_ERR	KERN_ERR    TPACPI_LOG
-#define TPACPI_NOTICE	KERN_NOTICE TPACPI_LOG
-#define TPACPI_INFO	KERN_INFO   TPACPI_LOG
-#define TPACPI_DEBUG	KERN_DEBUG  TPACPI_LOG
-
+#define TPACPI_EMERG	KERN_EMERG	TPACPI_LOG
+#define TPACPI_ALERT	KERN_ALERT	TPACPI_LOG
+#define TPACPI_CRIT	KERN_CRIT	TPACPI_LOG
+#define TPACPI_ERR	KERN_ERR	TPACPI_LOG
+#define TPACPI_WARN	KERN_WARNING	TPACPI_LOG
+#define TPACPI_NOTICE	KERN_NOTICE	TPACPI_LOG
+#define TPACPI_INFO	KERN_INFO	TPACPI_LOG
+#define TPACPI_DEBUG	KERN_DEBUG	TPACPI_LOG
+
+/* Debugging printk groups */
 #define TPACPI_DBG_ALL		0xffff
 #define TPACPI_DBG_INIT		0x0001
 #define TPACPI_DBG_EXIT		0x0002
Signature · 1 line
1.6.2.1
#8 lore raw

PATCH 6/12 thinkpad-acpi: add new debug helpers and warn of deprecated atts

In reply to Henrique de Moraes Holschuh

Add a debug helper that discloses the TGID of the userspace task attempting to access the driver. This is highly useful when dealing with bug reports, since often the user has no idea that some userspace application is accessing thinkpad-acpi...

Also add a helper to log warnings about sysfs attributes that are deprecated.

Use the new helpers to issue deprecation warnings for bluetooth_enable and wwan_enabled, that have been deprecated for a while, now.

---
 Documentation/laptops/thinkpad-acpi.txt |    2 +
 drivers/platform/x86/thinkpad_acpi.c    |   40 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +2 -0
index f6e6bc6..e8f52fb 100644
@@ -1484,6 +1484,8 @@ will enable all debugging output classes.  It takes a bitmask, so
 to enable more than one output class, just add their values.
 
 	Debug bitmask		Description
+	0x8000			Disclose PID of userspace programs
+				accessing some functions of the driver
 	0x0001			Initialization and probing
 	0x0002			Removal
 
drivers/platform/x86/thinkpad_acpi.c +40 -0
index c93324a..badf471 100644
@@ -54,6 +54,7 @@
 #include <linux/string.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
+#include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
 #include <linux/delay.h>
@@ -185,6 +186,7 @@ enum {
 
 /* Debugging printk groups */
 #define TPACPI_DBG_ALL		0xffff
+#define TPACPI_DBG_DISCLOSETASK	0x8000
 #define TPACPI_DBG_INIT		0x0001
 #define TPACPI_DBG_EXIT		0x0002
 
@@ -335,6 +337,21 @@ static const char *str_supported(int is_supported);
 	do { } while (0)
 #endif
 
+static void tpacpi_log_usertask(const char * const what)
+{
+	printk(TPACPI_DEBUG "%s: access by process with PID %d\n",
+		what, task_tgid_vnr(current));
+}
+
+#define tpacpi_disclose_usertask(what, format, arg...) \
+	do { \
+		if (unlikely( \
+		    (dbg_level & TPACPI_DBG_DISCLOSETASK) && \
+		    (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \
+			printk(TPACPI_DEBUG "%s: PID %d: " format, \
+				what, task_tgid_vnr(current), ## arg); \
+		} \
+	} while (0)
 
 /****************************************************************************
  ****************************************************************************
@@ -1030,6 +1047,21 @@ static int __init tpacpi_new_rfkill(const unsigned int id,
 	return 0;
 }
 
+static void printk_deprecated_attribute(const char * const what,
+					const char * const details)
+{
+	tpacpi_log_usertask("deprecated sysfs attribute");
+	printk(TPACPI_WARN "WARNING: sysfs attribute %s is deprecated and "
+		"will be removed. %s\n",
+		what, details);
+}
+
+static void printk_deprecated_rfkill_attribute(const char * const what)
+{
+	printk_deprecated_attribute(what,
+			"Please switch to generic rfkill before year 2010");
+}
+
 /*************************************************************************
  * thinkpad-acpi driver attributes
  */
@@ -3070,6 +3102,8 @@ static ssize_t bluetooth_enable_show(struct device *dev,
 {
 	int status;
 
+	printk_deprecated_rfkill_attribute("bluetooth_enable");
+
 	status = bluetooth_get_radiosw();
 	if (status < 0)
 		return status;
@@ -3085,6 +3119,8 @@ static ssize_t bluetooth_enable_store(struct device *dev,
 	unsigned long t;
 	int res;
 
+	printk_deprecated_rfkill_attribute("bluetooth_enable");
+
 	if (parse_strtoul(buf, 1, &t))
 		return -EINVAL;
 
@@ -3347,6 +3383,8 @@ static ssize_t wan_enable_show(struct device *dev,
 {
 	int status;
 
+	printk_deprecated_rfkill_attribute("wwan_enable");
+
 	status = wan_get_radiosw();
 	if (status < 0)
 		return status;
@@ -3362,6 +3400,8 @@ static ssize_t wan_enable_store(struct device *dev,
 	unsigned long t;
 	int res;
 
+	printk_deprecated_rfkill_attribute("wwan_enable");
+
 	if (parse_strtoul(buf, 1, &t))
 		return -EINVAL;
 
Signature · 1 line
1.6.2.1
#9 lore raw

PATCH 7/12 thinkpad-acpi: remove HKEY disable functionality

In reply to Henrique de Moraes Holschuh

The HKEY disable functionality basically cripples the entire event model of the ThinkPad firmware and of the thinkpad-acpi driver. Remove this functionality from the driver. HKEY must be enabled at all times while thinkpad-acpi is loaded, and disabled otherwise.

For sysfs, according to the sysfs ABI and the thinkpad-acpi sysfs rules of engagement, we will just remove the attributes. This will be done in two stages: disable their function now, after two kernel releases, remove the attributes.

For procfs, we call WARN(). If nothing triggers it, I will simply remove the enable/disable commands entirely in the future along with the sysfs attributes.

I don't expect much, if any fallout from this. There really isn't any reason to mess with hotkey_enable or with the enable/disable commands to /proc/acpi/ibm/hotkey, and this has been true for years...

---
 Documentation/laptops/thinkpad-acpi.txt |   39 ++++++++++++------------
 drivers/platform/x86/thinkpad_acpi.c    |   49 +++++++++++++++++--------------
 2 files changed, 46 insertions(+), 42 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +19 -20
index e8f52fb..de6f14c 100644
@@ -179,17 +179,14 @@ system.  Enabling the hotkey functionality of thinkpad-acpi signals the
 firmware that such a driver is present, and modifies how the ThinkPad
 firmware will behave in many situations.
 
-The driver enables the hot key feature automatically when loaded.  The
-feature can later be disabled and enabled back at runtime.  The driver
-will also restore the hot key feature to its previous state and mask
-when it is unloaded.
+The driver enables the HKEY ("hot key") event reporting automatically
+when loaded, and disables it when it is removed.
 
-When the hotkey feature is enabled and the hot key mask is set (see
-below), the driver will report HKEY events in the following format:
+The driver will report HKEY events in the following format:
 
 	ibm/hotkey HKEY 00000080 0000xxxx
 
-Some of these events refer to hot key presses, but not all.
+Some of these events refer to hot key presses, but not all of them.
 
 The driver will generate events over the input layer for hot keys and
 radio switches, and over the ACPI netlink layer for other events.  The
@@ -221,13 +218,17 @@ procfs notes:
 
 The following commands can be written to the /proc/acpi/ibm/hotkey file:
 
-	echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature
-	echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature
 	echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
 	echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
 	... any other 8-hex-digit mask ...
 	echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
 
+The following commands have been deprecated and will cause the kernel
+to log a warning:
+
+	echo enable > /proc/acpi/ibm/hotkey -- does nothing
+	echo disable > /proc/acpi/ibm/hotkey -- returns an error
+
 The procfs interface does not support NVRAM polling control.  So as to
 maintain maximum bug-to-bug compatibility, it does not report any masks,
 nor does it allow one to manipulate the hot key mask when the firmware
@@ -236,12 +237,9 @@ does not support masks at all, even if NVRAM polling is in use.
 sysfs notes:
 
 	hotkey_bios_enabled:
-		Returns the status of the hot keys feature when
-		thinkpad-acpi was loaded.  Upon module unload, the hot
-		key feature status will be restored to this value.
+		DEPRECATED, WILL BE REMOVED SOON.
 
-		0: hot keys were disabled
-		1: hot keys were enabled (unusual)
+		Returns 0.
 
 	hotkey_bios_mask:
 		Returns the hot keys mask when thinkpad-acpi was loaded.
@@ -249,13 +247,10 @@ sysfs notes:
 		to this value.
 
 	hotkey_enable:
-		Enables/disables the hot keys feature in the ACPI
-		firmware, and reports current status of the hot keys
-		feature.  Has no effect on the NVRAM hot key polling
-		functionality.
+		DEPRECATED, WILL BE REMOVED SOON.
 
-		0: disables the hot keys feature / feature disabled
-		1: enables the hot keys feature / feature enabled
+		0: returns -EPERM
+		1: does nothing
 
 	hotkey_mask:
 		bit mask to enable driver-handling (and depending on
@@ -1535,3 +1530,7 @@ Sysfs interface changelog:
 
 0x020200:	Add poll()/select() support to the following attributes:
 		hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason
+
+0x020300:	hotkey enable/disable support removed, attributes
+		hotkey_bios_enabled and hotkey_enable deprecated and
+		marked for removal.
drivers/platform/x86/thinkpad_acpi.c +27 -22

136 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#10 lore raw

remove HKEY disable functionality (triggers Ubuntu Karmic regression)

Hello,

The following patch is involved in a regression for a number of Ubuntu Karmic Koala users. There is apparently still a few bits of code in Ubuntu that trigger this issue and will ultimately need to be updated. Ubuntu also has some kind of tool that monitors for kernel warnings and reports them to users with a scary warning:

"Your system might become unstable now and might need to be restarted."

It seems I get this "kernel oops" warning at least once a day.

With the release of Karmic upon us, perhaps there a short term fix that can be made, like making the warning level less severe.

Here's a link to the Ubuntu bug report about it:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/430361

I appreciate your work on the related drivers and hope that you help us resolve this.

Thanks!

Mark

Quoted 262 lines · On Sat, 4 Apr 2009 01:25:48 -0300 Henrique de Moraes Holschuh…

The HKEY disable functionality basically cripples the entire event model of the ThinkPad firmware and of the thinkpad-acpi driver. Remove this functionality from the driver. HKEY must be enabled at all times while thinkpad-acpi is loaded, and disabled otherwise.

For sysfs, according to the sysfs ABI and the thinkpad-acpi sysfs rules of engagement, we will just remove the attributes. This will be done in two stages: disable their function now, after two kernel releases, remove the attributes.

For procfs, we call WARN(). If nothing triggers it, I will simply remove the enable/disable commands entirely in the future along with the sysfs attributes.

I don't expect much, if any fallout from this. There really isn't any reason to mess with hotkey_enable or with the enable/disable commands to /proc/acpi/ibm/hotkey, and this has been true for years...

---
 Documentation/laptops/thinkpad-acpi.txt |   39 ++++++++++++------------
 drivers/platform/x86/thinkpad_acpi.c    |   49 +++++++++++++++++--------------
 2 files changed, 46 insertions(+), 42 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +19 -20
index e8f52fb..de6f14c 100644
@@ -179,17 +179,14 @@ system.  Enabling the hotkey functionality of thinkpad-acpi signals the
 firmware that such a driver is present, and modifies how the ThinkPad
 firmware will behave in many situations.
 
-The driver enables the hot key feature automatically when loaded.  The
-feature can later be disabled and enabled back at runtime.  The driver
-will also restore the hot key feature to its previous state and mask
-when it is unloaded.
+The driver enables the HKEY ("hot key") event reporting automatically
+when loaded, and disables it when it is removed.
 
-When the hotkey feature is enabled and the hot key mask is set (see
-below), the driver will report HKEY events in the following format:
+The driver will report HKEY events in the following format:
 
 	ibm/hotkey HKEY 00000080 0000xxxx
 
-Some of these events refer to hot key presses, but not all.
+Some of these events refer to hot key presses, but not all of them.
 
 The driver will generate events over the input layer for hot keys and
 radio switches, and over the ACPI netlink layer for other events.  The
@@ -221,13 +218,17 @@ procfs notes:
 
 The following commands can be written to the /proc/acpi/ibm/hotkey file:
 
-	echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature
-	echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature
 	echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
 	echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
 	... any other 8-hex-digit mask ...
 	echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
 
+The following commands have been deprecated and will cause the kernel
+to log a warning:
+
+	echo enable > /proc/acpi/ibm/hotkey -- does nothing
+	echo disable > /proc/acpi/ibm/hotkey -- returns an error
+
 The procfs interface does not support NVRAM polling control.  So as to
 maintain maximum bug-to-bug compatibility, it does not report any masks,
 nor does it allow one to manipulate the hot key mask when the firmware
@@ -236,12 +237,9 @@ does not support masks at all, even if NVRAM polling is in use.
 sysfs notes:
 
 	hotkey_bios_enabled:
-		Returns the status of the hot keys feature when
-		thinkpad-acpi was loaded.  Upon module unload, the hot
-		key feature status will be restored to this value.
+		DEPRECATED, WILL BE REMOVED SOON.
 
-		0: hot keys were disabled
-		1: hot keys were enabled (unusual)
+		Returns 0.
 
 	hotkey_bios_mask:
 		Returns the hot keys mask when thinkpad-acpi was loaded.
@@ -249,13 +247,10 @@ sysfs notes:
 		to this value.
 
 	hotkey_enable:
-		Enables/disables the hot keys feature in the ACPI
-		firmware, and reports current status of the hot keys
-		feature.  Has no effect on the NVRAM hot key polling
-		functionality.
+		DEPRECATED, WILL BE REMOVED SOON.
 
-		0: disables the hot keys feature / feature disabled
-		1: enables the hot keys feature / feature enabled
+		0: returns -EPERM
+		1: does nothing
 
 	hotkey_mask:
 		bit mask to enable driver-handling (and depending on
@@ -1535,3 +1530,7 @@ Sysfs interface changelog:
 
 0x020200:	Add poll()/select() support to the following attributes:
 		hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason
+
+0x020300:	hotkey enable/disable support removed, attributes
+		hotkey_bios_enabled and hotkey_enable deprecated and
+		marked for removal.
drivers/platform/x86/thinkpad_acpi.c +27 -22
index badf471..ef6c963 100644
@@ -22,7 +22,7 @@
  */
 
 #define TPACPI_VERSION "0.22"
-#define TPACPI_SYSFS_VERSION 0x020200
+#define TPACPI_SYSFS_VERSION 0x020300
 
 /*
  *  Changelog:
@@ -1424,7 +1424,6 @@ static enum {	/* Reasons for waking up */
 
 static int hotkey_autosleep_ack;
 
-static int hotkey_orig_status;
 static u32 hotkey_orig_mask;
 static u32 hotkey_all_mask;
 static u32 hotkey_reserved_mask;
@@ -1571,9 +1570,9 @@ static int hotkey_status_get(int *status)
 	return 0;
 }
 
-static int hotkey_status_set(int status)
+static int hotkey_status_set(bool enable)
 {
-	if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", status))
+	if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", enable ? 1 : 0))
 		return -EIO;
 
 	return 0;
@@ -1889,6 +1888,9 @@ static ssize_t hotkey_enable_show(struct device *dev,
 {
 	int res, status;
 
+	printk_deprecated_attribute("hotkey_enable",
+			"Hotkey reporting is always enabled");
+
 	res = hotkey_status_get(&status);
 	if (res)
 		return res;
@@ -1901,14 +1903,17 @@ static ssize_t hotkey_enable_store(struct device *dev,
 			    const char *buf, size_t count)
 {
 	unsigned long t;
-	int res;
+
+	printk_deprecated_attribute("hotkey_enable",
+			"Hotkeys can be disabled through hotkey_mask");
 
 	if (parse_strtoul(buf, 1, &t))
 		return -EINVAL;
 
-	res = hotkey_status_set(t);
+	if (t == 0)
+		return -EPERM;
 
-	return (res) ? res : count;
+	return count;
 }
 
 static struct device_attribute dev_attr_hotkey_enable =
@@ -1964,7 +1969,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
 			   struct device_attribute *attr,
 			   char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_orig_status);
+	return sprintf(buf, "0\n");
 }
 
 static struct device_attribute dev_attr_hotkey_bios_enabled =
@@ -2243,7 +2248,7 @@ static void hotkey_exit(void)
 			   "restoring original hot key mask\n");
 		/* no short-circuit boolean operator below! */
 		if ((hotkey_mask_set(hotkey_orig_mask) |
-		     hotkey_status_set(hotkey_orig_status)) != 0)
+		     hotkey_status_set(false)) != 0)
 			printk(TPACPI_ERR
 			       "failed to restore hot key mask "
 			       "to BIOS defaults\n");
@@ -2438,10 +2443,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 
 	/* hotkey_source_mask *must* be zero for
 	 * the first hotkey_mask_get */
-	res = hotkey_status_get(&hotkey_orig_status);
-	if (res)
-		goto err_exit;
-
 	if (tp_features.hotkey_mask) {
 		res = hotkey_mask_get();
 		if (res)
@@ -2581,7 +2582,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 	}
 
 	dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n");
-	res = hotkey_status_set(1);
+	res = hotkey_status_set(true);
 	if (res) {
 		hotkey_exit();
 		return res;
@@ -2926,9 +2927,17 @@ static int hotkey_read(char *p)
 	return len;
 }
 
+static void hotkey_enabledisable_warn(void)
+{
+	tpacpi_log_usertask("procfs hotkey enable/disable");
+	WARN(1, TPACPI_WARN
+	     "hotkey enable/disable functionality has been "
+	     "removed from the driver. Hotkeys are always enabled.\n");
+}
+
 static int hotkey_write(char *buf)
 {
-	int res, status;
+	int res;
 	u32 mask;
 	char *cmd;
 
@@ -2938,17 +2947,16 @@ static int hotkey_write(char *buf)
 	if (mutex_lock_killable(&hotkey_mutex))
 		return -ERESTARTSYS;
 
-	status = -1;
 	mask = hotkey_mask;
 
 	res = 0;
 	while ((cmd = next_cmd(&buf))) {
 		if (strlencmp(cmd, "enable") == 0) {
-			status = 1;
+			hotkey_enabledisable_warn();
 		} else if (strlencmp(cmd, "disable") == 0) {
-			status = 0;
+			hotkey_enabledisable_warn();
+			res = -EPERM;
 		} else if (strlencmp(cmd, "reset") == 0) {
-			status = hotkey_orig_status;
 			mask = hotkey_orig_mask;
 		} else if (sscanf(cmd, "0x%x", &mask) == 1) {
 			/* mask set */
@@ -2959,9 +2967,6 @@ static int hotkey_write(char *buf)
 			goto errexit;
 		}
 	}
-	if (status != -1)
-		res = hotkey_status_set(status);
-
 	if (!res && mask != hotkey_mask)
 		res = hotkey_mask_set(mask);
 
Signature · 11 lines
http://mark.stosberg.com/




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
#11 lore raw

Re: remove HKEY disable functionality (triggers Ubuntu Karmic regression)

Quoted 2 lines · Mark Stosberg

With the release of Karmic upon us, perhaps there a short term fix that can be made, like making the warning level less severe.

If the userspace in Ubuntu is triggering the warning, and you don't have enough time to fix the issue properly (i.e. remove any code that attempts to mess with hotkey_enable), the Ubuntu kernel team will have to remove the WARN from the driver code, yes.

However, I recommend trying to fix the real bug, first. There are absolutely no known-valid reasons for any program to access the hotkey_enable attribute.

Please ask someone who can reproduce the warning to check for debug output from thinkpad-acpi, it will log to the kernel log the PID of the process trying to access the deprecated attributes. The user should check the PID and use the ps command to find out what process corresponts to that PID:

Run this in a shell window:

tail -f /var/log/kern.log | grep "thinkpad_acpi"

then run whatever application causes the warnings to happen, or if they are common, just wait for one to happen. Thinkpad-acpi will log the PID of the offending processes using a phrase like "access by process with PID...".

I would be interested in the full log output by thinkpad-acpi showing the problem. In fact, I find it surprising that your automated bug report tool doesn't attach to the bug report the last 100 lines of the kernel log or somesuch...

Anyway, now that the user knows the PID of the process attempting to access the deprecated attributes, he should immediately use the "ps PID", where PID is the numerical value of the PID logged by thinkpad-acpi, to find out the name and parameters of the process who accessed the deprecated attribute.

Maybe the user should also use "pstree -p" to help locate the parent of the process if the PID resultued in something unhelpful (e.g. bash).

That could give us a clue about exactly why that attribute is being accessed, especially if it is happening when someone is trying to test their ALSA setup...

Signature · 11 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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
#12 lore raw

PATCH 8/12 thinkpad-acpi: restrict access to some firmware LEDs

In reply to Henrique de Moraes Holschuh

Some of the ThinkPad LEDs indicate critical conditions that can cause data loss or cause hardware damage when ignored (e.g. force-ejecting a powered up bay; ignoring a failing battery, or empty battery; force- undocking with the dock buses still active, etc).

On almost all ThinkPads, LED access is write-only, and the firmware usually does fire-and-forget signaling on them, so you effectively lose whatever message the firmware was trying to convey to the user when you override the LED state, without any chance to restore it.

Restrict access to all LEDs that can convey important alarms, or that could mislead the user into incorrectly operating the hardware. This will make the Lenovo engineers less unhappy about the whole issue.

Allow users that really want it to still control all LEDs, it is the unaware user that we have to worry about.

---
 Documentation/laptops/thinkpad-acpi.txt |   11 +++++
 drivers/platform/x86/Kconfig            |   24 ++++++++++
 drivers/platform/x86/thinkpad_acpi.c    |   76 +++++++++++++++++++++++--------
 3 files changed, 91 insertions(+), 20 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +11 -0
index de6f14c..bce1d95 100644
@@ -901,6 +901,17 @@ some older ThinkPad models, it is possible to query the status of the
 LED indicators as well.  Newer ThinkPads cannot query the real status
 of the LED indicators.
 
+Because misuse of the LEDs could induce an unaware user to perform
+dangerous actions (like undocking or ejecting a bay device while the
+buses are still active), or mask an important alarm (such as a nearly
+empty battery, or a broken battery), access to most LEDs is
+restricted.
+
+Unrestricted access to all LEDs requires that thinkpad-acpi be
+compiled with the CONFIG_THINKPAD_ACPI_UNSAFE_LEDS option enabled.
+Distributions must never enable this option.  Individual users that
+are aware of the consequences are welcome to enabling it.
+
 procfs notes:
 
 The available commands are:
drivers/platform/x86/Kconfig +24 -0
index 3608081..d45c6ab 100644
@@ -226,6 +226,30 @@ config THINKPAD_ACPI_DEBUG
 
 	  If you are not sure, say N here.
 
+config THINKPAD_ACPI_UNSAFE_LEDS
+	bool "Allow control of important LEDs (unsafe)"
+	depends on THINKPAD_ACPI
+	default n
+	---help---
+	  Overriding LED state on ThinkPads can mask important
+	  firmware alerts (like critical battery condition), or misled
+	  the user into damaging the hardware (undocking or ejecting
+	  the bay while buses are still active), etc.
+
+	  LED control on the ThinkPad is write-only (with very few
+	  exceptions on very ancient models), which makes it
+	  impossible to know beforehand if important information will
+	  be lost when one changes LED state.
+
+	  Users that know what they are doing can enable this option
+	  and the driver will allow control of every LED, including
+	  the ones on the dock stations.
+
+	  Never enable this option on a distribution kernel.
+
+	  Say N here, unless you are building a kernel for your own
+	  use, and need to control the important firmware LEDs.
+
 config THINKPAD_ACPI_DOCK
 	bool "Legacy Docking Station Support"
 	depends on THINKPAD_ACPI
drivers/platform/x86/thinkpad_acpi.c +56 -20

117 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#13 lore raw

PATCH 9/12 thinkpad-acpi: enhanced debugging messages for rfkill subdrivers

In reply to Henrique de Moraes Holschuh

Enhance debugging messages for all rfkill subdrivers in thinkpad-acpi.

Also, log a warning if the deprecated sysfs attributes are in use. These attributes are going to be removed sometime in 2010.

There is an user-visible side-effect: we now coalesce attempts to enable/disable bluetooth or WWAN in the procfs interface, instead of hammering the firmware with multiple requests.

---
 Documentation/laptops/thinkpad-acpi.txt |    2 +
 drivers/platform/x86/thinkpad_acpi.c    |  117 +++++++++++++++++++++++++------
 2 files changed, 98 insertions(+), 21 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +2 -0
index bce1d95..7daca05 100644
@@ -1494,6 +1494,8 @@ to enable more than one output class, just add their values.
 				accessing some functions of the driver
 	0x0001			Initialization and probing
 	0x0002			Removal
+	0x0004			RF Transmitter control (RFKILL)
+				(bluetooth, WWAN, UWB...)
 
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
drivers/platform/x86/thinkpad_acpi.c +96 -21

343 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#14 lore raw

PATCH 10/12 thinkpad-acpi: enhanced debugging messages for the hotkey subdriver

In reply to Henrique de Moraes Holschuh

Enhance debugging messages for the hotkey subdriver.

---
 Documentation/laptops/thinkpad-acpi.txt |    1 +
 drivers/platform/x86/thinkpad_acpi.c    |   39 +++++++++++++++++++++++--------
 2 files changed, 30 insertions(+), 10 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +1 -0
index 7daca05..abbbe78 100644
@@ -1496,6 +1496,7 @@ to enable more than one output class, just add their values.
 	0x0002			Removal
 	0x0004			RF Transmitter control (RFKILL)
 				(bluetooth, WWAN, UWB...)
+	0x0008			HKEY event interface, hotkeys
 
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
drivers/platform/x86/thinkpad_acpi.c +29 -10
index 92fff8d..c8bd563 100644
@@ -190,6 +190,7 @@ enum {
 #define TPACPI_DBG_INIT		0x0001
 #define TPACPI_DBG_EXIT		0x0002
 #define TPACPI_DBG_RFKILL	0x0004
+#define TPACPI_DBG_HKEY		0x0008
 
 #define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off")
 #define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
@@ -1961,6 +1962,8 @@ static ssize_t hotkey_mask_store(struct device *dev,
 
 	mutex_unlock(&hotkey_mutex);
 
+	tpacpi_disclose_usertask("hotkey_mask", "set to 0x%08lx\n", t);
+
 	return (res) ? res : count;
 }
 
@@ -2047,6 +2050,8 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
 
 	mutex_unlock(&hotkey_mutex);
 
+	tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t);
+
 	return count;
 }
 
@@ -2079,6 +2084,8 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
 	hotkey_poll_setup(1);
 	mutex_unlock(&hotkey_mutex);
 
+	tpacpi_disclose_usertask("hotkey_poll_freq", "set to %lu\n", t);
+
 	return count;
 }
 
@@ -2248,7 +2255,7 @@ static void hotkey_exit(void)
 	kfree(hotkey_keycode_map);
 
 	if (tp_features.hotkey) {
-		dbg_printk(TPACPI_DBG_EXIT,
+		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) |
@@ -2378,7 +2385,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 	int status;
 	int hkeyv;
 
-	vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
+	vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+			"initializing hotkey subdriver\n");
 
 	BUG_ON(!tpacpi_inputdev);
 	BUG_ON(tpacpi_inputdev->open != NULL ||
@@ -2395,7 +2403,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 	/* hotkey not supported on 570 */
 	tp_features.hotkey = hkey_handle != NULL;
 
-	vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n",
+	vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+		"hotkeys are %s\n",
 		str_supported(tp_features.hotkey));
 
 	if (!tp_features.hotkey)
@@ -2427,10 +2436,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 			 * T4x, X31, and later
 			 */
 			tp_features.hotkey_mask = 1;
+			vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+				"firmware HKEY interface version: 0x%x\n",
+				hkeyv);
 		}
 	}
 
-	vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
+	vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+		"hotkey masks are %s\n",
 		str_supported(tp_features.hotkey_mask));
 
 	if (tp_features.hotkey_mask) {
@@ -2469,7 +2482,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 		hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK;
 	}
 
-	vdbg_printk(TPACPI_DBG_INIT,
+	vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
 		    "hotkey source mask 0x%08x, polling freq %d\n",
 		    hotkey_source_mask, hotkey_poll_freq);
 #endif
@@ -2523,12 +2536,12 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 	}
 
 	if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) {
-		dbg_printk(TPACPI_DBG_INIT,
+		dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
 			   "using Lenovo default hot key map\n");
 		memcpy(hotkey_keycode_map, &lenovo_keycode_map,
 			TPACPI_HOTKEY_MAP_SIZE);
 	} else {
-		dbg_printk(TPACPI_DBG_INIT,
+		dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
 			   "using IBM default hot key map\n");
 		memcpy(hotkey_keycode_map, &ibm_keycode_map,
 			TPACPI_HOTKEY_MAP_SIZE);
@@ -2585,7 +2598,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 			| (1 << TP_ACPI_HOTKEYSCAN_FNEND);
 	}
 
-	dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n");
+	dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+			"enabling firmware HKEY event interface...\n");
 	res = hotkey_status_set(true);
 	if (res) {
 		hotkey_exit();
@@ -2599,8 +2613,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
 		return res;
 	}
 
-	dbg_printk(TPACPI_DBG_INIT,
-			"legacy hot key reporting over procfs %s\n",
+	dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+			"legacy ibm/hotkey event reporting over procfs %s\n",
 			(hotkey_report_mode < 2) ?
 				"enabled" : "disabled");
 
@@ -2971,6 +2985,11 @@ static int hotkey_write(char *buf)
 			goto errexit;
 		}
 	}
+
+	if (!res)
+		tpacpi_disclose_usertask("procfs hotkey",
+			"set mask to 0x%08x\n", mask);
+
 	if (!res && mask != hotkey_mask)
 		res = hotkey_mask_set(mask);
 
Signature · 1 line
1.6.2.1
#15 lore raw

PATCH 11/12 thinkpad-acpi: enhanced debugging messages for the fan subdriver

In reply to Henrique de Moraes Holschuh

Enhance debugging messages for the fan subdriver.

---
 Documentation/laptops/thinkpad-acpi.txt |    1 +
 drivers/platform/x86/thinkpad_acpi.c    |   46 +++++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 5 deletions(-)
Documentation/laptops/thinkpad-acpi.txt +1 -0
index abbbe78..25ed43d 100644
@@ -1497,6 +1497,7 @@ to enable more than one output class, just add their values.
 	0x0004			RF Transmitter control (RFKILL)
 				(bluetooth, WWAN, UWB...)
 	0x0008			HKEY event interface, hotkeys
+	0x0010			Fan control
 
 There is also a kernel build option to enable more debugging
 information, which may be necessary to debug driver problems.
drivers/platform/x86/thinkpad_acpi.c +41 -5

143 lines not on this page · raw message

Signature · 1 line
1.6.2.1
reviewer Applied
#16 lore raw
In reply to Henrique de Moraes Holschuh

applied

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 35 lines · Henrique de Moraes Holschuh

Len,

This patchset has the changes for thinkpad-acpi that I would like to see merged for 2.6.30 (while the window is still open).

It contains the patch for
http://bugzilla.kernel.org/show_bug.cgi?id=11750, and a few enhancements.

Shortlog:

Henrique de Moraes Holschuh (12):
thinkpad-acpi: update copyright notices
thinkpad-acpi: drop ibm-acpi alias
thinkpad-acpi: documentation cleanup
thinkpad-acpi: cleanup debug helpers
thinkpad-acpi: add missing log levels
thinkpad-acpi: add new debug helpers and warn of deprecated atts
thinkpad-acpi: remove HKEY disable functionality
thinkpad-acpi: restrict access to some firmware LEDs
thinkpad-acpi: enhanced debugging messages for rfkill subdrivers
thinkpad-acpi: enhanced debugging messages for the hotkey subdriver
thinkpad-acpi: enhanced debugging messages for the fan subdriver
thinkpad-acpi: rework brightness support

Signature · 8 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