linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] leds: lp8860: Fix linuxdoc format for structure
@ 2017-11-15 19:52 Dan Murphy
  2017-11-15 19:52 ` [PATCH 2/2] leds: lp8860: Add regulator enable during init Dan Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Murphy @ 2017-11-15 19:52 UTC (permalink / raw)
  To: rpurdie, jacek.anaszewski, pavel; +Cc: linux-leds, linux-kernel, Dan Murphy

Fix the linuxdoc format defining the lp8860 structure.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/leds/leds-lp8860.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 3e70775a2d54..91b6c5fbd361 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -98,7 +98,7 @@
  * @enable_gpio - VDDIO/EN gpio to enable communication interface
  * @regulator - LED supply regulator pointer
  * @label - LED label
-**/
+ */
 struct lp8860_led {
 	struct mutex lock;
 	struct i2c_client *client;
-- 
2.15.0.124.g7668cbc60

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

* [PATCH 2/2] leds: lp8860: Add regulator enable during init
  2017-11-15 19:52 [PATCH 1/2] leds: lp8860: Fix linuxdoc format for structure Dan Murphy
@ 2017-11-15 19:52 ` Dan Murphy
  2017-11-16 20:53   ` Jacek Anaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Murphy @ 2017-11-15 19:52 UTC (permalink / raw)
  To: rpurdie, jacek.anaszewski, pavel; +Cc: linux-leds, linux-kernel, Dan Murphy

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;
 }
 
-- 
2.15.0.124.g7668cbc60

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

* Re: [PATCH 2/2] leds: lp8860: Add regulator enable during init
  2017-11-15 19:52 ` [PATCH 2/2] leds: lp8860: Add regulator enable during init Dan Murphy
@ 2017-11-16 20:53   ` Jacek Anaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Jacek Anaszewski @ 2017-11-16 20:53 UTC (permalink / raw)
  To: Dan Murphy; +Cc: rpurdie, pavel, linux-leds, linux-kernel

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;
>  }
>  
> 

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

end of thread, other threads:[~2017-11-16 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).