Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3bb29ec1
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
153
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3bb29ec1
编写于
9月 19, 2009
作者:
L
Len Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'acer' into release
上级
985f3878
f9449151
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
78 addition
and
43 deletion
+78
-43
drivers/platform/x86/acerhdf.c
drivers/platform/x86/acerhdf.c
+78
-43
未找到文件。
drivers/platform/x86/acerhdf.c
浏览文件 @
3bb29ec1
...
...
@@ -52,7 +52,7 @@
*/
#undef START_IN_KERNEL_MODE
#define DRV_VER "0.5.1
3
"
#define DRV_VER "0.5.1
7
"
/*
* According to the Atom N270 datasheet,
...
...
@@ -90,6 +90,7 @@ static unsigned int fanoff = 58;
static
unsigned
int
verbose
;
static
unsigned
int
fanstate
=
ACERHDF_FAN_AUTO
;
static
char
force_bios
[
16
];
static
char
force_product
[
16
];
static
unsigned
int
prev_interval
;
struct
thermal_zone_device
*
thz_dev
;
struct
thermal_cooling_device
*
cl_dev
;
...
...
@@ -107,34 +108,62 @@ module_param(verbose, uint, 0600);
MODULE_PARM_DESC
(
verbose
,
"Enable verbose dmesg output"
);
module_param_string
(
force_bios
,
force_bios
,
16
,
0
);
MODULE_PARM_DESC
(
force_bios
,
"Force BIOS version and omit BIOS check"
);
module_param_string
(
force_product
,
force_product
,
16
,
0
);
MODULE_PARM_DESC
(
force_product
,
"Force BIOS product and omit BIOS check"
);
/*
* cmd_off: to switch the fan completely off / to check if the fan is off
* cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then
* the fan speed depending on the temperature
*/
struct
fancmd
{
u8
cmd_off
;
u8
cmd_auto
;
};
/* BIOS settings */
struct
bios_settings_t
{
const
char
*
vendor
;
const
char
*
product
;
const
char
*
version
;
unsigned
char
fanreg
;
unsigned
char
tempreg
;
unsigned
char
fancmd
[
2
];
/* fan off and auto commands */
struct
fancmd
cmd
;
};
/* Register addresses and values for different BIOS versions */
static
const
struct
bios_settings_t
bios_tbl
[]
=
{
{
"Acer"
,
"v0.3109"
,
0x55
,
0x58
,
{
0x1f
,
0x00
}
},
{
"Acer"
,
"v0.3114"
,
0x55
,
0x58
,
{
0x1f
,
0x00
}
},
{
"Acer"
,
"v0.3301"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"v0.3304"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"v0.3305"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"v0.3308"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Acer"
,
"v0.3309"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Acer"
,
"v0.3310"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Gateway"
,
"v0.3103"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Packard Bell"
,
"v0.3105"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
""
,
""
,
0
,
0
,
{
0
,
0
}
}
/* AOA110 */
{
"Acer"
,
"AOA110"
,
"v0.3109"
,
0x55
,
0x58
,
{
0x1f
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3114"
,
0x55
,
0x58
,
{
0x1f
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3301"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3304"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3305"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3307"
,
0x55
,
0x58
,
{
0xaf
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3308"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3309"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Acer"
,
"AOA110"
,
"v0.3310"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
/* AOA150 */
{
"Acer"
,
"AOA150"
,
"v0.3114"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3301"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3304"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3305"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3307"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3308"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3309"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Acer"
,
"AOA150"
,
"v0.3310"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
/* special BIOS / other */
{
"Gateway"
,
"AOA110"
,
"v0.3103"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Gateway"
,
"AOA150"
,
"v0.3103"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
{
"Packard Bell"
,
"DOA150"
,
"v0.3104"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Packard Bell"
,
"AOA110"
,
"v0.3105"
,
0x55
,
0x58
,
{
0x21
,
0x00
}
},
{
"Packard Bell"
,
"AOA150"
,
"v0.3105"
,
0x55
,
0x58
,
{
0x20
,
0x00
}
},
/* pewpew-terminator */
{
""
,
""
,
""
,
0
,
0
,
{
0
,
0
}
}
};
static
const
struct
bios_settings_t
*
bios_cfg
__read_mostly
;
static
int
acerhdf_get_temp
(
int
*
temp
)
{
u8
read_temp
;
...
...
@@ -150,13 +179,14 @@ static int acerhdf_get_temp(int *temp)
static
int
acerhdf_get_fanstate
(
int
*
state
)
{
u8
fan
;
bool
tmp
;
if
(
ec_read
(
bios_cfg
->
fanreg
,
&
fan
))
return
-
EINVAL
;
tmp
=
(
fan
==
bios_cfg
->
fancmd
[
ACERHDF_FAN_OFF
]);
*
state
=
tmp
?
ACERHDF_FAN_OFF
:
ACERHDF_FAN_AUTO
;
if
(
fan
!=
bios_cfg
->
cmd
.
cmd_off
)
*
state
=
ACERHDF_FAN_AUTO
;
else
*
state
=
ACERHDF_FAN_OFF
;
return
0
;
}
...
...
@@ -175,7 +205,8 @@ static void acerhdf_change_fanstate(int state)
state
=
ACERHDF_FAN_AUTO
;
}
cmd
=
bios_cfg
->
fancmd
[
state
];
cmd
=
(
state
==
ACERHDF_FAN_OFF
)
?
bios_cfg
->
cmd
.
cmd_off
:
bios_cfg
->
cmd
.
cmd_auto
;
fanstate
=
state
;
ec_write
(
bios_cfg
->
fanreg
,
cmd
);
...
...
@@ -408,7 +439,7 @@ struct thermal_cooling_device_ops acerhdf_cooling_ops = {
};
/* suspend / resume functionality */
static
int
acerhdf_suspend
(
struct
platform_device
*
dev
,
pm_message_t
state
)
static
int
acerhdf_suspend
(
struct
device
*
dev
)
{
if
(
kernelmode
)
acerhdf_change_fanstate
(
ACERHDF_FAN_AUTO
);
...
...
@@ -419,14 +450,6 @@ static int acerhdf_suspend(struct platform_device *dev, pm_message_t state)
return
0
;
}
static
int
acerhdf_resume
(
struct
platform_device
*
device
)
{
if
(
verbose
)
pr_notice
(
"resuming
\n
"
);
return
0
;
}
static
int
__devinit
acerhdf_probe
(
struct
platform_device
*
device
)
{
return
0
;
...
...
@@ -437,15 +460,19 @@ static int acerhdf_remove(struct platform_device *device)
return
0
;
}
struct
platform_driver
acerhdf_drv
=
{
static
struct
dev_pm_ops
acerhdf_pm_ops
=
{
.
suspend
=
acerhdf_suspend
,
.
freeze
=
acerhdf_suspend
,
};
static
struct
platform_driver
acerhdf_driver
=
{
.
driver
=
{
.
name
=
"acerhdf"
,
.
name
=
"acerhdf"
,
.
owner
=
THIS_MODULE
,
.
pm
=
&
acerhdf_pm_ops
,
},
.
probe
=
acerhdf_probe
,
.
remove
=
acerhdf_remove
,
.
suspend
=
acerhdf_suspend
,
.
resume
=
acerhdf_resume
,
};
...
...
@@ -454,32 +481,40 @@ static int acerhdf_check_hardware(void)
{
char
const
*
vendor
,
*
version
,
*
product
;
int
i
;
unsigned
long
prod_len
=
0
;
/* get BIOS data */
vendor
=
dmi_get_system_info
(
DMI_SYS_VENDOR
);
version
=
dmi_get_system_info
(
DMI_BIOS_VERSION
);
product
=
dmi_get_system_info
(
DMI_PRODUCT_NAME
);
pr_info
(
"Acer Aspire One Fan driver, v.%s
\n
"
,
DRV_VER
);
if
(
!
force_bios
[
0
])
{
if
(
strncmp
(
product
,
"AO"
,
2
))
{
pr_err
(
"no Aspire One hardware found
\n
"
);
return
-
EINVAL
;
}
}
else
{
pr_info
(
"forcing BIOS version: %s
\n
"
,
version
);
if
(
force_bios
[
0
])
{
version
=
force_bios
;
pr_info
(
"forcing BIOS version: %s
\n
"
,
version
);
kernelmode
=
0
;
}
if
(
force_product
[
0
])
{
product
=
force_product
;
pr_info
(
"forcing BIOS product: %s
\n
"
,
product
);
kernelmode
=
0
;
}
prod_len
=
strlen
(
product
);
if
(
verbose
)
pr_info
(
"BIOS info: %s %s, product: %s
\n
"
,
vendor
,
version
,
product
);
/* search BIOS version and vendor in BIOS settings table */
for
(
i
=
0
;
bios_tbl
[
i
].
version
[
0
];
i
++
)
{
if
(
!
strcmp
(
bios_tbl
[
i
].
vendor
,
vendor
)
&&
if
(
strlen
(
bios_tbl
[
i
].
product
)
>=
prod_len
&&
!
strncmp
(
bios_tbl
[
i
].
product
,
product
,
strlen
(
bios_tbl
[
i
].
product
))
&&
!
strcmp
(
bios_tbl
[
i
].
vendor
,
vendor
)
&&
!
strcmp
(
bios_tbl
[
i
].
version
,
version
))
{
bios_cfg
=
&
bios_tbl
[
i
];
break
;
...
...
@@ -487,8 +522,8 @@ static int acerhdf_check_hardware(void)
}
if
(
!
bios_cfg
)
{
pr_err
(
"unknown (unsupported) BIOS version %s/%s, "
"please report, aborting!
\n
"
,
vendor
,
version
);
pr_err
(
"unknown (unsupported) BIOS version %s/%s
/%s
, "
"please report, aborting!
\n
"
,
vendor
,
product
,
version
);
return
-
EINVAL
;
}
...
...
@@ -509,7 +544,7 @@ static int acerhdf_register_platform(void)
{
int
err
=
0
;
err
=
platform_driver_register
(
&
acerhdf_dr
v
);
err
=
platform_driver_register
(
&
acerhdf_dr
iver
);
if
(
err
)
return
err
;
...
...
@@ -525,7 +560,7 @@ static void acerhdf_unregister_platform(void)
return
;
platform_device_del
(
acerhdf_dev
);
platform_driver_unregister
(
&
acerhdf_dr
v
);
platform_driver_unregister
(
&
acerhdf_dr
iver
);
}
static
int
acerhdf_register_thermal
(
void
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录