Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2a86e8e7
Commit
2a86e8e7
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/da9052' into regulator-next
parents
81e439f4
d706b1e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
+35
-6
drivers/regulator/da9052-regulator.c
drivers/regulator/da9052-regulator.c
+35
-6
No files found.
drivers/regulator/da9052-regulator.c
View file @
2a86e8e7
...
@@ -70,6 +70,7 @@ struct da9052_regulator_info {
...
@@ -70,6 +70,7 @@ struct da9052_regulator_info {
int
step_uV
;
int
step_uV
;
int
min_uV
;
int
min_uV
;
int
max_uV
;
int
max_uV
;
unsigned
char
activate_bit
;
};
};
struct
da9052_regulator
{
struct
da9052_regulator
{
...
@@ -209,6 +210,36 @@ static int da9052_map_voltage(struct regulator_dev *rdev,
...
@@ -209,6 +210,36 @@ static int da9052_map_voltage(struct regulator_dev *rdev,
return
sel
;
return
sel
;
}
}
static
int
da9052_regulator_set_voltage_sel
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
)
{
struct
da9052_regulator
*
regulator
=
rdev_get_drvdata
(
rdev
);
struct
da9052_regulator_info
*
info
=
regulator
->
info
;
int
id
=
rdev_get_id
(
rdev
);
int
ret
;
ret
=
da9052_reg_update
(
regulator
->
da9052
,
rdev
->
desc
->
vsel_reg
,
rdev
->
desc
->
vsel_mask
,
selector
);
if
(
ret
<
0
)
return
ret
;
/* Some LDOs and DCDCs are DVC controlled which requires enabling of
* the activate bit to implment the changes on the output.
*/
switch
(
id
)
{
case
DA9052_ID_BUCK1
:
case
DA9052_ID_BUCK2
:
case
DA9052_ID_BUCK3
:
case
DA9052_ID_LDO2
:
case
DA9052_ID_LDO3
:
ret
=
da9052_reg_update
(
regulator
->
da9052
,
DA9052_SUPPLY_REG
,
info
->
activate_bit
,
info
->
activate_bit
);
break
;
}
return
ret
;
}
static
struct
regulator_ops
da9052_dcdc_ops
=
{
static
struct
regulator_ops
da9052_dcdc_ops
=
{
.
get_current_limit
=
da9052_dcdc_get_current_limit
,
.
get_current_limit
=
da9052_dcdc_get_current_limit
,
.
set_current_limit
=
da9052_dcdc_set_current_limit
,
.
set_current_limit
=
da9052_dcdc_set_current_limit
,
...
@@ -216,7 +247,7 @@ static struct regulator_ops da9052_dcdc_ops = {
...
@@ -216,7 +247,7 @@ static struct regulator_ops da9052_dcdc_ops = {
.
list_voltage
=
da9052_list_voltage
,
.
list_voltage
=
da9052_list_voltage
,
.
map_voltage
=
da9052_map_voltage
,
.
map_voltage
=
da9052_map_voltage
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_sel
=
da9052_regulator_set_voltage_sel
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
regulator_enable_regmap
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
disable
=
regulator_disable_regmap
,
...
@@ -226,7 +257,7 @@ static struct regulator_ops da9052_ldo_ops = {
...
@@ -226,7 +257,7 @@ static struct regulator_ops da9052_ldo_ops = {
.
list_voltage
=
da9052_list_voltage
,
.
list_voltage
=
da9052_list_voltage
,
.
map_voltage
=
da9052_map_voltage
,
.
map_voltage
=
da9052_map_voltage
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_sel
=
da9052_regulator_set_voltage_sel
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable
=
regulator_enable_regmap
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
regulator_disable_regmap
,
.
disable
=
regulator_disable_regmap
,
...
@@ -243,14 +274,13 @@ static struct regulator_ops da9052_ldo_ops = {
...
@@ -243,14 +274,13 @@ static struct regulator_ops da9052_ldo_ops = {
.owner = THIS_MODULE,\
.owner = THIS_MODULE,\
.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.vsel_mask = (1 << (sbits)) - 1,\
.vsel_mask = (1 << (sbits)) - 1,\
.apply_reg = DA9052_SUPPLY_REG, \
.apply_bit = (abits), \
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_mask = 1 << (ebits),\
.enable_mask = 1 << (ebits),\
},\
},\
.min_uV = (min) * 1000,\
.min_uV = (min) * 1000,\
.max_uV = (max) * 1000,\
.max_uV = (max) * 1000,\
.step_uV = (step) * 1000,\
.step_uV = (step) * 1000,\
.activate_bit = (abits),\
}
}
#define DA9052_DCDC(_id, step, min, max, sbits, ebits, abits) \
#define DA9052_DCDC(_id, step, min, max, sbits, ebits, abits) \
...
@@ -264,14 +294,13 @@ static struct regulator_ops da9052_ldo_ops = {
...
@@ -264,14 +294,13 @@ static struct regulator_ops da9052_ldo_ops = {
.owner = THIS_MODULE,\
.owner = THIS_MODULE,\
.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.vsel_mask = (1 << (sbits)) - 1,\
.vsel_mask = (1 << (sbits)) - 1,\
.apply_reg = DA9052_SUPPLY_REG, \
.apply_bit = (abits), \
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_mask = 1 << (ebits),\
.enable_mask = 1 << (ebits),\
},\
},\
.min_uV = (min) * 1000,\
.min_uV = (min) * 1000,\
.max_uV = (max) * 1000,\
.max_uV = (max) * 1000,\
.step_uV = (step) * 1000,\
.step_uV = (step) * 1000,\
.activate_bit = (abits),\
}
}
static
struct
da9052_regulator_info
da9052_regulator_info
[]
=
{
static
struct
da9052_regulator_info
da9052_regulator_info
[]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment