From patchwork Tue Mar 29 20:35:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8690971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C2442C0553 for ; Tue, 29 Mar 2016 20:38:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9A5E20361 for ; Tue, 29 Mar 2016 20:38:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FD242035E for ; Tue, 29 Mar 2016 20:38:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1al0Nd-0000fU-JF; Tue, 29 Mar 2016 20:36:49 +0000 Received: from mail-qg0-x235.google.com ([2607:f8b0:400d:c04::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1al0NK-00007N-JW for linux-arm-kernel@lists.infradead.org; Tue, 29 Mar 2016 20:36:31 +0000 Received: by mail-qg0-x235.google.com with SMTP id w104so17016342qge.3 for ; Tue, 29 Mar 2016 13:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g+vWvuBZkADWI//9SWTNXVJmK0GBzWfmRpE8yNF6Ooo=; b=poruF4BuZy1f8df3BzytKD8lWYBUbFQyu93tkuUQjPmyQ7InW5kRsfTM2pidqjaB++ OJvYgBQuu7rHqbix8r2RF9oSJAu2RpT/Rlq9u8p1AgrVyI/Kabw8BmI3v+gUfvcOLHt7 q9bDAm2JUolGbUnvUjZ7jTYqkv4nCpWR/mETxzqSU7OR/eGTca+hv1MUkot/E8jfMmla xQcg/XulZpFXokKDwlHkSuZJOBZEsbr7xdD2MruNcLgK9Ns0U+WAt01xd4isADadIN9B TQ5fQAWEb2M/cmCPrGIb+bAShA/VqiOIbnjc01DujAUuaFBAA9YJGiW1jau0CNFi1Rbe 2+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g+vWvuBZkADWI//9SWTNXVJmK0GBzWfmRpE8yNF6Ooo=; b=lC2V/aJ7B1vavx9aSAIJU/EYjnl1rcu18HQyJkKV8uvlSIS2EQZI9J8dEv1k0ACOYn 6BztZ52S8Te1T+Q/IGwXzx4ZBiQjDQutDPVI55gd03BvnG1WqGUskCvJUCdnfiL1+FvM UAuN0Nic+W7LkuA6mgg5ceganRzEpFmRv1KfuU/Zj0zNjlRtyNGYDquuBpDQF5fxcCkN B50+eoGNz+r1MGDTyJpsi/lRVnQYzFWQ7cQtXfCCHXdc8KMayqpYb3RMnxT2hpm3p21u NGCUCav3Dyy3UHFs/hXGrn57ItQKB+A6IduJFagDSmo3DUaPG8Rtmhs7fxFDiW6DlEYN M9Eg== X-Gm-Message-State: AD7BkJKaifDLqhSKxFpigonzyCQSOaNgmCBiyjO1HCBwFo7uHrB/3zhVqgvpfEZchWTczA== X-Received: by 10.140.42.196 with SMTP id c62mr5544877qga.66.1459283768508; Tue, 29 Mar 2016 13:36:08 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id a66sm228623qkb.20.2016.03.29.13.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Mar 2016 13:36:07 -0700 (PDT) From: Ezequiel Garcia To: , Subject: [PATCH 1/3] leds: trigger: Introduce a kernel panic LED trigger Date: Tue, 29 Mar 2016 17:35:47 -0300 Message-Id: <1459283749-22451-2-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1459283749-22451-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1459283749-22451-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160329_133630_756156_DACE397F X-CRM114-Status: GOOD ( 17.14 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: k.kozlowski@samsung.com, kgene@kernel.org, Richard Purdie , Jacek Anaszewski , Ezequiel Garcia MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/leds/trigger/Kconfig | 7 +++++++ drivers/leds/trigger/Makefile | 1 + drivers/leds/trigger/ledtrig-panic.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 drivers/leds/trigger/ledtrig-panic.c diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig index 5bda6a9b56bb..554f5bfbeced 100644 --- a/drivers/leds/trigger/Kconfig +++ b/drivers/leds/trigger/Kconfig @@ -108,4 +108,11 @@ config LEDS_TRIGGER_CAMERA This enables direct flash/torch on/off by the driver, kernel space. If unsure, say Y. +config LEDS_TRIGGER_PANIC + bool "LED Panic Trigger" + depends on LEDS_TRIGGERS + help + This allows LEDs to be configured to blink on a kernel panic. + If unsure, say Y. + endif # LEDS_TRIGGERS diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile index 1abf48dacf7e..547bf5c80e52 100644 --- a/drivers/leds/trigger/Makefile +++ b/drivers/leds/trigger/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o +obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c new file mode 100644 index 000000000000..627b350c5ec3 --- /dev/null +++ b/drivers/leds/trigger/ledtrig-panic.c @@ -0,0 +1,30 @@ +/* + * Kernel Panic LED Trigger + * + * Copyright 2016 Ezequiel Garcia + * + * 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 +#include +#include + +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);