From patchwork Thu Apr 28 22:03:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8975681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DA3E9F1D3 for ; Thu, 28 Apr 2016 22:06:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C93B20219 for ; Thu, 28 Apr 2016 22:06:08 +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 48002200E7 for ; Thu, 28 Apr 2016 22:06:07 +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 1avu3E-0004cw-Fs; Thu, 28 Apr 2016 22:04:48 +0000 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avu2u-0004Qy-Am for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 22:04:29 +0000 Received: by mail-pf0-x232.google.com with SMTP id c189so39567729pfb.3 for ; Thu, 28 Apr 2016 15:04:07 -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=IaaGyfzZtM5Ks9PyYWi8EWW7KzUlY1cX6+7zefpJ2ro=; b=wABHSOnPnUxhQ+edP7/srhPa5U64o/y2DcaHHOSIXklJlNs7nYA6dKx8VrDVZauIDv CQf97obn/oX2B0RJ0+cKqrqDvdbfWIqCvogxZqRz/m7LTJ7kW4sNboUBN8QFI6griPLx EhgE96qdyhgQkD14/HsWGHP68+AwFnYlwtuHESnlgDKTTPC1e4lnrycSLmel6pE++rlA GDq2oVAYcK4iq+59oep5yenZaXudwpsIyKiiJ5r3bdibel5WVUNBRBJEIom6rLLmA+3O l3Npg5tsvr2hIl9Z+VocThSyVNEOEeg4Vmeqda+G02yhh63yL+nk936Q6xkhcPsl39Db 37Ww== 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=IaaGyfzZtM5Ks9PyYWi8EWW7KzUlY1cX6+7zefpJ2ro=; b=X7I9yul6+7uz0vTpWfM4uMi32SlqKgOYFRkU5E2OIKMmEmG5XsFaSBYS/dSxmvz9lF Y0tialGsmhI5EkJy9S9UesnrQHR8NU8zQ0EHK2JZMEQ90a7DzOvtlkk8Xqi6Bs97a79W FOlsSZLz5uSrwzBFzOdJMSa+kY1nD+SV0BJlXH/Sv77QB+EeQMoqj7scN3JAE9XXA5N7 uis4TJGiSgVgch7Mdz2lggexT0g8LL8o8Ldp9vT6oxqa5UKAIuZpXgaO7FqdnrQWgVKU z1qNMEiL2isX1LyvK/UtU3GEIsVReZNozOTDABxcwnjcsjh4Izpiba4zK41ayzqV8g0F NBww== X-Gm-Message-State: AOPr4FUzHjLSWDUpQNae0B7OG/PRz74i8ZcS+yMBf+tP8z0avU3NlfD/bnRZL5zbbmjYsg== X-Received: by 10.98.64.4 with SMTP id n4mr24138076pfa.58.1461881047448; Thu, 28 Apr 2016 15:04:07 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id g84sm17609045pfj.42.2016.04.28.15.04.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Apr 2016 15:04:06 -0700 (PDT) From: Ezequiel Garcia To: , , , Subject: [PATCH v3 3/3] leds: gpio: Support the "panic-indicator" firmware property Date: Thu, 28 Apr 2016 19:03:40 -0300 Message-Id: <1461881020-13964-4-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461881020-13964-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1461881020-13964-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_150428_504192_9C64FFBF X-CRM114-Status: GOOD ( 13.69 ) 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: Mark Rutland , Pawel Moll , Ian Campbell , Rob Herring , Richard Purdie , Ezequiel Garcia , Pavel Machek , Kumar Gala , Jacek Anaszewski 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 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 Acked-by: Rob Herring --- Documentation/devicetree/bindings/leds/leds-gpio.txt | 2 ++ drivers/leds/leds-gpio.c | 4 ++++ include/linux/leds.h | 1 + 3 files changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/leds-gpio.txt b/Documentation/devicetree/bindings/leds/leds-gpio.txt index fea1ebfe24a9..cbbeb1850910 100644 --- a/Documentation/devicetree/bindings/leds/leds-gpio.txt +++ b/Documentation/devicetree/bindings/leds/leds-gpio.txt @@ -23,6 +23,8 @@ LED sub-node properties: property is not present. - retain-state-suspended: (optional) The suspend state can be retained.Such as charge-led gpio. +- panic-indicator : (optional) + see Documentation/devicetree/bindings/leds/common.txt Examples: diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 61143f55597e..8229f063b483 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -127,6 +127,8 @@ static int create_gpio_led(const struct gpio_led *template, led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; if (!template->retain_state_suspended) led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; + if (template->panic_indicator) + led_dat->cdev.flags |= LED_PANIC_INDICATOR; ret = gpiod_direction_output(led_dat->gpiod, state); if (ret < 0) @@ -200,6 +202,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) if (fwnode_property_present(child, "retain-state-suspended")) led.retain_state_suspended = 1; + if (fwnode_property_present(child, "panic-indicator")) + led.panic_indicator = 1; ret = create_gpio_led(&led, &priv->leds[priv->num_leds], dev, NULL); diff --git a/include/linux/leds.h b/include/linux/leds.h index 7e9fb00e15e8..d2b13066e781 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -365,6 +365,7 @@ struct gpio_led { unsigned gpio; unsigned active_low : 1; unsigned retain_state_suspended : 1; + unsigned panic_indicator : 1; unsigned default_state : 2; /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ struct gpio_desc *gpiod;