linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup
@ 2020-08-25  8:22 Grant Feng
  2020-08-25  8:22 ` [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios' Grant Feng
  2020-09-09  9:18 ` [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Pavel Machek
  0 siblings, 2 replies; 5+ messages in thread
From: Grant Feng @ 2020-08-25  8:22 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, robh+dt, linux-leds,
	devicetree, linux-kernel

generate a 5ms low pulse on shutdown pin when startup, then the chip
becomes more stable in the complex EM environment.

Signed-off-by: Grant Feng <von81@163.com>
---
 drivers/leds/leds-is31fl319x.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index ca6634b8683c..54ac50740d43 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -16,6 +16,8 @@
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 
 /* register numbers */
 #define IS31FL319X_SHUTDOWN		0x00
@@ -61,6 +63,7 @@
 struct is31fl319x_chip {
 	const struct is31fl319x_chipdef *cdef;
 	struct i2c_client               *client;
+	struct gpio_desc		*shutdown_gpio;
 	struct regmap                   *regmap;
 	struct mutex                    lock;
 	u32                             audio_gain_db;
@@ -207,6 +210,15 @@ static int is31fl319x_parse_dt(struct device *dev,
 	if (!np)
 		return -ENODEV;
 
+	is31->shutdown_gpio = devm_gpiod_get_optional(dev,
+						"shutdown",
+						GPIOD_OUT_HIGH);
+	if (IS_ERR(is31->shutdown_gpio)) {
+		ret = PTR_ERR(is31->shutdown_gpio);
+		dev_err(dev, "Failed to get shutdown gpio: %d\n", ret);
+		return ret;
+	}
+
 	of_dev_id = of_match_device(of_is31fl319x_match, dev);
 	if (!of_dev_id) {
 		dev_err(dev, "Failed to match device with supported chips\n");
@@ -350,6 +362,12 @@ static int is31fl319x_probe(struct i2c_client *client,
 	if (err)
 		goto free_mutex;
 
+	if (is31->shutdown_gpio) {
+		gpiod_direction_output(is31->shutdown_gpio, 0);
+		mdelay(5);
+		gpiod_direction_output(is31->shutdown_gpio, 1);
+	}
+
 	is31->client = client;
 	is31->regmap = devm_regmap_init_i2c(client, &regmap_config);
 	if (IS_ERR(is31->regmap)) {
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios'
  2020-08-25  8:22 [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Grant Feng
@ 2020-08-25  8:22 ` Grant Feng
  2020-08-28 22:20   ` Rob Herring
  2020-09-09  9:18 ` [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Pavel Machek
  1 sibling, 1 reply; 5+ messages in thread
From: Grant Feng @ 2020-08-25  8:22 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, robh+dt, linux-leds,
	devicetree, linux-kernel

The chip enters hardware shutdown when the SDB pin is pulled low.
The chip releases hardware shutdown when the SDB pin is pulled high.

Signed-off-by: Grant Feng <von81@163.com>
---
 Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
index fc2603484544..676d43ec8169 100644
--- a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
+++ b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
@@ -16,6 +16,7 @@ Optional properties:
 - audio-gain-db : audio gain selection for external analog modulation input.
 	Valid values: 0 - 21, step by 3 (rounded down)
 	Default: 0
+- shutdown-gpios : Specifier of the GPIO connected to SDB pin of the chip.
 
 Each led is represented as a sub-node of the issi,is31fl319x device.
 There can be less leds subnodes than the chip can support but not more.
@@ -44,6 +45,7 @@ fancy_leds: leds@65 {
 	#address-cells = <1>;
 	#size-cells = <0>;
 	reg = <0x65>;
+	shutdown-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
 
 	red_aux: led@1 {
 		label = "red:aux";
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios'
  2020-08-25  8:22 ` [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios' Grant Feng
@ 2020-08-28 22:20   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-08-28 22:20 UTC (permalink / raw)
  To: Grant Feng
  Cc: linux-kernel, jacek.anaszewski, pavel, linux-leds, robh+dt,
	dmurphy, devicetree

On Tue, 25 Aug 2020 16:22:06 +0800, Grant Feng wrote:
> The chip enters hardware shutdown when the SDB pin is pulled low.
> The chip releases hardware shutdown when the SDB pin is pulled high.
> 
> Signed-off-by: Grant Feng <von81@163.com>
> ---
>  Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup
  2020-08-25  8:22 [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Grant Feng
  2020-08-25  8:22 ` [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios' Grant Feng
@ 2020-09-09  9:18 ` Pavel Machek
  2020-09-12  2:23   ` Grant Feng
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2020-09-09  9:18 UTC (permalink / raw)
  To: Grant Feng
  Cc: jacek.anaszewski, dmurphy, robh+dt, linux-leds, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

On Tue 2020-08-25 16:22:05, Grant Feng wrote:
> generate a 5ms low pulse on shutdown pin when startup, then the chip
> becomes more stable in the complex EM environment.

Thanks, I applied the series.

Best regards,
								Pavel
								
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup
  2020-09-09  9:18 ` [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Pavel Machek
@ 2020-09-12  2:23   ` Grant Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Feng @ 2020-09-12  2:23 UTC (permalink / raw)
  To: Pavel Machek
  Cc: jacek.anaszewski, dmurphy, robh+dt, linux-leds, devicetree, linux-kernel

Thanks for the info.

Best regards,

                                                 Grant

On 2020-09-09 17:18, Pavel Machek wrote:
> On Tue 2020-08-25 16:22:05, Grant Feng wrote:
>> generate a 5ms low pulse on shutdown pin when startup, then the chip
>> becomes more stable in the complex EM environment.
> Thanks, I applied the series.
>
> Best regards,
> 								Pavel
> 								


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-12  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  8:22 [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Grant Feng
2020-08-25  8:22 ` [PATCH v3 2/2] DT: leds: Add an optional property named 'shutdown-gpios' Grant Feng
2020-08-28 22:20   ` Rob Herring
2020-09-09  9:18 ` [PATCH v3 1/2] leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup Pavel Machek
2020-09-12  2:23   ` Grant Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).