summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-cros-ec.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-03-12 12:00:58 +0300
committerThierry Reding <thierry.reding@gmail.com>2021-03-22 14:08:06 +0300
commit9f0f6107e07289c99f599d4e4ad9c62dec4abfd6 (patch)
tree9c9128777eb3e94e9a5ae1e9cb661e81184016d0 /drivers/pwm/pwm-cros-ec.c
parent09081c9ba6c22bd63b6ce681e60d71a95acbc115 (diff)
downloadlinux-9f0f6107e07289c99f599d4e4ad9c62dec4abfd6.tar.xz
pwm: cros-ec: Refuse requests with unsupported polarity
The driver only supports normal polarity and so should refuse requests for inversed polarity. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-cros-ec.c')
-rw-r--r--drivers/pwm/pwm-cros-ec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
index d3115cb0e058..9fffb566af5f 100644
--- a/drivers/pwm/pwm-cros-ec.c
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -124,6 +124,9 @@ static int cros_ec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (state->period != EC_PWM_MAX_DUTY)
return -EINVAL;
+ if (state->polarity != PWM_POLARITY_NORMAL)
+ return -EINVAL;
+
/*
* EC doesn't separate the concept of duty cycle and enabled, but
* kernel does. Translate.