Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
81e439f4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
170
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看板
提交
81e439f4
编写于
10月 24, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
上级
cea64d8c
5df529d4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
83 addition
and
6 deletion
+83
-6
Documentation/devicetree/bindings/regulator/regulator.txt
Documentation/devicetree/bindings/regulator/regulator.txt
+5
-0
drivers/regulator/core.c
drivers/regulator/core.c
+70
-6
drivers/regulator/of_regulator.c
drivers/regulator/of_regulator.c
+6
-0
include/linux/regulator/machine.h
include/linux/regulator/machine.h
+2
-0
未找到文件。
Documentation/devicetree/bindings/regulator/regulator.txt
浏览文件 @
81e439f4
...
...
@@ -14,6 +14,11 @@ Optional properties:
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
For hardwares which support disabling ramp rate, it should be explicitly
intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
rail to reach the target voltage, plus/minus whatever tolerance the board
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
...
...
drivers/regulator/core.c
浏览文件 @
81e439f4
...
...
@@ -919,6 +919,36 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
return
0
;
}
static
int
machine_constraints_current
(
struct
regulator_dev
*
rdev
,
struct
regulation_constraints
*
constraints
)
{
struct
regulator_ops
*
ops
=
rdev
->
desc
->
ops
;
int
ret
;
if
(
!
constraints
->
min_uA
&&
!
constraints
->
max_uA
)
return
0
;
if
(
constraints
->
min_uA
>
constraints
->
max_uA
)
{
rdev_err
(
rdev
,
"Invalid current constraints
\n
"
);
return
-
EINVAL
;
}
if
(
!
ops
->
set_current_limit
||
!
ops
->
get_current_limit
)
{
rdev_warn
(
rdev
,
"Operation of current configuration missing
\n
"
);
return
0
;
}
/* Set regulator current in constraints range */
ret
=
ops
->
set_current_limit
(
rdev
,
constraints
->
min_uA
,
constraints
->
max_uA
);
if
(
ret
<
0
)
{
rdev_err
(
rdev
,
"Failed to set current constraint, %d
\n
"
,
ret
);
return
ret
;
}
return
0
;
}
/**
* set_machine_constraints - sets regulator constraints
* @rdev: regulator source
...
...
@@ -949,6 +979,10 @@ static int set_machine_constraints(struct regulator_dev *rdev,
if
(
ret
!=
0
)
goto
out
;
ret
=
machine_constraints_current
(
rdev
,
rdev
->
constraints
);
if
(
ret
!=
0
)
goto
out
;
/* do we need to setup our suspend state */
if
(
rdev
->
constraints
->
initial_state
)
{
ret
=
suspend_prepare
(
rdev
,
rdev
->
constraints
->
initial_state
);
...
...
@@ -1182,6 +1216,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
static
int
_regulator_get_enable_time
(
struct
regulator_dev
*
rdev
)
{
if
(
rdev
->
constraints
&&
rdev
->
constraints
->
enable_time
)
return
rdev
->
constraints
->
enable_time
;
if
(
!
rdev
->
desc
->
ops
->
enable_time
)
return
rdev
->
desc
->
enable_time
;
return
rdev
->
desc
->
ops
->
enable_time
(
rdev
);
...
...
@@ -1276,7 +1312,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
if
(
id
==
NULL
)
{
pr_err
(
"get() with no identifier
\n
"
);
return
regulator
;
return
ERR_PTR
(
-
EINVAL
)
;
}
if
(
dev
)
...
...
@@ -1733,11 +1769,39 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
* together. */
trace_regulator_enable_delay
(
rdev_get_name
(
rdev
));
if
(
delay
>=
1000
)
{
mdelay
(
delay
/
1000
);
udelay
(
delay
%
1000
);
}
else
if
(
delay
)
{
udelay
(
delay
);
/*
* Delay for the requested amount of time as per the guidelines in:
*
* Documentation/timers/timers-howto.txt
*
* The assumption here is that regulators will never be enabled in
* atomic context and therefore sleeping functions can be used.
*/
if
(
delay
)
{
unsigned
int
ms
=
delay
/
1000
;
unsigned
int
us
=
delay
%
1000
;
if
(
ms
>
0
)
{
/*
* For small enough values, handle super-millisecond
* delays in the usleep_range() call below.
*/
if
(
ms
<
20
)
us
+=
ms
*
1000
;
else
msleep
(
ms
);
}
/*
* Give the scheduler some room to coalesce with any other
* wakeup sources. For delays shorter than 10 us, don't even
* bother setting up high-resolution timers and just busy-
* loop.
*/
if
(
us
>=
10
)
usleep_range
(
us
,
us
+
100
);
else
udelay
(
us
);
}
trace_regulator_enable_complete
(
rdev_get_name
(
rdev
));
...
...
drivers/regulator/of_regulator.c
浏览文件 @
81e439f4
...
...
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
const
__be32
*
min_uA
,
*
max_uA
,
*
ramp_delay
;
struct
property
*
prop
;
struct
regulation_constraints
*
constraints
=
&
(
*
init_data
)
->
constraints
;
int
ret
;
u32
pval
;
constraints
->
name
=
of_get_property
(
np
,
"regulator-name"
,
NULL
);
...
...
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
else
constraints
->
ramp_disable
=
true
;
}
ret
=
of_property_read_u32
(
np
,
"regulator-enable-ramp-delay"
,
&
pval
);
if
(
!
ret
)
constraints
->
enable_time
=
pval
;
}
/**
...
...
include/linux/regulator/machine.h
浏览文件 @
81e439f4
...
...
@@ -95,6 +95,7 @@ struct regulator_state {
* @initial_state: Suspend state to set by default.
* @initial_mode: Mode to set at startup.
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
* @enable_time: Turn-on time of the rails (unit: microseconds)
*/
struct
regulation_constraints
{
...
...
@@ -129,6 +130,7 @@ struct regulation_constraints {
unsigned
int
initial_mode
;
unsigned
int
ramp_delay
;
unsigned
int
enable_time
;
/* constraint flags */
unsigned
always_on
:
1
;
/* regulator never off when system is on */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录