From patchwork Mon Apr 4 20:22:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 8743951 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 DF7159F38C for ; Mon, 4 Apr 2016 20:25:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B80F2022A for ; Mon, 4 Apr 2016 20:25:02 +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 EEA462025A for ; Mon, 4 Apr 2016 20:25: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 1anB28-0007CS-9b; Mon, 04 Apr 2016 20:23:36 +0000 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anB1S-0006ni-7U for linux-arm-kernel@lists.infradead.org; Mon, 04 Apr 2016 20:22:55 +0000 Received: by mail-qg0-x22d.google.com with SMTP id j35so162642119qge.0 for ; Mon, 04 Apr 2016 13:22:33 -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=DkRSq5rGXWARRbdsWS/RKIycoHaYrJT4Pac8pDtSI5U=; b=JlUk2Dq61+L0Jdsgk9kebo0Ol+hn6c6mupS9IUszNIrp7R3h9yIwIS7TVKf7dGflBv sVtuhnIsbudAHJSaGQbatoTrDJaRn864ZQc8js9BKQItBHLxC6ehzVJIWvUoZ8MycPu6 Aa7/IBmYNOVE0D5tklYT98PzB4QKWyl0ARzSYZFcizIaxFRpY2erHR3/FM8vw9aNkPc8 1KCm3ZDYHV6TlMllKr1bWd2KaGxYNiKuS6TLPdH0j+GYGJ9Yj073Or5RNHs4wNx6wmgE BYL57e4X/GqJLaI8isjqgSK+xiU7TeLnc+pYIq/P8HWdyOPN2asqPeWqcy0EzRyMWr3R ZFaA== 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=DkRSq5rGXWARRbdsWS/RKIycoHaYrJT4Pac8pDtSI5U=; b=ha+sTmFGqPQ3Ndlj4Uxq/vp4drxAqtuucX0ElgwD8hKYwr7IYIdLoVUNgreT7uTekx tSzR7hof/rQg/IiI/KaJXPIt8u5kBlfZ1DsScKQZPb1Lei2+a6DNxNo4pGtV8vXVEVV3 gkDCQFlckjfwktTORneOqd0ql95AyoAx6GV213Oq48zPUoQloNAsEZ5sjmHlSxjQBWVO WVgzO8fpXQkPgYHUgCFBPkJjOkFoFriW2/Engh/sRIqfDVTkets64odFV1hNYkWsuLUv XMiORb74SeV5V2XP52ijh9m6i8skPnYJjRGXMIiQMwK86OIBQRh/xA8uXPWeamj+9CvO CjNw== X-Gm-Message-State: AD7BkJLx+HyvUmd22fGv+HnP0Lj36CYFYaCO52uwnrbIK7Q35BwX0Fg10oqTlWTyIYm91A== X-Received: by 10.140.96.137 with SMTP id k9mr42812748qge.23.1459801353279; Mon, 04 Apr 2016 13:22:33 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.156]) by smtp.gmail.com with ESMTPSA id w75sm13065124qka.49.2016.04.04.13.22.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 13:22:32 -0700 (PDT) From: Ezequiel Garcia To: , , Subject: [PATCH 5/5] leds: gpio: Support the panic-blink firmware property Date: Mon, 4 Apr 2016 17:22:06 -0300 Message-Id: <1459801326-5541-6-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1459801326-5541-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1459801326-5541-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160404_132254_443530_2081175B X-CRM114-Status: GOOD ( 12.11 ) 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: 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 GPIO LEDs are relatively cheap, and so are ideal to blink on a kernel panic. This commit adds support for the new "panic-blink" 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..74e35dcaf874 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_blink) + led_dat->cdev.flags |= LED_BLINK_AT_PANIC; 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-blink")) + led.panic_blink = 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 d33b230ce66d..e8e99cc5f99e 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -363,6 +363,7 @@ struct gpio_led { unsigned gpio; unsigned active_low : 1; unsigned retain_state_suspended : 1; + unsigned panic_blink : 1; unsigned default_state : 2; /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ struct gpio_desc *gpiod;