Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c36a1cdf
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
c36a1cdf
编写于
7月 02, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
regulator: wm8350: Convert to use linear ranges
Signed-off-by:
N
Mark Brown
<
broonie@linaro.org
>
上级
5ff26a14
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
38 deletion
+17
-38
drivers/regulator/wm8350-regulator.c
drivers/regulator/wm8350-regulator.c
+17
-38
未找到文件。
drivers/regulator/wm8350-regulator.c
浏览文件 @
c36a1cdf
...
...
@@ -542,41 +542,12 @@ static int wm8350_dcdc_set_suspend_mode(struct regulator_dev *rdev,
return
0
;
}
static
int
wm8350_ldo_list_voltage
(
struct
regulator_dev
*
rdev
,
unsigned
selector
)
{
if
(
selector
>
WM8350_LDO1_VSEL_MASK
)
return
-
EINVAL
;
if
(
selector
<
16
)
return
(
selector
*
50000
)
+
900000
;
else
return
((
selector
-
16
)
*
100000
)
+
1800000
;
}
static
int
wm8350_ldo_map_voltage
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
)
{
int
volt
,
sel
;
int
min_mV
=
min_uV
/
1000
;
int
max_mV
=
max_uV
/
1000
;
if
(
min_mV
<
900
||
min_mV
>
3300
)
return
-
EINVAL
;
if
(
max_mV
<
900
||
max_mV
>
3300
)
return
-
EINVAL
;
if
(
min_mV
<
1800
)
/* step size is 50mV < 1800mV */
sel
=
DIV_ROUND_UP
(
min_uV
-
900
,
50
);
else
/* step size is 100mV > 1800mV */
sel
=
DIV_ROUND_UP
(
min_uV
-
1800
,
100
)
+
16
;
volt
=
wm8350_ldo_list_voltage
(
rdev
,
sel
);
if
(
volt
<
min_uV
||
volt
>
max_uV
)
return
-
EINVAL
;
return
sel
;
}
static
const
struct
regulator_linear_range
wm8350_ldo_ranges
[]
=
{
{
.
min_uV
=
900000
,
.
max_uV
=
1750000
,
.
min_sel
=
0
,
.
max_sel
=
15
,
.
uV_step
=
50000
},
{
.
min_uV
=
1800000
,
.
max_uV
=
3300000
,
.
min_sel
=
16
,
.
max_sel
=
31
,
.
uV_step
=
100000
},
};
static
int
wm8350_ldo_set_suspend_voltage
(
struct
regulator_dev
*
rdev
,
int
uV
)
{
...
...
@@ -603,7 +574,7 @@ static int wm8350_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV)
return
-
EINVAL
;
}
sel
=
wm8350_ldo_map_volta
ge
(
rdev
,
uV
,
uV
);
sel
=
regulator_map_voltage_linear_ran
ge
(
rdev
,
uV
,
uV
);
if
(
sel
<
0
)
return
-
EINVAL
;
...
...
@@ -998,10 +969,10 @@ static struct regulator_ops wm8350_dcdc2_5_ops = {
};
static
struct
regulator_ops
wm8350_ldo_ops
=
{
.
map_voltage
=
wm8350_ldo_map_volta
ge
,
.
map_voltage
=
regulator_map_voltage_linear_ran
ge
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
list_voltage
=
wm8350_ldo_list_volta
ge
,
.
list_voltage
=
regulator_list_voltage_linear_ran
ge
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
regulator_is_enabled_regmap
,
...
...
@@ -1108,6 +1079,8 @@ static const struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
.
irq
=
WM8350_IRQ_UV_LDO1
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
WM8350_LDO1_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8350_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8350_ldo_ranges
),
.
vsel_reg
=
WM8350_LDO1_CONTROL
,
.
vsel_mask
=
WM8350_LDO1_VSEL_MASK
,
.
enable_reg
=
WM8350_DCDC_LDO_REQUESTED
,
...
...
@@ -1121,6 +1094,8 @@ static const struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
.
irq
=
WM8350_IRQ_UV_LDO2
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
WM8350_LDO2_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8350_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8350_ldo_ranges
),
.
vsel_reg
=
WM8350_LDO2_CONTROL
,
.
vsel_mask
=
WM8350_LDO2_VSEL_MASK
,
.
enable_reg
=
WM8350_DCDC_LDO_REQUESTED
,
...
...
@@ -1134,6 +1109,8 @@ static const struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
.
irq
=
WM8350_IRQ_UV_LDO3
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
WM8350_LDO3_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8350_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8350_ldo_ranges
),
.
vsel_reg
=
WM8350_LDO3_CONTROL
,
.
vsel_mask
=
WM8350_LDO3_VSEL_MASK
,
.
enable_reg
=
WM8350_DCDC_LDO_REQUESTED
,
...
...
@@ -1147,6 +1124,8 @@ static const struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {
.
irq
=
WM8350_IRQ_UV_LDO4
,
.
type
=
REGULATOR_VOLTAGE
,
.
n_voltages
=
WM8350_LDO4_VSEL_MASK
+
1
,
.
linear_ranges
=
wm8350_ldo_ranges
,
.
n_linear_ranges
=
ARRAY_SIZE
(
wm8350_ldo_ranges
),
.
vsel_reg
=
WM8350_LDO4_CONTROL
,
.
vsel_mask
=
WM8350_LDO4_VSEL_MASK
,
.
enable_reg
=
WM8350_DCDC_LDO_REQUESTED
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录