leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup
PATCH 1/1 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 <[email protected]>
--- drivers/leds/leds-is31fl32xx.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/leds/leds-is31fl32xx.c +14 -2
@@ -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;
Signature · 1 line
2.17.1
Pavel Machek
AppliedQuoted 2 lines · Grant Feng
generate a 5ms low pulse on sdb pin when startup, then the chip becomes more stable in the complex EM environment.
Thanks, applied.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html