Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
0dbf165e
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
0dbf165e
编写于
2月 19, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/anatop' into regulator-next
上级
19f949f5
ff1ce057
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
0 deletion
+49
-0
Documentation/devicetree/bindings/regulator/anatop-regulator.txt
...tation/devicetree/bindings/regulator/anatop-regulator.txt
+8
-0
drivers/regulator/anatop-regulator.c
drivers/regulator/anatop-regulator.c
+41
-0
未找到文件。
Documentation/devicetree/bindings/regulator/anatop-regulator.txt
浏览文件 @
0dbf165e
...
@@ -9,6 +9,11 @@ Required properties:
...
@@ -9,6 +9,11 @@ Required properties:
- anatop-min-voltage: Minimum voltage of this regulator
- anatop-min-voltage: Minimum voltage of this regulator
- anatop-max-voltage: Maximum voltage of this regulator
- anatop-max-voltage: Maximum voltage of this regulator
Optional properties:
- anatop-delay-reg-offset: Anatop MFD step time register offset
- anatop-delay-bit-shift: Bit shift for the step time register
- anatop-delay-bit-width: Number of bits used in the step time register
Any property defined as part of the core regulator
Any property defined as part of the core regulator
binding, defined in regulator.txt, can also be used.
binding, defined in regulator.txt, can also be used.
...
@@ -23,6 +28,9 @@ Example:
...
@@ -23,6 +28,9 @@ Example:
anatop-reg-offset = <0x140>;
anatop-reg-offset = <0x140>;
anatop-vol-bit-shift = <9>;
anatop-vol-bit-shift = <9>;
anatop-vol-bit-width = <5>;
anatop-vol-bit-width = <5>;
anatop-delay-reg-offset = <0x170>;
anatop-delay-bit-shift = <24>;
anatop-delay-bit-width = <2>;
anatop-min-bit-val = <1>;
anatop-min-bit-val = <1>;
anatop-min-voltage = <725000>;
anatop-min-voltage = <725000>;
anatop-max-voltage = <1300000>;
anatop-max-voltage = <1300000>;
...
...
drivers/regulator/anatop-regulator.c
浏览文件 @
0dbf165e
...
@@ -31,12 +31,18 @@
...
@@ -31,12 +31,18 @@
#include <linux/regulator/driver.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/of_regulator.h>
#define LDO_RAMP_UP_UNIT_IN_CYCLES 64
/* 64 cycles per step */
#define LDO_RAMP_UP_FREQ_IN_MHZ 24
/* cycle based on 24M OSC */
struct
anatop_regulator
{
struct
anatop_regulator
{
const
char
*
name
;
const
char
*
name
;
u32
control_reg
;
u32
control_reg
;
struct
regmap
*
anatop
;
struct
regmap
*
anatop
;
int
vol_bit_shift
;
int
vol_bit_shift
;
int
vol_bit_width
;
int
vol_bit_width
;
u32
delay_reg
;
int
delay_bit_shift
;
int
delay_bit_width
;
int
min_bit_val
;
int
min_bit_val
;
int
min_voltage
;
int
min_voltage
;
int
max_voltage
;
int
max_voltage
;
...
@@ -55,6 +61,32 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
...
@@ -55,6 +61,32 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
return
regulator_set_voltage_sel_regmap
(
reg
,
selector
);
return
regulator_set_voltage_sel_regmap
(
reg
,
selector
);
}
}
static
int
anatop_regmap_set_voltage_time_sel
(
struct
regulator_dev
*
reg
,
unsigned
int
old_sel
,
unsigned
int
new_sel
)
{
struct
anatop_regulator
*
anatop_reg
=
rdev_get_drvdata
(
reg
);
u32
val
;
int
ret
=
0
;
/* check whether need to care about LDO ramp up speed */
if
(
anatop_reg
->
delay_bit_width
&&
new_sel
>
old_sel
)
{
/*
* the delay for LDO ramp up time is
* based on the register setting, we need
* to calculate how many steps LDO need to
* ramp up, and how much delay needed. (us)
*/
regmap_read
(
anatop_reg
->
anatop
,
anatop_reg
->
delay_reg
,
&
val
);
val
=
(
val
>>
anatop_reg
->
delay_bit_shift
)
&
((
1
<<
anatop_reg
->
delay_bit_width
)
-
1
);
ret
=
(
new_sel
-
old_sel
)
*
(
LDO_RAMP_UP_UNIT_IN_CYCLES
<<
val
)
/
LDO_RAMP_UP_FREQ_IN_MHZ
+
1
;
}
return
ret
;
}
static
int
anatop_regmap_get_voltage_sel
(
struct
regulator_dev
*
reg
)
static
int
anatop_regmap_get_voltage_sel
(
struct
regulator_dev
*
reg
)
{
{
struct
anatop_regulator
*
anatop_reg
=
rdev_get_drvdata
(
reg
);
struct
anatop_regulator
*
anatop_reg
=
rdev_get_drvdata
(
reg
);
...
@@ -67,6 +99,7 @@ static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
...
@@ -67,6 +99,7 @@ static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
static
struct
regulator_ops
anatop_rops
=
{
static
struct
regulator_ops
anatop_rops
=
{
.
set_voltage_sel
=
anatop_regmap_set_voltage_sel
,
.
set_voltage_sel
=
anatop_regmap_set_voltage_sel
,
.
set_voltage_time_sel
=
anatop_regmap_set_voltage_time_sel
,
.
get_voltage_sel
=
anatop_regmap_get_voltage_sel
,
.
get_voltage_sel
=
anatop_regmap_get_voltage_sel
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
...
@@ -143,6 +176,14 @@ static int anatop_regulator_probe(struct platform_device *pdev)
...
@@ -143,6 +176,14 @@ static int anatop_regulator_probe(struct platform_device *pdev)
goto
anatop_probe_end
;
goto
anatop_probe_end
;
}
}
/* read LDO ramp up setting, only for core reg */
of_property_read_u32
(
np
,
"anatop-delay-reg-offset"
,
&
sreg
->
delay_reg
);
of_property_read_u32
(
np
,
"anatop-delay-bit-width"
,
&
sreg
->
delay_bit_width
);
of_property_read_u32
(
np
,
"anatop-delay-bit-shift"
,
&
sreg
->
delay_bit_shift
);
rdesc
->
n_voltages
=
(
sreg
->
max_voltage
-
sreg
->
min_voltage
)
/
25000
+
1
rdesc
->
n_voltages
=
(
sreg
->
max_voltage
-
sreg
->
min_voltage
)
/
25000
+
1
+
sreg
->
min_bit_val
;
+
sreg
->
min_bit_val
;
rdesc
->
min_uV
=
sreg
->
min_voltage
;
rdesc
->
min_uV
=
sreg
->
min_voltage
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录