aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/button.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/button.c')
-rw-r--r--drivers/acpi/button.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index c8441627f68e..9195deba9d94 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -41,17 +41,13 @@
41 41
42#define ACPI_BUTTON_SUBCLASS_POWER "power" 42#define ACPI_BUTTON_SUBCLASS_POWER "power"
43#define ACPI_BUTTON_HID_POWER "PNP0C0C" 43#define ACPI_BUTTON_HID_POWER "PNP0C0C"
44#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)" 44#define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button"
45#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
46#define ACPI_BUTTON_TYPE_POWER 0x01 45#define ACPI_BUTTON_TYPE_POWER 0x01
47#define ACPI_BUTTON_TYPE_POWERF 0x02
48 46
49#define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" 47#define ACPI_BUTTON_SUBCLASS_SLEEP "sleep"
50#define ACPI_BUTTON_HID_SLEEP "PNP0C0E" 48#define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
51#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)" 49#define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button"
52#define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)"
53#define ACPI_BUTTON_TYPE_SLEEP 0x03 50#define ACPI_BUTTON_TYPE_SLEEP 0x03
54#define ACPI_BUTTON_TYPE_SLEEPF 0x04
55 51
56#define ACPI_BUTTON_SUBCLASS_LID "lid" 52#define ACPI_BUTTON_SUBCLASS_LID "lid"
57#define ACPI_BUTTON_HID_LID "PNP0C0D" 53#define ACPI_BUTTON_HID_LID "PNP0C0D"
@@ -166,14 +162,12 @@ static int acpi_button_add_fs(struct acpi_device *device)
166 162
167 switch (button->type) { 163 switch (button->type) {
168 case ACPI_BUTTON_TYPE_POWER: 164 case ACPI_BUTTON_TYPE_POWER:
169 case ACPI_BUTTON_TYPE_POWERF:
170 if (!acpi_power_dir) 165 if (!acpi_power_dir)
171 acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, 166 acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
172 acpi_button_dir); 167 acpi_button_dir);
173 entry = acpi_power_dir; 168 entry = acpi_power_dir;
174 break; 169 break;
175 case ACPI_BUTTON_TYPE_SLEEP: 170 case ACPI_BUTTON_TYPE_SLEEP:
176 case ACPI_BUTTON_TYPE_SLEEPF:
177 if (!acpi_sleep_dir) 171 if (!acpi_sleep_dir)
178 acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, 172 acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
179 acpi_button_dir); 173 acpi_button_dir);
@@ -315,30 +309,18 @@ static int acpi_button_add(struct acpi_device *device)
315 name = acpi_device_name(device); 309 name = acpi_device_name(device);
316 class = acpi_device_class(device); 310 class = acpi_device_class(device);
317 311
318 /* 312 if (!strcmp(hid, ACPI_BUTTON_HID_POWER) ||
319 * Determine the button type (via hid), as fixed-feature buttons 313 !strcmp(hid, ACPI_BUTTON_HID_POWERF)) {
320 * need to be handled a bit differently than generic-space.
321 */
322 if (!strcmp(hid, ACPI_BUTTON_HID_POWER)) {
323 button->type = ACPI_BUTTON_TYPE_POWER; 314 button->type = ACPI_BUTTON_TYPE_POWER;
324 strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER); 315 strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER);
325 sprintf(class, "%s/%s", 316 sprintf(class, "%s/%s",
326 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); 317 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
327 } else if (!strcmp(hid, ACPI_BUTTON_HID_POWERF)) { 318 } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) ||
328 button->type = ACPI_BUTTON_TYPE_POWERF; 319 !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) {
329 strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWERF);
330 sprintf(class, "%s/%s",
331 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
332 } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP)) {
333 button->type = ACPI_BUTTON_TYPE_SLEEP; 320 button->type = ACPI_BUTTON_TYPE_SLEEP;
334 strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP); 321 strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP);
335 sprintf(class, "%s/%s", 322 sprintf(class, "%s/%s",
336 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); 323 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
337 } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) {
338 button->type = ACPI_BUTTON_TYPE_SLEEPF;
339 strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEPF);
340 sprintf(class, "%s/%s",
341 ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
342 } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) { 324 } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) {
343 button->type = ACPI_BUTTON_TYPE_LID; 325 button->type = ACPI_BUTTON_TYPE_LID;
344 strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID); 326 strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID);
@@ -364,13 +346,11 @@ static int acpi_button_add(struct acpi_device *device)
364 346
365 switch (button->type) { 347 switch (button->type) {
366 case ACPI_BUTTON_TYPE_POWER: 348 case ACPI_BUTTON_TYPE_POWER:
367 case ACPI_BUTTON_TYPE_POWERF:
368 input->evbit[0] = BIT_MASK(EV_KEY); 349 input->evbit[0] = BIT_MASK(EV_KEY);
369 set_bit(KEY_POWER, input->keybit); 350 set_bit(KEY_POWER, input->keybit);
370 break; 351 break;
371 352
372 case ACPI_BUTTON_TYPE_SLEEP: 353 case ACPI_BUTTON_TYPE_SLEEP:
373 case ACPI_BUTTON_TYPE_SLEEPF:
374 input->evbit[0] = BIT_MASK(EV_KEY); 354 input->evbit[0] = BIT_MASK(EV_KEY);
375 set_bit(KEY_SLEEP, input->keybit); 355 set_bit(KEY_SLEEP, input->keybit);
376 break; 356 break;