Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
e6120461
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看板
提交
e6120461
编写于
12月 10, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/palmas' into regulator-next
上级
adca48f7
bdc4baac
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
83 deletion
+38
-83
drivers/regulator/palmas-regulator.c
drivers/regulator/palmas-regulator.c
+38
-83
未找到文件。
drivers/regulator/palmas-regulator.c
浏览文件 @
e6120461
...
...
@@ -309,68 +309,22 @@ static int palmas_list_voltage_smps(struct regulator_dev *dev,
int
id
=
rdev_get_id
(
dev
);
int
mult
=
1
;
if
(
!
selector
)
return
0
;
/* Read the multiplier set in VSEL register to return
* the correct voltage.
*/
if
(
pmic
->
range
[
id
])
mult
=
2
;
/* Voltage is (0.49V + (selector * 0.01V)) * RANGE
* as defined in data sheet. RANGE is either x1 or x2
*/
return
(
490000
+
(
selector
*
10000
))
*
mult
;
}
static
int
palmas_get_voltage_smps_sel
(
struct
regulator_dev
*
dev
)
{
struct
palmas_pmic
*
pmic
=
rdev_get_drvdata
(
dev
);
int
id
=
rdev_get_id
(
dev
);
int
selector
;
unsigned
int
reg
;
unsigned
int
addr
;
addr
=
palmas_regs_info
[
id
].
vsel_addr
;
palmas_smps_read
(
pmic
->
palmas
,
addr
,
&
reg
);
selector
=
reg
&
PALMAS_SMPS12_VOLTAGE_VSEL_MASK
;
/* Adjust selector to match list_voltage ranges */
if
((
selector
>
0
)
&&
(
selector
<
6
))
selector
=
6
;
if
(
!
selector
)
selector
=
5
;
if
(
selector
>
121
)
selector
=
121
;
selector
-=
5
;
return
selector
;
}
static
int
palmas_set_voltage_smps_sel
(
struct
regulator_dev
*
dev
,
unsigned
selector
)
{
struct
palmas_pmic
*
pmic
=
rdev_get_drvdata
(
dev
);
int
id
=
rdev_get_id
(
dev
);
unsigned
int
reg
=
0
;
unsigned
int
addr
;
addr
=
palmas_regs_info
[
id
].
vsel_addr
;
/* Make sure we don't change the value of RANGE */
if
(
pmic
->
range
[
id
])
reg
|=
PALMAS_SMPS12_VOLTAGE_RANGE
;
/* Adjust the linux selector into range used in VSEL register */
if
(
selector
)
reg
|=
selector
+
5
;
palmas_smps_write
(
pmic
->
palmas
,
addr
,
reg
);
return
0
;
if
(
selector
==
0
)
return
0
;
else
if
(
selector
<
6
)
return
500000
*
mult
;
else
/* Voltage is linear mapping starting from selector 6,
* volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE
* RANGE is either x1 or x2
*/
return
(
490000
+
((
selector
-
5
)
*
10000
))
*
mult
;
}
static
int
palmas_map_voltage_smps
(
struct
regulator_dev
*
rdev
,
...
...
@@ -386,11 +340,11 @@ static int palmas_map_voltage_smps(struct regulator_dev *rdev,
if
(
pmic
->
range
[
id
])
{
/* RANGE is x2 */
if
(
min_uV
<
1000000
)
min_uV
=
1000000
;
ret
=
DIV_ROUND_UP
(
min_uV
-
1000000
,
20000
)
+
1
;
ret
=
DIV_ROUND_UP
(
min_uV
-
1000000
,
20000
)
+
6
;
}
else
{
/* RANGE is x1 */
if
(
min_uV
<
500000
)
min_uV
=
500000
;
ret
=
DIV_ROUND_UP
(
min_uV
-
500000
,
10000
)
+
1
;
ret
=
DIV_ROUND_UP
(
min_uV
-
500000
,
10000
)
+
6
;
}
/* Map back into a voltage to verify we're still in bounds */
...
...
@@ -407,8 +361,8 @@ static struct regulator_ops palmas_ops_smps = {
.
disable
=
palmas_disable_smps
,
.
set_mode
=
palmas_set_mode_smps
,
.
get_mode
=
palmas_get_mode_smps
,
.
get_voltage_sel
=
palmas_get_voltage_smps_sel
,
.
set_voltage_sel
=
palmas_set_voltage_smps_sel
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
list_voltage
=
palmas_list_voltage_smps
,
.
map_voltage
=
palmas_map_voltage_smps
,
};
...
...
@@ -703,6 +657,14 @@ static int palmas_probe(struct platform_device *pdev)
continue
;
}
/* Initialise sleep/init values from platform data */
if
(
pdata
&&
pdata
->
reg_init
[
id
])
{
reg_init
=
pdata
->
reg_init
[
id
];
ret
=
palmas_smps_init
(
palmas
,
id
,
reg_init
);
if
(
ret
)
goto
err_unregister_regulator
;
}
/* Register the regulators */
pmic
->
desc
[
id
].
name
=
palmas_regs_info
[
id
].
name
;
pmic
->
desc
[
id
].
id
=
id
;
...
...
@@ -723,29 +685,11 @@ static int palmas_probe(struct platform_device *pdev)
pmic
->
desc
[
id
].
uV_step
=
1250000
;
break
;
default:
pmic
->
desc
[
id
].
ops
=
&
palmas_ops_smps
;
pmic
->
desc
[
id
].
n_voltages
=
PALMAS_SMPS_NUM_VOLTAGES
;
}
pmic
->
desc
[
id
].
type
=
REGULATOR_VOLTAGE
;
pmic
->
desc
[
id
].
owner
=
THIS_MODULE
;
/* Initialise sleep/init values from platform data */
if
(
pdata
)
{
reg_init
=
pdata
->
reg_init
[
id
];
if
(
reg_init
)
{
ret
=
palmas_smps_init
(
palmas
,
id
,
reg_init
);
if
(
ret
)
goto
err_unregister_regulator
;
}
}
/*
* read and store the RANGE bit for later use
* This must be done before regulator is probed otherwise
* we error in probe with unsuportable ranges.
*/
if
(
id
!=
PALMAS_REG_SMPS10
)
{
/*
* Read and store the RANGE bit for later use
* This must be done before regulator is probed,
* otherwise we error in probe with unsupportable ranges.
*/
addr
=
palmas_regs_info
[
id
].
vsel_addr
;
ret
=
palmas_smps_read
(
pmic
->
palmas
,
addr
,
&
reg
);
...
...
@@ -753,8 +697,19 @@ static int palmas_probe(struct platform_device *pdev)
goto
err_unregister_regulator
;
if
(
reg
&
PALMAS_SMPS12_VOLTAGE_RANGE
)
pmic
->
range
[
id
]
=
1
;
pmic
->
desc
[
id
].
ops
=
&
palmas_ops_smps
;
pmic
->
desc
[
id
].
n_voltages
=
PALMAS_SMPS_NUM_VOLTAGES
;
pmic
->
desc
[
id
].
vsel_reg
=
PALMAS_BASE_TO_REG
(
PALMAS_SMPS_BASE
,
palmas_regs_info
[
id
].
vsel_addr
);
pmic
->
desc
[
id
].
vsel_mask
=
PALMAS_SMPS12_VOLTAGE_VSEL_MASK
;
}
pmic
->
desc
[
id
].
type
=
REGULATOR_VOLTAGE
;
pmic
->
desc
[
id
].
owner
=
THIS_MODULE
;
if
(
pdata
)
config
.
init_data
=
pdata
->
reg_data
[
id
];
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录