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
1d60a4cf
Commit
1d60a4cf
authored
Apr 28, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/enable-invert' into v3.9-rc8
parents
0e340ce1
ea88b132
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
69 deletions
+33
-69
drivers/regulator/88pm8607.c
drivers/regulator/88pm8607.c
+4
-32
drivers/regulator/core.c
drivers/regulator/core.c
+20
-4
drivers/regulator/max8649.c
drivers/regulator/max8649.c
+6
-33
include/linux/regulator/driver.h
include/linux/regulator/driver.h
+3
-0
No files found.
drivers/regulator/88pm8607.c
View file @
1d60a4cf
...
@@ -220,35 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
...
@@ -220,35 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
return
ret
;
return
ret
;
}
}
static
int
pm8606_preg_enable
(
struct
regulator_dev
*
rdev
)
{
struct
pm8607_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
return
pm860x_set_bits
(
info
->
i2c
,
rdev
->
desc
->
enable_reg
,
1
<<
rdev
->
desc
->
enable_mask
,
0
);
}
static
int
pm8606_preg_disable
(
struct
regulator_dev
*
rdev
)
{
struct
pm8607_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
return
pm860x_set_bits
(
info
->
i2c
,
rdev
->
desc
->
enable_reg
,
1
<<
rdev
->
desc
->
enable_mask
,
1
<<
rdev
->
desc
->
enable_mask
);
}
static
int
pm8606_preg_is_enabled
(
struct
regulator_dev
*
rdev
)
{
struct
pm8607_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
int
ret
;
ret
=
pm860x_reg_read
(
info
->
i2c
,
rdev
->
desc
->
enable_reg
);
if
(
ret
<
0
)
return
ret
;
return
!
((
unsigned
char
)
ret
&
(
1
<<
rdev
->
desc
->
enable_mask
));
}
static
struct
regulator_ops
pm8607_regulator_ops
=
{
static
struct
regulator_ops
pm8607_regulator_ops
=
{
.
list_voltage
=
pm8607_list_voltage
,
.
list_voltage
=
pm8607_list_voltage
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
...
@@ -259,9 +230,9 @@ static struct regulator_ops pm8607_regulator_ops = {
...
@@ -259,9 +230,9 @@ static struct regulator_ops pm8607_regulator_ops = {
};
};
static
struct
regulator_ops
pm8606_preg_ops
=
{
static
struct
regulator_ops
pm8606_preg_ops
=
{
.
enable
=
pm8606_preg_enable
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
pm8606_preg_disable
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
pm8606_preg_is_enabled
,
.
is_enabled
=
regulator_is_enabled_regmap
,
};
};
#define PM8606_PREG(ereg, ebit) \
#define PM8606_PREG(ereg, ebit) \
...
@@ -274,6 +245,7 @@ static struct regulator_ops pm8606_preg_ops = {
...
@@ -274,6 +245,7 @@ static struct regulator_ops pm8606_preg_ops = {
.owner = THIS_MODULE, \
.owner = THIS_MODULE, \
.enable_reg = PM8606_##ereg, \
.enable_reg = PM8606_##ereg, \
.enable_mask = (ebit), \
.enable_mask = (ebit), \
.enable_is_inverted = true, \
}, \
}, \
}
}
...
...
drivers/regulator/core.c
View file @
1d60a4cf
...
@@ -1803,7 +1803,10 @@ int regulator_is_enabled_regmap(struct regulator_dev *rdev)
...
@@ -1803,7 +1803,10 @@ int regulator_is_enabled_regmap(struct regulator_dev *rdev)
if
(
ret
!=
0
)
if
(
ret
!=
0
)
return
ret
;
return
ret
;
return
(
val
&
rdev
->
desc
->
enable_mask
)
!=
0
;
if
(
rdev
->
desc
->
enable_is_inverted
)
return
(
val
&
rdev
->
desc
->
enable_mask
)
==
0
;
else
return
(
val
&
rdev
->
desc
->
enable_mask
)
!=
0
;
}
}
EXPORT_SYMBOL_GPL
(
regulator_is_enabled_regmap
);
EXPORT_SYMBOL_GPL
(
regulator_is_enabled_regmap
);
...
@@ -1818,9 +1821,15 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
...
@@ -1818,9 +1821,15 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
*/
*/
int
regulator_enable_regmap
(
struct
regulator_dev
*
rdev
)
int
regulator_enable_regmap
(
struct
regulator_dev
*
rdev
)
{
{
unsigned
int
val
;
if
(
rdev
->
desc
->
enable_is_inverted
)
val
=
0
;
else
val
=
rdev
->
desc
->
enable_mask
;
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
rdev
->
desc
->
enable_mask
,
val
);
rdev
->
desc
->
enable_mask
);
}
}
EXPORT_SYMBOL_GPL
(
regulator_enable_regmap
);
EXPORT_SYMBOL_GPL
(
regulator_enable_regmap
);
...
@@ -1835,8 +1844,15 @@ EXPORT_SYMBOL_GPL(regulator_enable_regmap);
...
@@ -1835,8 +1844,15 @@ EXPORT_SYMBOL_GPL(regulator_enable_regmap);
*/
*/
int
regulator_disable_regmap
(
struct
regulator_dev
*
rdev
)
int
regulator_disable_regmap
(
struct
regulator_dev
*
rdev
)
{
{
unsigned
int
val
;
if
(
rdev
->
desc
->
enable_is_inverted
)
val
=
rdev
->
desc
->
enable_mask
;
else
val
=
0
;
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
return
regmap_update_bits
(
rdev
->
regmap
,
rdev
->
desc
->
enable_reg
,
rdev
->
desc
->
enable_mask
,
0
);
rdev
->
desc
->
enable_mask
,
val
);
}
}
EXPORT_SYMBOL_GPL
(
regulator_disable_regmap
);
EXPORT_SYMBOL_GPL
(
regulator_disable_regmap
);
...
...
drivers/regulator/max8649.c
View file @
1d60a4cf
...
@@ -60,36 +60,6 @@ struct max8649_regulator_info {
...
@@ -60,36 +60,6 @@ struct max8649_regulator_info {
unsigned
ramp_down
:
1
;
unsigned
ramp_down
:
1
;
};
};
/* EN_PD means pulldown on EN input */
static
int
max8649_enable
(
struct
regulator_dev
*
rdev
)
{
struct
max8649_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
return
regmap_update_bits
(
info
->
regmap
,
MAX8649_CONTROL
,
MAX8649_EN_PD
,
0
);
}
/*
* Applied internal pulldown resistor on EN input pin.
* If pulldown EN pin outside, it would be better.
*/
static
int
max8649_disable
(
struct
regulator_dev
*
rdev
)
{
struct
max8649_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
return
regmap_update_bits
(
info
->
regmap
,
MAX8649_CONTROL
,
MAX8649_EN_PD
,
MAX8649_EN_PD
);
}
static
int
max8649_is_enabled
(
struct
regulator_dev
*
rdev
)
{
struct
max8649_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
unsigned
int
val
;
int
ret
;
ret
=
regmap_read
(
info
->
regmap
,
MAX8649_CONTROL
,
&
val
);
if
(
ret
!=
0
)
return
ret
;
return
!
((
unsigned
char
)
val
&
MAX8649_EN_PD
);
}
static
int
max8649_enable_time
(
struct
regulator_dev
*
rdev
)
static
int
max8649_enable_time
(
struct
regulator_dev
*
rdev
)
{
{
struct
max8649_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
struct
max8649_regulator_info
*
info
=
rdev_get_drvdata
(
rdev
);
...
@@ -151,9 +121,9 @@ static struct regulator_ops max8649_dcdc_ops = {
...
@@ -151,9 +121,9 @@ static struct regulator_ops max8649_dcdc_ops = {
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
enable
=
max8649_enable
,
.
enable
=
regulator_enable_regmap
,
.
disable
=
max8649_disable
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
max8649_is_enabled
,
.
is_enabled
=
regulator_is_enabled_regmap
,
.
enable_time
=
max8649_enable_time
,
.
enable_time
=
max8649_enable_time
,
.
set_mode
=
max8649_set_mode
,
.
set_mode
=
max8649_set_mode
,
.
get_mode
=
max8649_get_mode
,
.
get_mode
=
max8649_get_mode
,
...
@@ -169,6 +139,9 @@ static struct regulator_desc dcdc_desc = {
...
@@ -169,6 +139,9 @@ static struct regulator_desc dcdc_desc = {
.
vsel_mask
=
MAX8649_VOL_MASK
,
.
vsel_mask
=
MAX8649_VOL_MASK
,
.
min_uV
=
MAX8649_DCDC_VMIN
,
.
min_uV
=
MAX8649_DCDC_VMIN
,
.
uV_step
=
MAX8649_DCDC_STEP
,
.
uV_step
=
MAX8649_DCDC_STEP
,
.
enable_reg
=
MAX8649_CONTROL
,
.
enable_mask
=
MAX8649_EN_PD
,
.
enable_is_inverted
=
true
,
};
};
static
struct
regmap_config
max8649_regmap_config
=
{
static
struct
regmap_config
max8649_regmap_config
=
{
...
...
include/linux/regulator/driver.h
View file @
1d60a4cf
...
@@ -199,6 +199,8 @@ enum regulator_type {
...
@@ -199,6 +199,8 @@ enum regulator_type {
* output when using regulator_set_voltage_sel_regmap
* output when using regulator_set_voltage_sel_regmap
* @enable_reg: Register for control when using regmap enable/disable ops
* @enable_reg: Register for control when using regmap enable/disable ops
* @enable_mask: Mask for control when using regmap enable/disable ops
* @enable_mask: Mask for control when using regmap enable/disable ops
* @enable_is_inverted: A flag to indicate set enable_mask bits to disable
* when using regulator_enable_regmap and friends APIs.
* @bypass_reg: Register for control when using regmap set_bypass
* @bypass_reg: Register for control when using regmap set_bypass
* @bypass_mask: Mask for control when using regmap set_bypass
* @bypass_mask: Mask for control when using regmap set_bypass
*
*
...
@@ -228,6 +230,7 @@ struct regulator_desc {
...
@@ -228,6 +230,7 @@ struct regulator_desc {
unsigned
int
apply_bit
;
unsigned
int
apply_bit
;
unsigned
int
enable_reg
;
unsigned
int
enable_reg
;
unsigned
int
enable_mask
;
unsigned
int
enable_mask
;
bool
enable_is_inverted
;
unsigned
int
bypass_reg
;
unsigned
int
bypass_reg
;
unsigned
int
bypass_mask
;
unsigned
int
bypass_mask
;
...
...
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