[PATCH 16/20] leds: mark pwm driver with LED_BRIGHTNESS_FAST flag

From: Stas Sergeev
Date: Wed May 20 2015 - 11:34:27 EST



This driver doesn't use sleeping operations in .brightness_set
method if can_sleep variable is not set. In that case it can be
marked with LED_BRIGHTNESS_FAST flag.
That flag allows changing brightness at high rates (over 100Hz).

CC: Bryan Wu <cooloney@xxxxxxxxx>
CC: Richard Purdie <rpurdie@xxxxxxxxx>
CC: Jacek Anaszewski <j.anaszewski@xxxxxxxxxxx>
CC: linux-leds@xxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx

Signed-off-by: Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/leds/leds-pwm.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 1d07e3e..82d01e5 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -124,6 +124,8 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
led_data->can_sleep = pwm_can_sleep(led_data->pwm);
if (led_data->can_sleep)
INIT_WORK(&led_data->work, led_pwm_work);
+ else
+ led_data->cdev.flags |= LED_BRIGHTNESS_FAST;

led_data->period = pwm_get_period(led_data->pwm);
if (!led_data->period && (led->pwm_period_ns > 0))
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/