|
@@ -34,6 +34,20 @@ void pwm_disable(struct pwm_device *pwm);
|
|
|
#ifdef CONFIG_PWM
|
|
|
struct pwm_chip;
|
|
|
|
|
|
+/**
|
|
|
+ * enum pwm_polarity - polarity of a PWM signal
|
|
|
+ * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty-
|
|
|
+ * cycle, followed by a low signal for the remainder of the pulse
|
|
|
+ * period
|
|
|
+ * @PWM_POLARITY_INVERSED: a low signal for the duration of the duty-
|
|
|
+ * cycle, followed by a high signal for the remainder of the pulse
|
|
|
+ * period
|
|
|
+ */
|
|
|
+enum pwm_polarity {
|
|
|
+ PWM_POLARITY_NORMAL,
|
|
|
+ PWM_POLARITY_INVERSED,
|
|
|
+};
|
|
|
+
|
|
|
enum {
|
|
|
PWMF_REQUESTED = 1 << 0,
|
|
|
PWMF_ENABLED = 1 << 1,
|
|
@@ -61,11 +75,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
|
|
|
return pwm ? pwm->period : 0;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * pwm_set_polarity - configure the polarity of a PWM signal
|
|
|
+ */
|
|
|
+int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity);
|
|
|
+
|
|
|
/**
|
|
|
* struct pwm_ops - PWM controller operations
|
|
|
* @request: optional hook for requesting a PWM
|
|
|
* @free: optional hook for freeing a PWM
|
|
|
* @config: configure duty cycles and period length for this PWM
|
|
|
+ * @set_polarity: configure the polarity of this PWM
|
|
|
* @enable: enable PWM output toggling
|
|
|
* @disable: disable PWM output toggling
|
|
|
* @dbg_show: optional routine to show contents in debugfs
|
|
@@ -79,6 +99,9 @@ struct pwm_ops {
|
|
|
int (*config)(struct pwm_chip *chip,
|
|
|
struct pwm_device *pwm,
|
|
|
int duty_ns, int period_ns);
|
|
|
+ int (*set_polarity)(struct pwm_chip *chip,
|
|
|
+ struct pwm_device *pwm,
|
|
|
+ enum pwm_polarity polarity);
|
|
|
int (*enable)(struct pwm_chip *chip,
|
|
|
struct pwm_device *pwm);
|
|
|
void (*disable)(struct pwm_chip *chip,
|