public inbox for linux-pwm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PWM: drop legacy wrapper for changing polarity
@ 2018-10-15  8:21 Uwe Kleine-König
  2018-11-04 21:19 ` Uwe Kleine-König
  2018-12-12 10:56 ` [PATCH] PWM: drop legacy wrapper for changing polarity Thierry Reding
  0 siblings, 2 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2018-10-15  8:21 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, Gavin Schenk, Vokáč Michal, kernel

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>
---
 include/linux/pwm.h | 42 ------------------------------------------
 1 file changed, 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
@@ -348,42 +348,6 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
 	return pwm_apply_state(pwm, &state);
 }
 
-/**
- * pwm_set_polarity() - configure the polarity of a PWM signal
- * @pwm: PWM device
- * @polarity: new polarity of the PWM signal
- *
- * Note that the polarity cannot be configured while the PWM device is
- * enabled.
- *
- * Returns: 0 on success or a negative error code on failure.
- */
-static inline int pwm_set_polarity(struct pwm_device *pwm,
-				   enum pwm_polarity polarity)
-{
-	struct pwm_state state;
-
-	if (!pwm)
-		return -EINVAL;
-
-	pwm_get_state(pwm, &state);
-	if (state.polarity == polarity)
-		return 0;
-
-	/*
-	 * Changing the polarity of a running PWM without adjusting the
-	 * dutycycle/period value is a bit risky (can introduce glitches).
-	 * Return -EBUSY in this case.
-	 * Note that this is allowed when using pwm_apply_state() because
-	 * the user specifies all the parameters.
-	 */
-	if (state.enabled)
-		return -EBUSY;
-
-	state.polarity = polarity;
-	return pwm_apply_state(pwm, &state);
-}
-
 /**
  * pwm_enable() - start a PWM output toggling
  * @pwm: PWM device
@@ -483,12 +447,6 @@ static inline int pwm_capture(struct pwm_device *pwm,
 	return -EINVAL;
 }
 
-static inline int pwm_set_polarity(struct pwm_device *pwm,
-				   enum pwm_polarity polarity)
-{
-	return -ENOTSUPP;
-}
-
 static inline int pwm_enable(struct pwm_device *pwm)
 {
 	return -EINVAL;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-09-16 13:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-15  8:21 [PATCH] PWM: drop legacy wrapper for changing polarity Uwe Kleine-König
2018-11-04 21:19 ` Uwe Kleine-König
2018-11-20 16:57   ` Uwe Kleine-König
2018-11-30  8:59     ` Uwe Kleine-König
2018-12-06  9:20       ` Uwe Kleine-König
2018-12-11 21:26         ` Uwe Kleine-König
2018-12-12 10:25           ` Thierry Reding
2018-12-12 10:59             ` Uwe Kleine-König
2019-09-16 13:05             ` Offer to co-maintain drivers/pwm [Was: Re: [PATCH] PWM: drop legacy wrapper for changing polarity] Uwe Kleine-König
2019-09-16 13:53               ` Thierry Reding
2018-12-12 10:56 ` [PATCH] PWM: drop legacy wrapper for changing polarity Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox