Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
9199addf
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看板
提交
9199addf
编写于
12月 10, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/max77686' into regulator-next
上级
0d2cff8b
38d34035
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
155 addition
and
9 deletion
+155
-9
drivers/regulator/max77686.c
drivers/regulator/max77686.c
+155
-9
未找到文件。
drivers/regulator/max77686.c
浏览文件 @
9199addf
...
...
@@ -67,8 +67,94 @@ enum max77686_ramp_rate {
struct
max77686_data
{
struct
regulator_dev
*
rdev
[
MAX77686_REGULATORS
];
unsigned
int
opmode
[
MAX77686_REGULATORS
];
};
/* Some BUCKS supports Normal[ON/OFF] mode during suspend */
static
int
max77686_buck_set_suspend_disable
(
struct
regulator_dev
*
rdev
)
{
unsigned
int
val
;
struct
max77686_data
*
max77686
=
rdev_get_drvdata
(
rdev
);
if
(
rdev
->
desc
->
id
==
MAX77686_BUCK1
)
val
=
0x1
;
else
val
=
0x1
<<
MAX77686_OPMODE_BUCK234_SHIFT
;
max77686
->
opmode
[
rdev
->
desc
->
id
]
=
val
;
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
val
);
}
/* Some LDOs supports [LPM/Normal]ON mode during suspend state */
static
int
max77686_set_suspend_mode
(
struct
regulator_dev
*
rdev
,
unsigned
int
mode
)
{
struct
max77686_data
*
max77686
=
rdev_get_drvdata
(
rdev
);
unsigned
int
val
;
/* BUCK[5-9] doesn't support this feature */
if
(
rdev
->
desc
->
id
>=
MAX77686_BUCK5
)
return
0
;
switch
(
mode
)
{
case
REGULATOR_MODE_IDLE
:
/* ON in LP Mode */
val
=
0x2
<<
MAX77686_OPMODE_SHIFT
;
break
;
case
REGULATOR_MODE_NORMAL
:
/* ON in Normal Mode */
val
=
0x3
<<
MAX77686_OPMODE_SHIFT
;
break
;
default:
pr_warn
(
"%s: regulator_suspend_mode : 0x%x not supported
\n
"
,
rdev
->
desc
->
name
,
mode
);
return
-
EINVAL
;
}
max77686
->
opmode
[
rdev
->
desc
->
id
]
=
val
;
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
val
);
}
/* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */
static
int
max77686_ldo_set_suspend_mode
(
struct
regulator_dev
*
rdev
,
unsigned
int
mode
)
{
unsigned
int
val
;
struct
max77686_data
*
max77686
=
rdev_get_drvdata
(
rdev
);
switch
(
mode
)
{
case
REGULATOR_MODE_STANDBY
:
/* switch off */
val
=
0x1
<<
MAX77686_OPMODE_SHIFT
;
break
;
case
REGULATOR_MODE_IDLE
:
/* ON in LP Mode */
val
=
0x2
<<
MAX77686_OPMODE_SHIFT
;
break
;
case
REGULATOR_MODE_NORMAL
:
/* ON in Normal Mode */
val
=
0x3
<<
MAX77686_OPMODE_SHIFT
;
break
;
default:
pr_warn
(
"%s: regulator_suspend_mode : 0x%x not supported
\n
"
,
rdev
->
desc
->
name
,
mode
);
return
-
EINVAL
;
}
max77686
->
opmode
[
rdev
->
desc
->
id
]
=
val
;
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
val
);
}
static
int
max77686_enable
(
struct
regulator_dev
*
rdev
)
{
struct
max77686_data
*
max77686
=
rdev_get_drvdata
(
rdev
);
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
max77686
->
opmode
[
rdev
->
desc
->
id
]);
}
static
int
max77686_set_ramp_delay
(
struct
regulator_dev
*
rdev
,
int
ramp_delay
)
{
unsigned
int
ramp_value
=
RAMP_RATE_NO_CTRL
;
...
...
@@ -98,23 +184,49 @@ static struct regulator_ops max77686_ops = {
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
regulator_enable_regmap
,
.
enable
=
max77686_enable
,
.
disable
=
regulator_disable_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_time_sel
=
regulator_set_voltage_time_sel
,
.
set_suspend_mode
=
max77686_set_suspend_mode
,
};
static
struct
regulator_ops
max77686_ldo_ops
=
{
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
max77686_enable
,
.
disable
=
regulator_disable_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_time_sel
=
regulator_set_voltage_time_sel
,
.
set_suspend_mode
=
max77686_ldo_set_suspend_mode
,
};
static
struct
regulator_ops
max77686_buck1_ops
=
{
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
max77686_enable
,
.
disable
=
regulator_disable_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_time_sel
=
regulator_set_voltage_time_sel
,
.
set_suspend_disable
=
max77686_buck_set_suspend_disable
,
};
static
struct
regulator_ops
max77686_buck_dvs_ops
=
{
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
regulator_enable_regmap
,
.
enable
=
max77686_enable
,
.
disable
=
regulator_disable_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_time_sel
=
regulator_set_voltage_time_sel
,
.
set_ramp_delay
=
max77686_set_ramp_delay
,
.
set_suspend_disable
=
max77686_buck_set_suspend_disable
,
};
#define regulator_desc_ldo(num) { \
...
...
@@ -133,7 +245,39 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \
}
#define regulator_desc_lpm_ldo(num) { \
.name = "LDO"#num, \
.id = MAX77686_LDO##num, \
.ops = &max77686_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_MINUV, \
.uV_step = MAX77686_LDO_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
.enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \
}
#define regulator_desc_ldo_low(num) { \
.name = "LDO"#num, \
.id = MAX77686_LDO##num, \
.ops = &max77686_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_LOW_MINUV, \
.uV_step = MAX77686_LDO_LOW_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
.enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \
}
#define regulator_desc_ldo1_low(num) { \
.name = "LDO"#num, \
.id = MAX77686_LDO##num, \
.ops = &max77686_ops, \
...
...
@@ -167,7 +311,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
#define regulator_desc_buck1(num) { \
.name = "BUCK"#num, \
.id = MAX77686_BUCK##num, \
.ops = &max77686_ops, \
.ops = &max77686_
buck1_
ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = MAX77686_BUCK_MINUV, \
...
...
@@ -197,7 +341,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
}
static
struct
regulator_desc
regulators
[]
=
{
regulator_desc_ldo_low
(
1
),
regulator_desc_ldo
1
_low
(
1
),
regulator_desc_ldo_low
(
2
),
regulator_desc_ldo
(
3
),
regulator_desc_ldo
(
4
),
...
...
@@ -206,13 +350,13 @@ static struct regulator_desc regulators[] = {
regulator_desc_ldo_low
(
7
),
regulator_desc_ldo_low
(
8
),
regulator_desc_ldo
(
9
),
regulator_desc_ldo
(
10
),
regulator_desc_ldo
(
11
),
regulator_desc_ldo
(
12
),
regulator_desc_l
pm_l
do
(
10
),
regulator_desc_l
pm_l
do
(
11
),
regulator_desc_l
pm_l
do
(
12
),
regulator_desc_ldo
(
13
),
regulator_desc_ldo
(
14
),
regulator_desc_l
pm_l
do
(
14
),
regulator_desc_ldo_low
(
15
),
regulator_desc_ldo
(
16
),
regulator_desc_l
pm_l
do
(
16
),
regulator_desc_ldo
(
17
),
regulator_desc_ldo
(
18
),
regulator_desc_ldo
(
19
),
...
...
@@ -314,12 +458,14 @@ static int max77686_pmic_probe(struct platform_device *pdev)
config
.
dev
=
&
pdev
->
dev
;
config
.
regmap
=
iodev
->
regmap
;
config
.
driver_data
=
max77686
;
platform_set_drvdata
(
pdev
,
max77686
);
for
(
i
=
0
;
i
<
MAX77686_REGULATORS
;
i
++
)
{
config
.
init_data
=
pdata
->
regulators
[
i
].
initdata
;
config
.
of_node
=
pdata
->
regulators
[
i
].
of_node
;
max77686
->
opmode
[
i
]
=
regulators
[
i
].
enable_mask
;
max77686
->
rdev
[
i
]
=
regulator_register
(
&
regulators
[
i
],
&
config
);
if
(
IS_ERR
(
max77686
->
rdev
[
i
]))
{
ret
=
PTR_ERR
(
max77686
->
rdev
[
i
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录