{"id":805786,"url":"http://patchwork.ozlabs.org/api/1.2/patches/805786/?format=json","web_url":"http://patchwork.ozlabs.org/project/openbmc/patch/20170825063503.31577-3-andrew@aj.id.au/","project":{"id":56,"url":"http://patchwork.ozlabs.org/api/1.2/projects/56/?format=json","name":"OpenBMC development","link_name":"openbmc","list_id":"openbmc.lists.ozlabs.org","list_email":"openbmc@lists.ozlabs.org","web_url":"http://github.com/openbmc/","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170825063503.31577-3-andrew@aj.id.au>","list_archive_url":null,"date":"2017-08-25T06:35:03","name":"[2/2] leds: gpio: Allow LED to retain state at shutdown","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":true,"hash":"92ff6e6c14e5522e86aaaeb7c3f213606214b8ee","submitter":{"id":68332,"url":"http://patchwork.ozlabs.org/api/1.2/people/68332/?format=json","name":"Andrew Jeffery","email":"andrew@aj.id.au"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openbmc/patch/20170825063503.31577-3-andrew@aj.id.au/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/805786/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/805786/checks/","tags":{},"related":[],"headers":{"Return-Path":"<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","openbmc@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","openbmc@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xdrzt0ws1z9t24\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 25 Aug 2017 16:36:58 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xdrzs6mwmzDrWK\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 25 Aug 2017 16:36:57 +1000 (AEST)","from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com\n\t[66.111.4.26])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xdryz3dSkzDqfh\n\tfor <openbmc@lists.ozlabs.org>; Fri, 25 Aug 2017 16:36:11 +1000 (AEST)","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 167072107B;\n\tFri, 25 Aug 2017 02:36:09 -0400 (EDT)","from frontend1 ([10.202.2.160])\n\tby compute4.internal (MEProxy); Fri, 25 Aug 2017 02:36:09 -0400","from keelia.aj.id.au\n\t(ppp118-210-176-216.bras2.adl6.internode.on.net [118.210.176.216])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id E86AE7F9A8;\n\tFri, 25 Aug 2017 02:36:04 -0400 (EDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"b2JibCXq\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"S+YjUokx\"; \n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"b2JibCXq\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"S+YjUokx\"; \n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=aj.id.au header.i=@aj.id.au header.b=\"b2JibCXq\";\n\tdkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"S+YjUokx\"; dkim-atps=neutral"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc\n\t:date:from:in-reply-to:message-id:references:subject:to\n\t:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=z4LVJA\n\tIVU2M56RIprl/qiX+/PbTEHvDvbXK/fTx4AqQ=; b=b2JibCXq0f9tZ7p62kPrO+\n\txie5bzX5u+plx3sI+Kkua0I3tP3ZmBXCCEa91GW4d/Asr8sQwfz1PPDtgwhwoEzU\n\t2XXk6howiGNos1DFWSRKDgKnDBNqyIcgzEUfJbyDYvQgHh7TLY9cYDa4dU2kL4Zx\n\tfvVWi9KlQ/VbAqCcIuVTcMk5fS196NkLMDmO2oPgnZs8y8Sq80iirEDadSQ4jn1n\n\tePF19cjoqnRRa+hKuXWSH9U56XkS+PIHg4UjWBioFhjQwKLmUc1RGnGBFCy5u3dl\n\tOgrfIqWKkiIYeiU6+87/K5rzgOd0E54HHvSKrX1sSaHLWMnyoTbVkodJQakDw/EQ\n\t==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=z4LVJAIVU2M56RIprl/qiX+/PbTEHvDvbXK/fTx4A\n\tqQ=; b=S+YjUokxzDTMQ75eQUPC6qWqpRR6KP+GmPgZQMVkjPMkHBK0EjW9aO6G3\n\tNSYkBf+raYDd/p4cG30TmVlu+ZJkTSLj/oxqVn6lVMD/yP0o5tpEV6Z9mZDhftB4\n\tg2efCkxe9729nIkb+0maA3hq//SNXG4MhtlDWdheL3SLTHIeynvzIQfsvxJp81E6\n\tqdiq1UR4wfAfasAQjs+BXCDaP/+onvZO7wmMg7j0/nZeGCWPD2TMF8Yhp5qcNcgA\n\t0vAo2v8zFXvEniYNXZKgf/Rxull2BeR5XW4hkl+svm9I9KgNnMe9X/Qs9hFsmsDY\n\tsISeRZ085zBZgLpzu3yh/yvlgj2HA=="],"X-ME-Sender":"<xms:WcWfWdiHUWmzMYEXJOXXjpbYv7sQfrc9P3lznLnbMUHaeDoH-Z-GUw>","X-Sasl-enc":"HgZ/bYw+qbv0JKHpk/b/LemW+p2pK8DPAUmQWMu4L1VO 1503642968","From":"Andrew Jeffery <andrew@aj.id.au>","To":"linux-leds@vger.kernel.org","Subject":"[PATCH 2/2] leds: gpio: Allow LED to retain state at shutdown","Date":"Fri, 25 Aug 2017 16:05:03 +0930","Message-Id":"<20170825063503.31577-3-andrew@aj.id.au>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170825063503.31577-1-andrew@aj.id.au>","References":"<20170825063503.31577-1-andrew@aj.id.au>","X-BeenThere":"openbmc@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Development list for OpenBMC <openbmc.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/openbmc/>","List-Post":"<mailto:openbmc@lists.ozlabs.org>","List-Help":"<mailto:openbmc-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/openbmc>,\n\t<mailto:openbmc-request@lists.ozlabs.org?subject=subscribe>","Cc":"mark.rutland@arm.com, devicetree@vger.kernel.org,\n\tAndrew Jeffery <andrew@aj.id.au>, openbmc@lists.ozlabs.org,\n\tlinux-kernel@vger.kernel.org, robh+dt@kernel.org, rpurdie@rpsys.net, \n\tjacek.anaszewski@gmail.com, pavel@ucw.cz","Errors-To":"openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"openbmc\"\n\t<openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"},"content":"In some systems, such as BMCs, we want to retain the state of LEDs\nacross a reboot of the BMC whilst the host remains up.\n\nSigned-off-by: Andrew Jeffery <andrew@aj.id.au>\n---\n drivers/leds/leds-gpio.c | 7 ++++++-\n include/linux/leds.h     | 2 ++\n 2 files changed, 8 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c\nindex e753ba93ba1e..764c31301f90 100644\n--- a/drivers/leds/leds-gpio.c\n+++ b/drivers/leds/leds-gpio.c\n@@ -134,6 +134,8 @@ static int create_gpio_led(const struct gpio_led *template,\n \t\tled_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;\n \tif (template->panic_indicator)\n \t\tled_dat->cdev.flags |= LED_PANIC_INDICATOR;\n+\tif (template->retain_state_shutdown)\n+\t\tled_dat->cdev.flags |= LED_RETAIN_AT_SHUTDOWN;\n \n \tret = gpiod_direction_output(led_dat->gpiod, state);\n \tif (ret < 0)\n@@ -205,6 +207,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)\n \n \t\tif (fwnode_property_present(child, \"retain-state-suspended\"))\n \t\t\tled.retain_state_suspended = 1;\n+\t\tif (fwnode_property_present(child, \"retain-state-shutdown\"))\n+\t\t\tled.retain_state_shutdown = 1;\n \t\tif (fwnode_property_present(child, \"panic-indicator\"))\n \t\t\tled.panic_indicator = 1;\n \n@@ -267,7 +271,8 @@ static void gpio_led_shutdown(struct platform_device *pdev)\n \tfor (i = 0; i < priv->num_leds; i++) {\n \t\tstruct gpio_led_data *led = &priv->leds[i];\n \n-\t\tgpio_led_set(&led->cdev, LED_OFF);\n+\t\tif (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN))\n+\t\t\tgpio_led_set(&led->cdev, LED_OFF);\n \t}\n }\n \ndiff --git a/include/linux/leds.h b/include/linux/leds.h\nindex 64c56d454f7d..bf6db4fe895b 100644\n--- a/include/linux/leds.h\n+++ b/include/linux/leds.h\n@@ -49,6 +49,7 @@ struct led_classdev {\n #define LED_HW_PLUGGABLE\t(1 << 19)\n #define LED_PANIC_INDICATOR\t(1 << 20)\n #define LED_BRIGHT_HW_CHANGED\t(1 << 21)\n+#define LED_RETAIN_AT_SHUTDOWN\t(1 << 22)\n \n \t/* set_brightness_work / blink_timer flags, atomic, private. */\n \tunsigned long\t\twork_flags;\n@@ -392,6 +393,7 @@ struct gpio_led {\n \tunsigned\tretain_state_suspended : 1;\n \tunsigned\tpanic_indicator : 1;\n \tunsigned\tdefault_state : 2;\n+\tunsigned\tretain_state_shutdown : 1;\n \t/* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */\n \tstruct gpio_desc *gpiod;\n };\n","prefixes":["2/2"]}