Loading drivers/acpi/asus_acpi.c +110 −111 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ #define ASUS_ACPI_VERSION "0.30" #define ASUS_ACPI_VERSION "0.30" #define PROC_ASUS "asus" //the directory #define PROC_ASUS "asus" /* The directory */ #define PROC_MLED "mled" #define PROC_MLED "mled" #define PROC_WLED "wled" #define PROC_WLED "wled" #define PROC_TLED "tled" #define PROC_TLED "tled" Loading @@ -66,10 +66,10 @@ /* /* * Flags for hotk status * Flags for hotk status */ */ #define MLED_ON 0x01 //mail LED #define MLED_ON 0x01 /* Mail LED */ #define WLED_ON 0x02 //wireless LED #define WLED_ON 0x02 /* Wireless LED */ #define TLED_ON 0x04 //touchpad LED #define TLED_ON 0x04 /* Touchpad LED */ #define BT_ON 0x08 //internal Bluetooth #define BT_ON 0x08 /* Internal Bluetooth */ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); MODULE_DESCRIPTION(ACPI_HOTK_NAME); MODULE_DESCRIPTION(ACPI_HOTK_NAME); Loading @@ -85,25 +85,25 @@ MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus"); /* For each model, all features implemented, /* For each model, all features implemented, * those marked with R are relative to HOTK, A for absolute */ * those marked with R are relative to HOTK, A for absolute */ struct model_data { struct model_data { char *name; //name of the laptop________________A char *name; /* name of the laptop________________A */ char *mt_mled; //method to handle mled_____________R char *mt_mled; /* method to handle mled_____________R */ char *mled_status; //node to handle mled reading_______A char *mled_status; /* node to handle mled reading_______A */ char *mt_wled; //method to handle wled_____________R char *mt_wled; /* method to handle wled_____________R */ char *wled_status; //node to handle wled reading_______A char *wled_status; /* node to handle wled reading_______A */ char *mt_tled; //method to handle tled_____________R char *mt_tled; /* method to handle tled_____________R */ char *tled_status; //node to handle tled reading_______A char *tled_status; /* node to handle tled reading_______A */ char *mt_ledd; //method to handle LED display______R char *mt_ledd; /* method to handle LED display______R */ char *mt_bt_switch; //method to switch Bluetooth on/off_R char *mt_bt_switch; /* method to switch Bluetooth on/off_R */ char *bt_status; //no model currently supports this__? char *bt_status; /* no model currently supports this__? */ char *mt_lcd_switch; //method to turn LCD on/off_________A char *mt_lcd_switch; /* method to turn LCD on/off_________A */ char *lcd_status; //node to read LCD panel state______A char *lcd_status; /* node to read LCD panel state______A */ char *brightness_up; //method to set brightness up_______A char *brightness_up; /* method to set brightness up_______A */ char *brightness_down; //guess what ?______________________A char *brightness_down; /* method to set brightness down ____A */ char *brightness_set; //method to set absolute brightness_R char *brightness_set; /* method to set absolute brightness_R */ char *brightness_get; //method to get absolute brightness_R char *brightness_get; /* method to get absolute brightness_R */ char *brightness_status; //node to get brightness____________A char *brightness_status;/* node to get brightness____________A */ char *display_set; //method to set video output________R char *display_set; /* method to set video output________R */ char *display_get; //method to get video output________R char *display_get; /* method to get video output________R */ }; }; /* /* Loading @@ -111,41 +111,41 @@ struct model_data { * about the hotk device * about the hotk device */ */ struct asus_hotk { struct asus_hotk { struct acpi_device *device; //the device we are in struct acpi_device *device; /* the device we are in */ acpi_handle handle; //the handle of the hotk device acpi_handle handle; /* the handle of the hotk device */ char status; //status of the hotk, for LEDs, ... char status; /* status of the hotk, for LEDs */ u32 ledd_status; //status of the LED display u32 ledd_status; /* status of the LED display */ struct model_data *methods; //methods available on the laptop struct model_data *methods; /* methods available on the laptop */ u8 brightness; //brightness level u8 brightness; /* brightness level */ enum { enum { A1x = 0, //A1340D, A1300F A1x = 0, /* A1340D, A1300F */ A2x, //A2500H A2x, /* A2500H */ A4G, //A4700G A4G, /* A4700G */ D1x, //D1 D1x, /* D1 */ L2D, //L2000D L2D, /* L2000D */ L3C, //L3800C L3C, /* L3800C */ L3D, //L3400D L3D, /* L3400D */ L3H, //L3H, L2000E, L5D L3H, /* L3H, L2000E, L5D */ L4R, //L4500R L4R, /* L4500R */ L5x, //L5800C L5x, /* L5800C */ L8L, //L8400L L8L, /* L8400L */ M1A, //M1300A M1A, /* M1300A */ M2E, //M2400E, L4400L M2E, /* M2400E, L4400L */ M6N, //M6800N, W3400N M6N, /* M6800N, W3400N */ M6R, //M6700R, A3000G M6R, /* M6700R, A3000G */ P30, //Samsung P30 P30, /* Samsung P30 */ S1x, //S1300A, but also L1400B and M2400A (L84F) S1x, /* S1300A, but also L1400B and M2400A (L84F) */ S2x, //S200 (J1 reported), Victor MP-XP7210 S2x, /* S200 (J1 reported), Victor MP-XP7210 */ W1N, //W1000N W1N, /* W1000N */ W5A, //W5A W5A, /* W5A */ W3V, //W3030V W3V, /* W3030V */ xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N xxN, /* M2400N, M3700N, M5200N, M6800N, A4S, //Z81sp S1300N, S5200N*/ //(Centrino) A4S, /* Z81sp */ F3Sa, F3Sa, /* (Centrino) */ END_MODEL END_MODEL } model; //Models currently supported } model; /* Models currently supported */ u16 event_count[128]; //count for each event TODO make this better u16 event_count[128]; /* Count for each event TODO make this better */ }; }; /* Here we go */ /* Here we go */ Loading Loading @@ -469,8 +469,8 @@ static struct acpi_driver asus_hotk_driver = { static int write_acpi_int(acpi_handle handle, const char *method, int val, static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output) struct acpi_buffer *output) { { struct acpi_object_list params; //list of input parameters (an int here) struct acpi_object_list params; /* list of input parameters (int) */ union acpi_object in_obj; //the only param we use union acpi_object in_obj; /* the only param we use */ acpi_status status; acpi_status status; params.count = 1; params.count = 1; Loading Loading @@ -507,10 +507,10 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, { { int len = 0; int len = 0; int temp; int temp; char buf[16]; //enough for all info char buf[16]; /* enough for all info */ /* /* * We use the easy way, we don't care of off and count, so we don't set eof * We use the easy way, we don't care of off and count, * to 1 * so we don't set eof to 1 */ */ len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); Loading Loading @@ -796,7 +796,8 @@ static int set_lcd_state(int value) acpi_evaluate_object(NULL, acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch, hotk->methods->mt_lcd_switch, NULL, NULL); NULL, NULL); } else { /* L3H and the like have to be handled differently */ } else { /* L3H and the like must be handled differently */ if (!write_acpi_int if (!write_acpi_int (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL)) NULL)) Loading Loading @@ -940,8 +941,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, /* /* * Experimental support for display switching. As of now: 1 should activate * Experimental support for display switching. As of now: 1 should activate * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination * (bitwise) of these will suffice. I never actually tested 3 displays hooked up * (bitwise) of these will suffice. I never actually tested 3 displays hooked * simultaneously, so be warned. See the acpi4asus README for more info. * up simultaneously, so be warned. See the acpi4asus README for more info. */ */ static int static int proc_write_disp(struct file *file, const char __user *buffer, proc_write_disp(struct file *file, const char __user *buffer, Loading Loading @@ -1041,8 +1042,8 @@ static int asus_hotk_add_fs(struct acpi_device *device) } } /* /* * We need both read node and write method as LCD switch is also accessible * We need both read node and write method as LCD switch is also * from keyboard * accessible from the keyboard */ */ if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, Loading Loading @@ -1096,11 +1097,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) if (!hotk) if (!hotk) return; return; if ((event & ~((u32) BR_UP)) < 16) { if ((event & ~((u32) BR_UP)) < 16) hotk->brightness = (event & ~((u32) BR_UP)); hotk->brightness = (event & ~((u32) BR_UP)); } else if ((event & ~((u32) BR_DOWN)) < 16) { else if ((event & ~((u32) BR_DOWN)) < 16) hotk->brightness = (event & ~((u32) BR_DOWN)); hotk->brightness = (event & ~((u32) BR_DOWN)); } acpi_bus_generate_proc_event(hotk->device, event, acpi_bus_generate_proc_event(hotk->device, event, hotk->event_count[event % 128]++); hotk->event_count[event % 128]++); Loading Loading @@ -1367,9 +1367,8 @@ static int asus_hotk_add(struct acpi_device *device) hotk->ledd_status = 0xFFF; hotk->ledd_status = 0xFFF; end: end: if (result) { if (result) kfree(hotk); kfree(hotk); } return result; return result; } } Loading Loading
drivers/acpi/asus_acpi.c +110 −111 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ #define ASUS_ACPI_VERSION "0.30" #define ASUS_ACPI_VERSION "0.30" #define PROC_ASUS "asus" //the directory #define PROC_ASUS "asus" /* The directory */ #define PROC_MLED "mled" #define PROC_MLED "mled" #define PROC_WLED "wled" #define PROC_WLED "wled" #define PROC_TLED "tled" #define PROC_TLED "tled" Loading @@ -66,10 +66,10 @@ /* /* * Flags for hotk status * Flags for hotk status */ */ #define MLED_ON 0x01 //mail LED #define MLED_ON 0x01 /* Mail LED */ #define WLED_ON 0x02 //wireless LED #define WLED_ON 0x02 /* Wireless LED */ #define TLED_ON 0x04 //touchpad LED #define TLED_ON 0x04 /* Touchpad LED */ #define BT_ON 0x08 //internal Bluetooth #define BT_ON 0x08 /* Internal Bluetooth */ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); MODULE_AUTHOR("Julien Lerouge, Karol Kozimor"); MODULE_DESCRIPTION(ACPI_HOTK_NAME); MODULE_DESCRIPTION(ACPI_HOTK_NAME); Loading @@ -85,25 +85,25 @@ MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus"); /* For each model, all features implemented, /* For each model, all features implemented, * those marked with R are relative to HOTK, A for absolute */ * those marked with R are relative to HOTK, A for absolute */ struct model_data { struct model_data { char *name; //name of the laptop________________A char *name; /* name of the laptop________________A */ char *mt_mled; //method to handle mled_____________R char *mt_mled; /* method to handle mled_____________R */ char *mled_status; //node to handle mled reading_______A char *mled_status; /* node to handle mled reading_______A */ char *mt_wled; //method to handle wled_____________R char *mt_wled; /* method to handle wled_____________R */ char *wled_status; //node to handle wled reading_______A char *wled_status; /* node to handle wled reading_______A */ char *mt_tled; //method to handle tled_____________R char *mt_tled; /* method to handle tled_____________R */ char *tled_status; //node to handle tled reading_______A char *tled_status; /* node to handle tled reading_______A */ char *mt_ledd; //method to handle LED display______R char *mt_ledd; /* method to handle LED display______R */ char *mt_bt_switch; //method to switch Bluetooth on/off_R char *mt_bt_switch; /* method to switch Bluetooth on/off_R */ char *bt_status; //no model currently supports this__? char *bt_status; /* no model currently supports this__? */ char *mt_lcd_switch; //method to turn LCD on/off_________A char *mt_lcd_switch; /* method to turn LCD on/off_________A */ char *lcd_status; //node to read LCD panel state______A char *lcd_status; /* node to read LCD panel state______A */ char *brightness_up; //method to set brightness up_______A char *brightness_up; /* method to set brightness up_______A */ char *brightness_down; //guess what ?______________________A char *brightness_down; /* method to set brightness down ____A */ char *brightness_set; //method to set absolute brightness_R char *brightness_set; /* method to set absolute brightness_R */ char *brightness_get; //method to get absolute brightness_R char *brightness_get; /* method to get absolute brightness_R */ char *brightness_status; //node to get brightness____________A char *brightness_status;/* node to get brightness____________A */ char *display_set; //method to set video output________R char *display_set; /* method to set video output________R */ char *display_get; //method to get video output________R char *display_get; /* method to get video output________R */ }; }; /* /* Loading @@ -111,41 +111,41 @@ struct model_data { * about the hotk device * about the hotk device */ */ struct asus_hotk { struct asus_hotk { struct acpi_device *device; //the device we are in struct acpi_device *device; /* the device we are in */ acpi_handle handle; //the handle of the hotk device acpi_handle handle; /* the handle of the hotk device */ char status; //status of the hotk, for LEDs, ... char status; /* status of the hotk, for LEDs */ u32 ledd_status; //status of the LED display u32 ledd_status; /* status of the LED display */ struct model_data *methods; //methods available on the laptop struct model_data *methods; /* methods available on the laptop */ u8 brightness; //brightness level u8 brightness; /* brightness level */ enum { enum { A1x = 0, //A1340D, A1300F A1x = 0, /* A1340D, A1300F */ A2x, //A2500H A2x, /* A2500H */ A4G, //A4700G A4G, /* A4700G */ D1x, //D1 D1x, /* D1 */ L2D, //L2000D L2D, /* L2000D */ L3C, //L3800C L3C, /* L3800C */ L3D, //L3400D L3D, /* L3400D */ L3H, //L3H, L2000E, L5D L3H, /* L3H, L2000E, L5D */ L4R, //L4500R L4R, /* L4500R */ L5x, //L5800C L5x, /* L5800C */ L8L, //L8400L L8L, /* L8400L */ M1A, //M1300A M1A, /* M1300A */ M2E, //M2400E, L4400L M2E, /* M2400E, L4400L */ M6N, //M6800N, W3400N M6N, /* M6800N, W3400N */ M6R, //M6700R, A3000G M6R, /* M6700R, A3000G */ P30, //Samsung P30 P30, /* Samsung P30 */ S1x, //S1300A, but also L1400B and M2400A (L84F) S1x, /* S1300A, but also L1400B and M2400A (L84F) */ S2x, //S200 (J1 reported), Victor MP-XP7210 S2x, /* S200 (J1 reported), Victor MP-XP7210 */ W1N, //W1000N W1N, /* W1000N */ W5A, //W5A W5A, /* W5A */ W3V, //W3030V W3V, /* W3030V */ xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N xxN, /* M2400N, M3700N, M5200N, M6800N, A4S, //Z81sp S1300N, S5200N*/ //(Centrino) A4S, /* Z81sp */ F3Sa, F3Sa, /* (Centrino) */ END_MODEL END_MODEL } model; //Models currently supported } model; /* Models currently supported */ u16 event_count[128]; //count for each event TODO make this better u16 event_count[128]; /* Count for each event TODO make this better */ }; }; /* Here we go */ /* Here we go */ Loading Loading @@ -469,8 +469,8 @@ static struct acpi_driver asus_hotk_driver = { static int write_acpi_int(acpi_handle handle, const char *method, int val, static int write_acpi_int(acpi_handle handle, const char *method, int val, struct acpi_buffer *output) struct acpi_buffer *output) { { struct acpi_object_list params; //list of input parameters (an int here) struct acpi_object_list params; /* list of input parameters (int) */ union acpi_object in_obj; //the only param we use union acpi_object in_obj; /* the only param we use */ acpi_status status; acpi_status status; params.count = 1; params.count = 1; Loading Loading @@ -507,10 +507,10 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, { { int len = 0; int len = 0; int temp; int temp; char buf[16]; //enough for all info char buf[16]; /* enough for all info */ /* /* * We use the easy way, we don't care of off and count, so we don't set eof * We use the easy way, we don't care of off and count, * to 1 * so we don't set eof to 1 */ */ len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); Loading Loading @@ -796,7 +796,8 @@ static int set_lcd_state(int value) acpi_evaluate_object(NULL, acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch, hotk->methods->mt_lcd_switch, NULL, NULL); NULL, NULL); } else { /* L3H and the like have to be handled differently */ } else { /* L3H and the like must be handled differently */ if (!write_acpi_int if (!write_acpi_int (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, (hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL)) NULL)) Loading Loading @@ -940,8 +941,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, /* /* * Experimental support for display switching. As of now: 1 should activate * Experimental support for display switching. As of now: 1 should activate * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination * (bitwise) of these will suffice. I never actually tested 3 displays hooked up * (bitwise) of these will suffice. I never actually tested 3 displays hooked * simultaneously, so be warned. See the acpi4asus README for more info. * up simultaneously, so be warned. See the acpi4asus README for more info. */ */ static int static int proc_write_disp(struct file *file, const char __user *buffer, proc_write_disp(struct file *file, const char __user *buffer, Loading Loading @@ -1041,8 +1042,8 @@ static int asus_hotk_add_fs(struct acpi_device *device) } } /* /* * We need both read node and write method as LCD switch is also accessible * We need both read node and write method as LCD switch is also * from keyboard * accessible from the keyboard */ */ if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, Loading Loading @@ -1096,11 +1097,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) if (!hotk) if (!hotk) return; return; if ((event & ~((u32) BR_UP)) < 16) { if ((event & ~((u32) BR_UP)) < 16) hotk->brightness = (event & ~((u32) BR_UP)); hotk->brightness = (event & ~((u32) BR_UP)); } else if ((event & ~((u32) BR_DOWN)) < 16) { else if ((event & ~((u32) BR_DOWN)) < 16) hotk->brightness = (event & ~((u32) BR_DOWN)); hotk->brightness = (event & ~((u32) BR_DOWN)); } acpi_bus_generate_proc_event(hotk->device, event, acpi_bus_generate_proc_event(hotk->device, event, hotk->event_count[event % 128]++); hotk->event_count[event % 128]++); Loading Loading @@ -1367,9 +1367,8 @@ static int asus_hotk_add(struct acpi_device *device) hotk->ledd_status = 0xFFF; hotk->ledd_status = 0xFFF; end: end: if (result) { if (result) kfree(hotk); kfree(hotk); } return result; return result; } } Loading