Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3266d63c
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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,发现更多精彩内容 >>
提交
3266d63c
编写于
4月 05, 2009
作者:
L
Len Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'battery' into release
上级
4926a236
7faa144a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
16 deletion
+27
-16
drivers/acpi/battery.c
drivers/acpi/battery.c
+7
-5
drivers/acpi/sbs.c
drivers/acpi/sbs.c
+16
-11
drivers/power/power_supply_sysfs.c
drivers/power/power_supply_sysfs.c
+2
-0
include/linux/power_supply.h
include/linux/power_supply.h
+2
-0
未找到文件。
drivers/acpi/battery.c
浏览文件 @
3266d63c
...
...
@@ -92,7 +92,7 @@ struct acpi_battery {
#endif
struct
acpi_device
*
device
;
unsigned
long
update_time
;
int
current
_now
;
int
rate
_now
;
int
capacity_now
;
int
voltage_now
;
int
design_capacity
;
...
...
@@ -196,7 +196,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val
->
intval
=
battery
->
voltage_now
*
1000
;
break
;
case
POWER_SUPPLY_PROP_CURRENT_NOW
:
val
->
intval
=
battery
->
current_now
*
1000
;
case
POWER_SUPPLY_PROP_POWER_NOW
:
val
->
intval
=
battery
->
rate_now
*
1000
;
break
;
case
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN
:
case
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
:
...
...
@@ -247,6 +248,7 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN
,
POWER_SUPPLY_PROP_VOLTAGE_NOW
,
POWER_SUPPLY_PROP_CURRENT_NOW
,
POWER_SUPPLY_PROP_POWER_NOW
,
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
,
POWER_SUPPLY_PROP_ENERGY_FULL
,
POWER_SUPPLY_PROP_ENERGY_NOW
,
...
...
@@ -273,7 +275,7 @@ struct acpi_offsets {
static
struct
acpi_offsets
state_offsets
[]
=
{
{
offsetof
(
struct
acpi_battery
,
state
),
0
},
{
offsetof
(
struct
acpi_battery
,
current
_now
),
0
},
{
offsetof
(
struct
acpi_battery
,
rate
_now
),
0
},
{
offsetof
(
struct
acpi_battery
,
capacity_now
),
0
},
{
offsetof
(
struct
acpi_battery
,
voltage_now
),
0
},
};
...
...
@@ -605,11 +607,11 @@ static int acpi_battery_print_state(struct seq_file *seq, int result)
else
seq_printf
(
seq
,
"charging state: charged
\n
"
);
if
(
battery
->
current
_now
==
ACPI_BATTERY_VALUE_UNKNOWN
)
if
(
battery
->
rate
_now
==
ACPI_BATTERY_VALUE_UNKNOWN
)
seq_printf
(
seq
,
"present rate: unknown
\n
"
);
else
seq_printf
(
seq
,
"present rate: %d %s
\n
"
,
battery
->
current
_now
,
acpi_battery_units
(
battery
));
battery
->
rate
_now
,
acpi_battery_units
(
battery
));
if
(
battery
->
capacity_now
==
ACPI_BATTERY_VALUE_UNKNOWN
)
seq_printf
(
seq
,
"remaining capacity: unknown
\n
"
);
...
...
drivers/acpi/sbs.c
浏览文件 @
3266d63c
...
...
@@ -102,8 +102,8 @@ struct acpi_battery {
u16
cycle_count
;
u16
temp_now
;
u16
voltage_now
;
s16
current
_now
;
s16
current
_avg
;
s16
rate
_now
;
s16
rate
_avg
;
u16
capacity_now
;
u16
state_of_charge
;
u16
state
;
...
...
@@ -202,9 +202,9 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
return
-
ENODEV
;
switch
(
psp
)
{
case
POWER_SUPPLY_PROP_STATUS
:
if
(
battery
->
current
_now
<
0
)
if
(
battery
->
rate
_now
<
0
)
val
->
intval
=
POWER_SUPPLY_STATUS_DISCHARGING
;
else
if
(
battery
->
current
_now
>
0
)
else
if
(
battery
->
rate
_now
>
0
)
val
->
intval
=
POWER_SUPPLY_STATUS_CHARGING
;
else
val
->
intval
=
POWER_SUPPLY_STATUS_FULL
;
...
...
@@ -224,11 +224,13 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
acpi_battery_vscale
(
battery
)
*
1000
;
break
;
case
POWER_SUPPLY_PROP_CURRENT_NOW
:
val
->
intval
=
abs
(
battery
->
current_now
)
*
case
POWER_SUPPLY_PROP_POWER_NOW
:
val
->
intval
=
abs
(
battery
->
rate_now
)
*
acpi_battery_ipscale
(
battery
)
*
1000
;
break
;
case
POWER_SUPPLY_PROP_CURRENT_AVG
:
val
->
intval
=
abs
(
battery
->
current_avg
)
*
case
POWER_SUPPLY_PROP_POWER_AVG
:
val
->
intval
=
abs
(
battery
->
rate_avg
)
*
acpi_battery_ipscale
(
battery
)
*
1000
;
break
;
case
POWER_SUPPLY_PROP_CAPACITY
:
...
...
@@ -293,6 +295,8 @@ static enum power_supply_property sbs_energy_battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW
,
POWER_SUPPLY_PROP_CURRENT_NOW
,
POWER_SUPPLY_PROP_CURRENT_AVG
,
POWER_SUPPLY_PROP_POWER_NOW
,
POWER_SUPPLY_PROP_POWER_AVG
,
POWER_SUPPLY_PROP_CAPACITY
,
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
,
POWER_SUPPLY_PROP_ENERGY_FULL
,
...
...
@@ -301,6 +305,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
POWER_SUPPLY_PROP_MODEL_NAME
,
POWER_SUPPLY_PROP_MANUFACTURER
,
};
#endif
/* --------------------------------------------------------------------------
...
...
@@ -330,8 +335,8 @@ static struct acpi_battery_reader info_readers[] = {
static
struct
acpi_battery_reader
state_readers
[]
=
{
{
0x08
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
temp_now
)},
{
0x09
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
voltage_now
)},
{
0x0a
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
current
_now
)},
{
0x0b
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
current
_avg
)},
{
0x0a
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
rate
_now
)},
{
0x0b
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
rate
_avg
)},
{
0x0f
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
capacity_now
)},
{
0x0e
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
state_of_charge
)},
{
0x16
,
SMBUS_READ_WORD
,
offsetof
(
struct
acpi_battery
,
state
)},
...
...
@@ -589,9 +594,9 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
seq_printf
(
seq
,
"capacity state: %s
\n
"
,
(
battery
->
state
&
0x0010
)
?
"critical"
:
"ok"
);
seq_printf
(
seq
,
"charging state: %s
\n
"
,
(
battery
->
current
_now
<
0
)
?
"discharging"
:
((
battery
->
current
_now
>
0
)
?
"charging"
:
"charged"
));
rate
=
abs
(
battery
->
current
_now
)
*
acpi_battery_ipscale
(
battery
);
(
battery
->
rate
_now
<
0
)
?
"discharging"
:
((
battery
->
rate
_now
>
0
)
?
"charging"
:
"charged"
));
rate
=
abs
(
battery
->
rate
_now
)
*
acpi_battery_ipscale
(
battery
);
rate
*=
(
acpi_battery_mode
(
battery
))
?
(
battery
->
voltage_now
*
acpi_battery_vscale
(
battery
)
/
1000
)
:
1
;
seq_printf
(
seq
,
"present rate: %d%s
\n
"
,
rate
,
...
...
drivers/power/power_supply_sysfs.c
浏览文件 @
3266d63c
...
...
@@ -93,6 +93,8 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR
(
voltage_avg
),
POWER_SUPPLY_ATTR
(
current_now
),
POWER_SUPPLY_ATTR
(
current_avg
),
POWER_SUPPLY_ATTR
(
power_now
),
POWER_SUPPLY_ATTR
(
power_avg
),
POWER_SUPPLY_ATTR
(
charge_full_design
),
POWER_SUPPLY_ATTR
(
charge_empty_design
),
POWER_SUPPLY_ATTR
(
charge_full
),
...
...
include/linux/power_supply.h
浏览文件 @
3266d63c
...
...
@@ -73,6 +73,8 @@ enum power_supply_property {
POWER_SUPPLY_PROP_VOLTAGE_AVG
,
POWER_SUPPLY_PROP_CURRENT_NOW
,
POWER_SUPPLY_PROP_CURRENT_AVG
,
POWER_SUPPLY_PROP_POWER_NOW
,
POWER_SUPPLY_PROP_POWER_AVG
,
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN
,
POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN
,
POWER_SUPPLY_PROP_CHARGE_FULL
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录