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
Kirill Smelkov
linux
Commits
8def05fa
Commit
8def05fa
authored
Jan 30, 2007
by
Len Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asus-laptop: Lindent
Signed-off-by:
Len Brown
<
len.brown@intel.com
>
parent
8b857353
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
124 deletions
+123
-124
drivers/misc/asus-laptop.c
drivers/misc/asus-laptop.c
+123
-124
No files found.
drivers/misc/asus-laptop.c
View file @
8def05fa
...
@@ -130,8 +130,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
...
@@ -130,8 +130,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
/* Display */
/* Display */
ASUS_HANDLE
(
display_set
,
ASUS_HOTK_PREFIX
"SDSP"
);
ASUS_HANDLE
(
display_set
,
ASUS_HOTK_PREFIX
"SDSP"
);
ASUS_HANDLE
(
display_get
,
ASUS_HANDLE
(
display_get
,
"
\\
_SB.PCI0.P0P1.VGA.GETD"
,
/* A6B, A6K A6R A7D F3JM L4R M6R A3G
"
\\
_SB.PCI0.P0P1.VGA.GETD"
,
/* A6B, A6K A6R A7D F3JM L4R M6R A3G
M6A M6V VX-1 V6J V6V W3Z */
M6A M6V VX-1 V6J V6V W3Z */
"
\\
_SB.PCI0.P0P2.VGA.GETD"
,
/* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
"
\\
_SB.PCI0.P0P2.VGA.GETD"
,
/* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
S5A M5A z33A W1Jc W2V */
S5A M5A z33A W1Jc W2V */
...
@@ -263,7 +262,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,
...
@@ -263,7 +262,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val,
return
(
status
==
AE_OK
)
&&
(
out_obj
.
type
==
ACPI_TYPE_INTEGER
);
return
(
status
==
AE_OK
)
&&
(
out_obj
.
type
==
ACPI_TYPE_INTEGER
);
}
}
static
int
read_wireless_status
(
int
mask
)
{
static
int
read_wireless_status
(
int
mask
)
{
int
status
;
int
status
;
if
(
!
wireless_status_handle
)
if
(
!
wireless_status_handle
)
...
@@ -287,8 +287,7 @@ static int read_status(int mask)
...
@@ -287,8 +287,7 @@ static int read_status(int mask)
return
(
hotk
->
status
&
mask
)
?
1
:
0
;
return
(
hotk
->
status
&
mask
)
?
1
:
0
;
}
}
static
void
write_status
(
acpi_handle
handle
,
int
out
,
int
mask
,
static
void
write_status
(
acpi_handle
handle
,
int
out
,
int
mask
,
int
invert
)
int
invert
)
{
{
hotk
->
status
=
(
out
)
?
(
hotk
->
status
|
mask
)
:
(
hotk
->
status
&
~
mask
);
hotk
->
status
=
(
out
)
?
(
hotk
->
status
|
mask
)
:
(
hotk
->
status
&
~
mask
);
...
@@ -333,7 +332,7 @@ static int set_lcd_state(int value)
...
@@ -333,7 +332,7 @@ static int set_lcd_state(int value)
if
(
lcd
==
get_lcd_state
())
if
(
lcd
==
get_lcd_state
())
return
0
;
return
0
;
if
(
lcd_switch_handle
)
{
if
(
lcd_switch_handle
)
{
status
=
acpi_evaluate_object
(
lcd_switch_handle
,
status
=
acpi_evaluate_object
(
lcd_switch_handle
,
NULL
,
NULL
,
NULL
);
NULL
,
NULL
,
NULL
);
...
@@ -349,11 +348,11 @@ static void lcd_blank(int blank)
...
@@ -349,11 +348,11 @@ static void lcd_blank(int blank)
{
{
struct
backlight_device
*
bd
=
asus_backlight_device
;
struct
backlight_device
*
bd
=
asus_backlight_device
;
if
(
bd
)
{
if
(
bd
)
{
down
(
&
bd
->
sem
);
down
(
&
bd
->
sem
);
if
(
likely
(
bd
->
props
))
{
if
(
likely
(
bd
->
props
))
{
bd
->
props
->
power
=
blank
;
bd
->
props
->
power
=
blank
;
if
(
likely
(
bd
->
props
->
update_status
))
if
(
likely
(
bd
->
props
->
update_status
))
bd
->
props
->
update_status
(
bd
);
bd
->
props
->
update_status
(
bd
);
}
}
up
(
&
bd
->
sem
);
up
(
&
bd
->
sem
);
...
@@ -391,7 +390,7 @@ static int update_bl_status(struct backlight_device *bd)
...
@@ -391,7 +390,7 @@ static int update_bl_status(struct backlight_device *bd)
int
value
=
bd
->
props
->
brightness
;
int
value
=
bd
->
props
->
brightness
;
rv
=
set_brightness
(
bd
,
value
);
rv
=
set_brightness
(
bd
,
value
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
value
=
(
bd
->
props
->
power
==
FB_BLANK_UNBLANK
)
?
1
:
0
;
value
=
(
bd
->
props
->
power
==
FB_BLANK_UNBLANK
)
?
1
:
0
;
...
@@ -535,8 +534,9 @@ static ssize_t show_bluetooth(struct device *dev,
...
@@ -535,8 +534,9 @@ static ssize_t show_bluetooth(struct device *dev,
return
sprintf
(
buf
,
"%d
\n
"
,
read_status
(
BT_ON
));
return
sprintf
(
buf
,
"%d
\n
"
,
read_status
(
BT_ON
));
}
}
static
ssize_t
store_bluetooth
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
static
ssize_t
store_bluetooth
(
struct
device
*
dev
,
const
char
*
buf
,
size_t
count
)
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
{
return
store_status
(
buf
,
count
,
bt_switch_handle
,
BT_ON
,
0
);
return
store_status
(
buf
,
count
,
bt_switch_handle
,
BT_ON
,
0
);
}
}
...
@@ -558,7 +558,7 @@ static int read_display(void)
...
@@ -558,7 +558,7 @@ static int read_display(void)
/* In most of the case, we know how to set the display, but sometime
/* In most of the case, we know how to set the display, but sometime
we can't read it */
we can't read it */
if
(
display_get_handle
)
{
if
(
display_get_handle
)
{
if
(
!
read_acpi_int
(
display_get_handle
,
NULL
,
&
value
,
NULL
))
if
(
!
read_acpi_int
(
display_get_handle
,
NULL
,
&
value
,
NULL
))
printk
(
ASUS_WARNING
"Error reading display status
\n
"
);
printk
(
ASUS_WARNING
"Error reading display status
\n
"
);
}
}
...
@@ -567,6 +567,7 @@ static int read_display(void)
...
@@ -567,6 +567,7 @@ static int read_display(void)
return
value
;
return
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 store_disp()
* complained. The significance of bits is the same as in store_disp()
...
@@ -664,7 +665,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
...
@@ -664,7 +665,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
if
(
event
==
ATKD_LCD_ON
)
{
if
(
event
==
ATKD_LCD_ON
)
{
write_status
(
NULL
,
1
,
LCD_ON
,
0
);
write_status
(
NULL
,
1
,
LCD_ON
,
0
);
lcd_blank
(
FB_BLANK_UNBLANK
);
lcd_blank
(
FB_BLANK_UNBLANK
);
}
else
if
(
event
==
ATKD_LCD_OFF
)
{
}
else
if
(
event
==
ATKD_LCD_OFF
)
{
write_status
(
NULL
,
0
,
LCD_ON
,
0
);
write_status
(
NULL
,
0
,
LCD_ON
,
0
);
lcd_blank
(
FB_BLANK_POWERDOWN
);
lcd_blank
(
FB_BLANK_POWERDOWN
);
}
}
...
@@ -724,7 +725,6 @@ static struct platform_driver asuspf_driver = {
...
@@ -724,7 +725,6 @@ static struct platform_driver asuspf_driver = {
static
struct
platform_device
*
asuspf_device
;
static
struct
platform_device
*
asuspf_device
;
static
void
asus_hotk_add_fs
(
void
)
static
void
asus_hotk_add_fs
(
void
)
{
{
ASUS_SET_DEVICE_ATTR
(
infos
,
0444
,
show_infos
,
NULL
);
ASUS_SET_DEVICE_ATTR
(
infos
,
0444
,
show_infos
,
NULL
);
...
@@ -738,7 +738,7 @@ static void asus_hotk_add_fs(void)
...
@@ -738,7 +738,7 @@ static void asus_hotk_add_fs(void)
if
(
display_set_handle
&&
display_get_handle
)
if
(
display_set_handle
&&
display_get_handle
)
ASUS_SET_DEVICE_ATTR
(
display
,
0644
,
show_disp
,
store_disp
);
ASUS_SET_DEVICE_ATTR
(
display
,
0644
,
show_disp
,
store_disp
);
else
if
(
display_set_handle
)
else
if
(
display_set_handle
)
ASUS_SET_DEVICE_ATTR
(
display
,
0200
,
NULL
,
store_disp
);
ASUS_SET_DEVICE_ATTR
(
display
,
0200
,
NULL
,
store_disp
);
if
(
ledd_set_handle
)
if
(
ledd_set_handle
)
...
@@ -750,7 +750,7 @@ static void asus_hotk_add_fs(void)
...
@@ -750,7 +750,7 @@ static void asus_hotk_add_fs(void)
}
}
}
}
static
int
asus_handle_init
(
char
*
name
,
acpi_handle
*
handle
,
static
int
asus_handle_init
(
char
*
name
,
acpi_handle
*
handle
,
char
**
paths
,
int
num_paths
)
char
**
paths
,
int
num_paths
)
{
{
int
i
;
int
i
;
...
@@ -770,7 +770,6 @@ static int asus_handle_init(char *name, acpi_handle *handle,
...
@@ -770,7 +770,6 @@ static int asus_handle_init(char *name, acpi_handle *handle,
asus_handle_init(#object, &object##_handle, object##_paths, \
asus_handle_init(#object, &object##_handle, object##_paths, \
ARRAY_SIZE(object##_paths))
ARRAY_SIZE(object##_paths))
/*
/*
* This function is used to initialize the hotk with right values. In this
* This function is used to initialize the hotk with right values. In this
* method, we can make all the detection we want, and modify the hotk struct
* method, we can make all the detection we want, and modify the hotk struct
...
@@ -835,7 +834,7 @@ static int asus_hotk_get_info(void)
...
@@ -835,7 +834,7 @@ static int asus_hotk_get_info(void)
if
(
!
hotk
->
name
)
if
(
!
hotk
->
name
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
*
string
)
if
(
*
string
)
printk
(
ASUS_NOTICE
" %s model detected
\n
"
,
string
);
printk
(
ASUS_NOTICE
" %s model detected
\n
"
,
string
);
ASUS_HANDLE_INIT
(
mled_set
);
ASUS_HANDLE_INIT
(
mled_set
);
...
@@ -854,9 +853,9 @@ static int asus_hotk_get_info(void)
...
@@ -854,9 +853,9 @@ static int asus_hotk_get_info(void)
if
(
!
read_acpi_int
(
hotk
->
handle
,
"HRWS"
,
&
hwrs_result
,
NULL
))
if
(
!
read_acpi_int
(
hotk
->
handle
,
"HRWS"
,
&
hwrs_result
,
NULL
))
hwrs_result
=
WL_HWRS
|
BT_HWRS
;
hwrs_result
=
WL_HWRS
|
BT_HWRS
;
if
(
hwrs_result
&
WL_HWRS
)
if
(
hwrs_result
&
WL_HWRS
)
ASUS_HANDLE_INIT
(
wl_switch
);
ASUS_HANDLE_INIT
(
wl_switch
);
if
(
hwrs_result
&
BT_HWRS
)
if
(
hwrs_result
&
BT_HWRS
)
ASUS_HANDLE_INIT
(
bt_switch
);
ASUS_HANDLE_INIT
(
bt_switch
);
ASUS_HANDLE_INIT
(
wireless_status
);
ASUS_HANDLE_INIT
(
wireless_status
);
...
@@ -871,7 +870,7 @@ static int asus_hotk_get_info(void)
...
@@ -871,7 +870,7 @@ static int asus_hotk_get_info(void)
/* There is a lot of models with "ALSL", but a few get
/* There is a lot of models with "ALSL", but a few get
a real light sens, so we need to check it. */
a real light sens, so we need to check it. */
if
(
ASUS_HANDLE_INIT
(
ls_switch
))
if
(
ASUS_HANDLE_INIT
(
ls_switch
))
ASUS_HANDLE_INIT
(
ls_level
);
ASUS_HANDLE_INIT
(
ls_level
);
kfree
(
model
);
kfree
(
model
);
...
@@ -987,7 +986,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
...
@@ -987,7 +986,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
static
void
asus_backlight_exit
(
void
)
static
void
asus_backlight_exit
(
void
)
{
{
if
(
asus_backlight_device
)
if
(
asus_backlight_device
)
backlight_device_unregister
(
asus_backlight_device
);
backlight_device_unregister
(
asus_backlight_device
);
}
}
...
@@ -1019,14 +1018,14 @@ static void __exit asus_laptop_exit(void)
...
@@ -1019,14 +1018,14 @@ static void __exit asus_laptop_exit(void)
kfree
(
asus_info
);
kfree
(
asus_info
);
}
}
static
int
asus_backlight_init
(
struct
device
*
dev
)
static
int
asus_backlight_init
(
struct
device
*
dev
)
{
{
struct
backlight_device
*
bd
;
struct
backlight_device
*
bd
;
if
(
brightness_set_handle
&&
lcd_switch_handle
)
{
if
(
brightness_set_handle
&&
lcd_switch_handle
)
{
bd
=
backlight_device_register
(
ASUS_HOTK_FILE
,
dev
,
bd
=
backlight_device_register
(
ASUS_HOTK_FILE
,
dev
,
NULL
,
&
asusbl_data
);
NULL
,
&
asusbl_data
);
if
(
IS_ERR
(
bd
))
{
if
(
IS_ERR
(
bd
))
{
printk
(
ASUS_ERR
printk
(
ASUS_ERR
"Could not register asus backlight device
\n
"
);
"Could not register asus backlight device
\n
"
);
asus_backlight_device
=
NULL
;
asus_backlight_device
=
NULL
;
...
@@ -1036,10 +1035,10 @@ static int asus_backlight_init(struct device * dev)
...
@@ -1036,10 +1035,10 @@ static int asus_backlight_init(struct device * dev)
asus_backlight_device
=
bd
;
asus_backlight_device
=
bd
;
down
(
&
bd
->
sem
);
down
(
&
bd
->
sem
);
if
(
likely
(
bd
->
props
))
{
if
(
likely
(
bd
->
props
))
{
bd
->
props
->
brightness
=
read_brightness
(
NULL
);
bd
->
props
->
brightness
=
read_brightness
(
NULL
);
bd
->
props
->
power
=
FB_BLANK_UNBLANK
;
bd
->
props
->
power
=
FB_BLANK_UNBLANK
;
if
(
likely
(
bd
->
props
->
update_status
))
if
(
likely
(
bd
->
props
->
update_status
))
bd
->
props
->
update_status
(
bd
);
bd
->
props
->
update_status
(
bd
);
}
}
up
(
&
bd
->
sem
);
up
(
&
bd
->
sem
);
...
@@ -1048,39 +1047,39 @@ static int asus_backlight_init(struct device * dev)
...
@@ -1048,39 +1047,39 @@ static int asus_backlight_init(struct device * dev)
}
}
static
int
asus_led_register
(
acpi_handle
handle
,
static
int
asus_led_register
(
acpi_handle
handle
,
struct
led_classdev
*
ldev
,
struct
led_classdev
*
ldev
,
struct
device
*
dev
)
struct
device
*
dev
)
{
{
if
(
!
handle
)
if
(
!
handle
)
return
0
;
return
0
;
return
led_classdev_register
(
dev
,
ldev
);
return
led_classdev_register
(
dev
,
ldev
);
}
}
#define ASUS_LED_REGISTER(object, device) \
#define ASUS_LED_REGISTER(object, device) \
asus_led_register(object##_set_handle, &object##_led, device)
asus_led_register(object##_set_handle, &object##_led, device)
static
int
asus_led_init
(
struct
device
*
dev
)
static
int
asus_led_init
(
struct
device
*
dev
)
{
{
int
rv
;
int
rv
;
rv
=
ASUS_LED_REGISTER
(
mled
,
dev
);
rv
=
ASUS_LED_REGISTER
(
mled
,
dev
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
rv
=
ASUS_LED_REGISTER
(
tled
,
dev
);
rv
=
ASUS_LED_REGISTER
(
tled
,
dev
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
rv
=
ASUS_LED_REGISTER
(
rled
,
dev
);
rv
=
ASUS_LED_REGISTER
(
rled
,
dev
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
rv
=
ASUS_LED_REGISTER
(
pled
,
dev
);
rv
=
ASUS_LED_REGISTER
(
pled
,
dev
);
if
(
rv
)
if
(
rv
)
return
rv
;
return
rv
;
led_workqueue
=
create_singlethread_workqueue
(
"led_workqueue"
);
led_workqueue
=
create_singlethread_workqueue
(
"led_workqueue"
);
if
(
!
led_workqueue
)
if
(
!
led_workqueue
)
return
-
ENOMEM
;
return
-
ENOMEM
;
return
0
;
return
0
;
...
@@ -1118,11 +1117,11 @@ static int __init asus_laptop_init(void)
...
@@ -1118,11 +1117,11 @@ static int __init asus_laptop_init(void)
dev
=
acpi_get_physical_device
(
hotk
->
device
->
handle
);
dev
=
acpi_get_physical_device
(
hotk
->
device
->
handle
);
result
=
asus_backlight_init
(
dev
);
result
=
asus_backlight_init
(
dev
);
if
(
result
)
if
(
result
)
goto
fail_backlight
;
goto
fail_backlight
;
result
=
asus_led_init
(
dev
);
result
=
asus_led_init
(
dev
);
if
(
result
)
if
(
result
)
goto
fail_led
;
goto
fail_led
;
/* Register platform stuff */
/* Register platform stuff */
...
@@ -1147,22 +1146,22 @@ static int __init asus_laptop_init(void)
...
@@ -1147,22 +1146,22 @@ static int __init asus_laptop_init(void)
return
0
;
return
0
;
fail_sysfs:
fail_sysfs:
platform_device_del
(
asuspf_device
);
platform_device_del
(
asuspf_device
);
fail_platform_device2:
fail_platform_device2:
platform_device_put
(
asuspf_device
);
platform_device_put
(
asuspf_device
);
fail_platform_device1:
fail_platform_device1:
platform_driver_unregister
(
&
asuspf_driver
);
platform_driver_unregister
(
&
asuspf_driver
);
fail_platform_driver:
fail_platform_driver:
asus_led_exit
();
asus_led_exit
();
fail_led:
fail_led:
asus_backlight_exit
();
asus_backlight_exit
();
fail_backlight:
fail_backlight:
return
result
;
return
result
;
}
}
...
...
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