Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
f2a66185
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f2a66185
编写于
8月 14, 2010
作者:
L
Len Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'nvs' into release
上级
9fe6206f
618d7fd0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
80 deletion
+33
-80
drivers/acpi/sleep.c
drivers/acpi/sleep.c
+21
-39
drivers/acpi/sleep.h
drivers/acpi/sleep.h
+2
-3
drivers/acpi/wakeup.c
drivers/acpi/wakeup.c
+10
-38
未找到文件。
drivers/acpi/sleep.c
浏览文件 @
f2a66185
...
@@ -70,10 +70,10 @@ static int acpi_sleep_prepare(u32 acpi_state)
...
@@ -70,10 +70,10 @@ static int acpi_sleep_prepare(u32 acpi_state)
}
}
ACPI_FLUSH_CPU_CACHE
();
ACPI_FLUSH_CPU_CACHE
();
acpi_enable_wakeup_device_prep
(
acpi_state
);
#endif
#endif
printk
(
KERN_INFO
PREFIX
"Preparing to enter system sleep state S%d
\n
"
,
printk
(
KERN_INFO
PREFIX
"Preparing to enter system sleep state S%d
\n
"
,
acpi_state
);
acpi_state
);
acpi_enable_wakeup_devices
(
acpi_state
);
acpi_enter_sleep_state_prep
(
acpi_state
);
acpi_enter_sleep_state_prep
(
acpi_state
);
return
0
;
return
0
;
}
}
...
@@ -118,6 +118,16 @@ static int acpi_pm_freeze(void)
...
@@ -118,6 +118,16 @@ static int acpi_pm_freeze(void)
return
0
;
return
0
;
}
}
/**
* acpi_pre_suspend - Enable wakeup devices, "freeze" EC and save NVS.
*/
static
int
acpi_pm_pre_suspend
(
void
)
{
acpi_pm_freeze
();
suspend_nvs_save
();
return
0
;
}
/**
/**
* __acpi_pm_prepare - Prepare the platform to enter the target state.
* __acpi_pm_prepare - Prepare the platform to enter the target state.
*
*
...
@@ -127,11 +137,9 @@ static int acpi_pm_freeze(void)
...
@@ -127,11 +137,9 @@ static int acpi_pm_freeze(void)
static
int
__acpi_pm_prepare
(
void
)
static
int
__acpi_pm_prepare
(
void
)
{
{
int
error
=
acpi_sleep_prepare
(
acpi_target_sleep_state
);
int
error
=
acpi_sleep_prepare
(
acpi_target_sleep_state
);
suspend_nvs_save
();
if
(
error
)
if
(
error
)
acpi_target_sleep_state
=
ACPI_STATE_S0
;
acpi_target_sleep_state
=
ACPI_STATE_S0
;
return
error
;
return
error
;
}
}
...
@@ -142,9 +150,8 @@ static int __acpi_pm_prepare(void)
...
@@ -142,9 +150,8 @@ static int __acpi_pm_prepare(void)
static
int
acpi_pm_prepare
(
void
)
static
int
acpi_pm_prepare
(
void
)
{
{
int
error
=
__acpi_pm_prepare
();
int
error
=
__acpi_pm_prepare
();
if
(
!
error
)
if
(
!
error
)
acpi_pm_
freeze
();
acpi_pm_
pre_suspend
();
return
error
;
return
error
;
}
}
...
@@ -159,7 +166,6 @@ static void acpi_pm_finish(void)
...
@@ -159,7 +166,6 @@ static void acpi_pm_finish(void)
{
{
u32
acpi_state
=
acpi_target_sleep_state
;
u32
acpi_state
=
acpi_target_sleep_state
;
suspend_nvs_free
();
acpi_ec_unblock_transactions
();
acpi_ec_unblock_transactions
();
if
(
acpi_state
==
ACPI_STATE_S0
)
if
(
acpi_state
==
ACPI_STATE_S0
)
...
@@ -167,7 +173,7 @@ static void acpi_pm_finish(void)
...
@@ -167,7 +173,7 @@ static void acpi_pm_finish(void)
printk
(
KERN_INFO
PREFIX
"Waking up from system sleep state S%d
\n
"
,
printk
(
KERN_INFO
PREFIX
"Waking up from system sleep state S%d
\n
"
,
acpi_state
);
acpi_state
);
acpi_disable_wakeup_device
(
acpi_state
);
acpi_disable_wakeup_device
s
(
acpi_state
);
acpi_leave_sleep_state
(
acpi_state
);
acpi_leave_sleep_state
(
acpi_state
);
/* reset firmware waking vector */
/* reset firmware waking vector */
...
@@ -181,6 +187,7 @@ static void acpi_pm_finish(void)
...
@@ -181,6 +187,7 @@ static void acpi_pm_finish(void)
*/
*/
static
void
acpi_pm_end
(
void
)
static
void
acpi_pm_end
(
void
)
{
{
suspend_nvs_free
();
/*
/*
* This is necessary in case acpi_pm_finish() is not called during a
* This is necessary in case acpi_pm_finish() is not called during a
* failing transition to a sleep state.
* failing transition to a sleep state.
...
@@ -251,7 +258,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
...
@@ -251,7 +258,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
}
}
local_irq_save
(
flags
);
local_irq_save
(
flags
);
acpi_enable_wakeup_device
(
acpi_state
);
switch
(
acpi_state
)
{
switch
(
acpi_state
)
{
case
ACPI_STATE_S1
:
case
ACPI_STATE_S1
:
barrier
();
barrier
();
...
@@ -297,11 +303,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
...
@@ -297,11 +303,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
return
ACPI_SUCCESS
(
status
)
?
0
:
-
EFAULT
;
return
ACPI_SUCCESS
(
status
)
?
0
:
-
EFAULT
;
}
}
static
void
acpi_suspend_finish
(
void
)
{
acpi_pm_finish
();
}
static
int
acpi_suspend_state_valid
(
suspend_state_t
pm_state
)
static
int
acpi_suspend_state_valid
(
suspend_state_t
pm_state
)
{
{
u32
acpi_state
;
u32
acpi_state
;
...
@@ -323,7 +324,7 @@ static struct platform_suspend_ops acpi_suspend_ops = {
...
@@ -323,7 +324,7 @@ static struct platform_suspend_ops acpi_suspend_ops = {
.
begin
=
acpi_suspend_begin
,
.
begin
=
acpi_suspend_begin
,
.
prepare_late
=
acpi_pm_prepare
,
.
prepare_late
=
acpi_pm_prepare
,
.
enter
=
acpi_suspend_enter
,
.
enter
=
acpi_suspend_enter
,
.
wake
=
acpi_
suspend
_finish
,
.
wake
=
acpi_
pm
_finish
,
.
end
=
acpi_pm_end
,
.
end
=
acpi_pm_end
,
};
};
...
@@ -336,9 +337,9 @@ static struct platform_suspend_ops acpi_suspend_ops = {
...
@@ -336,9 +337,9 @@ static struct platform_suspend_ops acpi_suspend_ops = {
static
int
acpi_suspend_begin_old
(
suspend_state_t
pm_state
)
static
int
acpi_suspend_begin_old
(
suspend_state_t
pm_state
)
{
{
int
error
=
acpi_suspend_begin
(
pm_state
);
int
error
=
acpi_suspend_begin
(
pm_state
);
if
(
!
error
)
if
(
!
error
)
error
=
__acpi_pm_prepare
();
error
=
__acpi_pm_prepare
();
return
error
;
return
error
;
}
}
...
@@ -349,9 +350,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
...
@@ -349,9 +350,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
static
struct
platform_suspend_ops
acpi_suspend_ops_old
=
{
static
struct
platform_suspend_ops
acpi_suspend_ops_old
=
{
.
valid
=
acpi_suspend_state_valid
,
.
valid
=
acpi_suspend_state_valid
,
.
begin
=
acpi_suspend_begin_old
,
.
begin
=
acpi_suspend_begin_old
,
.
prepare_late
=
acpi_pm_
freeze
,
.
prepare_late
=
acpi_pm_
pre_suspend
,
.
enter
=
acpi_suspend_enter
,
.
enter
=
acpi_suspend_enter
,
.
wake
=
acpi_
suspend
_finish
,
.
wake
=
acpi_
pm
_finish
,
.
end
=
acpi_pm_end
,
.
end
=
acpi_pm_end
,
.
recover
=
acpi_pm_finish
,
.
recover
=
acpi_pm_finish
,
};
};
...
@@ -423,16 +424,6 @@ static int acpi_hibernation_begin(void)
...
@@ -423,16 +424,6 @@ static int acpi_hibernation_begin(void)
return
error
;
return
error
;
}
}
static
int
acpi_hibernation_pre_snapshot
(
void
)
{
int
error
=
acpi_pm_prepare
();
if
(
!
error
)
suspend_nvs_save
();
return
error
;
}
static
int
acpi_hibernation_enter
(
void
)
static
int
acpi_hibernation_enter
(
void
)
{
{
acpi_status
status
=
AE_OK
;
acpi_status
status
=
AE_OK
;
...
@@ -441,7 +432,6 @@ static int acpi_hibernation_enter(void)
...
@@ -441,7 +432,6 @@ static int acpi_hibernation_enter(void)
ACPI_FLUSH_CPU_CACHE
();
ACPI_FLUSH_CPU_CACHE
();
local_irq_save
(
flags
);
local_irq_save
(
flags
);
acpi_enable_wakeup_device
(
ACPI_STATE_S4
);
/* This shouldn't return. If it returns, we have a problem */
/* This shouldn't return. If it returns, we have a problem */
status
=
acpi_enter_sleep_state
(
ACPI_STATE_S4
);
status
=
acpi_enter_sleep_state
(
ACPI_STATE_S4
);
/* Reprogram control registers and execute _BFS */
/* Reprogram control registers and execute _BFS */
...
@@ -481,7 +471,7 @@ static void acpi_pm_thaw(void)
...
@@ -481,7 +471,7 @@ static void acpi_pm_thaw(void)
static
struct
platform_hibernation_ops
acpi_hibernation_ops
=
{
static
struct
platform_hibernation_ops
acpi_hibernation_ops
=
{
.
begin
=
acpi_hibernation_begin
,
.
begin
=
acpi_hibernation_begin
,
.
end
=
acpi_pm_end
,
.
end
=
acpi_pm_end
,
.
pre_snapshot
=
acpi_
hibernation_pre_snapshot
,
.
pre_snapshot
=
acpi_
pm_prepare
,
.
finish
=
acpi_pm_finish
,
.
finish
=
acpi_pm_finish
,
.
prepare
=
acpi_pm_prepare
,
.
prepare
=
acpi_pm_prepare
,
.
enter
=
acpi_hibernation_enter
,
.
enter
=
acpi_hibernation_enter
,
...
@@ -517,13 +507,6 @@ static int acpi_hibernation_begin_old(void)
...
@@ -517,13 +507,6 @@ static int acpi_hibernation_begin_old(void)
return
error
;
return
error
;
}
}
static
int
acpi_hibernation_pre_snapshot_old
(
void
)
{
acpi_pm_freeze
();
suspend_nvs_save
();
return
0
;
}
/*
/*
* The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
* The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
* been requested.
* been requested.
...
@@ -531,7 +514,7 @@ static int acpi_hibernation_pre_snapshot_old(void)
...
@@ -531,7 +514,7 @@ static int acpi_hibernation_pre_snapshot_old(void)
static
struct
platform_hibernation_ops
acpi_hibernation_ops_old
=
{
static
struct
platform_hibernation_ops
acpi_hibernation_ops_old
=
{
.
begin
=
acpi_hibernation_begin_old
,
.
begin
=
acpi_hibernation_begin_old
,
.
end
=
acpi_pm_end
,
.
end
=
acpi_pm_end
,
.
pre_snapshot
=
acpi_
hibernation_pre_snapshot_ol
d
,
.
pre_snapshot
=
acpi_
pm_pre_suspen
d
,
.
prepare
=
acpi_pm_freeze
,
.
prepare
=
acpi_pm_freeze
,
.
finish
=
acpi_pm_finish
,
.
finish
=
acpi_pm_finish
,
.
enter
=
acpi_hibernation_enter
,
.
enter
=
acpi_hibernation_enter
,
...
@@ -695,7 +678,6 @@ static void acpi_power_off(void)
...
@@ -695,7 +678,6 @@ static void acpi_power_off(void)
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
printk
(
KERN_DEBUG
"%s called
\n
"
,
__func__
);
printk
(
KERN_DEBUG
"%s called
\n
"
,
__func__
);
local_irq_disable
();
local_irq_disable
();
acpi_enable_wakeup_device
(
ACPI_STATE_S5
);
acpi_enter_sleep_state
(
ACPI_STATE_S5
);
acpi_enter_sleep_state
(
ACPI_STATE_S5
);
}
}
...
...
drivers/acpi/sleep.h
浏览文件 @
f2a66185
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
extern
u8
sleep_states
[];
extern
u8
sleep_states
[];
extern
int
acpi_suspend
(
u32
state
);
extern
int
acpi_suspend
(
u32
state
);
extern
void
acpi_enable_wakeup_device_prep
(
u8
sleep_state
);
extern
void
acpi_enable_wakeup_devices
(
u8
sleep_state
);
extern
void
acpi_enable_wakeup_device
(
u8
sleep_state
);
extern
void
acpi_disable_wakeup_devices
(
u8
sleep_state
);
extern
void
acpi_disable_wakeup_device
(
u8
sleep_state
);
extern
struct
list_head
acpi_wakeup_device_list
;
extern
struct
list_head
acpi_wakeup_device_list
;
extern
struct
mutex
acpi_device_lock
;
extern
struct
mutex
acpi_device_lock
;
drivers/acpi/wakeup.c
浏览文件 @
f2a66185
...
@@ -21,45 +21,17 @@
...
@@ -21,45 +21,17 @@
ACPI_MODULE_NAME
(
"wakeup_devices"
)
ACPI_MODULE_NAME
(
"wakeup_devices"
)
/**
/**
* acpi_enable_wakeup_device
_prep - Prepare wake-up device
s.
* acpi_enable_wakeup_device
s - Enable wake-up device GPE
s.
* @sleep_state: ACPI system sleep state.
* @sleep_state: ACPI system sleep state.
*
*
* Enable all wake-up devices' power, unless the requested system sleep state is
* Enable wakeup device power of devices with the state.enable flag set and set
* too deep.
* the wakeup enable mask bits in the GPE registers that correspond to wakeup
* devices.
*/
*/
void
acpi_enable_wakeup_device
_prep
(
u8
sleep_state
)
void
acpi_enable_wakeup_device
s
(
u8
sleep_state
)
{
{
struct
list_head
*
node
,
*
next
;
struct
list_head
*
node
,
*
next
;
list_for_each_safe
(
node
,
next
,
&
acpi_wakeup_device_list
)
{
struct
acpi_device
*
dev
=
container_of
(
node
,
struct
acpi_device
,
wakeup_list
);
if
(
!
dev
->
wakeup
.
flags
.
valid
||
!
dev
->
wakeup
.
state
.
enabled
||
(
sleep_state
>
(
u32
)
dev
->
wakeup
.
sleep_state
))
continue
;
acpi_enable_wakeup_device_power
(
dev
,
sleep_state
);
}
}
/**
* acpi_enable_wakeup_device - Enable wake-up device GPEs.
* @sleep_state: ACPI system sleep state.
*
* Enable all wake-up devices' GPEs, with the assumption that
* acpi_disable_all_gpes() was executed before, so we don't need to disable any
* GPEs here.
*/
void
acpi_enable_wakeup_device
(
u8
sleep_state
)
{
struct
list_head
*
node
,
*
next
;
/*
* Caution: this routine must be invoked when interrupt is disabled
* Refer ACPI2.0: P212
*/
list_for_each_safe
(
node
,
next
,
&
acpi_wakeup_device_list
)
{
list_for_each_safe
(
node
,
next
,
&
acpi_wakeup_device_list
)
{
struct
acpi_device
*
dev
=
struct
acpi_device
*
dev
=
container_of
(
node
,
struct
acpi_device
,
wakeup_list
);
container_of
(
node
,
struct
acpi_device
,
wakeup_list
);
...
@@ -68,6 +40,9 @@ void acpi_enable_wakeup_device(u8 sleep_state)
...
@@ -68,6 +40,9 @@ void acpi_enable_wakeup_device(u8 sleep_state)
||
sleep_state
>
(
u32
)
dev
->
wakeup
.
sleep_state
)
||
sleep_state
>
(
u32
)
dev
->
wakeup
.
sleep_state
)
continue
;
continue
;
if
(
dev
->
wakeup
.
state
.
enabled
)
acpi_enable_wakeup_device_power
(
dev
,
sleep_state
);
/* The wake-up power should have been enabled already. */
/* The wake-up power should have been enabled already. */
acpi_enable_gpe
(
dev
->
wakeup
.
gpe_device
,
dev
->
wakeup
.
gpe_number
,
acpi_enable_gpe
(
dev
->
wakeup
.
gpe_device
,
dev
->
wakeup
.
gpe_number
,
ACPI_GPE_TYPE_WAKE
);
ACPI_GPE_TYPE_WAKE
);
...
@@ -75,13 +50,10 @@ void acpi_enable_wakeup_device(u8 sleep_state)
...
@@ -75,13 +50,10 @@ void acpi_enable_wakeup_device(u8 sleep_state)
}
}
/**
/**
* acpi_disable_wakeup_device - Disable devices' wakeup capability.
* acpi_disable_wakeup_device
s
- Disable devices' wakeup capability.
* @sleep_state: ACPI system sleep state.
* @sleep_state: ACPI system sleep state.
*
* This function only affects devices with wakeup.state.enabled set, which means
* that it reverses the changes made by acpi_enable_wakeup_device_prep().
*/
*/
void
acpi_disable_wakeup_device
(
u8
sleep_state
)
void
acpi_disable_wakeup_device
s
(
u8
sleep_state
)
{
{
struct
list_head
*
node
,
*
next
;
struct
list_head
*
node
,
*
next
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录