linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup
@ 2020-08-03 10:29 Grant Feng
  2020-08-05 21:57 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Grant Feng @ 2020-08-03 10:29 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, linux-leds, linux-kernel

generate a 5ms low pulse on sdb 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-is31fl32xx.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
index cd768f991da1..e0f8734223c0 100644
--- a/drivers/leds/leds-is31fl32xx.c
+++ b/drivers/leds/leds-is31fl32xx.c
@@ -16,6 +16,8 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 
 /* Used to indicate a device has no such register */
 #define IS31FL32XX_REG_NONE 0xFF
@@ -43,6 +45,7 @@ struct is31fl32xx_led_data {
 struct is31fl32xx_priv {
 	const struct is31fl32xx_chipdef *cdef;
 	struct i2c_client *client;
+	struct gpio_desc *sdb_pin;
 	unsigned int num_leds;
 	struct is31fl32xx_led_data leds[];
 };
@@ -405,6 +408,15 @@ static int is31fl32xx_parse_dt(struct device *dev,
 		priv->num_leds++;
 	}
 
+	priv->sdb_pin = gpiod_get(dev, "sdb", GPIOD_ASIS);
+	if (IS_ERR(priv->sdb_pin)) {
+		dev_warn(dev, "failed to get SDB GPIO, try default\r\n");
+	} else {
+		gpiod_direction_output(priv->sdb_pin, 0);
+		mdelay(5);
+		gpiod_direction_output(priv->sdb_pin, 1);
+	}
+
 	return 0;
 
 err:
@@ -453,11 +465,11 @@ static int is31fl32xx_probe(struct i2c_client *client,
 	priv->cdef = cdef;
 	i2c_set_clientdata(client, priv);
 
-	ret = is31fl32xx_init_regs(priv);
+	ret = is31fl32xx_parse_dt(dev, priv);
 	if (ret)
 		return ret;
 
-	ret = is31fl32xx_parse_dt(dev, priv);
+	ret = is31fl32xx_init_regs(priv);
 	if (ret)
 		return ret;
 
-- 
2.17.1



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

* Re: [PATCH v1] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup
  2020-08-03 10:29 [PATCH v1] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
@ 2020-08-05 21:57 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2020-08-05 21:57 UTC (permalink / raw)
  To: Grant Feng; +Cc: jacek.anaszewski, dmurphy, linux-leds, linux-kernel

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

On Mon 2020-08-03 18:29:35, Grant Feng wrote:
> generate a 5ms low pulse on sdb pin when startup, then the chip
> becomes more stable in the complex EM environment.

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2020-08-05 21:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 10:29 [PATCH v1] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
2020-08-05 21:57 ` Pavel Machek

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).