Skip to content

Commit 08d869a

Browse files
committed
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: ACPI: introduce kernel parameter acpi_sleep=sci_force_enable ACPI: WMI: Survive BIOS with duplicate GUIDs dell-wmi - fix condition to abort driver loading wmi: check find_guid() return value to prevent oops dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value ACPI: hp-wmi, msi-wmi: clarify that wmi_install_notify_handler() returns an acpi_status dell-wmi: sys_init_module: 'dell_wmi'->init suspiciously returned 21, it should ACPI video: correct error-handling code ACPI video: no warning message if "acpi_backlight=vendor" is used ACPI: fix ACPI=n allmodconfig build thinkpad-acpi: improve Kconfig help text thinkpad-acpi: update volume subdriver documentation thinkpad-acpi: make volume subdriver optional thinkpad-acpi: don't fail to load the entire module due to ALSA problems thinkpad-acpi: don't take the first ALSA slot by default
2 parents 05a6254 + 1201b2a commit 08d869a

File tree

13 files changed

+207
-44
lines changed

13 files changed

+207
-44
lines changed

Documentation/kernel-parameters.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ and is between 256 and 4096 characters. It is defined in the file
240240

241241
acpi_sleep= [HW,ACPI] Sleep options
242242
Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
243-
old_ordering, s4_nonvs }
243+
old_ordering, s4_nonvs, sci_force_enable }
244244
See Documentation/power/video.txt for information on
245245
s3_bios and s3_mode.
246246
s3_beep is for debugging; it makes the PC's speaker beep
@@ -253,6 +253,9 @@ and is between 256 and 4096 characters. It is defined in the file
253253
of _PTS is used by default).
254254
s4_nonvs prevents the kernel from saving/restoring the
255255
ACPI NVS memory during hibernation.
256+
sci_force_enable causes the kernel to set SCI_EN directly
257+
on resume from S1/S3 (which is against the ACPI spec,
258+
but some broken systems don't work without it).
256259

257260
acpi_use_timer_override [HW,ACPI]
258261
Use timer override. For some broken Nvidia NF5 boards

Documentation/laptops/thinkpad-acpi.txt

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,8 @@ WARNING:
10921092
its level up and down at every change.
10931093

10941094

1095-
Volume control
1096-
--------------
1095+
Volume control (Console Audio control)
1096+
--------------------------------------
10971097

10981098
procfs: /proc/acpi/ibm/volume
10991099
ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC"
@@ -1110,9 +1110,53 @@ the desktop environment to just provide on-screen-display feedback.
11101110
Software volume control should be done only in the main AC97/HDA
11111111
mixer.
11121112

1113-
This feature allows volume control on ThinkPad models with a digital
1114-
volume knob (when available, not all models have it), as well as
1115-
mute/unmute control. The available commands are:
1113+
1114+
About the ThinkPad Console Audio control:
1115+
1116+
ThinkPads have a built-in amplifier and muting circuit that drives the
1117+
console headphone and speakers. This circuit is after the main AC97
1118+
or HDA mixer in the audio path, and under exclusive control of the
1119+
firmware.
1120+
1121+
ThinkPads have three special hotkeys to interact with the console
1122+
audio control: volume up, volume down and mute.
1123+
1124+
It is worth noting that the normal way the mute function works (on
1125+
ThinkPads that do not have a "mute LED") is:
1126+
1127+
1. Press mute to mute. It will *always* mute, you can press it as
1128+
many times as you want, and the sound will remain mute.
1129+
1130+
2. Press either volume key to unmute the ThinkPad (it will _not_
1131+
change the volume, it will just unmute).
1132+
1133+
This is a very superior design when compared to the cheap software-only
1134+
mute-toggle solution found on normal consumer laptops: you can be
1135+
absolutely sure the ThinkPad will not make noise if you press the mute
1136+
button, no matter the previous state.
1137+
1138+
The IBM ThinkPads, and the earlier Lenovo ThinkPads have variable-gain
1139+
amplifiers driving the speakers and headphone output, and the firmware
1140+
also handles volume control for the headphone and speakers on these
1141+
ThinkPads without any help from the operating system (this volume
1142+
control stage exists after the main AC97 or HDA mixer in the audio
1143+
path).
1144+
1145+
The newer Lenovo models only have firmware mute control, and depend on
1146+
the main HDA mixer to do volume control (which is done by the operating
1147+
system). In this case, the volume keys are filtered out for unmute
1148+
key press (there are some firmware bugs in this area) and delivered as
1149+
normal key presses to the operating system (thinkpad-acpi is not
1150+
involved).
1151+
1152+
1153+
The ThinkPad-ACPI volume control:
1154+
1155+
The preferred way to interact with the Console Audio control is the
1156+
ALSA interface.
1157+
1158+
The legacy procfs interface allows one to read the current state,
1159+
and if volume control is enabled, accepts the following commands:
11161160

11171161
echo up >/proc/acpi/ibm/volume
11181162
echo down >/proc/acpi/ibm/volume
@@ -1121,12 +1165,10 @@ mute/unmute control. The available commands are:
11211165
echo 'level <level>' >/proc/acpi/ibm/volume
11221166

11231167
The <level> number range is 0 to 14 although not all of them may be
1124-
distinct. The unmute the volume after the mute command, use either the
1168+
distinct. To unmute the volume after the mute command, use either the
11251169
up or down command (the level command will not unmute the volume), or
11261170
the unmute command.
11271171

1128-
The current volume level and mute state is shown in the file.
1129-
11301172
You can use the volume_capabilities parameter to tell the driver
11311173
whether your thinkpad has volume control or mute-only control:
11321174
volume_capabilities=1 for mixers with mute and volume control,

arch/x86/kernel/acpi/sleep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ static int __init acpi_sleep_setup(char *str)
162162
#endif
163163
if (strncmp(str, "old_ordering", 12) == 0)
164164
acpi_old_suspend_ordering();
165+
if (strncmp(str, "sci_force_enable", 16) == 0)
166+
acpi_set_sci_en_on_resume();
165167
str = strchr(str, ',');
166168
if (str != NULL)
167169
str += strspn(str, ", \t");

drivers/acpi/sleep.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ static int acpi_sleep_prepare(u32 acpi_state)
8080

8181
#ifdef CONFIG_ACPI_SLEEP
8282
static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83+
/*
84+
* According to the ACPI specification the BIOS should make sure that ACPI is
85+
* enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
86+
* some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
87+
* on such systems during resume. Unfortunately that doesn't help in
88+
* particularly pathological cases in which SCI_EN has to be set directly on
89+
* resume, although the specification states very clearly that this flag is
90+
* owned by the hardware. The set_sci_en_on_resume variable will be set in such
91+
* cases.
92+
*/
93+
static bool set_sci_en_on_resume;
94+
95+
void __init acpi_set_sci_en_on_resume(void)
96+
{
97+
set_sci_en_on_resume = true;
98+
}
99+
83100
/*
84101
* ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
85102
* user to request that behavior by using the 'acpi_old_suspend_ordering'
@@ -170,18 +187,6 @@ static void acpi_pm_end(void)
170187
#endif /* CONFIG_ACPI_SLEEP */
171188

172189
#ifdef CONFIG_SUSPEND
173-
/*
174-
* According to the ACPI specification the BIOS should make sure that ACPI is
175-
* enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
176-
* some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
177-
* on such systems during resume. Unfortunately that doesn't help in
178-
* particularly pathological cases in which SCI_EN has to be set directly on
179-
* resume, although the specification states very clearly that this flag is
180-
* owned by the hardware. The set_sci_en_on_resume variable will be set in such
181-
* cases.
182-
*/
183-
static bool set_sci_en_on_resume;
184-
185190
extern void do_suspend_lowlevel(void);
186191

187192
static u32 acpi_suspend_states[] = {

drivers/acpi/video.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
999999
sprintf(name, "acpi_video%d", count++);
10001000
device->backlight = backlight_device_register(name,
10011001
NULL, device, &acpi_backlight_ops);
1002-
device->backlight->props.max_brightness = device->brightness->count-3;
10031002
kfree(name);
1003+
if (IS_ERR(device->backlight))
1004+
return;
1005+
device->backlight->props.max_brightness = device->brightness->count-3;
10041006

10051007
result = sysfs_create_link(&device->backlight->dev.kobj,
10061008
&device->dev->dev.kobj, "device");
@@ -1979,6 +1981,10 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
19791981
unsigned long long level_current, level_next;
19801982
int result = -EINVAL;
19811983

1984+
/* no warning message if acpi_backlight=vendor is used */
1985+
if (!acpi_video_backlight_support())
1986+
return 0;
1987+
19821988
if (!device->brightness)
19831989
goto out;
19841990

drivers/char/ipmi/ipmi_si_intf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,7 +3204,7 @@ static __devinit int init_ipmi_si(void)
32043204
#ifdef CONFIG_ACPI
32053205
spmi_find_bmc();
32063206
#endif
3207-
#ifdef CONFIG_PNP
3207+
#ifdef CONFIG_ACPI
32083208
pnp_register_driver(&ipmi_pnp_driver);
32093209
#endif
32103210

@@ -3330,7 +3330,7 @@ static __exit void cleanup_ipmi_si(void)
33303330
#ifdef CONFIG_PCI
33313331
pci_unregister_driver(&ipmi_pci_driver);
33323332
#endif
3333-
#ifdef CONFIG_PNP
3333+
#ifdef CONFIG_ACPI
33343334
pnp_unregister_driver(&ipmi_pnp_driver);
33353335
#endif
33363336

drivers/platform/x86/Kconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,36 @@ config THINKPAD_ACPI
231231

232232
This driver was formerly known as ibm-acpi.
233233

234+
Extra functionality will be available if the rfkill (CONFIG_RFKILL)
235+
and/or ALSA (CONFIG_SND) subsystems are available in the kernel.
236+
Note that if you want ThinkPad-ACPI to be built-in instead of
237+
modular, ALSA and rfkill will also have to be built-in.
238+
234239
If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
235240

241+
config THINKPAD_ACPI_ALSA_SUPPORT
242+
bool "Console audio control ALSA interface"
243+
depends on THINKPAD_ACPI
244+
depends on SND
245+
depends on SND = y || THINKPAD_ACPI = SND
246+
default y
247+
---help---
248+
Enables monitoring of the built-in console audio output control
249+
(headphone and speakers), which is operated by the mute and (in
250+
some ThinkPad models) volume hotkeys.
251+
252+
If this option is enabled, ThinkPad-ACPI will export an ALSA card
253+
with a single read-only mixer control, which should be used for
254+
on-screen-display feedback purposes by the Desktop Environment.
255+
256+
Optionally, the driver will also allow software control (the
257+
ALSA mixer will be made read-write). Please refer to the driver
258+
documentation for details.
259+
260+
All IBM models have both volume and mute control. Newer Lenovo
261+
models only have mute control (the volume hotkeys are just normal
262+
keys and volume control is done through the main HDA mixer).
263+
236264
config THINKPAD_ACPI_DEBUGFACILITIES
237265
bool "Maintainer debug facilities"
238266
depends on THINKPAD_ACPI

drivers/platform/x86/dell-wmi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,13 @@ static void dell_wmi_notify(u32 value, void *context)
202202
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
203203
static struct key_entry *key;
204204
union acpi_object *obj;
205+
acpi_status status;
205206

206-
wmi_get_event_data(value, &response);
207+
status = wmi_get_event_data(value, &response);
208+
if (status != AE_OK) {
209+
printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
210+
return;
211+
}
207212

208213
obj = (union acpi_object *)response.pointer;
209214

@@ -325,7 +330,7 @@ static int __init dell_wmi_init(void)
325330
int err;
326331
acpi_status status;
327332

328-
if (wmi_has_guid(DELL_EVENT_GUID)) {
333+
if (!wmi_has_guid(DELL_EVENT_GUID)) {
329334
printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n");
330335
return -ENODEV;
331336
}

drivers/platform/x86/hp-wmi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,13 @@ static void hp_wmi_notify(u32 value, void *context)
338338
static struct key_entry *key;
339339
union acpi_object *obj;
340340
int eventcode;
341+
acpi_status status;
341342

342-
wmi_get_event_data(value, &response);
343+
status = wmi_get_event_data(value, &response);
344+
if (status != AE_OK) {
345+
printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
346+
return;
347+
}
343348

344349
obj = (union acpi_object *)response.pointer;
345350

@@ -581,7 +586,7 @@ static int __init hp_wmi_init(void)
581586
if (wmi_has_guid(HPWMI_EVENT_GUID)) {
582587
err = wmi_install_notify_handler(HPWMI_EVENT_GUID,
583588
hp_wmi_notify, NULL);
584-
if (!err)
589+
if (ACPI_SUCCESS(err))
585590
hp_wmi_input_setup();
586591
}
587592

drivers/platform/x86/msi-wmi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context)
149149
static struct key_entry *key;
150150
union acpi_object *obj;
151151
ktime_t cur;
152+
acpi_status status;
152153

153-
wmi_get_event_data(value, &response);
154+
status = wmi_get_event_data(value, &response);
155+
if (status != AE_OK) {
156+
printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status);
157+
return;
158+
}
154159

155160
obj = (union acpi_object *)response.pointer;
156161

@@ -236,7 +241,7 @@ static int __init msi_wmi_init(void)
236241
}
237242
err = wmi_install_notify_handler(MSIWMI_EVENT_GUID,
238243
msi_wmi_notify, NULL);
239-
if (err)
244+
if (ACPI_FAILURE(err))
240245
return -EINVAL;
241246

242247
err = msi_wmi_input_setup();

0 commit comments

Comments
 (0)