pwm: cros-ec: Refuse requests with unsupported polarity
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 12 Mar 2021 09:00:58 +0000 (10:00 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 22 Mar 2021 11:08:06 +0000 (12:08 +0100)
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>
drivers/pwm/pwm-cros-ec.c

index d3115cb0e058ed3abdbda6798d950fd9ce1aae45..9fffb566af5f94ea699dfc17a7a7940ca7bb38b0 100644 (file)
@@ -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.