diff options
author | John Crispin <john@openwrt.org> | 2015-08-17 06:04:32 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2015-08-17 06:04:32 +0000 |
commit | 22b3e521b5ec4022717df7ef0c532b58aaca4abe (patch) | |
tree | caa2bcb90a9e6eeeccf5af9e7d02849c0b59285b /target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch | |
parent | 98e122e4ccd533a5836e5dcb8a96d2d09180b8f0 (diff) | |
download | mtk-20170518-22b3e521b5ec4022717df7ef0c532b58aaca4abe.zip mtk-20170518-22b3e521b5ec4022717df7ef0c532b58aaca4abe.tar.gz mtk-20170518-22b3e521b5ec4022717df7ef0c532b58aaca4abe.tar.bz2 |
brcm2708: update 4.1 patches
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
SVN-Revision: 46640
Diffstat (limited to 'target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch b/target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch new file mode 100644 index 0000000..fa803ba --- /dev/null +++ b/target/linux/brcm2708/patches-4.1/0123-leds-gpio-Implement-the-brightness_get-method.patch @@ -0,0 +1,43 @@ +From b0482b8fe870cfc43e4f9a00470b267f27900ce7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell <phil@raspberrypi.org> +Date: Wed, 15 Jul 2015 13:46:08 +0100 +Subject: [PATCH 123/148] leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -82,6 +82,13 @@ static void gpio_led_set(struct led_clas + } + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -138,6 +145,7 @@ static int create_gpio_led(const struct + led_dat->cdev.blink_set = gpio_blink_set; + } + led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else |