devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Dan Murphy <dmurphy-l0cyMroinI0@public.gmane.org>
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org,
	jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 2/2] leds: lm3692x: Introduce LM3692x dual string driver
Date: Wed, 15 Nov 2017 22:12:36 +0100	[thread overview]
Message-ID: <20171115211236.GD6183@amd> (raw)
In-Reply-To: <20171115194203.13572-2-dmurphy-l0cyMroinI0@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]

Hi!

> Introducing the LM3692x Dual-String white LED driver.
> 
> Data sheet is located

"located at"? (Twice.)

> http://www.ti.com/lit/ds/snvsa29/snvsa29.pdf
> 
> Signed-off-by: Dan Murphy <dmurphy-l0cyMroinI0@public.gmane.org>

> +config LEDS_LM3692X
> +	tristate "LED support for LM3692x Chips"
> +	depends on LEDS_CLASS && I2C
> +	select REGMAP_I2C
> +	help
> +	  This option enables support for the TI LM3692x family
> +	  of LED drivers.

"If unsure ..., module will be named..."

Might want to say this is for backlight LEDs here.

> +static int lm3692x_fault_check(struct lm3692x_led *led)
> +{
> +	int ret, fault;
> +	unsigned int read_buf;
> +
> +	ret = regmap_read(led->regmap, LM3692X_FAULT_FLAGS, &read_buf);
> +	if (ret)
> +		return ret;
> +
> +	fault = read_buf;
> +
> +	if (fault)
> +		dev_err(&led->client->dev, "Detected a fault 0x%X\n",
> +			fault);
> +
> +	return ret;
> +}

Get rid of "fault" variable?

Does fault need to be propagated to the caller?


> +static int lm3692x_init(struct lm3692x_led *led)
> +{
> +	int ret;
> +
> +	if (led->regulator) {
> +		ret = regulator_enable(led->regulator);
> +		if (ret)
> +			dev_err(&led->client->dev,
> +				"Failed to enable regulator\n");
> +			goto out;
> +	}
> +
> +	if (led->enable_gpio)
> +		gpiod_direction_output(led->enable_gpio, 1);
> +
> +	ret = lm3692x_fault_check(led);
> +	if (ret) {
> +		dev_err(&led->client->dev, "Cannot read/clear faults\n");
> +		goto out;
> +	}
> +
> +	ret = regmap_write(led->regmap, LM3692X_BRT_CTRL, 0x00);
> +	if (ret) {
> +		dev_err(&led->client->dev, "Fail writing BRT CTRL\n");
> +		goto out;
> +	}

How often are those fails reached? Maybe regmap wrapper that would
print "reading/writing register XY failed" would be enough?

Otherwise looks good,

Acked-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2017-11-15 21:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 19:42 [PATCH v3 1/2] dt: bindings: lm3692x: Add bindings for lm3692x LED driver Dan Murphy
     [not found] ` <20171115194203.13572-1-dmurphy-l0cyMroinI0@public.gmane.org>
2017-11-15 19:42   ` [PATCH v3 2/2] leds: lm3692x: Introduce LM3692x dual string driver Dan Murphy
     [not found]     ` <20171115194203.13572-2-dmurphy-l0cyMroinI0@public.gmane.org>
2017-11-15 21:12       ` Pavel Machek [this message]
2017-11-15 21:25         ` Dan Murphy
2017-11-18 14:19       ` Jacek Anaszewski
2017-11-28 12:53         ` Dan Murphy
2017-11-15 20:15   ` [PATCH v3 1/2] dt: bindings: lm3692x: Add bindings for lm3692x LED driver Jacek Anaszewski
     [not found]     ` <cb5c5a65-d5a0-86a3-36b4-cf06baae9ec4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-15 20:31       ` Dan Murphy
     [not found]         ` <0a78c883-f074-cc19-3c0c-fc05607400e9-l0cyMroinI0@public.gmane.org>
2017-11-15 22:23           ` Pavel Machek
2017-11-16 20:14             ` Jacek Anaszewski
     [not found]               ` <82336eb7-2b89-d37b-d688-4e4302766346-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-16 21:42                 ` Dan Murphy
2017-11-17  2:19                   ` Jingoo Han
2017-11-17 11:20                   ` Pavel Machek
2017-11-17 16:30                     ` Jingoo Han
2017-11-17 18:02                       ` Dan Murphy
2017-11-17 23:58                         ` Pavel Machek
2017-11-28 17:27                           ` Dan Murphy
2017-11-16 15:41   ` Rob Herring
2017-11-16 15:45     ` Dan Murphy
     [not found]       ` <d3483e49-650d-1d68-bec6-eeb84d8ac48a-l0cyMroinI0@public.gmane.org>
2017-11-16 15:58         ` Rob Herring
2017-11-16 20:11       ` dts: fun with chip names " Pavel Machek
2017-11-16 20:36         ` Rob Herring
     [not found]           ` <CAL_Jsq+aysVR9U2Wquwwv7cjjO7wO8EXBg1Ja82u6s5t1yeJUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 21:40             ` Dan Murphy
2017-11-18 14:19 ` Jacek Anaszewski

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=20171115211236.GD6183@amd \
    --to=pavel-+zi9xunit7i@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmurphy-l0cyMroinI0@public.gmane.org \
    --cc=jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org \
    /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).