From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Ranostay Subject: [PATCH] leds: leds-pca963x: add nxp,leds-suspend property Date: Tue, 4 Oct 2016 19:29:32 -0700 Message-ID: <1475634572-18274-1-git-send-email-matt@ranostay.consulting> Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:36418 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753973AbcJEC3j (ORCPT ); Tue, 4 Oct 2016 22:29:39 -0400 Sender: linux-leds-owner@vger.kernel.org List-Id: linux-leds@vger.kernel.org To: linux-leds@vger.kernel.org, devicetree@vger.kernel.org Cc: Matt Ranostay , Richard Purdie , Jacek Anaszewski Allow the LED subsystem to blank the LEDS on suspend. Cc: Richard Purdie Cc: Jacek Anaszewski Signed-off-by: Matt Ranostay --- Documentation/devicetree/bindings/leds/pca963x.txt | 1 + drivers/leds/leds-pca963x.c | 9 +++++++++ include/linux/platform_data/leds-pca963x.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/pca963x.txt b/Documentation/devicetree/bindings/leds/pca963x.txt index dafbe9931c2b..61b1f037ebd0 100644 --- a/Documentation/devicetree/bindings/leds/pca963x.txt +++ b/Documentation/devicetree/bindings/leds/pca963x.txt @@ -7,6 +7,7 @@ Optional properties: - nxp,totem-pole : use totem pole (push-pull) instead of open-drain (pca9632 defaults to open-drain, newer chips to totem pole) - nxp,hw-blink : use hardware blinking instead of software blinking +- nxp,leds-suspend : turn off LEDS on system suspend Each led is represented as a sub-node of the nxp,pca963x device. diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 407eba11e187..9a347b94f1db 100644 --- a/drivers/leds/leds-pca963x.c +++ b/drivers/leds/leds-pca963x.c @@ -294,6 +294,12 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip) else pdata->blink_type = PCA963X_SW_BLINK; + /* default to turning off LEDs on suspend */ + if (of_property_read_bool(np, "nxp,leds-suspend")) + pdata->suspend = PCA963X_LED_SUSPEND; + else + pdata->suspend = PCA963X_LED_RETAIN; + return pdata; } @@ -386,6 +392,9 @@ static int pca963x_probe(struct i2c_client *client, if (pdata && pdata->blink_type == PCA963X_HW_BLINK) pca963x[i].led_cdev.blink_set = pca963x_blink_set; + if (pdata && pdata->suspend == PCA963X_LED_SUSPEND) + pca963x[i].led_cdev.flags = LED_CORE_SUSPENDRESUME; + err = led_classdev_register(&client->dev, &pca963x[i].led_cdev); if (err < 0) goto exit; diff --git a/include/linux/platform_data/leds-pca963x.h b/include/linux/platform_data/leds-pca963x.h index e731f0036329..e5bad91e2fab 100644 --- a/include/linux/platform_data/leds-pca963x.h +++ b/include/linux/platform_data/leds-pca963x.h @@ -33,10 +33,16 @@ enum pca963x_blink_type { PCA963X_HW_BLINK, }; +enum pca963x_suspend { + PCA963X_LED_RETAIN, + PCA963X_LED_SUSPEND, +}; + struct pca963x_platform_data { struct led_platform_data leds; enum pca963x_outdrv outdrv; enum pca963x_blink_type blink_type; + enum pca963x_suspend suspend; }; #endif /* __LINUX_PCA963X_H*/ -- 2.7.4