All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup
@ 2020-08-08  2:04 Grant Feng
  2020-08-08  2:04 ` [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios' Grant Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Feng @ 2020-08-08  2:04 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, robh+dt, linux-leds,
	devicetree, linux-kernel

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@163.com>
---
 drivers/leds/leds-is31fl32xx.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
index cd768f991da1..07b543120e06 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_gpio;
 	unsigned int num_leds;
 	struct is31fl32xx_led_data leds[];
 };
@@ -282,11 +285,17 @@ static int is31fl32xx_software_shutdown(struct is31fl32xx_priv *priv,
 	return 0;
 }
 
-static int is31fl32xx_init_regs(struct is31fl32xx_priv *priv)
+static int is31fl32xx_init(struct is31fl32xx_priv *priv)
 {
 	const struct is31fl32xx_chipdef *cdef = priv->cdef;
 	int ret;
 
+	if (priv->sdb_gpio) {
+		gpiod_direction_output(priv->sdb_gpio, 0);
+		mdelay(5);
+		gpiod_direction_output(priv->sdb_gpio, 1);
+	}
+
 	ret = is31fl32xx_reset_regs(priv);
 	if (ret)
 		return ret;
@@ -372,6 +381,15 @@ static int is31fl32xx_parse_dt(struct device *dev,
 	struct device_node *child;
 	int ret = 0;
 
+	priv->sdb_gpio = devm_gpiod_get_optional(dev,
+						"sdb",
+						GPIOD_OUT_HIGH);
+	if (IS_ERR(priv->sdb_gpio)) {
+		ret = PTR_ERR(priv->sdb_gpio);
+		dev_err(dev, "Failed to get sdb gpio: %d\n", ret);
+		return ret;
+	}
+
 	for_each_child_of_node(dev->of_node, child) {
 		struct is31fl32xx_led_data *led_data =
 			&priv->leds[priv->num_leds];
@@ -453,11 +471,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(priv);
 	if (ret)
 		return ret;
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
  2020-08-08  2:04 [PATCH v2 1/2] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
@ 2020-08-08  2:04 ` Grant Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Feng @ 2020-08-08  2:04 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, robh+dt, linux-leds,
	devicetree, linux-kernel

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 <von81@163.com>
---
 Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt b/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
index 926c2117942c..94f02827fd83 100644
--- a/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
+++ b/Documentation/devicetree/bindings/leds/leds-is31fl32xx.txt
@@ -15,6 +15,8 @@ Required properties:
 - reg: I2C slave address
 - address-cells : must be 1
 - size-cells : must be 0
+- sdb-gpios : (optional)
+  Specifier of the GPIO connected to SDB pin.
 
 LED sub-node properties:
 - reg : LED channel number (1..N)
@@ -31,6 +33,7 @@ is31fl3236: led-controller@3c {
 	reg = <0x3c>;
 	#address-cells = <1>;
 	#size-cells = <0>;
+	sdb-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
 
 	led@1 {
 		reg = <1>;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
  2020-08-24 22:21   ` Rob Herring
@ 2020-08-25  8:05     ` Grant Feng
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Feng @ 2020-08-25  8:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: jacek.anaszewski, pavel, dmurphy, linux-leds, devicetree, linux-kernel


On 2020-08-25 6:21, Rob Herring wrote:
> On Sat, Aug 08, 2020 at 11:37:31AM +0800, Grant Feng wrote:
>> 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 <von81@163.com>
>> ---
>>   Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
>> index fc2603484544..e8bef4be57dc 100644
>> --- a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
>> +++ b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
>> @@ -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.
>>   
>>   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";
>> -- 
>> 2.17.1
>>
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
  2020-08-08  3:37 ` [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios' Grant Feng
@ 2020-08-24 22:21   ` Rob Herring
  2020-08-25  8:05     ` Grant Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2020-08-24 22:21 UTC (permalink / raw)
  To: Grant Feng
  Cc: jacek.anaszewski, pavel, dmurphy, linux-leds, devicetree, linux-kernel

On Sat, Aug 08, 2020 at 11:37:31AM +0800, Grant Feng wrote:
> 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 <von81@163.com>
> ---
>  Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
> index fc2603484544..e8bef4be57dc 100644
> --- a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
> +++ b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
> @@ -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.

>  
>  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";
> -- 
> 2.17.1
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios'
  2020-08-08  3:37 [PATCH v2 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
@ 2020-08-08  3:37 ` Grant Feng
  2020-08-24 22:21   ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Feng @ 2020-08-08  3:37 UTC (permalink / raw)
  To: von81, jacek.anaszewski, pavel, dmurphy, robh+dt, linux-leds,
	devicetree, linux-kernel

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 <von81@163.com>
---
 Documentation/devicetree/bindings/leds/leds-is31fl319x.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
index fc2603484544..e8bef4be57dc 100644
--- a/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
+++ b/Documentation/devicetree/bindings/leds/leds-is31fl319x.txt
@@ -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";
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-25  8:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  2:04 [PATCH v2 1/2] leds: is31fl32xx: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
2020-08-08  2:04 ` [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios' Grant Feng
2020-08-08  3:37 [PATCH v2 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
2020-08-08  3:37 ` [PATCH v2 2/2] leds: Add an optional property named 'sdb-gpios' Grant Feng
2020-08-24 22:21   ` Rob Herring
2020-08-25  8:05     ` Grant Feng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.