Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: gpio: Support the "panic-indicator" firmware property

Calling a GPIO LEDs is quite likely to work even if the kernel
has paniced, so they are ideal to blink in this situation.
This commit adds support for the new "panic-indicator"
firmware property, allowing to mark a given LED to blink on
a kernel panic.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>

authored by

Ezequiel Garcia and committed by
Jacek Anaszewski
80d6737b e4f4f709

+7
+2
Documentation/devicetree/bindings/leds/leds-gpio.txt
··· 23 23 property is not present. 24 24 - retain-state-suspended: (optional) The suspend state can be retained.Such 25 25 as charge-led gpio. 26 + - panic-indicator : (optional) 27 + see Documentation/devicetree/bindings/leds/common.txt 26 28 27 29 Examples: 28 30
+4
drivers/leds/leds-gpio.c
··· 127 127 led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; 128 128 if (!template->retain_state_suspended) 129 129 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 130 + if (template->panic_indicator) 131 + led_dat->cdev.flags |= LED_PANIC_INDICATOR; 130 132 131 133 ret = gpiod_direction_output(led_dat->gpiod, state); 132 134 if (ret < 0) ··· 202 200 203 201 if (fwnode_property_present(child, "retain-state-suspended")) 204 202 led.retain_state_suspended = 1; 203 + if (fwnode_property_present(child, "panic-indicator")) 204 + led.panic_indicator = 1; 205 205 206 206 ret = create_gpio_led(&led, &priv->leds[priv->num_leds], 207 207 dev, NULL);
+1
include/linux/leds.h
··· 365 365 unsigned gpio; 366 366 unsigned active_low : 1; 367 367 unsigned retain_state_suspended : 1; 368 + unsigned panic_indicator : 1; 368 369 unsigned default_state : 2; 369 370 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ 370 371 struct gpio_desc *gpiod;