Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startup

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>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

authored by

Grant Feng and committed by
Pavel Machek
dddb4e38 3d93edc7

+18
+18
drivers/leds/leds-is31fl319x.c
··· 16 16 #include <linux/of_device.h> 17 17 #include <linux/regmap.h> 18 18 #include <linux/slab.h> 19 + #include <linux/delay.h> 20 + #include <linux/gpio/consumer.h> 19 21 20 22 /* register numbers */ 21 23 #define IS31FL319X_SHUTDOWN 0x00 ··· 63 61 struct is31fl319x_chip { 64 62 const struct is31fl319x_chipdef *cdef; 65 63 struct i2c_client *client; 64 + struct gpio_desc *shutdown_gpio; 66 65 struct regmap *regmap; 67 66 struct mutex lock; 68 67 u32 audio_gain_db; ··· 210 207 if (!np) 211 208 return -ENODEV; 212 209 210 + is31->shutdown_gpio = devm_gpiod_get_optional(dev, 211 + "shutdown", 212 + GPIOD_OUT_HIGH); 213 + if (IS_ERR(is31->shutdown_gpio)) { 214 + ret = PTR_ERR(is31->shutdown_gpio); 215 + dev_err(dev, "Failed to get shutdown gpio: %d\n", ret); 216 + return ret; 217 + } 218 + 213 219 of_dev_id = of_match_device(of_is31fl319x_match, dev); 214 220 if (!of_dev_id) { 215 221 dev_err(dev, "Failed to match device with supported chips\n"); ··· 361 349 err = is31fl319x_parse_dt(&client->dev, is31); 362 350 if (err) 363 351 goto free_mutex; 352 + 353 + if (is31->shutdown_gpio) { 354 + gpiod_direction_output(is31->shutdown_gpio, 0); 355 + mdelay(5); 356 + gpiod_direction_output(is31->shutdown_gpio, 1); 357 + } 364 358 365 359 is31->client = client; 366 360 is31->regmap = devm_regmap_init_i2c(client, &regmap_config);