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
73d80037
Commit
73d80037
authored
Jan 26, 2018
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
parents
0c5b9b5d
00cb9f4f
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
340 additions
and
155 deletions
+340
-155
Documentation/devicetree/bindings/regulator/regulator.txt
Documentation/devicetree/bindings/regulator/regulator.txt
+10
-2
drivers/regulator/core.c
drivers/regulator/core.c
+244
-139
drivers/regulator/internal.h
drivers/regulator/internal.h
+25
-2
drivers/regulator/of_regulator.c
drivers/regulator/of_regulator.c
+32
-2
include/linux/regulator/driver.h
include/linux/regulator/driver.h
+2
-0
include/linux/regulator/machine.h
include/linux/regulator/machine.h
+27
-10
No files found.
Documentation/devicetree/bindings/regulator/regulator.txt
View file @
73d80037
...
@@ -42,8 +42,16 @@ Optional properties:
...
@@ -42,8 +42,16 @@ Optional properties:
- regulator-state-[mem/disk] node has following common properties:
- regulator-state-[mem/disk] node has following common properties:
- regulator-on-in-suspend: regulator should be on in suspend state.
- regulator-on-in-suspend: regulator should be on in suspend state.
- regulator-off-in-suspend: regulator should be off in suspend state.
- regulator-off-in-suspend: regulator should be off in suspend state.
- regulator-suspend-microvolt: regulator should be set to this voltage
- regulator-suspend-min-microvolt: minimum voltage may be set in
in suspend.
suspend state.
- regulator-suspend-max-microvolt: maximum voltage may be set in
suspend state.
- regulator-suspend-microvolt: the default voltage which regulator
would be set in suspend. This property is now deprecated, instead
setting voltage for suspend mode via the API which regulator
driver provides is recommended.
- regulator-changeable-in-suspend: whether the default voltage and
the regulator on/off in suspend can be changed in runtime.
- regulator-mode: operating mode in the given suspend state.
- regulator-mode: operating mode in the given suspend state.
The set of possible operating modes depends on the capabilities of
The set of possible operating modes depends on the capabilities of
every hardware so the valid modes are documented on each regulator
every hardware so the valid modes are documented on each regulator
...
...
drivers/regulator/core.c
View file @
73d80037
This diff is collapsed.
Click to expand it.
drivers/regulator/internal.h
View file @
73d80037
...
@@ -16,10 +16,25 @@
...
@@ -16,10 +16,25 @@
#ifndef __REGULATOR_INTERNAL_H
#ifndef __REGULATOR_INTERNAL_H
#define __REGULATOR_INTERNAL_H
#define __REGULATOR_INTERNAL_H
#include <linux/suspend.h>
#define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1)
struct
regulator_voltage
{
int
min_uV
;
int
max_uV
;
};
/*
/*
* struct regulator
* struct regulator
*
*
* One for each consumer device.
* One for each consumer device.
* @voltage - a voltage array for each state of runtime, i.e.:
* PM_SUSPEND_ON
* PM_SUSPEND_TO_IDLE
* PM_SUSPEND_STANDBY
* PM_SUSPEND_MEM
* PM_SUSPEND_MAX
*/
*/
struct
regulator
{
struct
regulator
{
struct
device
*
dev
;
struct
device
*
dev
;
...
@@ -27,14 +42,22 @@ struct regulator {
...
@@ -27,14 +42,22 @@ struct regulator {
unsigned
int
always_on
:
1
;
unsigned
int
always_on
:
1
;
unsigned
int
bypass
:
1
;
unsigned
int
bypass
:
1
;
int
uA_load
;
int
uA_load
;
int
min_uV
;
struct
regulator_voltage
voltage
[
REGULATOR_STATES_NUM
];
int
max_uV
;
const
char
*
supply_name
;
const
char
*
supply_name
;
struct
device_attribute
dev_attr
;
struct
device_attribute
dev_attr
;
struct
regulator_dev
*
rdev
;
struct
regulator_dev
*
rdev
;
struct
dentry
*
debugfs
;
struct
dentry
*
debugfs
;
};
};
extern
struct
class
regulator_class
;
static
inline
struct
regulator_dev
*
dev_to_rdev
(
struct
device
*
dev
)
{
return
container_of
(
dev
,
struct
regulator_dev
,
dev
);
}
struct
regulator_dev
*
of_find_regulator_by_node
(
struct
device_node
*
np
);
#ifdef CONFIG_OF
#ifdef CONFIG_OF
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
struct
regulator_init_data
*
regulator_of_get_init_data
(
struct
device
*
dev
,
const
struct
regulator_desc
*
desc
,
const
struct
regulator_desc
*
desc
,
...
...
drivers/regulator/of_regulator.c
View file @
73d80037
...
@@ -177,14 +177,30 @@ static void of_get_regulation_constraints(struct device_node *np,
...
@@ -177,14 +177,30 @@ static void of_get_regulation_constraints(struct device_node *np,
if
(
of_property_read_bool
(
suspend_np
,
if
(
of_property_read_bool
(
suspend_np
,
"regulator-on-in-suspend"
))
"regulator-on-in-suspend"
))
suspend_state
->
enabled
=
true
;
suspend_state
->
enabled
=
ENABLE_IN_SUSPEND
;
else
if
(
of_property_read_bool
(
suspend_np
,
else
if
(
of_property_read_bool
(
suspend_np
,
"regulator-off-in-suspend"
))
"regulator-off-in-suspend"
))
suspend_state
->
disabled
=
true
;
suspend_state
->
enabled
=
DISABLE_IN_SUSPEND
;
else
suspend_state
->
enabled
=
DO_NOTHING_IN_SUSPEND
;
if
(
!
of_property_read_u32
(
np
,
"regulator-suspend-min-microvolt"
,
&
pval
))
suspend_state
->
min_uV
=
pval
;
if
(
!
of_property_read_u32
(
np
,
"regulator-suspend-max-microvolt"
,
&
pval
))
suspend_state
->
max_uV
=
pval
;
if
(
!
of_property_read_u32
(
suspend_np
,
if
(
!
of_property_read_u32
(
suspend_np
,
"regulator-suspend-microvolt"
,
&
pval
))
"regulator-suspend-microvolt"
,
&
pval
))
suspend_state
->
uV
=
pval
;
suspend_state
->
uV
=
pval
;
else
/* otherwise use min_uV as default suspend voltage */
suspend_state
->
uV
=
suspend_state
->
min_uV
;
if
(
of_property_read_bool
(
suspend_np
,
"regulator-changeable-in-suspend"
))
suspend_state
->
changeable
=
true
;
if
(
i
==
PM_SUSPEND_MEM
)
if
(
i
==
PM_SUSPEND_MEM
)
constraints
->
initial_state
=
PM_SUSPEND_MEM
;
constraints
->
initial_state
=
PM_SUSPEND_MEM
;
...
@@ -376,3 +392,17 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
...
@@ -376,3 +392,17 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
return
init_data
;
return
init_data
;
}
}
static
int
of_node_match
(
struct
device
*
dev
,
const
void
*
data
)
{
return
dev
->
of_node
==
data
;
}
struct
regulator_dev
*
of_find_regulator_by_node
(
struct
device_node
*
np
)
{
struct
device
*
dev
;
dev
=
class_find_device
(
&
regulator_class
,
NULL
,
np
,
of_node_match
);
return
dev
?
dev_to_rdev
(
dev
)
:
NULL
;
}
include/linux/regulator/driver.h
View file @
73d80037
...
@@ -214,6 +214,8 @@ struct regulator_ops {
...
@@ -214,6 +214,8 @@ struct regulator_ops {
/* set regulator suspend operating mode (defined in consumer.h) */
/* set regulator suspend operating mode (defined in consumer.h) */
int
(
*
set_suspend_mode
)
(
struct
regulator_dev
*
,
unsigned
int
mode
);
int
(
*
set_suspend_mode
)
(
struct
regulator_dev
*
,
unsigned
int
mode
);
int
(
*
resume_early
)(
struct
regulator_dev
*
rdev
);
int
(
*
set_pull_down
)
(
struct
regulator_dev
*
);
int
(
*
set_pull_down
)
(
struct
regulator_dev
*
);
};
};
...
...
include/linux/regulator/machine.h
View file @
73d80037
...
@@ -42,6 +42,16 @@ struct regulator;
...
@@ -42,6 +42,16 @@ struct regulator;
#define REGULATOR_CHANGE_DRMS 0x10
#define REGULATOR_CHANGE_DRMS 0x10
#define REGULATOR_CHANGE_BYPASS 0x20
#define REGULATOR_CHANGE_BYPASS 0x20
/*
* operations in suspend mode
* DO_NOTHING_IN_SUSPEND - the default value
* DISABLE_IN_SUSPEND - turn off regulator in suspend states
* ENABLE_IN_SUSPEND - keep regulator on in suspend states
*/
#define DO_NOTHING_IN_SUSPEND (-1)
#define DISABLE_IN_SUSPEND 0
#define ENABLE_IN_SUSPEND 1
/* Regulator active discharge flags */
/* Regulator active discharge flags */
enum
regulator_active_discharge
{
enum
regulator_active_discharge
{
REGULATOR_ACTIVE_DISCHARGE_DEFAULT
,
REGULATOR_ACTIVE_DISCHARGE_DEFAULT
,
...
@@ -56,16 +66,24 @@ enum regulator_active_discharge {
...
@@ -56,16 +66,24 @@ enum regulator_active_discharge {
* state. One of enabled or disabled must be set for the
* state. One of enabled or disabled must be set for the
* configuration to be applied.
* configuration to be applied.
*
*
* @uV: Operating voltage during suspend.
* @uV: Default operating voltage during suspend, it can be adjusted
* among <min_uV, max_uV>.
* @min_uV: Minimum suspend voltage may be set.
* @max_uV: Maximum suspend voltage may be set.
* @mode: Operating mode during suspend.
* @mode: Operating mode during suspend.
* @enabled: Enabled during suspend.
* @enabled: operations during suspend.
* @disabled: Disabled during suspend.
* - DO_NOTHING_IN_SUSPEND
* - DISABLE_IN_SUSPEND
* - ENABLE_IN_SUSPEND
* @changeable: Is this state can be switched between enabled/disabled,
*/
*/
struct
regulator_state
{
struct
regulator_state
{
int
uV
;
/* suspend voltage */
int
uV
;
unsigned
int
mode
;
/* suspend regulator operating mode */
int
min_uV
;
int
enabled
;
/* is regulator enabled in this suspend state */
int
max_uV
;
int
disabled
;
/* is the regulator disabled in this suspend state */
unsigned
int
mode
;
int
enabled
;
bool
changeable
;
};
};
/**
/**
...
@@ -225,12 +243,12 @@ struct regulator_init_data {
...
@@ -225,12 +243,12 @@ struct regulator_init_data {
#ifdef CONFIG_REGULATOR
#ifdef CONFIG_REGULATOR
void
regulator_has_full_constraints
(
void
);
void
regulator_has_full_constraints
(
void
);
int
regulator_suspend_prepare
(
suspend_state_t
state
);
int
regulator_suspend_finish
(
void
);
#else
#else
static
inline
void
regulator_has_full_constraints
(
void
)
static
inline
void
regulator_has_full_constraints
(
void
)
{
{
}
}
#endif
static
inline
int
regulator_suspend_prepare
(
suspend_state_t
state
)
static
inline
int
regulator_suspend_prepare
(
suspend_state_t
state
)
{
{
return
0
;
return
0
;
...
@@ -239,6 +257,5 @@ static inline int regulator_suspend_finish(void)
...
@@ -239,6 +257,5 @@ static inline int regulator_suspend_finish(void)
{
{
return
0
;
return
0
;
}
}
#endif
#endif
#endif
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