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
5ee6c728
Commit
5ee6c728
authored
Jul 01, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/max8973' into regulator-next
parents
7455c7f4
f986c356
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
17 deletions
+53
-17
Documentation/devicetree/bindings/regulator/max8973-regulator.txt
...ation/devicetree/bindings/regulator/max8973-regulator.txt
+21
-0
drivers/regulator/max8973-regulator.c
drivers/regulator/max8973-regulator.c
+32
-17
No files found.
Documentation/devicetree/bindings/regulator/max8973-regulator.txt
0 → 100644
View file @
5ee6c728
* Maxim MAX8973 Voltage Regulator
Required properties:
- compatible: must be "maxim,max8973"
- reg: the i2c slave address of the regulator. It should be 0x1b.
Any standard regulator properties can be used to configure the single max8973
DCDC.
Example:
max8973@1b {
compatible = "maxim,max8973";
reg = <0x1b>;
regulator-min-microvolt = <935000>;
regulator-max-microvolt = <1200000>;
regulator-boot-on;
regulator-always-on;
};
drivers/regulator/max8973-regulator.c
View file @
5ee6c728
...
...
@@ -26,10 +26,12 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/max8973-regulator.h>
#include <linux/regulator/of_regulator.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/slab.h>
...
...
@@ -100,6 +102,7 @@ struct max8973_chip {
int
curr_vout_reg
;
int
curr_gpio_val
;
bool
valid_dvs_gpio
;
struct
regulator_ops
ops
;
};
/*
...
...
@@ -240,7 +243,7 @@ static unsigned int max8973_dcdc_get_mode(struct regulator_dev *rdev)
REGULATOR_MODE_FAST
:
REGULATOR_MODE_NORMAL
;
}
static
struct
regulator_ops
max8973_dcdc_ops
=
{
static
const
struct
regulator_ops
max8973_dcdc_ops
=
{
.
get_voltage_sel
=
max8973_dcdc_get_voltage_sel
,
.
set_voltage_sel
=
max8973_dcdc_set_voltage_sel
,
.
list_voltage
=
regulator_list_voltage_linear
,
...
...
@@ -369,7 +372,8 @@ static int max8973_probe(struct i2c_client *client,
int
ret
;
pdata
=
client
->
dev
.
platform_data
;
if
(
!
pdata
)
{
if
(
!
pdata
&&
!
client
->
dev
.
of_node
)
{
dev_err
(
&
client
->
dev
,
"No Platform data"
);
return
-
EIO
;
}
...
...
@@ -388,30 +392,36 @@ static int max8973_probe(struct i2c_client *client,
}
i2c_set_clientdata
(
client
,
max
);
max
->
ops
=
max8973_dcdc_ops
;
max
->
dev
=
&
client
->
dev
;
max
->
desc
.
name
=
id
->
name
;
max
->
desc
.
id
=
0
;
max
->
desc
.
ops
=
&
max
8973_dcdc_
ops
;
max
->
desc
.
ops
=
&
max
->
ops
;
max
->
desc
.
type
=
REGULATOR_VOLTAGE
;
max
->
desc
.
owner
=
THIS_MODULE
;
max
->
desc
.
min_uV
=
MAX8973_MIN_VOLATGE
;
max
->
desc
.
uV_step
=
MAX8973_VOLATGE_STEP
;
max
->
desc
.
n_voltages
=
MAX8973_BUCK_N_VOLTAGE
;
if
(
!
pdata
->
enable_ext_control
)
{
if
(
!
pdata
||
!
pdata
->
enable_ext_control
)
{
max
->
desc
.
enable_reg
=
MAX8973_VOUT
;
max
->
desc
.
enable_mask
=
MAX8973_VOUT_ENABLE
;
max8973_dcdc_ops
.
enable
=
regulator_enable_regmap
;
max8973_dcdc_ops
.
disable
=
regulator_disable_regmap
;
max8973_dcdc_ops
.
is_enabled
=
regulator_is_enabled_regmap
;
max
->
ops
.
enable
=
regulator_enable_regmap
;
max
->
ops
.
disable
=
regulator_disable_regmap
;
max
->
ops
.
is_enabled
=
regulator_is_enabled_regmap
;
}
if
(
pdata
)
{
max
->
dvs_gpio
=
pdata
->
dvs_gpio
;
max
->
enable_external_control
=
pdata
->
enable_ext_control
;
max
->
curr_gpio_val
=
pdata
->
dvs_def_state
;
max
->
curr_vout_reg
=
MAX8973_VOUT
+
pdata
->
dvs_def_state
;
}
else
{
max
->
dvs_gpio
=
-
EINVAL
;
max
->
curr_vout_reg
=
MAX8973_VOUT
;
}
max
->
enable_external_control
=
pdata
->
enable_ext_control
;
max
->
dvs_gpio
=
pdata
->
dvs_gpio
;
max
->
curr_gpio_val
=
pdata
->
dvs_def_state
;
max
->
curr_vout_reg
=
MAX8973_VOUT
+
pdata
->
dvs_def_state
;
max
->
lru_index
[
0
]
=
max
->
curr_vout_reg
;
max
->
valid_dvs_gpio
=
false
;
if
(
gpio_is_valid
(
max
->
dvs_gpio
))
{
int
gpio_flags
;
...
...
@@ -437,16 +447,21 @@ static int max8973_probe(struct i2c_client *client,
max
->
lru_index
[
i
]
=
i
;
max
->
lru_index
[
0
]
=
max
->
curr_vout_reg
;
max
->
lru_index
[
max
->
curr_vout_reg
]
=
0
;
}
else
{
max
->
valid_dvs_gpio
=
false
;
}
ret
=
max8973_init_dcdc
(
max
,
pdata
);
if
(
ret
<
0
)
{
dev_err
(
max
->
dev
,
"Max8973 Init failed, err = %d
\n
"
,
ret
);
return
ret
;
if
(
pdata
)
{
ret
=
max8973_init_dcdc
(
max
,
pdata
);
if
(
ret
<
0
)
{
dev_err
(
max
->
dev
,
"Max8973 Init failed, err = %d
\n
"
,
ret
);
return
ret
;
}
}
config
.
dev
=
&
client
->
dev
;
config
.
init_data
=
pdata
->
reg_init_data
;
config
.
init_data
=
pdata
?
pdata
->
reg_init_data
:
of_get_regulator_init_data
(
&
client
->
dev
,
client
->
dev
.
of_node
);
config
.
driver_data
=
max
;
config
.
of_node
=
client
->
dev
.
of_node
;
config
.
regmap
=
max
->
regmap
;
...
...
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