diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-10-15 04:21:52 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2018-12-12 05:55:42 -0500 |
commit | a36b2606795800a15f6f33ee4c283ad66e1d7bfe (patch) | |
tree | 7a1b0bbca8ea8d91baf78958b4a9ccfebc3a6850 /include/linux/pwm.h | |
parent | bf9b0b1b0b6cd51797ce79b6fa5fc2d1baa2719e (diff) |
pwm: Drop legacy wrapper for changing polarity
The API to configure a PWM using pwm_enable(), pwm_disable(),
pwm_config() and pwm_set_polarity() is superseeded by atomically setting
the parameters using pwm_apply_state(). To get forward with deprecating
the former set of functions use the opportunity that there is no current
user of pwm_set_polarity() and remove it.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 56518adc31dd..d5199b507d79 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
@@ -349,42 +349,6 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns, | |||
349 | } | 349 | } |
350 | 350 | ||
351 | /** | 351 | /** |
352 | * pwm_set_polarity() - configure the polarity of a PWM signal | ||
353 | * @pwm: PWM device | ||
354 | * @polarity: new polarity of the PWM signal | ||
355 | * | ||
356 | * Note that the polarity cannot be configured while the PWM device is | ||
357 | * enabled. | ||
358 | * | ||
359 | * Returns: 0 on success or a negative error code on failure. | ||
360 | */ | ||
361 | static inline int pwm_set_polarity(struct pwm_device *pwm, | ||
362 | enum pwm_polarity polarity) | ||
363 | { | ||
364 | struct pwm_state state; | ||
365 | |||
366 | if (!pwm) | ||
367 | return -EINVAL; | ||
368 | |||
369 | pwm_get_state(pwm, &state); | ||
370 | if (state.polarity == polarity) | ||
371 | return 0; | ||
372 | |||
373 | /* | ||
374 | * Changing the polarity of a running PWM without adjusting the | ||
375 | * dutycycle/period value is a bit risky (can introduce glitches). | ||
376 | * Return -EBUSY in this case. | ||
377 | * Note that this is allowed when using pwm_apply_state() because | ||
378 | * the user specifies all the parameters. | ||
379 | */ | ||
380 | if (state.enabled) | ||
381 | return -EBUSY; | ||
382 | |||
383 | state.polarity = polarity; | ||
384 | return pwm_apply_state(pwm, &state); | ||
385 | } | ||
386 | |||
387 | /** | ||
388 | * pwm_enable() - start a PWM output toggling | 352 | * pwm_enable() - start a PWM output toggling |
389 | * @pwm: PWM device | 353 | * @pwm: PWM device |
390 | * | 354 | * |
@@ -483,12 +447,6 @@ static inline int pwm_capture(struct pwm_device *pwm, | |||
483 | return -EINVAL; | 447 | return -EINVAL; |
484 | } | 448 | } |
485 | 449 | ||
486 | static inline int pwm_set_polarity(struct pwm_device *pwm, | ||
487 | enum pwm_polarity polarity) | ||
488 | { | ||
489 | return -ENOTSUPP; | ||
490 | } | ||
491 | |||
492 | static inline int pwm_enable(struct pwm_device *pwm) | 450 | static inline int pwm_enable(struct pwm_device *pwm) |
493 | { | 451 | { |
494 | return -EINVAL; | 452 | return -EINVAL; |