linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: rpurdie@rpsys.net, pavel@ucw.cz, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] leds: lp8860: Add regulator enable during init
Date: Thu, 16 Nov 2017 21:53:49 +0100	[thread overview]
Message-ID: <43567c55-e86a-9d76-be42-50e39ee827e8@gmail.com> (raw)
In-Reply-To: <20171115195213.8404-2-dmurphy@ti.com>

Hi Dan,

Thanks for the patch set.

Both patches applied to the for-4.16 branch of linux-leds.git.

Best regards,
Jacek Anaszewski

On 11/15/2017 08:52 PM, Dan Murphy wrote:
> Add the regulator enable call during initialization.
> If init fails then disable the regulator.
> 
> Also during init the gpio gets set low even
> on a passing case so add if everything passes
> then return.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/leds/leds-lp8860.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
> index 91b6c5fbd361..f91a4fe25168 100644
> --- a/drivers/leds/leds-lp8860.c
> +++ b/drivers/leds/leds-lp8860.c
> @@ -247,6 +247,15 @@ static int lp8860_init(struct lp8860_led *led)
>  	unsigned int read_buf;
>  	int ret, i, reg_count;
>  
> +	if (led->regulator) {
> +		ret = regulator_enable(led->regulator);
> +		if (ret) {
> +			dev_err(&led->client->dev,
> +				"Failed to enable regulator\n");
> +			return ret;
> +		}
> +	}
> +
>  	if (led->enable_gpio)
>  		gpiod_direction_output(led->enable_gpio, 1);
>  
> @@ -282,12 +291,25 @@ static int lp8860_init(struct lp8860_led *led)
>  	ret = regmap_write(led->regmap,
>  			LP8860_EEPROM_CNTRL,
>  			LP8860_PROGRAM_EEPROM);
> -	if (ret)
> +	if (ret) {
>  		dev_err(&led->client->dev, "Failed programming EEPROM\n");
> +		goto out;
> +	}
> +
> +	return ret;
> +
>  out:
>  	if (ret)
>  		if (led->enable_gpio)
>  			gpiod_direction_output(led->enable_gpio, 0);
> +
> +	if (led->regulator) {
> +		ret = regulator_disable(led->regulator);
> +		if (ret)
> +			dev_err(&led->client->dev,
> +				"Failed to disable regulator\n");
> +	}
> +
>  	return ret;
>  }
>  
> 

      reply	other threads:[~2017-11-16 20:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 19:52 [PATCH 1/2] leds: lp8860: Fix linuxdoc format for structure Dan Murphy
2017-11-15 19:52 ` [PATCH 2/2] leds: lp8860: Add regulator enable during init Dan Murphy
2017-11-16 20:53   ` Jacek Anaszewski [this message]

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=43567c55-e86a-9d76-be42-50e39ee827e8@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    /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;
as well as URLs for NNTP newsgroup(s).