lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  3 Aug 2020 18:29:35 +0800
From:   Grant Feng <von81@....com>
To:     von81@....com, jacek.anaszewski@...il.com, pavel@....cz,
        dmurphy@...com, linux-leds@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH v1] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ