[PATCH v6 4/6] pwm: add push-pull mode support

From: Claudiu.Beznea
Date: Mon Dec 17 2018 - 09:03:33 EST


From: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>

Add push-pull mode support. In push-pull mode the channels' outputs have
same polarities and the edges are complementary delayed for one period.

Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>
---
drivers/pwm/core.c | 3 +++
include/linux/pwm.h | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index eb444ee8d486..f182d1eb564e 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -328,6 +328,9 @@ const char *pwm_get_mode_name(unsigned long modebit)
if (modebit == PWM_MODE_BIT(COMPLEMENTARY))
return "complementary";

+ if (modebit == PWM_MODE_BIT(PUSH_PULL))
+ return "push-pull";
+
return "normal";
}

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index abe189d891af..cce29733d44e 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -32,11 +32,14 @@ enum pwm_polarity {
* PWM modes capabilities
* @PWM_MODE_NORMAL: PWM has one output
* @PWM_MODE_COMPLEMENTARY: PWM has 2 outputs with opposite polarities
+ * @PWM_MODE_PUSH_PULL: PWM has 2 outputs with same polarities and the edges
+ * are complementary delayed for one period
* @PWM_MODE_CNT: PWM modes count
*/
enum pwm_mode {
PWM_MODE_NORMAL,
PWM_MODE_COMPLEMENTARY,
+ PWM_MODE_PUSH_PULL,
PWM_MODE_CNT,
};

--
2.7.4