203-gpio_leds_brightness.patch 636 B

123456789101112131415161718192021222324252627
  1. --- a/drivers/leds/leds-gpio.c
  2. +++ b/drivers/leds/leds-gpio.c
  3. @@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas
  4. container_of(led_cdev, struct gpio_led_data, cdev);
  5. int level;
  6. - if (value == LED_OFF)
  7. - level = 0;
  8. - else
  9. - level = 1;
  10. -
  11. - if (led_dat->active_low)
  12. - level = !level;
  13. + switch (value) {
  14. + case LED_OFF:
  15. + level = led_dat->active_low ? 1 : 0;
  16. + break;
  17. + case LED_FULL:
  18. + level = led_dat->active_low ? 0 : 1;
  19. + break;
  20. + default:
  21. + level = value;
  22. + break;
  23. + }
  24. /* Setting GPIOs with I2C/etc requires a task context, and we don't
  25. * seem to have a reliable way to know if we're already in one; so