mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: Grant Feng <von81@163.com>, <jacek.anaszewski@gmail.com>,
	<pavel@ucw.cz>, <robh+dt@kernel.org>,
	<linux-leds@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
Date: Thu, 6 Aug 2020 10:00:59 -0500	[thread overview]
Message-ID: <7c828160-bef6-45b5-60d1-85c6074953c4@ti.com> (raw)
In-Reply-To: <20200806062130.25187-1-von81@163.com>

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



WARNING: multiple messages have this Message-ID
From: Dan Murphy <dmurphy@ti.com>
To: Grant Feng <von81@163.com>, <jacek.anaszewski@gmail.com>,
	<pavel@ucw.cz>, <robh+dt@kernel.org>,
	<linux-leds@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] leds: is31fl319x: Add sdb pin and generate a 5ms low pulse when startup
Date: Thu, 6 Aug 2020 10:00:59 -0500	[thread overview]
Message-ID: <7c828160-bef6-45b5-60d1-85c6074953c4@ti.com> (raw)
Message-ID: <20200806150059.Bds0tBBUMIzq55MVz1XTrPwAYQjdUm6eIVwuyEJ7BDc@z> (raw)
In-Reply-To: <20200806062130.25187-1-von81@163.com>



  parent reply	other threads:[~2020-08-06 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Dan Murphy [this message]
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 19:08   ` Pavel Machek
2020-08-08  0:52   ` Grant Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c828160-bef6-45b5-60d1-85c6074953c4@ti.com \
    --to=dmurphy@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=von81@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®