{"id":805789,"url":"http://patchwork.ozlabs.org/api/1.2/patches/805789/?format=json","web_url":"http://patchwork.ozlabs.org/project/openbmc/patch/20170825065244.488-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":"<20170825065244.488-3-andrew@aj.id.au>","list_archive_url":null,"date":"2017-08-25T06:52:41","name":"[linux,dev-4.10,2/5] leds: gpio: Allow LED to retain state at shutdown","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"fb93e8a6493706f4d251f4b44b4d4e3e4a1e4303","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/20170825065244.488-3-andrew@aj.id.au/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/805789/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/805789/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 [IPv6:2401:3900:2:1::3])\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 3xdsMs3LS6z9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 25 Aug 2017 16:54:17 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xdsMs2CLqzDrL5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 25 Aug 2017 16:54:17 +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 3xdsM65Yn2zDrLH\n\tfor <openbmc@lists.ozlabs.org>; Fri, 25 Aug 2017 16:53:38 +1000 (AEST)","from compute4.internal (compute4.nyi.internal [10.202.2.44])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 89F5620DE9;\n\tFri, 25 Aug 2017 02:53:36 -0400 (EDT)","from frontend2 ([10.202.2.161])\n\tby compute4.internal (MEProxy); Fri, 25 Aug 2017 02:53:36 -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 6BC6F240B1;\n\tFri, 25 Aug 2017 02:53:33 -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=\"GAWggC76\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"RxUnIL0x\"; \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=\"GAWggC76\";\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"RxUnIL0x\"; \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=\"GAWggC76\";\n\tdkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"RxUnIL0x\"; 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=zSvDc2\n\tJDivLhT4h+6jNj+TgZda3gTWf0YCDThpzKT0Y=; b=GAWggC761nSJOe9gvLnQWj\n\tEo5B7tP7uJEOSvIjDrjbuGjV18V0rMXT98/4SIOY6NPpn6fbpXCDLzrTj02dgetH\n\tC2qOseP4q5xrYueLk9haHVsZKrNuKOg9z8dNni+7err2Wdw4Loh7m4/srGoCYtNz\n\tvmy2MD5RVnTCbgftxPXxg81LRoQmrcJwaZz41eBMELB1JjVJnkj5GGW9gmTwscwy\n\tRSK0pshX3egqRe5gZaTB9Po691M0nyFB0X37OiN1qIEY3aD3Ve5Ei+toAVllvUoT\n\tuQe0Poftp1GisunkmblV7E7VHuxJ+sJhL2Z/WzrCnZZmIR5bDLeIxuHg7+0KFYUQ\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=zSvDc2JDivLhT4h+6jNj+TgZda3gTWf0YCDThpzKT\n\t0Y=; b=RxUnIL0xtNy+HKxsaZns5Qml5AlBpW75uwSFqKFffP8qa0BDNhKhN7/WZ\n\tYsMiWe+kAXeLe21m3GtNaw7ug45VNWTaqS0ydZDNYgzz7C7RXs7wXh9SLwV3gBe+\n\txFAt10bG1XDFNR1vpAZg/9dsADU9/nVb2yP1wL3y3YPB3qtinp3xfcEVQ+QYjwOe\n\tZwlGqbbcdahktLDhrS9KsnKFFTPpRianImOY7UCUhNqgkJ0bWtUWs2y/ko6WGS+u\n\tmfdmetyuTQMiP7LkRPwyh0gtrSOsh0wOa73H3KvRPFXFEcgU5bkqBqpO6nSXvpTK\n\tDredMLBw5NnDDtLSgxSwADchI5iHg=="],"X-ME-Sender":"<xms:cMmfWQgNuPNlq4ojrIASnYGhtVqC2mEpBARB07p5mXkHj7DfdWQ_qw>","X-Sasl-enc":"qtBV19+nsNhriEOYogfKocqZOaR6JjXr0kwdThvd4Hr8 1503644015","From":"Andrew Jeffery <andrew@aj.id.au>","To":"joel@jms.id.au","Subject":"[PATCH linux dev-4.10 2/5] leds: gpio: Allow LED to retain state at\n\tshutdown","Date":"Fri, 25 Aug 2017 16:22:41 +0930","Message-Id":"<20170825065244.488-3-andrew@aj.id.au>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170825065244.488-1-andrew@aj.id.au>","References":"<20170825065244.488-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":"Andrew Jeffery <andrew@aj.id.au>, eajames@linux.vnet.ibm.com,\n\topenbmc@lists.ozlabs.org, clg@kaod.org, bjwyman@gmail.com","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     | 3 +++\n 2 files changed, 9 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c\nindex d400dcaf4d29..061ab9220048 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@@ -203,6 +205,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@@ -265,7 +269,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 569cb531094c..4d39f767f34a 100644\n--- a/include/linux/leds.h\n+++ b/include/linux/leds.h\n@@ -46,6 +46,8 @@ struct led_classdev {\n #define LED_DEV_CAP_FLASH\t(1 << 18)\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@@ -378,6 +380,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":["linux","dev-4.10","2/5"]}