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
bde1e61b
Commit
bde1e61b
authored
Apr 30, 2017
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
parents
6a8007c8
c93609ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
19 deletions
+18
-19
drivers/regulator/core.c
drivers/regulator/core.c
+15
-18
drivers/regulator/internal.h
drivers/regulator/internal.h
+1
-1
include/linux/regulator/driver.h
include/linux/regulator/driver.h
+2
-0
No files found.
drivers/regulator/core.c
View file @
bde1e61b
...
@@ -1326,8 +1326,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
...
@@ -1326,8 +1326,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
regulator
->
dev
=
dev
;
regulator
->
dev
=
dev
;
/* Add a link to the device sysfs entry */
/* Add a link to the device sysfs entry */
size
=
s
c
nprintf
(
buf
,
REG_STR_SIZE
,
"%s-%s"
,
size
=
snprintf
(
buf
,
REG_STR_SIZE
,
"%s-%s"
,
dev
->
kobj
.
name
,
supply_name
);
dev
->
kobj
.
name
,
supply_name
);
if
(
size
>=
REG_STR_SIZE
)
if
(
size
>=
REG_STR_SIZE
)
goto
overflow_err
;
goto
overflow_err
;
...
@@ -1343,7 +1343,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
...
@@ -1343,7 +1343,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
/* non-fatal */
/* non-fatal */
}
}
}
else
{
}
else
{
regulator
->
supply_name
=
kstrdup
(
supply_name
,
GFP_KERNEL
);
regulator
->
supply_name
=
kstrdup
_const
(
supply_name
,
GFP_KERNEL
);
if
(
regulator
->
supply_name
==
NULL
)
if
(
regulator
->
supply_name
==
NULL
)
goto
overflow_err
;
goto
overflow_err
;
}
}
...
@@ -1451,8 +1451,6 @@ static struct regulator_dev *regulator_lookup_by_name(const char *name)
...
@@ -1451,8 +1451,6 @@ static struct regulator_dev *regulator_lookup_by_name(const char *name)
* regulator_dev_lookup - lookup a regulator device.
* regulator_dev_lookup - lookup a regulator device.
* @dev: device for regulator "consumer".
* @dev: device for regulator "consumer".
* @supply: Supply name or regulator ID.
* @supply: Supply name or regulator ID.
* @ret: 0 on success, -ENODEV if lookup fails permanently, -EPROBE_DEFER if
* lookup could succeed in the future.
*
*
* If successful, returns a struct regulator_dev that corresponds to the name
* If successful, returns a struct regulator_dev that corresponds to the name
* @supply and with the embedded struct device refcount incremented by one.
* @supply and with the embedded struct device refcount incremented by one.
...
@@ -1534,14 +1532,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
...
@@ -1534,14 +1532,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
if
(
IS_ERR
(
r
))
{
if
(
IS_ERR
(
r
))
{
ret
=
PTR_ERR
(
r
);
ret
=
PTR_ERR
(
r
);
if
(
ret
==
-
ENODEV
)
{
/*
* No supply was specified for this regulator and
* there will never be one.
*/
return
0
;
}
/* Did the lookup explicitly defer for us? */
/* Did the lookup explicitly defer for us? */
if
(
ret
==
-
EPROBE_DEFER
)
if
(
ret
==
-
EPROBE_DEFER
)
return
ret
;
return
ret
;
...
@@ -1799,7 +1789,7 @@ static void _regulator_put(struct regulator *regulator)
...
@@ -1799,7 +1789,7 @@ static void _regulator_put(struct regulator *regulator)
put_device
(
&
rdev
->
dev
);
put_device
(
&
rdev
->
dev
);
mutex_unlock
(
&
rdev
->
mutex
);
mutex_unlock
(
&
rdev
->
mutex
);
kfree
(
regulator
->
supply_name
);
kfree
_const
(
regulator
->
supply_name
);
kfree
(
regulator
);
kfree
(
regulator
);
module_put
(
rdev
->
owner
);
module_put
(
rdev
->
owner
);
...
@@ -2486,7 +2476,7 @@ static int _regulator_list_voltage(struct regulator *regulator,
...
@@ -2486,7 +2476,7 @@ static int _regulator_list_voltage(struct regulator *regulator,
ret
=
ops
->
list_voltage
(
rdev
,
selector
);
ret
=
ops
->
list_voltage
(
rdev
,
selector
);
if
(
lock
)
if
(
lock
)
mutex_unlock
(
&
rdev
->
mutex
);
mutex_unlock
(
&
rdev
->
mutex
);
}
else
if
(
rdev
->
supply
)
{
}
else
if
(
rdev
->
is_switch
&&
rdev
->
supply
)
{
ret
=
_regulator_list_voltage
(
rdev
->
supply
,
selector
,
lock
);
ret
=
_regulator_list_voltage
(
rdev
->
supply
,
selector
,
lock
);
}
else
{
}
else
{
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2544,7 +2534,7 @@ int regulator_count_voltages(struct regulator *regulator)
...
@@ -2544,7 +2534,7 @@ int regulator_count_voltages(struct regulator *regulator)
if
(
rdev
->
desc
->
n_voltages
)
if
(
rdev
->
desc
->
n_voltages
)
return
rdev
->
desc
->
n_voltages
;
return
rdev
->
desc
->
n_voltages
;
if
(
!
rdev
->
supply
)
if
(
!
rdev
->
is_switch
||
!
rdev
->
supply
)
return
-
EINVAL
;
return
-
EINVAL
;
return
regulator_count_voltages
(
rdev
->
supply
);
return
regulator_count_voltages
(
rdev
->
supply
);
...
@@ -2941,8 +2931,10 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
...
@@ -2941,8 +2931,10 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
out2
;
goto
out2
;
if
(
rdev
->
supply
&&
(
rdev
->
desc
->
min_dropout_uV
||
if
(
rdev
->
supply
&&
!
rdev
->
desc
->
ops
->
get_voltage
))
{
regulator_ops_is_valid
(
rdev
->
supply
->
rdev
,
REGULATOR_CHANGE_VOLTAGE
)
&&
(
rdev
->
desc
->
min_dropout_uV
||
!
rdev
->
desc
->
ops
->
get_voltage
))
{
int
current_supply_uV
;
int
current_supply_uV
;
int
selector
;
int
selector
;
...
@@ -4099,6 +4091,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -4099,6 +4091,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
mutex_unlock
(
&
regulator_list_mutex
);
mutex_unlock
(
&
regulator_list_mutex
);
}
}
if
(
!
rdev
->
desc
->
ops
->
get_voltage
&&
!
rdev
->
desc
->
ops
->
list_voltage
&&
!
rdev
->
desc
->
fixed_uV
)
rdev
->
is_switch
=
true
;
ret
=
device_register
(
&
rdev
->
dev
);
ret
=
device_register
(
&
rdev
->
dev
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
put_device
(
&
rdev
->
dev
);
put_device
(
&
rdev
->
dev
);
...
...
drivers/regulator/internal.h
View file @
bde1e61b
...
@@ -29,7 +29,7 @@ struct regulator {
...
@@ -29,7 +29,7 @@ struct regulator {
int
uA_load
;
int
uA_load
;
int
min_uV
;
int
min_uV
;
int
max_uV
;
int
max_uV
;
char
*
supply_name
;
c
onst
c
har
*
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
;
...
...
include/linux/regulator/driver.h
View file @
bde1e61b
...
@@ -429,6 +429,8 @@ struct regulator_dev {
...
@@ -429,6 +429,8 @@ struct regulator_dev {
struct
regulator_enable_gpio
*
ena_pin
;
struct
regulator_enable_gpio
*
ena_pin
;
unsigned
int
ena_gpio_state
:
1
;
unsigned
int
ena_gpio_state
:
1
;
unsigned
int
is_switch
:
1
;
/* time when this regulator was disabled last time */
/* time when this regulator was disabled last time */
unsigned
long
last_off_jiffy
;
unsigned
long
last_off_jiffy
;
};
};
...
...
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