From patchwork Wed Apr 13 18:08:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8824751 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 5864CC0553 for ; Wed, 13 Apr 2016 18:11:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77F412014A for ; Wed, 13 Apr 2016 18:11:01 +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 9AE0120374 for ; Wed, 13 Apr 2016 18:11:00 +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 1aqPEK-0006RQ-7y; Wed, 13 Apr 2016 18:09:32 +0000 Received: from mail-qg0-x231.google.com ([2607:f8b0:400d:c04::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aqPE2-0006K4-1Y for linux-arm-kernel@lists.infradead.org; Wed, 13 Apr 2016 18:09:15 +0000 Received: by mail-qg0-x231.google.com with SMTP id c6so49407444qga.1 for ; Wed, 13 Apr 2016 11:08:51 -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=NLGSVDhHXMpo+M/Tqp/dwiaIdeV34Rl1XBGZMVRA+JU=; b=1PfRHjto82CB7BpCJ594jcHxJh/lcF/x7tBhhkGDsOwPgMjjOEdvyotS8In1KdUP/K eDbGNH4GgKx4IIL8fm5Qk9IFrP7YiVJLFuKmtNKo8/aho2oLyyCBzASBf0cWRYcA42RM UY8ctMMbmHND7+OQ14Hw0qFaTOj1KiI1vxkGCmXG72b/oGCX6bwKZ+mCh6szLxRwlpQB 4hVGc2ZqCn/CnSslew5fOAdRJwgRPf04Ccnw6T8Jb+g1pZeGXOYHhUPUG8ujjK3mSM1y QDOkPu5UmdkZ6zWqkPIhXnvYunY+CFA0g7DfdaYn+DwJmkKn5laWAEUInDYyc2b5jM5G 4P0g== 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=NLGSVDhHXMpo+M/Tqp/dwiaIdeV34Rl1XBGZMVRA+JU=; b=Nt9q7qleQkvSQpjo2RNh0EJB2j75VQpEwHELdLuhxAwMcaHQkDXmybq0GVzVs9TuVX OnYJCkXwd9RW+Hkdh40bvsGI6s5EXS0qW83/c2G/i2QYXcKrb/RmYJWuy8LQVOP917jT 9yhmRvlgtSZbSlNAXtwl2PiNkDK1YCkCIM7zPLUrIfbHwEh/uP3YPf/ej0oa/9iIRnoC HhpBzRJOnEarjuV5g7G+JPrEmo9530cIp02Vq7Ds+niL5a3YxfXxA5YXtV5PSfWfnt/6 43aQkYJQQ53YR+JSYsAt6QEGVe8CQ0wwFRU8fRDZc/RTSxA8CCj4A53UHlfZyrz+5OvX iA7w== X-Gm-Message-State: AOPr4FVorHa4ui9wwE3Bk65CbbXXaY4tzvqhI8U3uN7AZ5/7RdXYqlvJeuoMdwr3X9jH8w== X-Received: by 10.140.93.79 with SMTP id c73mr12932390qge.101.1460570930975; Wed, 13 Apr 2016 11:08:50 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id x189sm16248410qhb.43.2016.04.13.11.08.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 11:08:49 -0700 (PDT) From: Ezequiel Garcia To: , , , Subject: [PATCH v2 3/3] leds: gpio: Support the "panic-indicator" firmware property Date: Wed, 13 Apr 2016 15:08:19 -0300 Message-Id: <1460570899-24642-4-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1460570899-24642-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1460570899-24642-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160413_110914_328732_9FEB4C69 X-CRM114-Status: GOOD ( 13.03 ) 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 , 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 --- drivers/leds/leds-gpio.c | 4 ++++ include/linux/leds.h | 1 + 2 files changed, 5 insertions(+) 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 49adf9c6e326..1067fb5f9296 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -359,6 +359,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;