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
81e439f4
Commit
81e439f4
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
parents
cea64d8c
5df529d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
6 deletions
+83
-6
Documentation/devicetree/bindings/regulator/regulator.txt
Documentation/devicetree/bindings/regulator/regulator.txt
+5
-0
drivers/regulator/core.c
drivers/regulator/core.c
+70
-6
drivers/regulator/of_regulator.c
drivers/regulator/of_regulator.c
+6
-0
include/linux/regulator/machine.h
include/linux/regulator/machine.h
+2
-0
No files found.
Documentation/devicetree/bindings/regulator/regulator.txt
View file @
81e439f4
...
@@ -14,6 +14,11 @@ Optional properties:
...
@@ -14,6 +14,11 @@ Optional properties:
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
For hardwares which support disabling ramp rate, it should be explicitly
For hardwares which support disabling ramp rate, it should be explicitly
intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
- regulator-enable-ramp-delay: The time taken, in microseconds, for the supply
rail to reach the target voltage, plus/minus whatever tolerance the board
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.
Deprecated properties:
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
- regulator-compatible: If a regulator chip contains multiple
...
...
drivers/regulator/core.c
View file @
81e439f4
...
@@ -919,6 +919,36 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
...
@@ -919,6 +919,36 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
return
0
;
return
0
;
}
}
static
int
machine_constraints_current
(
struct
regulator_dev
*
rdev
,
struct
regulation_constraints
*
constraints
)
{
struct
regulator_ops
*
ops
=
rdev
->
desc
->
ops
;
int
ret
;
if
(
!
constraints
->
min_uA
&&
!
constraints
->
max_uA
)
return
0
;
if
(
constraints
->
min_uA
>
constraints
->
max_uA
)
{
rdev_err
(
rdev
,
"Invalid current constraints
\n
"
);
return
-
EINVAL
;
}
if
(
!
ops
->
set_current_limit
||
!
ops
->
get_current_limit
)
{
rdev_warn
(
rdev
,
"Operation of current configuration missing
\n
"
);
return
0
;
}
/* Set regulator current in constraints range */
ret
=
ops
->
set_current_limit
(
rdev
,
constraints
->
min_uA
,
constraints
->
max_uA
);
if
(
ret
<
0
)
{
rdev_err
(
rdev
,
"Failed to set current constraint, %d
\n
"
,
ret
);
return
ret
;
}
return
0
;
}
/**
/**
* set_machine_constraints - sets regulator constraints
* set_machine_constraints - sets regulator constraints
* @rdev: regulator source
* @rdev: regulator source
...
@@ -949,6 +979,10 @@ static int set_machine_constraints(struct regulator_dev *rdev,
...
@@ -949,6 +979,10 @@ static int set_machine_constraints(struct regulator_dev *rdev,
if
(
ret
!=
0
)
if
(
ret
!=
0
)
goto
out
;
goto
out
;
ret
=
machine_constraints_current
(
rdev
,
rdev
->
constraints
);
if
(
ret
!=
0
)
goto
out
;
/* do we need to setup our suspend state */
/* do we need to setup our suspend state */
if
(
rdev
->
constraints
->
initial_state
)
{
if
(
rdev
->
constraints
->
initial_state
)
{
ret
=
suspend_prepare
(
rdev
,
rdev
->
constraints
->
initial_state
);
ret
=
suspend_prepare
(
rdev
,
rdev
->
constraints
->
initial_state
);
...
@@ -1182,6 +1216,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
...
@@ -1182,6 +1216,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
static
int
_regulator_get_enable_time
(
struct
regulator_dev
*
rdev
)
static
int
_regulator_get_enable_time
(
struct
regulator_dev
*
rdev
)
{
{
if
(
rdev
->
constraints
&&
rdev
->
constraints
->
enable_time
)
return
rdev
->
constraints
->
enable_time
;
if
(
!
rdev
->
desc
->
ops
->
enable_time
)
if
(
!
rdev
->
desc
->
ops
->
enable_time
)
return
rdev
->
desc
->
enable_time
;
return
rdev
->
desc
->
enable_time
;
return
rdev
->
desc
->
ops
->
enable_time
(
rdev
);
return
rdev
->
desc
->
ops
->
enable_time
(
rdev
);
...
@@ -1276,7 +1312,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
...
@@ -1276,7 +1312,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
if
(
id
==
NULL
)
{
if
(
id
==
NULL
)
{
pr_err
(
"get() with no identifier
\n
"
);
pr_err
(
"get() with no identifier
\n
"
);
return
regulator
;
return
ERR_PTR
(
-
EINVAL
)
;
}
}
if
(
dev
)
if
(
dev
)
...
@@ -1733,11 +1769,39 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
...
@@ -1733,11 +1769,39 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
* together. */
* together. */
trace_regulator_enable_delay
(
rdev_get_name
(
rdev
));
trace_regulator_enable_delay
(
rdev_get_name
(
rdev
));
if
(
delay
>=
1000
)
{
/*
mdelay
(
delay
/
1000
);
* Delay for the requested amount of time as per the guidelines in:
udelay
(
delay
%
1000
);
*
}
else
if
(
delay
)
{
* Documentation/timers/timers-howto.txt
udelay
(
delay
);
*
* The assumption here is that regulators will never be enabled in
* atomic context and therefore sleeping functions can be used.
*/
if
(
delay
)
{
unsigned
int
ms
=
delay
/
1000
;
unsigned
int
us
=
delay
%
1000
;
if
(
ms
>
0
)
{
/*
* For small enough values, handle super-millisecond
* delays in the usleep_range() call below.
*/
if
(
ms
<
20
)
us
+=
ms
*
1000
;
else
msleep
(
ms
);
}
/*
* Give the scheduler some room to coalesce with any other
* wakeup sources. For delays shorter than 10 us, don't even
* bother setting up high-resolution timers and just busy-
* loop.
*/
if
(
us
>=
10
)
usleep_range
(
us
,
us
+
100
);
else
udelay
(
us
);
}
}
trace_regulator_enable_complete
(
rdev_get_name
(
rdev
));
trace_regulator_enable_complete
(
rdev_get_name
(
rdev
));
...
...
drivers/regulator/of_regulator.c
View file @
81e439f4
...
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
...
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,
const
__be32
*
min_uA
,
*
max_uA
,
*
ramp_delay
;
const
__be32
*
min_uA
,
*
max_uA
,
*
ramp_delay
;
struct
property
*
prop
;
struct
property
*
prop
;
struct
regulation_constraints
*
constraints
=
&
(
*
init_data
)
->
constraints
;
struct
regulation_constraints
*
constraints
=
&
(
*
init_data
)
->
constraints
;
int
ret
;
u32
pval
;
constraints
->
name
=
of_get_property
(
np
,
"regulator-name"
,
NULL
);
constraints
->
name
=
of_get_property
(
np
,
"regulator-name"
,
NULL
);
...
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
...
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,
else
else
constraints
->
ramp_disable
=
true
;
constraints
->
ramp_disable
=
true
;
}
}
ret
=
of_property_read_u32
(
np
,
"regulator-enable-ramp-delay"
,
&
pval
);
if
(
!
ret
)
constraints
->
enable_time
=
pval
;
}
}
/**
/**
...
...
include/linux/regulator/machine.h
View file @
81e439f4
...
@@ -95,6 +95,7 @@ struct regulator_state {
...
@@ -95,6 +95,7 @@ struct regulator_state {
* @initial_state: Suspend state to set by default.
* @initial_state: Suspend state to set by default.
* @initial_mode: Mode to set at startup.
* @initial_mode: Mode to set at startup.
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
* @enable_time: Turn-on time of the rails (unit: microseconds)
*/
*/
struct
regulation_constraints
{
struct
regulation_constraints
{
...
@@ -129,6 +130,7 @@ struct regulation_constraints {
...
@@ -129,6 +130,7 @@ struct regulation_constraints {
unsigned
int
initial_mode
;
unsigned
int
initial_mode
;
unsigned
int
ramp_delay
;
unsigned
int
ramp_delay
;
unsigned
int
enable_time
;
/* constraint flags */
/* constraint flags */
unsigned
always_on
:
1
;
/* regulator never off when system is on */
unsigned
always_on
:
1
;
/* regulator never off when system is on */
...
...
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