Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
2285bc3d
Commit
2285bc3d
authored
Oct 22, 2008
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'asus-cleanup' into test
parents
bcb631f3
c6c38bac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
111 deletions
+110
-111
drivers/acpi/asus_acpi.c
drivers/acpi/asus_acpi.c
+110
-111
No files found.
drivers/acpi/asus_acpi.c
View file @
2285bc3d
...
@@ -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
);
...
@@ -82,28 +82,28 @@ MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus");
...
@@ -82,28 +82,28 @@ MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus");
module_param
(
asus_gid
,
uint
,
0
);
module_param
(
asus_gid
,
uint
,
0
);
MODULE_PARM_DESC
(
asus_gid
,
"GID for entries in /proc/acpi/asus"
);
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 */
...
@@ -459,18 +459,18 @@ static struct acpi_driver asus_hotk_driver = {
...
@@ -459,18 +459,18 @@ static struct acpi_driver asus_hotk_driver = {
},
},
};
};
/*
/*
* This function evaluates an ACPI method, given an int as parameter, the
* This function evaluates an ACPI method, given an int as parameter, the
* method is searched within the scope of the handle, can be NULL. The output
* method is searched within the scope of the handle, can be NULL. The output
* of the method is written is output, which can also be NULL
* of the method is written is output, which can also be NULL
*
*
* returns 1 if write is successful, 0 else.
* returns 1 if write is successful, 0 else.
*/
*/
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,18 +507,18 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
...
@@ -507,18 +507,18 @@ 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
"
);
len
+=
sprintf
(
page
+
len
,
"Model reference : %s
\n
"
,
len
+=
sprintf
(
page
+
len
,
"Model reference : %s
\n
"
,
hotk
->
methods
->
name
);
hotk
->
methods
->
name
);
/*
/*
* The SFUN method probably allows the original driver to get the list
* The SFUN method probably allows the original driver to get the list
* of features supported by a given model. For now, 0x0100 or 0x0800
* of features supported by a given model. For now, 0x0100 or 0x0800
* bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
* bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
* The significance of others is yet to be found.
* The significance of others is yet to be found.
*/
*/
...
@@ -528,7 +528,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
...
@@ -528,7 +528,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
/*
/*
* Another value for userspace: the ASYM method returns 0x02 for
* Another value for userspace: the ASYM method returns 0x02 for
* battery low and 0x04 for battery critical, its readings tend to be
* battery low and 0x04 for battery critical, its readings tend to be
* more accurate than those provided by _BST.
* more accurate than those provided by _BST.
* Note: since not all the laptops provide this method, errors are
* Note: since not all the laptops provide this method, errors are
* silently ignored.
* silently ignored.
*/
*/
...
@@ -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,10 +694,10 @@ proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
...
@@ -694,10 +694,10 @@ 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
presence and its LED */
presence and its LED */
return
write_led
(
buffer
,
count
,
hotk
->
methods
->
mt_bt_switch
,
BT_ON
,
0
);
return
write_led
(
buffer
,
count
,
hotk
->
methods
->
mt_bt_switch
,
BT_ON
,
0
);
}
}
...
@@ -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
);
...
@@ -734,7 +734,7 @@ static int get_lcd_state(void)
...
@@ -734,7 +734,7 @@ static int get_lcd_state(void)
input
.
count
=
2
;
input
.
count
=
2
;
input
.
pointer
=
mt_params
;
input
.
pointer
=
mt_params
;
/* Note: the following values are partly guessed up, but
/* Note: the following values are partly guessed up, but
otherwise they seem to work */
otherwise they seem to work */
mt_params
[
0
].
type
=
ACPI_TYPE_INTEGER
;
mt_params
[
0
].
type
=
ACPI_TYPE_INTEGER
;
mt_params
[
0
].
integer
.
value
=
0x02
;
mt_params
[
0
].
integer
.
value
=
0x02
;
...
@@ -796,12 +796,13 @@ static int set_lcd_state(int value)
...
@@ -796,12 +796,13 @@ 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
))
status
=
AE_ERROR
;
status
=
AE_ERROR
;
/* L3H's AML executes EHK (0x07) upon Fn+F7 keypress,
/* L3H's AML executes EHK (0x07) upon Fn+F7 keypress,
the exact behaviour is simulated here */
the exact behaviour is simulated here */
}
}
if
(
ACPI_FAILURE
(
status
))
if
(
ACPI_FAILURE
(
status
))
...
@@ -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
;
...
@@ -921,7 +922,7 @@ static void set_display(int value)
...
@@ -921,7 +922,7 @@ static void set_display(int value)
}
}
/*
/*
* Now, *this* one could be more user-friendly, but so far, no-one has
* Now, *this* one could be more user-friendly, but so far, no-one has
* complained. The significance of bits is the same as in proc_write_disp()
* complained. The significance of bits is the same as in proc_write_disp()
*/
*/
static
int
static
int
...
@@ -933,18 +934,18 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
...
@@ -933,18 +934,18 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
if
(
!
read_acpi_int
(
hotk
->
handle
,
hotk
->
methods
->
display_get
,
&
value
))
if
(
!
read_acpi_int
(
hotk
->
handle
,
hotk
->
methods
->
display_get
,
&
value
))
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"Asus ACPI: Error reading display status
\n
"
);
"Asus ACPI: Error reading display status
\n
"
);
value
&=
0x07
;
/* needed for some models, shouldn't hurt others */
value
&=
0x07
;
/* needed for some models, shouldn't hurt others */
return
sprintf
(
page
,
"%d
\n
"
,
value
);
return
sprintf
(
page
,
"%d
\n
"
,
value
);
}
}
/*
/*
* 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
=
...
@@ -1040,9 +1041,9 @@ static int asus_hotk_add_fs(struct acpi_device *device)
...
@@ -1040,9 +1041,9 @@ static int asus_hotk_add_fs(struct acpi_device *device)
&
proc_read_bluetooth
,
mode
,
device
);
&
proc_read_bluetooth
,
mode
,
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
]
++
);
...
@@ -1186,8 +1186,8 @@ static int asus_hotk_get_info(void)
...
@@ -1186,8 +1186,8 @@ static int asus_hotk_get_info(void)
acpi_status
status
;
acpi_status
status
;
/*
/*
* Get DSDT headers early enough to allow for differentiating between
* Get DSDT headers early enough to allow for differentiating between
* models, but late enough to allow acpi_bus_register_driver() to fail
* models, but late enough to allow acpi_bus_register_driver() to fail
* before doing anything ACPI-specific. Should we encounter a machine,
* before doing anything ACPI-specific. Should we encounter a machine,
* which needs special handling (i.e. its hotkey device has a different
* which needs special handling (i.e. its hotkey device has a different
* HID), this bit will be moved. A global variable asus_info contains
* HID), this bit will be moved. A global variable asus_info contains
...
@@ -1212,8 +1212,8 @@ static int asus_hotk_get_info(void)
...
@@ -1212,8 +1212,8 @@ static int asus_hotk_get_info(void)
/*
/*
* Try to match the object returned by INIT to the specific model.
* Try to match the object returned by INIT to the specific model.
* Handle every possible object (or the lack of thereof) the DSDT
* Handle every possible object (or the lack of thereof) the DSDT
* writers might throw at us. When in trouble, we pass NULL to
* writers might throw at us. When in trouble, we pass NULL to
* asus_model_match() and try something completely different.
* asus_model_match() and try something completely different.
*/
*/
if
(
buffer
.
pointer
)
{
if
(
buffer
.
pointer
)
{
...
@@ -1254,7 +1254,7 @@ static int asus_hotk_get_info(void)
...
@@ -1254,7 +1254,7 @@ static int asus_hotk_get_info(void)
/* Sort of per-model blacklist */
/* Sort of per-model blacklist */
if
(
strncmp
(
string
,
"L2B"
,
3
)
==
0
)
if
(
strncmp
(
string
,
"L2B"
,
3
)
==
0
)
hotk
->
methods
->
lcd_status
=
NULL
;
hotk
->
methods
->
lcd_status
=
NULL
;
/* L2B is similar enough to L3C to use its settings, with this only
/* L2B is similar enough to L3C to use its settings, with this only
exception */
exception */
else
if
(
strncmp
(
string
,
"A3G"
,
3
)
==
0
)
else
if
(
strncmp
(
string
,
"A3G"
,
3
)
==
0
)
hotk
->
methods
->
lcd_status
=
"
\\
BLFG"
;
hotk
->
methods
->
lcd_status
=
"
\\
BLFG"
;
...
@@ -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
;
}
}
...
@@ -1394,8 +1393,8 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
...
@@ -1394,8 +1393,8 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
}
}
static
struct
backlight_ops
asus_backlight_data
=
{
static
struct
backlight_ops
asus_backlight_data
=
{
.
get_brightness
=
read_brightness
,
.
get_brightness
=
read_brightness
,
.
update_status
=
set_brightness_status
,
.
update_status
=
set_brightness_status
,
};
};
static
void
asus_acpi_exit
(
void
)
static
void
asus_acpi_exit
(
void
)
...
@@ -1442,15 +1441,15 @@ static int __init asus_acpi_init(void)
...
@@ -1442,15 +1441,15 @@ 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
"
);
asus_backlight_device
=
NULL
;
asus_backlight_device
=
NULL
;
asus_acpi_exit
();
asus_acpi_exit
();
return
-
ENODEV
;
return
-
ENODEV
;
}
}
asus_backlight_device
->
props
.
max_brightness
=
15
;
asus_backlight_device
->
props
.
max_brightness
=
15
;
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment