aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorKarol Kozimor <sziwan@hell.org.pl>2006-06-30 19:04:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-30 20:34:06 -0400
commit42cb891295795ed9b3048c8922d93f7a71f63968 (patch)
tree2312b48ed28963e52fdd5fddca9891d8e78d98d5 /drivers/acpi
parented2cb07b2bb04f14793cdeecb0b384374e979525 (diff)
ACPI: asus_acpi: LED display support
This patch adds handling for front LED displays found on W1N and the like. Additionally, W1N is given its own model_data instance. Patch originally by Éric Burghard. Signed-off-by: Karol Kozimor <sziwan@hell.org.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/asus_acpi.c69
1 files changed, 63 insertions, 6 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index fdc3995b8911..b95b52e2932c 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -26,6 +26,7 @@
26 * Pontus Fuchs - Helper functions, cleanup 26 * Pontus Fuchs - Helper functions, cleanup
27 * Johann Wiesner - Small compile fixes 27 * Johann Wiesner - Small compile fixes
28 * John Belmonte - ACPI code for Toshiba laptop was a good starting point. 28 * John Belmonte - ACPI code for Toshiba laptop was a good starting point.
29 * Éric Burghard - LED display support for W1N
29 * 30 *
30 */ 31 */
31 32
@@ -44,6 +45,7 @@
44#define PROC_MLED "mled" 45#define PROC_MLED "mled"
45#define PROC_WLED "wled" 46#define PROC_WLED "wled"
46#define PROC_TLED "tled" 47#define PROC_TLED "tled"
48#define PROC_LEDD "ledd"
47#define PROC_INFO "info" 49#define PROC_INFO "info"
48#define PROC_LCD "lcd" 50#define PROC_LCD "lcd"
49#define PROC_BRN "brn" 51#define PROC_BRN "brn"
@@ -88,6 +90,7 @@ struct model_data {
88 char *wled_status; //node to handle wled reading_______A 90 char *wled_status; //node to handle wled reading_______A
89 char *mt_tled; //method to handle tled_____________R 91 char *mt_tled; //method to handle tled_____________R
90 char *tled_status; //node to handle tled reading_______A 92 char *tled_status; //node to handle tled reading_______A
93 char *mt_ledd; //method to handle LED display______R
91 char *mt_lcd_switch; //method to turn LCD ON/OFF_________A 94 char *mt_lcd_switch; //method to turn LCD ON/OFF_________A
92 char *lcd_status; //node to read LCD panel state______A 95 char *lcd_status; //node to read LCD panel state______A
93 char *brightness_up; //method to set brightness up_______A 96 char *brightness_up; //method to set brightness up_______A
@@ -107,6 +110,7 @@ struct asus_hotk {
107 struct acpi_device *device; //the device we are in 110 struct acpi_device *device; //the device we are in
108 acpi_handle handle; //the handle of the hotk device 111 acpi_handle handle; //the handle of the hotk device
109 char status; //status of the hotk, for LEDs, ... 112 char status; //status of the hotk, for LEDs, ...
113 u32 ledd_status; //status of the LED display
110 struct model_data *methods; //methods available on the laptop 114 struct model_data *methods; //methods available on the laptop
111 u8 brightness; //brightness level 115 u8 brightness; //brightness level
112 enum { 116 enum {
@@ -127,7 +131,8 @@ struct asus_hotk {
127 P30, //Samsung P30 131 P30, //Samsung P30
128 S1x, //S1300A, but also L1400B and M2400A (L84F) 132 S1x, //S1300A, but also L1400B and M2400A (L84F)
129 S2x, //S200 (J1 reported), Victor MP-XP7210 133 S2x, //S200 (J1 reported), Victor MP-XP7210
130 xxN, //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON 134 W1N, //W1000N
135 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
131 //(Centrino) 136 //(Centrino)
132 END_MODEL 137 END_MODEL
133 } model; //Models currently supported 138 } model; //Models currently supported
@@ -332,6 +337,18 @@ static struct model_data model_conf[END_MODEL] = {
332 .brightness_down = S2x_PREFIX "_Q0A"}, 337 .brightness_down = S2x_PREFIX "_Q0A"},
333 338
334 { 339 {
340 .name = "W1N",
341 .mt_mled = "MLED",
342 .mt_wled = "WLED",
343 .mt_ledd = "SLCM",
344 .mt_lcd_switch = xxN_PREFIX "_Q10",
345 .lcd_status = "\\BKLT",
346 .brightness_set = "SPLV",
347 .brightness_get = "GPLV",
348 .display_set = "SDSP",
349 .display_get = "\\ADVG"},
350
351 {
335 .name = "xxN", 352 .name = "xxN",
336 .mt_mled = "MLED", 353 .mt_mled = "MLED",
337/* WLED present, but not controlled by ACPI */ 354/* WLED present, but not controlled by ACPI */
@@ -550,6 +567,36 @@ proc_write_mled(struct file *file, const char __user * buffer,
550} 567}
551 568
552/* 569/*
570 * Proc handlers for LED display
571 */
572static int
573proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
574 void *data)
575{
576 return sprintf(page, "0x%08x\n", hotk->ledd_status);
577}
578
579static int
580proc_write_ledd(struct file *file, const char __user * buffer,
581 unsigned long count, void *data)
582{
583 int value;
584
585 count = parse_arg(buffer, count, &value);
586 if (count > 0) {
587 if (!write_acpi_int
588 (hotk->handle, hotk->methods->mt_ledd, value, NULL))
589 printk(KERN_WARNING
590 "Asus ACPI: LED display write failed\n");
591 else
592 hotk->ledd_status = (u32) value;
593 } else if (count < 0)
594 printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
595
596 return count;
597}
598
599/*
553 * Proc handlers for WLED 600 * Proc handlers for WLED
554 */ 601 */
555static int 602static int
@@ -863,6 +910,11 @@ static int asus_hotk_add_fs(struct acpi_device *device)
863 mode, device); 910 mode, device);
864 } 911 }
865 912
913 if (hotk->methods->mt_ledd) {
914 asus_proc_add(PROC_LEDD, &proc_write_ledd, &proc_read_ledd,
915 mode, device);
916 }
917
866 if (hotk->methods->mt_mled) { 918 if (hotk->methods->mt_mled) {
867 asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, 919 asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled,
868 mode, device); 920 mode, device);
@@ -906,6 +958,8 @@ static int asus_hotk_remove_fs(struct acpi_device *device)
906 remove_proc_entry(PROC_MLED, acpi_device_dir(device)); 958 remove_proc_entry(PROC_MLED, acpi_device_dir(device));
907 if (hotk->methods->mt_tled) 959 if (hotk->methods->mt_tled)
908 remove_proc_entry(PROC_TLED, acpi_device_dir(device)); 960 remove_proc_entry(PROC_TLED, acpi_device_dir(device));
961 if (hotk->methods->mt_ledd)
962 remove_proc_entry(PROC_LEDD, acpi_device_dir(device));
909 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) 963 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
910 remove_proc_entry(PROC_LCD, acpi_device_dir(device)); 964 remove_proc_entry(PROC_LCD, acpi_device_dir(device));
911 if ((hotk->methods->brightness_up 965 if ((hotk->methods->brightness_up
@@ -1033,8 +1087,7 @@ static int asus_hotk_get_info(void)
1033 strncmp(model->string.pointer, "M5N", 3) == 0 || 1087 strncmp(model->string.pointer, "M5N", 3) == 0 ||
1034 strncmp(model->string.pointer, "M6N", 3) == 0 || 1088 strncmp(model->string.pointer, "M6N", 3) == 0 ||
1035 strncmp(model->string.pointer, "S1N", 3) == 0 || 1089 strncmp(model->string.pointer, "S1N", 3) == 0 ||
1036 strncmp(model->string.pointer, "S5N", 3) == 0 || 1090 strncmp(model->string.pointer, "S5N", 3) == 0)
1037 strncmp(model->string.pointer, "W1N", 3) == 0)
1038 hotk->model = xxN; 1091 hotk->model = xxN;
1039 else if (strncmp(model->string.pointer, "M1", 2) == 0) 1092 else if (strncmp(model->string.pointer, "M1", 2) == 0)
1040 hotk->model = M1A; 1093 hotk->model = M1A;
@@ -1055,6 +1108,8 @@ static int asus_hotk_get_info(void)
1055 hotk->model = S2x; 1108 hotk->model = S2x;
1056 else if (strncmp(model->string.pointer, "L5", 2) == 0) 1109 else if (strncmp(model->string.pointer, "L5", 2) == 0)
1057 hotk->model = L5x; 1110 hotk->model = L5x;
1111 else if (strncmp(model->string.pointer, "W1N", 3) == 0)
1112 hotk->model = W1N;
1058 1113
1059 if (hotk->model == END_MODEL) { 1114 if (hotk->model == END_MODEL) {
1060 printk("unsupported, trying default values, supply the " 1115 printk("unsupported, trying default values, supply the "
@@ -1078,10 +1133,9 @@ static int asus_hotk_get_info(void)
1078 strncmp(model->string.pointer, "M5N", 3) == 0) 1133 strncmp(model->string.pointer, "M5N", 3) == 0)
1079 hotk->methods->mt_mled = NULL; 1134 hotk->methods->mt_mled = NULL;
1080 /* S5N and M5N have no MLED */ 1135 /* S5N and M5N have no MLED */
1081 else if (strncmp(model->string.pointer, "M2N", 3) == 0 || 1136 else if (strncmp(model->string.pointer, "M2N", 3) == 0)
1082 strncmp(model->string.pointer, "W1N", 3) == 0)
1083 hotk->methods->mt_wled = "WLED"; 1137 hotk->methods->mt_wled = "WLED";
1084 /* M2N and W1N have a usable WLED */ 1138 /* M2N has a usable WLED */
1085 else if (asus_info) { 1139 else if (asus_info) {
1086 if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) 1140 if (strncmp(asus_info->oem_table_id, "L1", 2) == 0)
1087 hotk->methods->mled_status = NULL; 1141 hotk->methods->mled_status = NULL;
@@ -1175,6 +1229,9 @@ static int asus_hotk_add(struct acpi_device *device)
1175 1229
1176 asus_hotk_found = 1; 1230 asus_hotk_found = 1;
1177 1231
1232 /* LED display is off by default */
1233 hotk->ledd_status = 0xFFF;
1234
1178 end: 1235 end:
1179 if (result) { 1236 if (result) {
1180 kfree(hotk); 1237 kfree(hotk);