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
d2a3f206
Commit
d2a3f206
authored
May 17, 2016
by
Thierry Reding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-4.7/pwm-regulator' into for-next
parents
bf5dd9ab
8c12ad8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
drivers/regulator/pwm-regulator.c
drivers/regulator/pwm-regulator.c
+14
-6
No files found.
drivers/regulator/pwm-regulator.c
View file @
d2a3f206
...
@@ -59,16 +59,16 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
...
@@ -59,16 +59,16 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
unsigned
selector
)
unsigned
selector
)
{
{
struct
pwm_regulator_data
*
drvdata
=
rdev_get_drvdata
(
rdev
);
struct
pwm_regulator_data
*
drvdata
=
rdev_get_drvdata
(
rdev
);
unsigned
int
pwm_reg_period
;
struct
pwm_args
pargs
;
int
dutycycle
;
int
dutycycle
;
int
ret
;
int
ret
;
pwm_
reg_period
=
pwm_get_period
(
drvdata
->
pwm
);
pwm_
get_args
(
drvdata
->
pwm
,
&
pargs
);
dutycycle
=
(
p
wm_reg_
period
*
dutycycle
=
(
p
args
.
period
*
drvdata
->
duty_cycle_table
[
selector
].
dutycycle
)
/
100
;
drvdata
->
duty_cycle_table
[
selector
].
dutycycle
)
/
100
;
ret
=
pwm_config
(
drvdata
->
pwm
,
dutycycle
,
p
wm_reg_
period
);
ret
=
pwm_config
(
drvdata
->
pwm
,
dutycycle
,
p
args
.
period
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
rdev
->
dev
,
"Failed to configure PWM
\n
"
);
dev_err
(
&
rdev
->
dev
,
"Failed to configure PWM
\n
"
);
return
ret
;
return
ret
;
...
@@ -138,13 +138,15 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
...
@@ -138,13 +138,15 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
{
{
struct
pwm_regulator_data
*
drvdata
=
rdev_get_drvdata
(
rdev
);
struct
pwm_regulator_data
*
drvdata
=
rdev_get_drvdata
(
rdev
);
unsigned
int
ramp_delay
=
rdev
->
constraints
->
ramp_delay
;
unsigned
int
ramp_delay
=
rdev
->
constraints
->
ramp_delay
;
unsigned
int
period
=
pwm_get_period
(
drvdata
->
pwm
)
;
struct
pwm_args
pargs
;
int
duty_cycle
;
int
duty_cycle
;
int
ret
;
int
ret
;
pwm_get_args
(
drvdata
->
pwm
,
&
pargs
);
duty_cycle
=
pwm_voltage_to_duty_cycle_percentage
(
rdev
,
min_uV
);
duty_cycle
=
pwm_voltage_to_duty_cycle_percentage
(
rdev
,
min_uV
);
ret
=
pwm_config
(
drvdata
->
pwm
,
(
period
/
100
)
*
duty_cycle
,
period
);
ret
=
pwm_config
(
drvdata
->
pwm
,
(
pargs
.
period
/
100
)
*
duty_cycle
,
pargs
.
period
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
rdev
->
dev
,
"Failed to configure PWM
\n
"
);
dev_err
(
&
rdev
->
dev
,
"Failed to configure PWM
\n
"
);
return
ret
;
return
ret
;
...
@@ -281,6 +283,12 @@ static int pwm_regulator_probe(struct platform_device *pdev)
...
@@ -281,6 +283,12 @@ static int pwm_regulator_probe(struct platform_device *pdev)
return
PTR_ERR
(
drvdata
->
pwm
);
return
PTR_ERR
(
drvdata
->
pwm
);
}
}
/*
* FIXME: pwm_apply_args() should be removed when switching to the
* atomic PWM API.
*/
pwm_apply_args
(
drvdata
->
pwm
);
regulator
=
devm_regulator_register
(
&
pdev
->
dev
,
regulator
=
devm_regulator_register
(
&
pdev
->
dev
,
&
drvdata
->
desc
,
&
config
);
&
drvdata
->
desc
,
&
config
);
if
(
IS_ERR
(
regulator
))
{
if
(
IS_ERR
(
regulator
))
{
...
...
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