Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
17e78f62
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
17e78f62
编写于
1月 13, 2010
作者:
C
Corentin Chary
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
asus-laptop: removing read_status/store_status/write_status and asus->status
Signed-off-by:
N
Corentin Chary
<
corentincj@iksaif.net
>
上级
3e68ae7c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
57 deletion
+24
-57
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus-laptop.c
+24
-57
未找到文件。
drivers/platform/x86/asus-laptop.c
浏览文件 @
17e78f62
...
...
@@ -107,16 +107,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
* Flags for hotk status
* WL_ON and BT_ON are also used for wireless_status()
*/
#define WL_ON 0x01
/* internal Wifi */
#define BT_ON 0x02
/* internal Bluetooth */
#define MLED_ON 0x04
/* mail LED */
#define TLED_ON 0x08
/* touchpad LED */
#define RLED_ON 0x10
/* Record LED */
#define PLED_ON 0x20
/* Phone LED */
#define GLED_ON 0x40
/* Gaming LED */
#define LCD_ON 0x80
/* LCD backlight */
#define GPS_ON 0x100
/* GPS */
#define KEY_ON 0x200
/* Keyboard backlight */
#define WL_RSTS 0x01
/* internal Wifi */
#define BT_RSTS 0x02
/* internal Bluetooth */
#define ASUS_HANDLE(object, paths...) \
static acpi_handle object##_handle = NULL; \
...
...
@@ -244,7 +236,6 @@ struct asus_laptop {
int
lcd_state
;
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 */
u8
light_level
;
/* light sensor level */
u8
light_switch
;
/* light sensor switch value */
...
...
@@ -332,35 +323,18 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val)
return
write_acpi_int_ret
(
handle
,
method
,
val
,
NULL
);
}
/* Generic LED functions */
static
int
read_status
(
struct
asus_laptop
*
asus
,
int
mask
)
/* Generic LED function */
static
void
asus_led_set
(
struct
asus_laptop
*
asus
,
acpi_handle
handle
,
int
value
)
{
return
(
asus
->
status
&
mask
)
?
1
:
0
;
}
static
void
write_status
(
struct
asus_laptop
*
asus
,
acpi_handle
handle
,
int
out
,
int
mask
)
{
asus
->
status
=
(
out
)
?
(
asus
->
status
|
mask
)
:
(
asus
->
status
&
~
mask
);
switch
(
mask
)
{
case
MLED_ON
:
out
=
!
(
out
&
0x1
);
break
;
case
GLED_ON
:
out
=
(
out
&
0x1
)
+
1
;
break
;
case
GPS_ON
:
handle
=
(
out
)
?
gps_on_handle
:
gps_off_handle
;
out
=
0x02
;
break
;
default:
out
&=
0x1
;
break
;
}
if
(
handle
==
mled_set_handle
)
value
=
!
value
;
else
if
(
handle
==
gled_set_handle
)
value
=
!
value
+
1
;
else
value
=
!!
value
;
if
(
write_acpi_int
(
handle
,
NULL
,
out
))
pr_warning
(
" write failed %x
\n
"
,
mask
);
write_acpi_int
(
handle
,
NULL
,
value
);
}
/*
...
...
@@ -403,7 +377,7 @@ ASUS_LED(kled, "kbd_backlight", 3);
struct asus_laptop *asus = work_to_asus(work, object); \
\
int value = asus->leds.object##_wk; \
write_status(asus, object##_set_handle, value, (mask));
\
asus_led_set(asus, object##_set_handle, value);
\
} \
static enum led_brightness object##_led_get( \
struct led_classdev *led_cdev) \
...
...
@@ -740,9 +714,9 @@ static int parse_arg(const char *buf, unsigned long count, int *val)
return
count
;
}
static
ssize_t
s
tore_status
(
struct
asus_laptop
*
asus
,
const
char
*
buf
,
size_t
count
,
acpi_handle
handle
,
int
mask
)
static
ssize_t
s
ysfs_acpi_set
(
struct
asus_laptop
*
asus
,
const
char
*
buf
,
size_t
count
,
acpi_handle
handle
)
{
int
rv
,
value
;
int
out
=
0
;
...
...
@@ -751,8 +725,8 @@ static ssize_t store_status(struct asus_laptop *asus,
if
(
rv
>
0
)
out
=
value
?
1
:
0
;
write_status
(
asus
,
handle
,
out
,
mask
);
if
(
write_acpi_int
(
handle
,
NULL
,
value
))
return
-
ENODEV
;
return
rv
;
}
...
...
@@ -810,7 +784,7 @@ static ssize_t show_wlan(struct device *dev,
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
asus_wireless_status
(
asus
,
WL_
ON
));
return
sprintf
(
buf
,
"%d
\n
"
,
asus_wireless_status
(
asus
,
WL_
RSTS
));
}
static
ssize_t
store_wlan
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
...
...
@@ -818,7 +792,7 @@ static ssize_t store_wlan(struct device *dev, struct device_attribute *attr,
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
return
s
tore_status
(
asus
,
buf
,
count
,
wl_switch_handle
,
WL_ON
);
return
s
ysfs_acpi_set
(
asus
,
buf
,
count
,
wl_switch_handle
);
}
/*
...
...
@@ -829,7 +803,7 @@ static ssize_t show_bluetooth(struct device *dev,
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
asus_wireless_status
(
asus
,
BT_
ON
));
return
sprintf
(
buf
,
"%d
\n
"
,
asus_wireless_status
(
asus
,
BT_
RSTS
));
}
static
ssize_t
store_bluetooth
(
struct
device
*
dev
,
...
...
@@ -838,7 +812,7 @@ static ssize_t store_bluetooth(struct device *dev,
{
struct
asus_laptop
*
asus
=
dev_get_drvdata
(
dev
);
return
s
tore_status
(
asus
,
buf
,
count
,
bt_switch_handle
,
BT_ON
);
return
s
ysfs_acpi_set
(
asus
,
buf
,
count
,
bt_switch_handle
);
}
/*
...
...
@@ -1439,16 +1413,9 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
/* WLED and BLED are on by default */
if
(
bluetooth_status
>=
0
)
write_
status
(
asus
,
bt_switch_handle
,
!!
bluetooth_status
,
BT_ON
);
write_
acpi_int
(
bt_switch_handle
,
NULL
,
!!
bluetooth_status
);
if
(
wireless_status
>=
0
)
write_status
(
asus
,
wl_switch_handle
,
!!
wireless_status
,
WL_ON
);
/* If the h/w switch is off, we need to check the real status */
write_status
(
asus
,
NULL
,
asus_wireless_status
(
asus
,
BT_ON
),
BT_ON
);
write_status
(
asus
,
NULL
,
asus_wireless_status
(
asus
,
WL_ON
),
WL_ON
);
/* LCD Backlight is on by default */
write_status
(
asus
,
NULL
,
1
,
LCD_ON
);
write_acpi_int
(
wl_switch_handle
,
NULL
,
!!
wireless_status
);
/* Keyboard Backlight is on by default */
if
(
kled_set_handle
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录