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

Merge branch 'asus-cleanup' into test

parents bcb631f3 c6c38bac
......@@ -42,7 +42,7 @@
#define ASUS_ACPI_VERSION "0.30"
#define PROC_ASUS "asus" //the directory
#define PROC_ASUS "asus" /* The directory */
#define PROC_MLED "mled"
#define PROC_WLED "wled"
#define PROC_TLED "tled"
......@@ -66,10 +66,10 @@
/*
* Flags for hotk status
*/
#define MLED_ON 0x01 //mail LED
#define WLED_ON 0x02 //wireless LED
#define TLED_ON 0x04 //touchpad LED
#define BT_ON 0x08 //internal Bluetooth
#define MLED_ON 0x01 /* Mail LED */
#define WLED_ON 0x02 /* Wireless LED */
#define TLED_ON 0x04 /* Touchpad LED */
#define BT_ON 0x08 /* Internal Bluetooth */
MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
MODULE_DESCRIPTION(ACPI_HOTK_NAME);
......@@ -85,25 +85,25 @@ MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus");
/* For each model, all features implemented,
* those marked with R are relative to HOTK, A for absolute */
struct model_data {
char *name; //name of the laptop________________A
char *mt_mled; //method to handle mled_____________R
char *mled_status; //node to handle mled reading_______A
char *mt_wled; //method to handle wled_____________R
char *wled_status; //node to handle wled reading_______A
char *mt_tled; //method to handle tled_____________R
char *tled_status; //node to handle tled reading_______A
char *mt_ledd; //method to handle LED display______R
char *mt_bt_switch; //method to switch Bluetooth on/off_R
char *bt_status; //no model currently supports this__?
char *mt_lcd_switch; //method to turn LCD on/off_________A
char *lcd_status; //node to read LCD panel state______A
char *brightness_up; //method to set brightness up_______A
char *brightness_down; //guess what ?______________________A
char *brightness_set; //method to set absolute brightness_R
char *brightness_get; //method to get absolute brightness_R
char *brightness_status; //node to get brightness____________A
char *display_set; //method to set video output________R
char *display_get; //method to get video output________R
char *name; /* name of the laptop________________A */
char *mt_mled; /* method to handle mled_____________R */
char *mled_status; /* node to handle mled reading_______A */
char *mt_wled; /* method to handle wled_____________R */
char *wled_status; /* node to handle wled reading_______A */
char *mt_tled; /* method to handle tled_____________R */
char *tled_status; /* node to handle tled reading_______A */
char *mt_ledd; /* method to handle LED display______R */
char *mt_bt_switch; /* method to switch Bluetooth on/off_R */
char *bt_status; /* no model currently supports this__? */
char *mt_lcd_switch; /* method to turn LCD on/off_________A */
char *lcd_status; /* node to read LCD panel state______A */
char *brightness_up; /* method to set brightness up_______A */
char *brightness_down; /* method to set brightness down ____A */
char *brightness_set; /* method to set absolute brightness_R */
char *brightness_get; /* method to get absolute brightness_R */
char *brightness_status;/* node to get brightness____________A */
char *display_set; /* method to set video output________R */
char *display_get; /* method to get video output________R */
};
/*
......@@ -111,41 +111,41 @@ struct model_data {
* about the hotk device
*/
struct asus_hotk {
struct acpi_device *device; //the device we are in
acpi_handle handle; //the handle of the hotk device
char status; //status of the hotk, for LEDs, ...
u32 ledd_status; //status of the LED display
struct model_data *methods; //methods available on the laptop
u8 brightness; //brightness level
struct acpi_device *device; /* the device we are in */
acpi_handle handle; /* the handle of the hotk device */
char status; /* status of the hotk, for LEDs */
u32 ledd_status; /* status of the LED display */
struct model_data *methods; /* methods available on the laptop */
u8 brightness; /* brightness level */
enum {
A1x = 0, //A1340D, A1300F
A2x, //A2500H
A4G, //A4700G
D1x, //D1
L2D, //L2000D
L3C, //L3800C
L3D, //L3400D
L3H, //L3H, L2000E, L5D
L4R, //L4500R
L5x, //L5800C
L8L, //L8400L
M1A, //M1300A
M2E, //M2400E, L4400L
M6N, //M6800N, W3400N
M6R, //M6700R, A3000G
P30, //Samsung P30
S1x, //S1300A, but also L1400B and M2400A (L84F)
S2x, //S200 (J1 reported), Victor MP-XP7210
W1N, //W1000N
W5A, //W5A
W3V, //W3030V
xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
A4S, //Z81sp
//(Centrino)
F3Sa,
A1x = 0, /* A1340D, A1300F */
A2x, /* A2500H */
A4G, /* A4700G */
D1x, /* D1 */
L2D, /* L2000D */
L3C, /* L3800C */
L3D, /* L3400D */
L3H, /* L3H, L2000E, L5D */
L4R, /* L4500R */
L5x, /* L5800C */
L8L, /* L8400L */
M1A, /* M1300A */
M2E, /* M2400E, L4400L */
M6N, /* M6800N, W3400N */
M6R, /* M6700R, A3000G */
P30, /* Samsung P30 */
S1x, /* S1300A, but also L1400B and M2400A (L84F) */
S2x, /* S200 (J1 reported), Victor MP-XP7210 */
W1N, /* W1000N */
W5A, /* W5A */
W3V, /* W3030V */
xxN, /* M2400N, M3700N, M5200N, M6800N,
S1300N, S5200N*/
A4S, /* Z81sp */
F3Sa, /* (Centrino) */
END_MODEL
} model; //Models currently supported
u16 event_count[128]; //count for each event TODO make this better
} model; /* Models currently supported */
u16 event_count[128]; /* Count for each event TODO make this better */
};
/* Here we go */
......@@ -469,8 +469,8 @@ static struct acpi_driver asus_hotk_driver = {
static int write_acpi_int(acpi_handle handle, const char *method, int val,
struct acpi_buffer *output)
{
struct acpi_object_list params; //list of input parameters (an int here)
union acpi_object in_obj; //the only param we use
struct acpi_object_list params; /* list of input parameters (int) */
union acpi_object in_obj; /* the only param we use */
acpi_status status;
params.count = 1;
......@@ -507,10 +507,10 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
{
int len = 0;
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
* to 1
* We use the easy way, we don't care of off and count,
* so we don't set eof to 1
*/
len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
......@@ -579,7 +579,7 @@ static int read_led(const char *ledname, int ledmask)
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];
if (!count)
......@@ -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 */
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)
{
int rv, value;
......@@ -631,7 +631,7 @@ proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
}
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)
{
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,
}
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)
{
int rv, value;
......@@ -677,7 +677,7 @@ proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
}
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)
{
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,
}
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)
{
/* 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,
}
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)
{
return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
......@@ -796,7 +796,8 @@ static int set_lcd_state(int value)
acpi_evaluate_object(NULL,
hotk->methods->mt_lcd_switch,
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
(hotk->handle, hotk->methods->mt_lcd_switch, 0x07,
NULL))
......@@ -819,7 +820,7 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
}
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)
{
int rv, value;
......@@ -897,7 +898,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
}
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)
{
int rv, value;
......@@ -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
* 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
* simultaneously, so be warned. See the acpi4asus README for more info.
* (bitwise) of these will suffice. I never actually tested 3 displays hooked
* up simultaneously, so be warned. See the acpi4asus README for more info.
*/
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)
{
int rv, value;
......@@ -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,
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);
static int
asus_proc_add(char *name, proc_writefunc * writefunc,
proc_readfunc * readfunc, mode_t mode,
asus_proc_add(char *name, proc_writefunc *writefunc,
proc_readfunc *readfunc, mode_t mode,
struct acpi_device *device)
{
struct proc_dir_entry *proc =
......@@ -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
* from keyboard
* We need both read node and write method as LCD switch is also
* accessible from the keyboard
*/
if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
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)
if (!hotk)
return;
if ((event & ~((u32) BR_UP)) < 16) {
if ((event & ~((u32) BR_UP)) < 16)
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));
}
acpi_bus_generate_proc_event(hotk->device, event,
hotk->event_count[event % 128]++);
......@@ -1366,10 +1366,9 @@ static int asus_hotk_add(struct acpi_device *device)
/* LED display is off by default */
hotk->ledd_status = 0xFFF;
end:
if (result) {
end:
if (result)
kfree(hotk);
}
return result;
}
......@@ -1442,7 +1441,7 @@ static int __init asus_acpi_init(void)
return -ENODEV;
}
asus_backlight_device = backlight_device_register("asus",NULL,NULL,
asus_backlight_device = backlight_device_register("asus", NULL, NULL,
&asus_backlight_data);
if (IS_ERR(asus_backlight_device)) {
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