aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/asus_acpi.c
diff options
context:
space:
mode:
authorKarol Kozimor <sziwan@hell.org.pl>2006-06-30 19:07:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-30 20:37:27 -0400
commite067aaa7612c273d4bfd70d1bd8d80313a57685c (patch)
tree305bac3e2fac826b78531a25d9394bbe1c17c65e /drivers/acpi/asus_acpi.c
parentf78c589d108f4b06a012817536c9ced37f473eae (diff)
ACPI: asus_acpi: handle internal Bluetooth / support W5A
This patch creates a new file named "bluetooth" under /proc/acpi/asus/. This file controls both the internal Bluetooth adapter's presence on the USB bus and the associated LED. echo 1 > /proc/acpi/asus/bluetooth to enable, 0 to disable. Additionally, the patch add support for Asus W5A, the first model that uses this feature. Patch originally by Fernando A. P. Gomes. Signed-off-by: Karol Kozimor <sziwan@hell.org.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/asus_acpi.c')
-rw-r--r--drivers/acpi/asus_acpi.c51
1 files changed, 47 insertions, 4 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index c613a4340db5..f39aef109736 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -45,6 +45,7 @@
45#define PROC_MLED "mled" 45#define PROC_MLED "mled"
46#define PROC_WLED "wled" 46#define PROC_WLED "wled"
47#define PROC_TLED "tled" 47#define PROC_TLED "tled"
48#define PROC_BT "bluetooth"
48#define PROC_LEDD "ledd" 49#define PROC_LEDD "ledd"
49#define PROC_INFO "info" 50#define PROC_INFO "info"
50#define PROC_LCD "lcd" 51#define PROC_LCD "lcd"
@@ -65,9 +66,10 @@
65/* 66/*
66 * Flags for hotk status 67 * Flags for hotk status
67 */ 68 */
68#define MLED_ON 0x01 //is MLED ON ? 69#define MLED_ON 0x01 //mail LED
69#define WLED_ON 0x02 70#define WLED_ON 0x02 //wireless LED
70#define TLED_ON 0x04 71#define TLED_ON 0x04 //touchpad LED
72#define BT_ON 0x08 //internal Bluetooth
71 73
72MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); 74MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
73MODULE_DESCRIPTION(ACPI_HOTK_NAME); 75MODULE_DESCRIPTION(ACPI_HOTK_NAME);
@@ -91,7 +93,9 @@ struct model_data {
91 char *mt_tled; //method to handle tled_____________R 93 char *mt_tled; //method to handle tled_____________R
92 char *tled_status; //node to handle tled reading_______A 94 char *tled_status; //node to handle tled reading_______A
93 char *mt_ledd; //method to handle LED display______R 95 char *mt_ledd; //method to handle LED display______R
94 char *mt_lcd_switch; //method to turn LCD ON/OFF_________A 96 char *mt_bt_switch; //method to switch Bluetooth on/off_R
97 char *bt_status; //no model currently supports this__?
98 char *mt_lcd_switch; //method to turn LCD on/off_________A
95 char *lcd_status; //node to read LCD panel state______A 99 char *lcd_status; //node to read LCD panel state______A
96 char *brightness_up; //method to set brightness up_______A 100 char *brightness_up; //method to set brightness up_______A
97 char *brightness_down; //guess what ?______________________A 101 char *brightness_down; //guess what ?______________________A
@@ -133,6 +137,7 @@ struct asus_hotk {
133 S1x, //S1300A, but also L1400B and M2400A (L84F) 137 S1x, //S1300A, but also L1400B and M2400A (L84F)
134 S2x, //S200 (J1 reported), Victor MP-XP7210 138 S2x, //S200 (J1 reported), Victor MP-XP7210
135 W1N, //W1000N 139 W1N, //W1000N
140 W5A, //W5A
136 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N 141 xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
137 //(Centrino) 142 //(Centrino)
138 END_MODEL 143 END_MODEL
@@ -360,6 +365,16 @@ static struct model_data model_conf[END_MODEL] = {
360 .display_get = "\\ADVG"}, 365 .display_get = "\\ADVG"},
361 366
362 { 367 {
368 .name = "W5A",
369 .mt_bt_switch = "BLED",
370 .mt_wled = "WLED",
371 .mt_lcd_switch = xxN_PREFIX "_Q10",
372 .brightness_set = "SPLV",
373 .brightness_get = "GPLV",
374 .display_set = "SDSP",
375 .display_get = "\\ADVG"},
376
377 {
363 .name = "xxN", 378 .name = "xxN",
364 .mt_mled = "MLED", 379 .mt_mled = "MLED",
365/* WLED present, but not controlled by ACPI */ 380/* WLED present, but not controlled by ACPI */
@@ -626,6 +641,25 @@ proc_write_wled(struct file *file, const char __user * buffer,
626} 641}
627 642
628/* 643/*
644 * Proc handlers for Bluetooth
645 */
646static int
647proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
648 void *data)
649{
650 return sprintf(page, "%d\n", read_led(hotk->methods->bt_status, BT_ON));
651}
652
653static int
654proc_write_bluetooth(struct file *file, const char __user * buffer,
655 unsigned long count, void *data)
656{
657 /* Note: mt_bt_switch controls both internal Bluetooth adapter's
658 presence and its LED */
659 return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
660}
661
662/*
629 * Proc handlers for TLED 663 * Proc handlers for TLED
630 */ 664 */
631static int 665static int
@@ -936,6 +970,11 @@ static int asus_hotk_add_fs(struct acpi_device *device)
936 mode, device); 970 mode, device);
937 } 971 }
938 972
973 if (hotk->methods->mt_bt_switch) {
974 asus_proc_add(PROC_BT, &proc_write_bluetooth,
975 &proc_read_bluetooth, mode, device);
976 }
977
939 /* 978 /*
940 * We need both read node and write method as LCD switch is also accessible 979 * We need both read node and write method as LCD switch is also accessible
941 * from keyboard 980 * from keyboard
@@ -971,6 +1010,8 @@ static int asus_hotk_remove_fs(struct acpi_device *device)
971 remove_proc_entry(PROC_TLED, acpi_device_dir(device)); 1010 remove_proc_entry(PROC_TLED, acpi_device_dir(device));
972 if (hotk->methods->mt_ledd) 1011 if (hotk->methods->mt_ledd)
973 remove_proc_entry(PROC_LEDD, acpi_device_dir(device)); 1012 remove_proc_entry(PROC_LEDD, acpi_device_dir(device));
1013 if (hotk->methods->mt_bt_switch)
1014 remove_proc_entry(PROC_BT, acpi_device_dir(device));
974 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) 1015 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
975 remove_proc_entry(PROC_LCD, acpi_device_dir(device)); 1016 remove_proc_entry(PROC_LCD, acpi_device_dir(device));
976 if ((hotk->methods->brightness_up 1017 if ((hotk->methods->brightness_up
@@ -1124,6 +1165,8 @@ static int asus_hotk_get_info(void)
1124 hotk->model = A4G; 1165 hotk->model = A4G;
1125 else if (strncmp(model->string.pointer, "W1N", 3) == 0) 1166 else if (strncmp(model->string.pointer, "W1N", 3) == 0)
1126 hotk->model = W1N; 1167 hotk->model = W1N;
1168 else if (strncmp(model->string.pointer, "W5A", 3) == 0)
1169 hotk->model = W5A;
1127 1170
1128 if (hotk->model == END_MODEL) { 1171 if (hotk->model == END_MODEL) {
1129 printk("unsupported, trying default values, supply the " 1172 printk("unsupported, trying default values, supply the "