leds: trigger: Introduce a kernel panic LED trigger
This commit introduces a new LED trigger which allows to configure a LED to blink on a kernel panic (through panic_blink). Notice that currently the Openmoko FreeRunner (GTA02) mach code sets panic_blink to blink a hard-coded LED. The new trigger is meant to introduce a generic mechanism to achieve this. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
This commit is contained in:

کامیت شده توسط
Jacek Anaszewski

والد
f55532a0c0
کامیت
916fe61995
30
drivers/leds/trigger/ledtrig-panic.c
Normal file
30
drivers/leds/trigger/ledtrig-panic.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Kernel Panic LED Trigger
|
||||
*
|
||||
* Copyright 2016 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
static struct led_trigger *trigger;
|
||||
|
||||
static long led_panic_blink(int state)
|
||||
{
|
||||
led_trigger_event(trigger, state ? LED_FULL : LED_OFF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init ledtrig_panic_init(void)
|
||||
{
|
||||
led_trigger_register_simple("panic", &trigger);
|
||||
panic_blink = led_panic_blink;
|
||||
return 0;
|
||||
}
|
||||
device_initcall(ledtrig_panic_init);
|
مرجع در شماره جدید
Block a user