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
bcedaba1
Commit
bcedaba1
authored
Jul 25, 2016
by
Thierry Reding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fixes' into for-next
parents
1a695a90
33cdcee0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
drivers/pwm/core.c
drivers/pwm/core.c
+2
-1
drivers/pwm/pwm-atmel-hlcdc.c
drivers/pwm/pwm-atmel-hlcdc.c
+1
-1
drivers/pwm/sysfs.c
drivers/pwm/sysfs.c
+1
-1
include/linux/pwm.h
include/linux/pwm.h
+13
-6
No files found.
drivers/pwm/core.c
View file @
bcedaba1
...
...
@@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
{
int
err
;
if
(
!
pwm
)
if
(
!
pwm
||
!
state
||
!
state
->
period
||
state
->
duty_cycle
>
state
->
period
)
return
-
EINVAL
;
if
(
!
memcmp
(
state
,
&
pwm
->
state
,
sizeof
(
*
state
)))
...
...
drivers/pwm/pwm-atmel-hlcdc.c
View file @
bcedaba1
...
...
@@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
chip
->
chip
.
of_pwm_n_cells
=
3
;
chip
->
chip
.
can_sleep
=
1
;
ret
=
pwmchip_add
(
&
chip
->
chip
);
ret
=
pwmchip_add
_with_polarity
(
&
chip
->
chip
,
PWM_POLARITY_INVERSED
);
if
(
ret
)
{
clk_disable_unprepare
(
hlcdc
->
periph_clk
);
return
ret
;
...
...
drivers/pwm/sysfs.c
View file @
bcedaba1
...
...
@@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child,
goto
unlock
;
}
pwm_apply_state
(
pwm
,
&
state
);
ret
=
pwm_apply_state
(
pwm
,
&
state
);
unlock:
mutex_unlock
(
&
export
->
lock
);
...
...
include/linux/pwm.h
View file @
bcedaba1
...
...
@@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
if
(
!
pwm
)
return
-
EINVAL
;
if
(
duty_ns
<
0
||
period_ns
<
0
)
return
-
EINVAL
;
pwm_get_state
(
pwm
,
&
state
);
if
(
state
.
duty_cycle
==
duty_ns
&&
state
.
period
==
period_ns
)
return
0
;
...
...
@@ -461,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm)
static
inline
void
pwm_apply_args
(
struct
pwm_device
*
pwm
)
{
struct
pwm_state
state
=
{
};
/*
* PWM users calling pwm_apply_args() expect to have a fresh config
* where the polarity and period are set according to pwm_args info.
...
...
@@ -473,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm)
* at startup (even if they are actually enabled), thus authorizing
* polarity setting.
*
* Instead of setting ->enabled to false, we call pwm_disable()
* before pwm_set_polarity() to ensure that everything is configured
* as expected, and the PWM is really disabled when the user request
* it.
* To fulfill this requirement, we apply a new state which disables
* the PWM device and set the reference period and polarity config.
*
* Note that PWM users requiring a smooth handover between the
* bootloader and the kernel (like critical regulators controlled by
* PWM devices) will have to switch to the atomic API and avoid calling
* pwm_apply_args().
*/
pwm_disable
(
pwm
);
pwm_set_polarity
(
pwm
,
pwm
->
args
.
polarity
);
state
.
enabled
=
false
;
state
.
polarity
=
pwm
->
args
.
polarity
;
state
.
period
=
pwm
->
args
.
period
;
pwm_apply_state
(
pwm
,
&
state
);
}
struct
pwm_lookup
{
...
...
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