main/linux-postmarketos-allwinner: set leds-gpio max_brightness to 1 (MR 1838)

LEDs controlled through the leds-gpio driver are not PWM capable.
Setting the max_brightness property to 1 instead of 255.
This commit is contained in:
Dylan Van Assche 2020-12-26 19:55:57 +01:00 committed by Oliver Smith
parent e42ff4ebd4
commit 6e33ebe6f3
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 40 additions and 2 deletions

View file

@ -0,0 +1,36 @@
From ecc1613977400f117a4f399d46404b399547ee18 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.26.2

View file

@ -6,7 +6,7 @@ _flavor=postmarketos-allwinner
_config="config-$_flavor.$CARCH" _config="config-$_flavor.$CARCH"
pkgname=linux-$_flavor pkgname=linux-$_flavor
pkgver=5.10.0_git20201214 pkgver=5.10.0_git20201214
pkgrel=2 pkgrel=3
_tag="orange-pi-5.10-20201214-0813" _tag="orange-pi-5.10-20201214-0813"
pkgdesc="Kernel fork with Pine64 patches (megi's tree, slightly patched)" pkgdesc="Kernel fork with Pine64 patches (megi's tree, slightly patched)"
arch="aarch64" arch="aarch64"
@ -35,6 +35,7 @@ source="$pkgname-$_tag.tar.gz::https://github.com/megous/linux/archive/$_tag.tar
0006-arm64-dts-allwinner-Add-bluetooth-node-to-the-PineTa.patch 0006-arm64-dts-allwinner-Add-bluetooth-node-to-the-PineTa.patch
0007-dts-pinephone-remove-bt-firmware-suffix.patch 0007-dts-pinephone-remove-bt-firmware-suffix.patch
0008-media-ov5640-Implement-autofocus.patch 0008-media-ov5640-Implement-autofocus.patch
0009-leds-gpio-set-max_brightness-to-1.patch
" "
subpackages="$pkgname-dev" subpackages="$pkgname-dev"
builddir="$srcdir/linux-$_tag" builddir="$srcdir/linux-$_tag"
@ -84,4 +85,5 @@ d92db05628de20c57f69edd0558fc56eb5a1c90f6dd3046813dc2b8c7393030f55e4980ae4135f9a
26bd19eb7849ad59ac73a002edeb5d015630c0f802b4da1ec75a01581aeb406350097b5e37ef5c0981cc503cdbfc4d24d446c193a533f01e3e4b51426c9e192e 0005-dts-pinetab-make-audio-routing-consistent-with-pinep.patch 26bd19eb7849ad59ac73a002edeb5d015630c0f802b4da1ec75a01581aeb406350097b5e37ef5c0981cc503cdbfc4d24d446c193a533f01e3e4b51426c9e192e 0005-dts-pinetab-make-audio-routing-consistent-with-pinep.patch
79f244794906b84f2033b04429f9bf187f171291c8f808a65f6d2c3a9b8a029eb0460f281148ff4a43c12be4fac3d78fcc4ddfa4c14e687a3f7fc310a5921048 0006-arm64-dts-allwinner-Add-bluetooth-node-to-the-PineTa.patch 79f244794906b84f2033b04429f9bf187f171291c8f808a65f6d2c3a9b8a029eb0460f281148ff4a43c12be4fac3d78fcc4ddfa4c14e687a3f7fc310a5921048 0006-arm64-dts-allwinner-Add-bluetooth-node-to-the-PineTa.patch
11e3210958afcd9a04885f364d9ce707845173430581601cc8d08451529f80aab137f1c578ab3453e7249fe38001eb6aafe728ba5e34e39b65c7e47a3ecd9fda 0007-dts-pinephone-remove-bt-firmware-suffix.patch 11e3210958afcd9a04885f364d9ce707845173430581601cc8d08451529f80aab137f1c578ab3453e7249fe38001eb6aafe728ba5e34e39b65c7e47a3ecd9fda 0007-dts-pinephone-remove-bt-firmware-suffix.patch
510e1cf463485315f99dfc86511fb7271591159c39cf1bbeecbc1056f8861c35603d61946f3488bfbb7a779ce9324c69d230fa159386b7920f866b47ada444a4 0008-media-ov5640-Implement-autofocus.patch" 510e1cf463485315f99dfc86511fb7271591159c39cf1bbeecbc1056f8861c35603d61946f3488bfbb7a779ce9324c69d230fa159386b7920f866b47ada444a4 0008-media-ov5640-Implement-autofocus.patch
6dee374e8459279e2e61894ab9146574283dad61605e4547a1258dd09e02646e46712059431b4086aebb95d24ab44c8b5dc21aa9d004f0190f864045a20b336a 0009-leds-gpio-set-max_brightness-to-1.patch"