@@ -249,6 +249,8 @@ static ssize_t mode_store(struct device *child,
mode = PWM_MODE_NORMAL;
else if (sysfs_streq(buf, pwm_get_mode_desc(PWM_MODE_COMPLEMENTARY)))
mode = PWM_MODE_COMPLEMENTARY;
+ else if (sysfs_streq(buf, pwm_get_mode_desc(PWM_MODE_PUSH_PULL)))
+ mode = PWM_MODE_PUSH_PULL;
else
return -EINVAL;
@@ -29,13 +29,16 @@ enum pwm_polarity {
* enum pwm_mode - PWM working modes
* PWM_MODE_NORMAL: PWM has one output per channel
* PWM_MODE_COMPLEMENTARY: PWM has 2 outputs per channel with opposite polarity
+ * PWM_MODE_PUSH_PULL: PWM has 2 outputs per channel with same polarity and
+ * the edges are complementary delayed for one period
* PWM_MODE_MAX: Used to get the defined PWM modes mask (PWM_MODE_MAX - 1)
* phase-shifted
*/
enum pwm_mode {
PWM_MODE_NORMAL = BIT(0),
PWM_MODE_COMPLEMENTARY = BIT(1),
- PWM_MODE_MAX = BIT(2),
+ PWM_MODE_PUSH_PULL = BIT(2),
+ PWM_MODE_MAX = BIT(3),
};
/**
@@ -478,7 +481,9 @@ static inline void pwm_disable(struct pwm_device *pwm)
static inline const char * const pwm_get_mode_desc(enum pwm_mode mode)
{
- static const char * const modes[] = { "normal", "complementary" };
+ static const char * const modes[] = {
+ "normal", "complementary", "push-pull"
+ };
return mode ? modes[ffs(mode) - 1] : "invalid";
}
Add push-pull mode support in PWM code. In push-pull mode the channels outputs has same polarity and the edges are complementary delayed for one period. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> --- drivers/pwm/sysfs.c | 2 ++ include/linux/pwm.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-)