* [PATCH 1/8] thinkpad-acpi: fix default brightness_mode for R50e/R51
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 2/8] thinkpad-acpi: preserve rfkill state across suspend/resume Henrique de Moraes Holschuh
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh, stable
According to a report, the R50e wants EC-based brightness control,
even if it uses an Intel GPU. The current driver default was reported
to not work at all.
This bug can be worked around by the "brightness_mode=3" module
parameter.
Change the default of the R50e and R51 2xxx models (which use the same
EC firmware, 1V) to TPACPI_BRGHT_Q_EC, but keep TPACPI_BRGHT_Q_ASK set
for now, as I'd like to get more reports.
This fixes a regression caused by commit
59fe4fe34d7afdf63208124f313be9056feaa2f4,
"thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM"
Kernel 2.6.31 also needs this fix.
Reported-by: Ferenc Wagner <wferi@niif.hu>
Tested-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
---
drivers/platform/x86/thinkpad_acpi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index a848c7e..9c6d5a9 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6123,8 +6123,8 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {
/* Models with Intel Extreme Graphics 2 */
TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC),
- TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
- TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
+ TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
+ TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
/* Models with Intel GMA900 */
TPACPI_Q_IBM('7', '0', TPACPI_BRGHT_Q_NOEC), /* T43, R52 */
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 2/8] thinkpad-acpi: preserve rfkill state across suspend/resume
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 1/8] thinkpad-acpi: fix default brightness_mode for R50e/R51 Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 3/8] thinkpad-acpi: fix some version quirks Henrique de Moraes Holschuh
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh, stable
Since the rfkill rework in 2.6.31, the driver is always resuming with
the radios disabled.
Change thinkpad-acpi to ask the firmware to resume with the radios in
the last state. This fixes the Bluetooth and WWAN rfkill switches.
Note that it means we respect the firmware's oddities. Should the
user toggle the hardware rfkill switch on and off, it might cause the
radios to resume enabled.
UWB is an unknown quantity since it has nowhere the same level of
firmware support (no control over state storage in NVRAM, for
example), and might need further fixing. Testers welcome.
This change fixes a regression from 2.6.30.
Reported-by: Jerone Young <jerone.young@canonical.com>
Reported-by: Ian Molton <ian.molton@collabora.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: Ian Molton <ian.molton@collabora.co.uk>
Cc: stable@kernel.org
---
drivers/platform/x86/thinkpad_acpi.c | 32 +++++---------------------------
1 files changed, 5 insertions(+), 27 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9c6d5a9..1ee734c 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3866,15 +3866,6 @@ enum {
#define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw"
-static void bluetooth_suspend(pm_message_t state)
-{
- /* Try to make sure radio will resume powered off */
- if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
- TP_ACPI_BLTH_PWR_OFF_ON_RESUME))
- vdbg_printk(TPACPI_DBG_RFKILL,
- "bluetooth power down on resume request failed\n");
-}
-
static int bluetooth_get_status(void)
{
int status;
@@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state)
#endif
/* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
+ status = TP_ACPI_BLUETOOTH_RESUMECTRL;
if (state == TPACPI_RFK_RADIO_ON)
- status = TP_ACPI_BLUETOOTH_RADIOSSW;
- else
- status = 0;
+ status |= TP_ACPI_BLUETOOTH_RADIOSSW;
if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
return -EIO;
@@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = {
.read = bluetooth_read,
.write = bluetooth_write,
.exit = bluetooth_exit,
- .suspend = bluetooth_suspend,
.shutdown = bluetooth_shutdown,
};
@@ -4068,15 +4057,6 @@ enum {
#define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw"
-static void wan_suspend(pm_message_t state)
-{
- /* Try to make sure radio will resume powered off */
- if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
- TP_ACPI_WGSV_PWR_OFF_ON_RESUME))
- vdbg_printk(TPACPI_DBG_RFKILL,
- "WWAN power down on resume request failed\n");
-}
-
static int wan_get_status(void)
{
int status;
@@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state)
}
#endif
- /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */
+ /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */
+ status = TP_ACPI_WANCARD_RESUMECTRL;
if (state == TPACPI_RFK_RADIO_ON)
- status = TP_ACPI_WANCARD_RADIOSSW;
- else
- status = 0;
+ status |= TP_ACPI_WANCARD_RADIOSSW;
if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
return -EIO;
@@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = {
.read = wan_read,
.write = wan_write,
.exit = wan_exit,
- .suspend = wan_suspend,
.shutdown = wan_shutdown,
};
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 3/8] thinkpad-acpi: fix some version quirks
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 1/8] thinkpad-acpi: fix default brightness_mode for R50e/R51 Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 2/8] thinkpad-acpi: preserve rfkill state across suspend/resume Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 4/8] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh
Update some of the BIOS/EC version quirks.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/platform/x86/thinkpad_acpi.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 1ee734c..6160813 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -1779,7 +1779,7 @@ static const struct tpacpi_quirk tpacpi_bios_version_qtable[] __initconst = {
TPV_QL1('7', '9', 'E', '3', '5', '0'), /* T60/p */
TPV_QL1('7', 'C', 'D', '2', '2', '2'), /* R60, R60i */
- TPV_QL0('7', 'E', 'D', '0'), /* R60e, R60i */
+ TPV_QL1('7', 'E', 'D', '0', '1', '5'), /* R60e, R60i */
/* BIOS FW BIOS VERS EC FW EC VERS */
TPV_QI2('1', 'W', '9', '0', '1', 'V', '2', '8'), /* R50e (1) */
@@ -1795,8 +1795,8 @@ static const struct tpacpi_quirk tpacpi_bios_version_qtable[] __initconst = {
TPV_QI1('7', '4', '6', '4', '2', '7'), /* X41 (0) */
TPV_QI1('7', '5', '6', '0', '2', '0'), /* X41t (0) */
- TPV_QL0('7', 'B', 'D', '7'), /* X60/s */
- TPV_QL0('7', 'J', '3', '0'), /* X60t */
+ TPV_QL1('7', 'B', 'D', '7', '4', '0'), /* X60/s */
+ TPV_QL1('7', 'J', '3', '0', '1', '3'), /* X60t */
/* (0) - older versions lack DMI EC fw string and functionality */
/* (1) - older versions known to lack functionality */
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 4/8] thinkpad-acpi: issue backlight class events
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
` (2 preceding siblings ...)
2009-12-03 11:41 ` [PATCH 3/8] thinkpad-acpi: fix some version quirks Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:49 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 5/8] thinkpad-acpi: silence bogus complain during rmmod Henrique de Moraes Holschuh
` (3 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown
Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh,
Matthew Garrett, Richard Purdie
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>
Cc: Richard Purdie <rpurdie@linux.intel.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 aafcaa6..f5056c7 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 6160813..4406136 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:
@@ -6073,6 +6073,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,
@@ -6227,6 +6233,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;
}
@@ -6303,6 +6315,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;
}
@@ -7702,6 +7717,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.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 4/8] thinkpad-acpi: issue backlight class events
2009-12-03 11:41 ` [PATCH 4/8] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh
@ 2009-12-03 11:49 ` Henrique de Moraes Holschuh
0 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:49 UTC (permalink / raw)
To: Richard Purdie; +Cc: linux-acpi, ibm-acpi-devel, Matthew Garrett, Len Brown
On Thu, 03 Dec 2009, Henrique de Moraes Holschuh wrote:
> 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>
> Cc: Richard Purdie <rpurdie@linux.intel.com>
Richard,
This patch is also in the backlight tree (and linux-next), but since it
didn't get merged for 2.6.32, it is causing some clashes and problems with
my changes for 2.6.33.
Can you drop it from the backlight tree, please? We will merge it through
the acpi tree, along with the rest of the thinkpad-acpi changes.
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] 13+ messages in thread
* [PATCH 5/8] thinkpad-acpi: silence bogus complain during rmmod
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
` (3 preceding siblings ...)
2009-12-03 11:41 ` [PATCH 4/8] thinkpad-acpi: issue backlight class events Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 6/8] thinkpad-acpi: adopt input device Henrique de Moraes Holschuh
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh
Fix this bogus warning during module shutdown, when
backlight event reporting is enabled:
"thinkpad_acpi: required events 0x00018000 not enabled!"
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/platform/x86/thinkpad_acpi.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 4406136..86418cd 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2189,7 +2189,8 @@ static int hotkey_mask_set(u32 mask)
fwmask, hotkey_acpi_mask);
}
- hotkey_mask_warn_incomplete_mask();
+ if (tpacpi_lifecycle != TPACPI_LIFE_EXITING)
+ hotkey_mask_warn_incomplete_mask();
return rc;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 6/8] thinkpad-acpi: adopt input device
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
` (4 preceding siblings ...)
2009-12-03 11:41 ` [PATCH 5/8] thinkpad-acpi: silence bogus complain during rmmod Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 7/8] thinkpad-acpi: expose module parameters Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm Henrique de Moraes Holschuh
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh
Properly init the parent field of the input device. Thanks to Alan
Jenkins, who noted this problem in a different driver.
Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/platform/x86/thinkpad_acpi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 86418cd..dd8bd07 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8375,6 +8375,7 @@ static int __init thinkpad_acpi_module_init(void)
PCI_VENDOR_ID_IBM;
tpacpi_inputdev->id.product = TPACPI_HKEY_INPUT_PRODUCT;
tpacpi_inputdev->id.version = TPACPI_HKEY_INPUT_VERSION;
+ tpacpi_inputdev->dev.parent = &tpacpi_pdev->dev;
}
for (i = 0; i < ARRAY_SIZE(ibms_init); i++) {
ret = ibm_init(&ibms_init[i]);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 7/8] thinkpad-acpi: expose module parameters
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
` (5 preceding siblings ...)
2009-12-03 11:41 ` [PATCH 6/8] thinkpad-acpi: adopt input device Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-03 11:41 ` [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm Henrique de Moraes Holschuh
7 siblings, 0 replies; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh
Export the normal (non-command) module paramenters as mode 0444, so
that they will show up in sysfs.
These parameters must not be changed at runtime as a rule, with very
few exceptions.
Reported-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/platform/x86/thinkpad_acpi.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index dd8bd07..4b96a96 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8116,32 +8116,32 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
return -EINVAL;
}
-module_param(experimental, int, 0);
+module_param(experimental, int, 0444);
MODULE_PARM_DESC(experimental,
"Enables experimental features when non-zero");
module_param_named(debug, dbg_level, uint, 0);
MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
-module_param(force_load, bool, 0);
+module_param(force_load, bool, 0444);
MODULE_PARM_DESC(force_load,
"Attempts to load the driver even on a "
"mis-identified ThinkPad when true");
-module_param_named(fan_control, fan_control_allowed, bool, 0);
+module_param_named(fan_control, fan_control_allowed, bool, 0444);
MODULE_PARM_DESC(fan_control,
"Enables setting fan parameters features when true");
-module_param_named(brightness_mode, brightness_mode, uint, 0);
+module_param_named(brightness_mode, brightness_mode, uint, 0444);
MODULE_PARM_DESC(brightness_mode,
"Selects brightness control strategy: "
"0=auto, 1=EC, 2=UCMS, 3=EC+NVRAM");
-module_param(brightness_enable, uint, 0);
+module_param(brightness_enable, uint, 0444);
MODULE_PARM_DESC(brightness_enable,
"Enables backlight control when 1, disables when 0");
-module_param(hotkey_report_mode, uint, 0);
+module_param(hotkey_report_mode, uint, 0444);
MODULE_PARM_DESC(hotkey_report_mode,
"used for backwards compatibility with userspace, "
"see documentation");
@@ -8164,25 +8164,25 @@ TPACPI_PARAM(volume);
TPACPI_PARAM(fan);
#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
-module_param(dbg_wlswemul, uint, 0);
+module_param(dbg_wlswemul, uint, 0444);
MODULE_PARM_DESC(dbg_wlswemul, "Enables WLSW emulation");
module_param_named(wlsw_state, tpacpi_wlsw_emulstate, bool, 0);
MODULE_PARM_DESC(wlsw_state,
"Initial state of the emulated WLSW switch");
-module_param(dbg_bluetoothemul, uint, 0);
+module_param(dbg_bluetoothemul, uint, 0444);
MODULE_PARM_DESC(dbg_bluetoothemul, "Enables bluetooth switch emulation");
module_param_named(bluetooth_state, tpacpi_bluetooth_emulstate, bool, 0);
MODULE_PARM_DESC(bluetooth_state,
"Initial state of the emulated bluetooth switch");
-module_param(dbg_wwanemul, uint, 0);
+module_param(dbg_wwanemul, uint, 0444);
MODULE_PARM_DESC(dbg_wwanemul, "Enables WWAN switch emulation");
module_param_named(wwan_state, tpacpi_wwan_emulstate, bool, 0);
MODULE_PARM_DESC(wwan_state,
"Initial state of the emulated WWAN switch");
-module_param(dbg_uwbemul, uint, 0);
+module_param(dbg_uwbemul, uint, 0444);
MODULE_PARM_DESC(dbg_uwbemul, "Enables UWB switch emulation");
module_param_named(uwb_state, tpacpi_uwb_emulstate, bool, 0);
MODULE_PARM_DESC(uwb_state,
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm
2009-12-03 11:41 [GIT PATCH] thinkpad-acpi first set of changes for 2.6.33 Henrique de Moraes Holschuh
` (6 preceding siblings ...)
2009-12-03 11:41 ` [PATCH 7/8] thinkpad-acpi: expose module parameters Henrique de Moraes Holschuh
@ 2009-12-03 11:41 ` Henrique de Moraes Holschuh
2009-12-06 21:01 ` Pavel Machek
7 siblings, 1 reply; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-03 11:41 UTC (permalink / raw)
To: Len Brown
Cc: linux-acpi, ibm-acpi-devel, Henrique de Moraes Holschuh,
Pavel Machek
Log temperatures on any of the EC thermal alarms. It could be
useful to help tracking down what is happening...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Pavel Machek <pavel@ucw.cz>
---
drivers/platform/x86/thinkpad_acpi.c | 60 +++++++++++++++++++++++++++------
1 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 4b96a96..7800232 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3546,49 +3546,57 @@ static bool hotkey_notify_usrevent(const u32 hkey,
}
}
+static void thermal_dump_all_sensors(void);
+
static bool hotkey_notify_thermal(const u32 hkey,
bool *send_acpi_ev,
bool *ignore_acpi_ev)
{
+ int known = true;
+
/* 0x6000-0x6FFF: thermal alarms */
*send_acpi_ev = true;
*ignore_acpi_ev = false;
switch (hkey) {
+ 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
+ * Lenovo ATM information */
+ return true;
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;
+ break;
case TP_HKEY_EV_ALARM_BAT_XHOT:
printk(TPACPI_ALERT
"THERMAL EMERGENCY: battery is extremely hot!\n");
/* recommended action: immediate sleep/hibernate */
- return true;
+ break;
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;
+ break;
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 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
- * Lenovo ATM information */
- return true;
+ break;
default:
printk(TPACPI_ALERT
"THERMAL ALERT: unknown thermal alarm received\n");
- return false;
+ known = false;
}
+
+ thermal_dump_all_sensors();
+
+ return known;
}
static void hotkey_notify(struct ibm_struct *ibm, u32 event)
@@ -5553,6 +5561,36 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
return n;
}
+#if TPACPI_MAX_THERMAL_SENSORS > 16
+#error Please adjust thermal_dump_all_sensors()
+#endif
+
+static void thermal_dump_all_sensors(void)
+{
+ int n, i;
+ struct ibm_thermal_sensors_struct t;
+
+ n = thermal_get_sensors(&t);
+ if (n <= 0)
+ return;
+
+ for (i = 0; i < n; i++)
+ t.temp[i] = t.temp[i] / 1000;
+
+ /* Fill missing sensors with N/A marker */
+ for (i = n; i < TPACPI_MAX_THERMAL_SENSORS; i++)
+ t.temp[i] = -128;
+
+ /* FIXME: it is ugly */
+ printk(TPACPI_NOTICE
+ "temperatures (Celsius): "
+ "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
+ t.temp[0], t.temp[1], t.temp[2], t.temp[3], t.temp[4],
+ t.temp[5], t.temp[6], t.temp[7], t.temp[8], t.temp[9],
+ t.temp[10], t.temp[11], t.temp[12], t.temp[13], t.temp[14],
+ t.temp[15]);
+}
+
/* sysfs temp##_input -------------------------------------------------- */
static ssize_t thermal_temp_input_show(struct device *dev,
--
1.6.5.2
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm
2009-12-03 11:41 ` [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm Henrique de Moraes Holschuh
@ 2009-12-06 21:01 ` Pavel Machek
2009-12-07 12:06 ` Henrique de Moraes Holschuh
0 siblings, 1 reply; 13+ messages in thread
From: Pavel Machek @ 2009-12-06 21:01 UTC (permalink / raw)
To: Henrique de Moraes Holschuh; +Cc: Len Brown, linux-acpi, ibm-acpi-devel
Hi!
> Log temperatures on any of the EC thermal alarms. It could be
> useful to help tracking down what is happening...
Thanks, I applied it locally.
> static bool hotkey_notify_thermal(const u32 hkey,
> bool *send_acpi_ev,
> bool *ignore_acpi_ev)
> {
> + int known = true;
> +
Oops?
> + for (i = 0; i < n; i++)
> + t.temp[i] = t.temp[i] / 1000;
> +
> + /* Fill missing sensors with N/A marker */
> + for (i = n; i < TPACPI_MAX_THERMAL_SENSORS; i++)
> + t.temp[i] = -128;
-273 would be better "N/A" marker :-).
> + /* FIXME: it is ugly */
> + printk(TPACPI_NOTICE
> + "temperatures (Celsius): "
> + "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
But this indeed is ugly. Why not sometihng like
printk(TPACPI_NOTICE "temperatures (Celsius): ");
for (i = 0; i < n; i++)
printk(KERN_CONT "%d ", t.temp[i]);
printk(KERN_CONT "\n");
...you'd get rid of #ifdef above, ugly -128 markers, and nasty %d series...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm
2009-12-06 21:01 ` Pavel Machek
@ 2009-12-07 12:06 ` Henrique de Moraes Holschuh
2009-12-07 21:10 ` Pavel Machek
0 siblings, 1 reply; 13+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-12-07 12:06 UTC (permalink / raw)
To: Pavel Machek; +Cc: Len Brown, linux-acpi, ibm-acpi-devel
On Sun, 06 Dec 2009, Pavel Machek wrote:
> > Log temperatures on any of the EC thermal alarms. It could be
> > useful to help tracking down what is happening...
>
> Thanks, I applied it locally.
>
> > static bool hotkey_notify_thermal(const u32 hkey,
> > bool *send_acpi_ev,
> > bool *ignore_acpi_ev)
> > {
> > + int known = true;
> > +
>
> Oops?
Yeah, will fix and resend the entire stack, as it has grown a few more
patches during the weekend :)
> > + for (i = 0; i < n; i++)
> > + t.temp[i] = t.temp[i] / 1000;
> > +
> > + /* Fill missing sensors with N/A marker */
> > + for (i = n; i < TPACPI_MAX_THERMAL_SENSORS; i++)
> > + t.temp[i] = -128;
>
> -273 would be better "N/A" marker :-).
No can do. The firmware uses -128 (it is a signed 8-bit value), so there is
an internal driver ABI *and* an userspace ABI since 2.6.13 or thereabouts
that forces N/A sensors in thinkpad-acpi to return -128...
In sysfs, I return an error code instead, which is arguably a much better
way of doing that.
But I do agree -273 would be a cooler value to return for N/A :-)
> > + /* FIXME: it is ugly */
> > + printk(TPACPI_NOTICE
> > + "temperatures (Celsius): "
> > + "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
>
> But this indeed is ugly. Why not sometihng like
>
> printk(TPACPI_NOTICE "temperatures (Celsius): ");
> for (i = 0; i < n; i++)
> printk(KERN_CONT "%d ", t.temp[i]);
> printk(KERN_CONT "\n");
>
> ...you'd get rid of #ifdef above, ugly -128 markers, and nasty %d series...
Can't get rid of -128, unless I print N/A instead, which your for() loop
would allow.
However, while using KERN_CONT is nicer, that printk is important and needs
to get out to the logs with no reordering, no long delay, and preferably, no
other printks interleaved with it. Please excuse my lack of knowledge on
this, but wouldn't KERN_CONT make it far more likely that a problem happens
to the printk that will make it hard to read/useless (if reordering
happens)?
--
"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] 13+ messages in thread* Re: [PATCH 8/8] thinkpad-acpi: log temperatures on termal alarm
2009-12-07 12:06 ` Henrique de Moraes Holschuh
@ 2009-12-07 21:10 ` Pavel Machek
0 siblings, 0 replies; 13+ messages in thread
From: Pavel Machek @ 2009-12-07 21:10 UTC (permalink / raw)
To: Henrique de Moraes Holschuh; +Cc: Len Brown, linux-acpi, ibm-acpi-devel
Hi!
> > > + for (i = 0; i < n; i++)
> > > + t.temp[i] = t.temp[i] / 1000;
> > > +
> > > + /* Fill missing sensors with N/A marker */
> > > + for (i = n; i < TPACPI_MAX_THERMAL_SENSORS; i++)
> > > + t.temp[i] = -128;
> >
> > -273 would be better "N/A" marker :-).
>
> No can do. The firmware uses -128 (it is a signed 8-bit value), so there is
> an internal driver ABI *and* an userspace ABI since 2.6.13 or thereabouts
> that forces N/A sensors in thinkpad-acpi to return -128...
>
> In sysfs, I return an error code instead, which is arguably a much better
> way of doing that.
>
> But I do agree -273 would be a cooler value to return for N/A :-)
:-).
> > > + /* FIXME: it is ugly */
> > > + printk(TPACPI_NOTICE
> > > + "temperatures (Celsius): "
> > > + "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
> >
> > But this indeed is ugly. Why not sometihng like
> >
> > printk(TPACPI_NOTICE "temperatures (Celsius): ");
> > for (i = 0; i < n; i++)
> > printk(KERN_CONT "%d ", t.temp[i]);
> > printk(KERN_CONT "\n");
> >
> > ...you'd get rid of #ifdef above, ugly -128 markers, and nasty %d series...
>
> Can't get rid of -128, unless I print N/A instead, which your for() loop
> would allow.
>
> However, while using KERN_CONT is nicer, that printk is important and needs
> to get out to the logs with no reordering, no long delay, and preferably, no
> other printks interleaved with it. Please excuse my lack of knowledge on
> this, but wouldn't KERN_CONT make it far more likely that a problem happens
> to the printk that will make it hard to read/useless (if reordering
> happens)?
It should be ok. Reordering is not possible, KERN_CONT will not
introduce delays. Interleaved messages are possible on SMP, but very
very unlikely. I don't really expect problems.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread