Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
c3caebad
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c3caebad
编写于
1月 13, 2008
作者:
A
Anton Vorontsov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pda_power: implement polling
Signed-off-by:
N
Anton Vorontsov
<
cbou@mail.ru
>
上级
bfde2662
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
46 addition
and
1 deletion
+46
-1
drivers/power/pda_power.c
drivers/power/pda_power.c
+45
-1
include/linux/pda_power.h
include/linux/pda_power.h
+1
-0
未找到文件。
drivers/power/pda_power.c
浏览文件 @
c3caebad
...
...
@@ -32,6 +32,8 @@ static struct pda_power_pdata *pdata;
static
struct
resource
*
ac_irq
,
*
usb_irq
;
static
struct
timer_list
charger_timer
;
static
struct
timer_list
supply_timer
;
static
struct
timer_list
polling_timer
;
static
int
polling
;
enum
{
PDA_PSY_OFFLINE
=
0
,
...
...
@@ -167,6 +169,31 @@ static irqreturn_t power_changed_isr(int irq, void *power_supply)
return
IRQ_HANDLED
;
}
static
void
polling_timer_func
(
unsigned
long
unused
)
{
int
changed
=
0
;
dev_dbg
(
dev
,
"polling...
\n
"
);
update_status
();
if
(
!
ac_irq
&&
new_ac_status
!=
ac_status
)
{
ac_status
=
PDA_PSY_TO_CHANGE
;
changed
=
1
;
}
if
(
!
usb_irq
&&
new_usb_status
!=
usb_status
)
{
usb_status
=
PDA_PSY_TO_CHANGE
;
changed
=
1
;
}
if
(
changed
)
psy_changed
();
mod_timer
(
&
polling_timer
,
jiffies
+
msecs_to_jiffies
(
pdata
->
polling_interval
));
}
static
int
pda_power_probe
(
struct
platform_device
*
pdev
)
{
int
ret
=
0
;
...
...
@@ -191,6 +218,9 @@ static int pda_power_probe(struct platform_device *pdev)
if
(
!
pdata
->
wait_for_charger
)
pdata
->
wait_for_charger
=
500
;
if
(
!
pdata
->
polling_interval
)
pdata
->
polling_interval
=
2000
;
setup_timer
(
&
charger_timer
,
charger_timer_func
,
0
);
setup_timer
(
&
supply_timer
,
supply_timer_func
,
0
);
...
...
@@ -220,6 +250,8 @@ static int pda_power_probe(struct platform_device *pdev)
dev_err
(
dev
,
"request ac irq failed
\n
"
);
goto
ac_irq_failed
;
}
}
else
{
polling
=
1
;
}
}
...
...
@@ -239,9 +271,19 @@ static int pda_power_probe(struct platform_device *pdev)
dev_err
(
dev
,
"request usb irq failed
\n
"
);
goto
usb_irq_failed
;
}
}
else
{
polling
=
1
;
}
}
if
(
polling
)
{
dev_dbg
(
dev
,
"will poll for status
\n
"
);
setup_timer
(
&
polling_timer
,
polling_timer_func
,
0
);
mod_timer
(
&
polling_timer
,
jiffies
+
msecs_to_jiffies
(
pdata
->
polling_interval
));
}
if
(
ac_irq
||
usb_irq
)
device_init_wakeup
(
&
pdev
->
dev
,
1
);
return
0
;
...
...
@@ -267,6 +309,8 @@ static int pda_power_remove(struct platform_device *pdev)
if
(
pdata
->
is_ac_online
&&
ac_irq
)
free_irq
(
ac_irq
->
start
,
&
pda_psy_ac
);
if
(
polling
)
del_timer_sync
(
&
polling_timer
);
del_timer_sync
(
&
charger_timer
);
del_timer_sync
(
&
supply_timer
);
...
...
include/linux/pda_power.h
浏览文件 @
c3caebad
...
...
@@ -26,6 +26,7 @@ struct pda_power_pdata {
unsigned
int
wait_for_status
;
/* msecs, default is 500 */
unsigned
int
wait_for_charger
;
/* msecs, default is 500 */
unsigned
int
polling_interval
;
/* msecs, default is 2000 */
};
#endif
/* __PDA_POWER_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录