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: 616485 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qwrTl45dfz9sxb for ; Fri, 29 Apr 2016 08:04:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vanguardiasur-com-ar.20150623.gappssmtp.com header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.b=wABHSOnP; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753871AbcD1WEL (ORCPT ); Thu, 28 Apr 2016 18:04:11 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:35837 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753603AbcD1WEI (ORCPT ); Thu, 28 Apr 2016 18:04:08 -0400 Received: by mail-pf0-f174.google.com with SMTP id 77so6683796pfv.2 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=GuHNgTXsiZ7UqQ9KSltEbzI+9p44QCN8/sCmDTnCmN3WTGoRP0ddTtc0AGmfw9kyaQ gefO18bFGPlToLHyEa4nHoxyckhpupqwh91E+U/+Ub+AHp181OpVX8aIzDFJZdmZrCOM 7JlqC7UX2VzpveRIwIjHucwb6NvOYJvyEN7lAS9KZSXD0R4/TW0MiwsfTjs7sHDGtj0R 5O0+PI9YvuMyZ/tLTSDE+8nqDf8sE4zXkQpAKJmNGtjOlqUlzIj5qGwICRfinyOz4Xa/ Zj2pivINOgf9czKukBZnNjN1vVlReVEPuGYswK+QCMHith3NriAt4Pl1fM1lxk1qE94Z CU0g== X-Gm-Message-State: AOPr4FWKM8jCBFeaLaGvrlPULq9OZIML8XeBVWUxJSTITnHikQt2S0mz0bPMr8XI+nQzCw== 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: , , , Cc: Richard Purdie , Jacek Anaszewski , Kumar Gala , Ian Campbell , Mark Rutland , Pawel Moll , Rob Herring , Pavel Machek , Ezequiel Garcia 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> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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;