Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
fca8e13f
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,发现更多精彩内容 >>
提交
fca8e13f
编写于
2月 08, 2015
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/dt-cb' into regulator-next
上级
a9877b60
f47531b1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
5 deletion
+43
-5
drivers/regulator/core.c
drivers/regulator/core.c
+17
-5
drivers/regulator/internal.h
drivers/regulator/internal.h
+2
-0
drivers/regulator/of_regulator.c
drivers/regulator/of_regulator.c
+11
-0
include/linux/regulator/driver.h
include/linux/regulator/driver.h
+13
-0
未找到文件。
drivers/regulator/core.c
浏览文件 @
fca8e13f
...
@@ -3561,7 +3561,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
...
@@ -3561,7 +3561,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
/**
/**
* regulator_register - register regulator
* regulator_register - register regulator
* @regulator_desc: regulator to register
* @regulator_desc: regulator to register
* @c
onfi
g: runtime configuration for regulator
* @c
f
g: runtime configuration for regulator
*
*
* Called by regulator drivers to register a regulator.
* Called by regulator drivers to register a regulator.
* Returns a valid pointer to struct regulator_dev on success
* Returns a valid pointer to struct regulator_dev on success
...
@@ -3569,20 +3569,21 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
...
@@ -3569,20 +3569,21 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
*/
*/
struct
regulator_dev
*
struct
regulator_dev
*
regulator_register
(
const
struct
regulator_desc
*
regulator_desc
,
regulator_register
(
const
struct
regulator_desc
*
regulator_desc
,
const
struct
regulator_config
*
c
onfi
g
)
const
struct
regulator_config
*
c
f
g
)
{
{
const
struct
regulation_constraints
*
constraints
=
NULL
;
const
struct
regulation_constraints
*
constraints
=
NULL
;
const
struct
regulator_init_data
*
init_data
;
const
struct
regulator_init_data
*
init_data
;
struct
regulator_config
*
config
=
NULL
;
static
atomic_t
regulator_no
=
ATOMIC_INIT
(
-
1
);
static
atomic_t
regulator_no
=
ATOMIC_INIT
(
-
1
);
struct
regulator_dev
*
rdev
;
struct
regulator_dev
*
rdev
;
struct
device
*
dev
;
struct
device
*
dev
;
int
ret
,
i
;
int
ret
,
i
;
const
char
*
supply
=
NULL
;
const
char
*
supply
=
NULL
;
if
(
regulator_desc
==
NULL
||
c
onfi
g
==
NULL
)
if
(
regulator_desc
==
NULL
||
c
f
g
==
NULL
)
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
dev
=
c
onfi
g
->
dev
;
dev
=
c
f
g
->
dev
;
WARN_ON
(
!
dev
);
WARN_ON
(
!
dev
);
if
(
regulator_desc
->
name
==
NULL
||
regulator_desc
->
ops
==
NULL
)
if
(
regulator_desc
->
name
==
NULL
||
regulator_desc
->
ops
==
NULL
)
...
@@ -3612,7 +3613,17 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -3612,7 +3613,17 @@ regulator_register(const struct regulator_desc *regulator_desc,
if
(
rdev
==
NULL
)
if
(
rdev
==
NULL
)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
init_data
=
regulator_of_get_init_data
(
dev
,
regulator_desc
,
/*
* Duplicate the config so the driver could override it after
* parsing init data.
*/
config
=
kmemdup
(
cfg
,
sizeof
(
*
cfg
),
GFP_KERNEL
);
if
(
config
==
NULL
)
{
kfree
(
rdev
);
return
ERR_PTR
(
-
ENOMEM
);
}
init_data
=
regulator_of_get_init_data
(
dev
,
regulator_desc
,
config
,
&
rdev
->
dev
.
of_node
);
&
rdev
->
dev
.
of_node
);
if
(
!
init_data
)
{
if
(
!
init_data
)
{
init_data
=
config
->
init_data
;
init_data
=
config
->
init_data
;
...
@@ -3735,6 +3746,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -3735,6 +3746,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev_init_debugfs
(
rdev
);
rdev_init_debugfs
(
rdev
);
out:
out:
mutex_unlock
(
&
regulator_list_mutex
);
mutex_unlock
(
&
regulator_list_mutex
);
kfree
(
config
);
return
rdev
;
return
rdev
;
unset_supplies:
unset_supplies:
...
...
drivers/regulator/internal.h
浏览文件 @
fca8e13f
...
@@ -38,11 +38,13 @@ struct regulator {
...
@@ -38,11 +38,13 @@ struct regulator {
#ifdef CONFIG_OF
#ifdef CONFIG_OF
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
const
struct
regulator_desc
*
desc
,
const
struct
regulator_desc
*
desc
,
struct
regulator_config
*
config
,
struct
device_node
**
node
);
struct
device_node
**
node
);
#else
#else
static
inline
struct
regulator_init_data
*
static
inline
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
regulator_of_get_init_data
(
struct
device
*
dev
,
const
struct
regulator_desc
*
desc
,
const
struct
regulator_desc
*
desc
,
struct
regulator_config
*
config
,
struct
device_node
**
node
)
struct
device_node
**
node
)
{
{
return
NULL
;
return
NULL
;
...
...
drivers/regulator/of_regulator.c
浏览文件 @
fca8e13f
...
@@ -270,6 +270,7 @@ EXPORT_SYMBOL_GPL(of_regulator_match);
...
@@ -270,6 +270,7 @@ EXPORT_SYMBOL_GPL(of_regulator_match);
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
const
struct
regulator_desc
*
desc
,
const
struct
regulator_desc
*
desc
,
struct
regulator_config
*
config
,
struct
device_node
**
node
)
struct
device_node
**
node
)
{
{
struct
device_node
*
search
,
*
child
;
struct
device_node
*
search
,
*
child
;
...
@@ -307,6 +308,16 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
...
@@ -307,6 +308,16 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
break
;
break
;
}
}
if
(
desc
->
of_parse_cb
)
{
if
(
desc
->
of_parse_cb
(
child
,
desc
,
config
))
{
dev_err
(
dev
,
"driver callback failed to parse DT for regulator %s
\n
"
,
child
->
name
);
init_data
=
NULL
;
break
;
}
}
of_node_get
(
child
);
of_node_get
(
child
);
*
node
=
child
;
*
node
=
child
;
break
;
break
;
...
...
include/linux/regulator/driver.h
浏览文件 @
fca8e13f
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
struct
regmap
;
struct
regmap
;
struct
regulator_dev
;
struct
regulator_dev
;
struct
regulator_config
;
struct
regulator_init_data
;
struct
regulator_init_data
;
struct
regulator_enable_gpio
;
struct
regulator_enable_gpio
;
...
@@ -205,6 +206,15 @@ enum regulator_type {
...
@@ -205,6 +206,15 @@ enum regulator_type {
* @supply_name: Identifying the regulator supply
* @supply_name: Identifying the regulator supply
* @of_match: Name used to identify regulator in DT.
* @of_match: Name used to identify regulator in DT.
* @regulators_node: Name of node containing regulator definitions in DT.
* @regulators_node: Name of node containing regulator definitions in DT.
* @of_parse_cb: Optional callback called only if of_match is present.
* Will be called for each regulator parsed from DT, during
* init_data parsing.
* The regulator_config passed as argument to the callback will
* be a copy of config passed to regulator_register, valid only
* for this particular call. Callback may freely change the
* config but it cannot store it for later usage.
* Callback should return 0 on success or negative ERRNO
* indicating failure.
* @id: Numerical identifier for the regulator.
* @id: Numerical identifier for the regulator.
* @ops: Regulator operations table.
* @ops: Regulator operations table.
* @irq: Interrupt number for the regulator.
* @irq: Interrupt number for the regulator.
...
@@ -251,6 +261,9 @@ struct regulator_desc {
...
@@ -251,6 +261,9 @@ struct regulator_desc {
const
char
*
supply_name
;
const
char
*
supply_name
;
const
char
*
of_match
;
const
char
*
of_match
;
const
char
*
regulators_node
;
const
char
*
regulators_node
;
int
(
*
of_parse_cb
)(
struct
device_node
*
,
const
struct
regulator_desc
*
,
struct
regulator_config
*
);
int
id
;
int
id
;
bool
continuous_voltage_range
;
bool
continuous_voltage_range
;
unsigned
n_voltages
;
unsigned
n_voltages
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录