pmaports/main/linux-postmarketos-allwinner/0008-leds-gpio-Set-max-brightness-to-1.patch
Clayton Craft a2524184ed
linux-postmarketos-allwinner: upgrade to 5.11.0 (MR 1955)
Upgrades to megi's 5.11 orange-pi-5.11-20210218-0749 tag.

All patches were rebased.
2021-02-26 17:08:53 -08:00

36 lines
1.3 KiB
Diff

From 9a4733f7b64738942086b6ddef7975550460c989 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Tue, 29 Dec 2020 14:59:23 +0100
Subject: [PATCH] leds: gpio: Set max brightness to 1
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 <me@dylanvanassche.be>
Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/1832
Related: https://lkml.org/lkml/2020/12/27/64
---
drivers/leds/leds-gpio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 93f5b1b60fde..0d66f19d71ba 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -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_ON : LED_OFF;
+ led_dat->cdev.max_brightness = LED_ON;
if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
if (template->panic_indicator)
--
2.30.1