leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
Subsystems (2)
PATCH v2 1/2 leds: is31fl319x: 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.
--- drivers/leds/leds-is31fl319x.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/leds/leds-is31fl319x.c +18 -0
@@ -16,6 +16,8 @@#include <linux/of_device.h> #include <linux/regmap.h> #include <linux/slab.h> +#include <linux/delay.h> +#include <linux/gpio/consumer.h> /* register numbers */ #define IS31FL319X_SHUTDOWN 0x00
@@ -61,6 +63,7 @@struct is31fl319x_chip {const struct is31fl319x_chipdef *cdef;struct i2c_client *client; +struct gpio_desc *sdb_gpio;struct regmap *regmap;struct mutex lock;u32 audio_gain_db;
@@ -207,6 +210,15 @@ static int is31fl319x_parse_dt(struct device *dev,if (!np)return -ENODEV ; + is31->sdb_gpio =devm_gpiod_get_optional (dev, +"sdb" , +GPIOD_OUT_HIGH ); +if (IS_ERR (is31->sdb_gpio)) { + ret =PTR_ERR (is31->sdb_gpio); +dev_err (dev,"Failed to get sdb gpio: %d\n" , ret); +return ret; + } + of_dev_id =of_match_device (of_is31fl319x_match, dev);if (!of_dev_id) {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) goto free_mutex; +if (is31->sdb_gpio) { +gpiod_direction_output (is31->sdb_gpio,0 ); +mdelay (5 ); +gpiod_direction_output (is31->sdb_gpio,1 ); + } + is31->client = client; is31->regmap =devm_regmap_init_i2c (client, ®map_config);if (IS_ERR (is31->regmap)) {
Signature · 1 line
2.17.1
PATCH v2 2/2 leds: Add an optional property named 'sdb-gpios'
The chip enters hardware shutdown when the SDB pin is pulled low. The chip releases hardware shutdown when the SDB pin is pulled high.
--- Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +2 -0
@@ -16,6 +16,7 @@ Optional properties: - audio-gain-db : audio gain selection for external analog modulation input. Valid values: 0 - 21, step by 3 (rounded down) Default: 0 +- sdb-gpios : Specifier of the GPIO connected to SDB pin. Each led is represented as a sub-node of the issi,is31fl319x device. There can be less leds subnodes than the chip can support but not more.
@@ -44,6 +45,7 @@ fancy_leds: leds@65 { #address-cells = <1>; #size-cells = <0>; reg = <0x65>; + sdb-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; red_aux: led@1 { label = "red:aux";
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
Quoted 13 lines · Grant Feng
The chip enters hardware shutdown when the SDB pin is pulled low. The chip releases hardware shutdown when the SDB pin is pulled high.
Signed-off-by Grant Feng <[email protected]>--- Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +0
-0
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt Optional properties: · line 19
Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +1
-0@@ -16,6 +16,7 @@ Optional properties: - audio-gain-db : audio gain selection for external analog modulation input. Valid values: 0 - 21, step by 3 (rounded down) Default: 0 +- sdb-gpios : Specifier of the GPIO connected to SDB pin.
We normally use 'shutdown-gpios' for a shutdown GPIO.
Quoted 15 lines
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +1
-0Each led is represented as a sub-node of the issi,is31fl319x device. There can be less leds subnodes than the chip can support but not more.@@ -44,6 +45,7 @@ fancy_leds: leds@65 { #address-cells = <1>; #size-cells = <0>; reg = <0x65>; + sdb-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; red_aux: led@1 { label = "red:aux";Signature · 1 line
2.17.1
Re: [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
Quoted 9 lines · Rob Herring
Quoted 8 lines · Grant Feng
The chip enters hardware shutdown when the SDB pin is pulled low. The chip releases hardware shutdown when the SDB pin is pulled high.
Signed-off-by Grant Feng <[email protected]>--- Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++ 1 file changed, 2 insertions(+)
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt Optional properties: · line 19
Quoted 9 lines
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +1
-0@@ -16,6 +16,7 @@ Optional properties: - audio-gain-db : audio gain selection for external analog modulation input. Valid values: 0 - 21, step by 3 (rounded down) Default: 0 +- sdb-gpios : Specifier of the GPIO connected to SDB pin.We normally use 'shutdown-gpios' for a shutdown GPIO.
Thanks for the review.
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/leds/leds-is31fl319x.txt +1
-0Each led is represented as a sub-node of the issi,is31fl319x device. There can be less leds subnodes than the chip can support but not more.@@ -44,6 +45,7 @@ fancy_leds: leds@65 { #address-cells = <1>; #size-cells = <0>; reg = <0x65>; + sdb-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; red_aux: led@1 { label = "red:aux";Signature · 1 line
2.17.1