Skip to content

Commit

Permalink
leds: gpio: Set max brightness to 1
Browse files Browse the repository at this point in the history
GPIO LEDs only know 2 states: ON or OFF and do not have PWM capabilities.
However, the max brightness is reported as 255.

This patch sets the max brightness value of a GPIO controlled LED to 1.

Tested on my PinePhone 1.2.

Signed-off-by: Dylan Van Assche <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
  • Loading branch information
DylanVanAssche authored and pavelmachek committed Feb 3, 2021
1 parent 6c3384d commit d864645
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/leds/leds-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static int create_gpio_led(const struct gpio_led *template,
} else {
state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
}
led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
led_dat->cdev.brightness = state;
led_dat->cdev.max_brightness = 1;
if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
if (template->panic_indicator)
Expand Down

0 comments on commit d864645

Please sign in to comment.