Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6692e432
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看板
提交
6692e432
编写于
7月 02, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
regulator: wm8400: Use linear ranges
Signed-off-by:
N
Mark Brown
<
broonie@linaro.org
>
上级
94d33c02
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
34 deletion
+16
-34
drivers/regulator/wm8400-regulator.c
drivers/regulator/wm8400-regulator.c
+16
-34
未找到文件。
drivers/regulator/wm8400-regulator.c
浏览文件 @
6692e432
...
...
@@ -19,47 +19,21 @@
#include <linux/regulator/driver.h>
#include <linux/mfd/wm8400-private.h>
static
int
wm8400_ldo_list_voltage
(
struct
regulator_dev
*
dev
,
unsigned
selector
)
{
if
(
selector
>
WM8400_LDO1_VSEL_MASK
)
return
-
EINVAL
;
if
(
selector
<
15
)
return
900000
+
(
selector
*
50000
);
else
return
1700000
+
((
selector
-
15
)
*
100000
);
}
static
int
wm8400_ldo_map_voltage
(
struct
regulator_dev
*
dev
,
int
min_uV
,
int
max_uV
)
{
u16
val
;
int
volt
;
if
(
min_uV
<
900000
||
min_uV
>
3300000
)
return
-
EINVAL
;
if
(
min_uV
<
1700000
)
/* Steps of 50mV from 900mV; */
val
=
DIV_ROUND_UP
(
min_uV
-
900000
,
50000
);
else
/* Steps of 100mV from 1700mV */
val
=
DIV_ROUND_UP
(
min_uV
-
1700000
,
100000
)
+
15
;
volt
=
wm8400_ldo_list_voltage
(
dev
,
val
);
if
(
volt
<
min_uV
||
volt
>
max_uV
)
return
-
EINVAL
;
return
val
;
}
static
const
struct
regulator_linear_range
wm8400_ldo_ranges
[]
=
{
{
.
min_uV
=
900000
,
.
max_uV
=
1600000
,
.
min_sel
=
0
,
.
max_sel
=
14
,
.
uV_step
=
50000
},
{
.
min_uV
=
1700000
,
.
max_uV
=
3300000
,
.
min_sel
=
15
,
.
max_sel
=
31
,
.
uV_step
=
100000
},
};
static
struct
regulator_ops
wm8400_ldo_ops
=
{
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
list_voltage
=
wm8400_ldo_list_volta
ge
,
.
list_voltage
=
regulator_list_voltage_linear_ran
ge
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
map_voltage
=
wm8400_ldo_map_volta
ge
,
.
map_voltage
=
regulator_map_voltage_linear_ran
ge
,
};
static
unsigned
int
wm8400_dcdc_get_mode
(
struct
regulator_dev
*
dev
)
...
...
@@ -155,6 +129,8 @@ static struct regulator_desc regulators[] = {
.
enable_reg
=
WM8400_LDO1_CONTROL
,
.
enable_mask
=
WM8400_LDO1_ENA
,
.
n_voltages
=
WM8400_LDO1_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8400_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8400_ldo_ranges
),
.
vsel_reg
=
WM8400_LDO1_CONTROL
,
.
vsel_mask
=
WM8400_LDO1_VSEL_MASK
,
.
type
=
REGULATOR_VOLTAGE
,
...
...
@@ -167,6 +143,8 @@ static struct regulator_desc regulators[] = {
.
enable_reg
=
WM8400_LDO2_CONTROL
,
.
enable_mask
=
WM8400_LDO2_ENA
,
.
n_voltages
=
WM8400_LDO2_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8400_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8400_ldo_ranges
),
.
type
=
REGULATOR_VOLTAGE
,
.
vsel_reg
=
WM8400_LDO2_CONTROL
,
.
vsel_mask
=
WM8400_LDO2_VSEL_MASK
,
...
...
@@ -179,6 +157,8 @@ static struct regulator_desc regulators[] = {
.
enable_reg
=
WM8400_LDO3_CONTROL
,
.
enable_mask
=
WM8400_LDO3_ENA
,
.
n_voltages
=
WM8400_LDO3_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8400_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8400_ldo_ranges
),
.
vsel_reg
=
WM8400_LDO3_CONTROL
,
.
vsel_mask
=
WM8400_LDO3_VSEL_MASK
,
.
type
=
REGULATOR_VOLTAGE
,
...
...
@@ -191,6 +171,8 @@ static struct regulator_desc regulators[] = {
.
enable_reg
=
WM8400_LDO4_CONTROL
,
.
enable_mask
=
WM8400_LDO4_ENA
,
.
n_voltages
=
WM8400_LDO4_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8400_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8400_ldo_ranges
),
.
vsel_reg
=
WM8400_LDO4_CONTROL
,
.
vsel_mask
=
WM8400_LDO4_VSEL_MASK
,
.
type
=
REGULATOR_VOLTAGE
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录