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
nexedi
linux
Commits
52582adc
Commit
52582adc
authored
Feb 19, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
parents
20ab4a7a
9c7b4e8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
drivers/regulator/core.c
drivers/regulator/core.c
+22
-7
No files found.
drivers/regulator/core.c
View file @
52582adc
...
...
@@ -200,8 +200,8 @@ static int regulator_check_consumers(struct regulator_dev *rdev,
}
if
(
*
min_uV
>
*
max_uV
)
{
dev_err
(
regulator
->
dev
,
"Restricting voltage, %u-%uuV
\n
"
,
regulator
->
min_uV
,
regulator
->
max_uV
);
rdev_err
(
r
dev
,
"Restricting voltage, %u-%uuV
\n
"
,
*
min_uV
,
*
max_uV
);
return
-
EINVAL
;
}
...
...
@@ -2239,8 +2239,11 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
best_val
=
rdev
->
desc
->
ops
->
list_voltage
(
rdev
,
ret
);
if
(
min_uV
<=
best_val
&&
max_uV
>=
best_val
)
{
selector
=
ret
;
ret
=
rdev
->
desc
->
ops
->
set_voltage_sel
(
rdev
,
ret
);
if
(
old_selector
==
selector
)
ret
=
0
;
else
ret
=
rdev
->
desc
->
ops
->
set_voltage_sel
(
rdev
,
ret
);
}
else
{
ret
=
-
EINVAL
;
}
...
...
@@ -2251,7 +2254,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
/* Call set_voltage_time_sel if successfully obtained old_selector */
if
(
ret
==
0
&&
_regulator_is_enabled
(
rdev
)
&&
old_selector
>=
0
&&
rdev
->
desc
->
ops
->
set_voltage_time_sel
)
{
old_selector
!=
selector
&&
rdev
->
desc
->
ops
->
set_voltage_time_sel
)
{
delay
=
rdev
->
desc
->
ops
->
set_voltage_time_sel
(
rdev
,
old_selector
,
selector
);
...
...
@@ -2304,6 +2307,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
{
struct
regulator_dev
*
rdev
=
regulator
->
rdev
;
int
ret
=
0
;
int
old_min_uV
,
old_max_uV
;
mutex_lock
(
&
rdev
->
mutex
);
...
...
@@ -2325,18 +2329,29 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
ret
=
regulator_check_voltage
(
rdev
,
&
min_uV
,
&
max_uV
);
if
(
ret
<
0
)
goto
out
;
/* restore original values in case of error */
old_min_uV
=
regulator
->
min_uV
;
old_max_uV
=
regulator
->
max_uV
;
regulator
->
min_uV
=
min_uV
;
regulator
->
max_uV
=
max_uV
;
ret
=
regulator_check_consumers
(
rdev
,
&
min_uV
,
&
max_uV
);
if
(
ret
<
0
)
goto
out
;
goto
out
2
;
ret
=
_regulator_do_set_voltage
(
rdev
,
min_uV
,
max_uV
);
if
(
ret
<
0
)
goto
out2
;
out:
mutex_unlock
(
&
rdev
->
mutex
);
return
ret
;
out2:
regulator
->
min_uV
=
old_min_uV
;
regulator
->
max_uV
=
old_max_uV
;
mutex_unlock
(
&
rdev
->
mutex
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
regulator_set_voltage
);
...
...
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