* [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
@ 2020-08-06 6:21 Grant Feng
2020-08-06 6:21 ` [PATCH 2/2] DT: leds: Add an optional property named 'sdb-gpios' Grant Feng
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
0 siblings, 2 replies; 6+ messages in thread
From: Grant Feng @ 2020-08-06 6:21 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-is31fl319x.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index ca6634b8683c..b4f70002cec9 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -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_pin;
struct regmap *regmap;
struct mutex lock;
u32 audio_gain_db;
@@ -265,6 +268,15 @@ static int is31fl319x_parse_dt(struct device *dev,
is31->audio_gain_db = min(is31->audio_gain_db,
IS31FL319X_AUDIO_GAIN_DB_MAX);
+ is31->sdb_pin = gpiod_get(dev, "sdb", GPIOD_ASIS);
+ if (IS_ERR(is31->sdb_pin)) {
+ dev_warn(dev, "failed to get gpio_sdb, try default\r\n");
+ } else {
+ gpiod_direction_output(is31->sdb_pin, 0);
+ mdelay(5);
+ gpiod_direction_output(is31->sdb_pin, 1);
+ }
+
return 0;
put_child_node:
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] DT: leds: Add an optional property named 'sdb-gpios'
2020-08-06 6:21 [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
@ 2020-08-06 6:21 ` Grant Feng
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
1 sibling, 0 replies; 6+ messages in thread
From: Grant Feng @ 2020-08-06 6:21 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] 6+ messages in thread
* Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
2020-08-06 6:21 [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
2020-08-06 6:21 ` [PATCH 2/2] DT: leds: Add an optional property named 'sdb-gpios' Grant Feng
@ 2020-08-06 15:00 ` Dan Murphy
2020-08-06 15:00 ` Dan Murphy
` (2 more replies)
1 sibling, 3 replies; 6+ messages in thread
From: Dan Murphy @ 2020-08-06 15:00 UTC (permalink / raw)
To: Grant Feng, jacek.anaszewski, pavel, robh+dt, linux-leds,
devicetree, linux-kernel
Grant
On 8/6/20 1:21 AM, Grant Feng wrote:
> 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-is31fl319x.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
> index ca6634b8683c..b4f70002cec9 100644
> --- a/drivers/leds/leds-is31fl319x.c
> +++ b/drivers/leds/leds-is31fl319x.c
> @@ -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_pin;
> struct regmap *regmap;
> struct mutex lock;
> u32 audio_gain_db;
> @@ -265,6 +268,15 @@ static int is31fl319x_parse_dt(struct device *dev,
> is31->audio_gain_db = min(is31->audio_gain_db,
> IS31FL319X_AUDIO_GAIN_DB_MAX);
>
> + is31->sdb_pin = gpiod_get(dev, "sdb", GPIOD_ASIS);
Since this is optional maybe use devm_gpiod_get_optional.
If this is required for stability then if the GPIO is not present then
the parse_dt should return the error.
And use the devm_gpiod_get call. Otherwise you are missing the
gpiod_put when exiting or removing the driver.
Dan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
@ 2020-08-06 15:00 ` Dan Murphy
2020-08-06 19:08 ` Pavel Machek
2020-08-08 0:52 ` Grant Feng
2 siblings, 0 replies; 6+ messages in thread
From: Dan Murphy @ 2020-08-06 15:00 UTC (permalink / raw)
To: Grant Feng, jacek.anaszewski, pavel, robh+dt, linux-leds,
devicetree, linux-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
2020-08-06 15:00 ` Dan Murphy
@ 2020-08-06 19:08 ` Pavel Machek
2020-08-08 0:52 ` Grant Feng
2 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2020-08-06 19:08 UTC (permalink / raw)
To: Dan Murphy
Cc: Grant Feng, jacek.anaszewski, robh+dt, linux-leds, devicetree,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]
Hi!
> On 8/6/20 1:21 AM, Grant Feng wrote:
> > 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-is31fl319x.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
> > index ca6634b8683c..b4f70002cec9 100644
> > --- a/drivers/leds/leds-is31fl319x.c
> > +++ b/drivers/leds/leds-is31fl319x.c
> > @@ -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_pin;
> > struct regmap *regmap;
> > struct mutex lock;
> > u32 audio_gain_db;
> > @@ -265,6 +268,15 @@ static int is31fl319x_parse_dt(struct device *dev,
> > is31->audio_gain_db = min(is31->audio_gain_db,
> > IS31FL319X_AUDIO_GAIN_DB_MAX);
> > + is31->sdb_pin = gpiod_get(dev, "sdb", GPIOD_ASIS);
>
> Since this is optional maybe use devm_gpiod_get_optional.
>
> If this is required for stability then if the GPIO is not present then the
> parse_dt should return the error.
>
> And use the devm_gpiod_get call. Otherwise you are missing the gpiod_put
> when exiting or removing the driver.
Yep, thanks for the review, I dropped it from for-next.
And yes, this should be in series with device tree change, and we need
Rob 's ack.
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
2020-08-06 15:00 ` Dan Murphy
2020-08-06 19:08 ` Pavel Machek
@ 2020-08-08 0:52 ` Grant Feng
2 siblings, 0 replies; 6+ messages in thread
From: Grant Feng @ 2020-08-08 0:52 UTC (permalink / raw)
To: Dan Murphy, jacek.anaszewski, pavel, robh+dt, linux-leds,
devicetree, linux-kernel
Thanks for the review, I will rewrit it.
Grant
On 2020-08-06 23:00, Dan Murphy wrote:
> Grant
>
> On 8/6/20 1:21 AM, Grant Feng wrote:
>> 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-is31fl319x.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/leds/leds-is31fl319x.c
>> b/drivers/leds/leds-is31fl319x.c
>> index ca6634b8683c..b4f70002cec9 100644
>> --- a/drivers/leds/leds-is31fl319x.c
>> +++ b/drivers/leds/leds-is31fl319x.c
>> @@ -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_pin;
>> struct regmap *regmap;
>> struct mutex lock;
>> u32 audio_gain_db;
>> @@ -265,6 +268,15 @@ static int is31fl319x_parse_dt(struct device *dev,
>> is31->audio_gain_db = min(is31->audio_gain_db,
>> IS31FL319X_AUDIO_GAIN_DB_MAX);
>> + is31->sdb_pin = gpiod_get(dev, "sdb", GPIOD_ASIS);
>
> Since this is optional maybe use devm_gpiod_get_optional.
>
> If this is required for stability then if the GPIO is not present then
> the parse_dt should return the error.
>
> And use the devm_gpiod_get call. Otherwise you are missing the
> gpiod_put when exiting or removing the driver.
>
> Dan
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-08 0:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 6:21 [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Grant Feng
2020-08-06 6:21 ` [PATCH 2/2] DT: leds: Add an optional property named 'sdb-gpios' Grant Feng
2020-08-06 15:00 ` [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup Dan Murphy
2020-08-06 15:00 ` Dan Murphy
2020-08-06 19:08 ` Pavel Machek
2020-08-08 0:52 ` Grant Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).