Commit 2285bc3d authored by Len Brown's avatar Len Brown

Merge branch 'asus-cleanup' into test

parents bcb631f3 c6c38bac
...@@ -42,7 +42,7 @@ ...@@ -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"
...@@ -66,10 +66,10 @@ ...@@ -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);
...@@ -85,25 +85,25 @@ MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus"); ...@@ -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 */
}; };
/* /*
...@@ -111,41 +111,41 @@ struct model_data { ...@@ -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 */
...@@ -469,8 +469,8 @@ static struct acpi_driver asus_hotk_driver = { ...@@ -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;
...@@ -507,10 +507,10 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, ...@@ -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");
...@@ -579,7 +579,7 @@ static int read_led(const char *ledname, int ledmask) ...@@ -579,7 +579,7 @@ static int read_led(const char *ledname, int ledmask)
return (hotk->status & ledmask) ? 1 : 0; return (hotk->status & ledmask) ? 1 : 0;
} }
static int parse_arg(const char __user * buf, unsigned long count, int *val) static int parse_arg(const char __user *buf, unsigned long count, int *val)
{ {
char s[32]; char s[32];
if (!count) if (!count)
...@@ -596,7 +596,7 @@ static int parse_arg(const char __user * buf, unsigned long count, int *val) ...@@ -596,7 +596,7 @@ static int parse_arg(const char __user * buf, unsigned long count, int *val)
/* FIXME: kill extraneous args so it can be called independently */ /* FIXME: kill extraneous args so it can be called independently */
static int static int
write_led(const char __user * buffer, unsigned long count, write_led(const char __user *buffer, unsigned long count,
char *ledname, int ledmask, int invert) char *ledname, int ledmask, int invert)
{ {
int rv, value; int rv, value;
...@@ -631,7 +631,7 @@ proc_read_mled(char *page, char **start, off_t off, int count, int *eof, ...@@ -631,7 +631,7 @@ proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_mled(struct file *file, const char __user * buffer, proc_write_mled(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
...@@ -648,7 +648,7 @@ proc_read_ledd(char *page, char **start, off_t off, int count, int *eof, ...@@ -648,7 +648,7 @@ proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_ledd(struct file *file, const char __user * buffer, proc_write_ledd(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
int rv, value; int rv, value;
...@@ -677,7 +677,7 @@ proc_read_wled(char *page, char **start, off_t off, int count, int *eof, ...@@ -677,7 +677,7 @@ proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_wled(struct file *file, const char __user * buffer, proc_write_wled(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
...@@ -694,7 +694,7 @@ proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof, ...@@ -694,7 +694,7 @@ proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_bluetooth(struct file *file, const char __user * buffer, proc_write_bluetooth(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
/* Note: mt_bt_switch controls both internal Bluetooth adapter's /* Note: mt_bt_switch controls both internal Bluetooth adapter's
...@@ -714,7 +714,7 @@ proc_read_tled(char *page, char **start, off_t off, int count, int *eof, ...@@ -714,7 +714,7 @@ proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_tled(struct file *file, const char __user * buffer, proc_write_tled(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
...@@ -796,7 +796,8 @@ static int set_lcd_state(int value) ...@@ -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))
...@@ -819,7 +820,7 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof, ...@@ -819,7 +820,7 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_lcd(struct file *file, const char __user * buffer, proc_write_lcd(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
int rv, value; int rv, value;
...@@ -897,7 +898,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof, ...@@ -897,7 +898,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
} }
static int static int
proc_write_brn(struct file *file, const char __user * buffer, proc_write_brn(struct file *file, const char __user *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
int rv, value; int rv, value;
...@@ -940,11 +941,11 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, ...@@ -940,11 +941,11 @@ 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,
unsigned long count, void *data) unsigned long count, void *data)
{ {
int rv, value; int rv, value;
...@@ -957,12 +958,12 @@ proc_write_disp(struct file *file, const char __user * buffer, ...@@ -957,12 +958,12 @@ proc_write_disp(struct file *file, const char __user * buffer,
typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
int *eof, void *data); int *eof, void *data);
typedef int (proc_writefunc) (struct file * file, const char __user * buffer, typedef int (proc_writefunc) (struct file *file, const char __user *buffer,
unsigned long count, void *data); unsigned long count, void *data);
static int static int
asus_proc_add(char *name, proc_writefunc * writefunc, asus_proc_add(char *name, proc_writefunc *writefunc,
proc_readfunc * readfunc, mode_t mode, proc_readfunc *readfunc, mode_t mode,
struct acpi_device *device) struct acpi_device *device)
{ {
struct proc_dir_entry *proc = struct proc_dir_entry *proc =
...@@ -1041,8 +1042,8 @@ static int asus_hotk_add_fs(struct acpi_device *device) ...@@ -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,
...@@ -1096,11 +1097,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) ...@@ -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]++);
...@@ -1366,10 +1366,9 @@ static int asus_hotk_add(struct acpi_device *device) ...@@ -1366,10 +1366,9 @@ static int asus_hotk_add(struct acpi_device *device)
/* LED display is off by default */ /* LED display is off by default */
hotk->ledd_status = 0xFFF; hotk->ledd_status = 0xFFF;
end: end:
if (result) { if (result)
kfree(hotk); kfree(hotk);
}
return result; return result;
} }
...@@ -1442,7 +1441,7 @@ static int __init asus_acpi_init(void) ...@@ -1442,7 +1441,7 @@ static int __init asus_acpi_init(void)
return -ENODEV; return -ENODEV;
} }
asus_backlight_device = backlight_device_register("asus",NULL,NULL, asus_backlight_device = backlight_device_register("asus", NULL, NULL,
&asus_backlight_data); &asus_backlight_data);
if (IS_ERR(asus_backlight_device)) { if (IS_ERR(asus_backlight_device)) {
printk(KERN_ERR "Could not register asus backlight device\n"); printk(KERN_ERR "Could not register asus backlight device\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment