mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
3d93edc775
commit
dddb4e38c6
|
@ -16,6 +16,8 @@
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/gpio/consumer.h>
|
||||||
|
|
||||||
/* register numbers */
|
/* register numbers */
|
||||||
#define IS31FL319X_SHUTDOWN 0x00
|
#define IS31FL319X_SHUTDOWN 0x00
|
||||||
|
@ -61,6 +63,7 @@
|
||||||
struct is31fl319x_chip {
|
struct is31fl319x_chip {
|
||||||
const struct is31fl319x_chipdef *cdef;
|
const struct is31fl319x_chipdef *cdef;
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
|
struct gpio_desc *shutdown_gpio;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
u32 audio_gain_db;
|
u32 audio_gain_db;
|
||||||
|
@ -207,6 +210,15 @@ static int is31fl319x_parse_dt(struct device *dev,
|
||||||
if (!np)
|
if (!np)
|
||||||
return -ENODEV;
|
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);
|
of_dev_id = of_match_device(of_is31fl319x_match, dev);
|
||||||
if (!of_dev_id) {
|
if (!of_dev_id) {
|
||||||
dev_err(dev, "Failed to match device with supported chips\n");
|
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)
|
if (err)
|
||||||
goto free_mutex;
|
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->client = client;
|
||||||
is31->regmap = devm_regmap_init_i2c(client, ®map_config);
|
is31->regmap = devm_regmap_init_i2c(client, ®map_config);
|
||||||
if (IS_ERR(is31->regmap)) {
|
if (IS_ERR(is31->regmap)) {
|
||||||
|
|
Loading…
Reference in New Issue