devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Simon Shields <simon@lineageos.org>
Cc: linux-leds@vger.kernel.org, Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH v2 2/2] leds: add Panasonic AN30259A support
Date: Wed, 7 Mar 2018 23:07:25 +0100	[thread overview]
Message-ID: <20180307220725.GC10438@amd> (raw)
In-Reply-To: <20180307004722.23524-3-simon@lineageos.org>

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

Hi!

> The datasheet is freely available:
> https://www.alliedelec.com/m/d/a9d2b3ee87c2d1a535a41dd747b1c247.pdf

> +	  To compile this driver as a module, choose M here: the module
> +	  will be called leds-an30259a.

leds-an30259a.ko?

> @@ -0,0 +1,382 @@
> +// SPDX-License-Identifier: GPL-2.0

I'd prefer 2.0+, but... your choice.

> +/*
> + * Driver for Panasonic AN30259A 3-channel LED driver
> + *
> + * Copyright (c) 2018 Simon Shields <simon@lineageos.org>
> + *
> + * Datasheet:
> + * https://www.alliedelec.com/m/d/a9d2b3ee87c2d1a535a41dd747b1c247.pdf
> + */
> +#include <linux/i2c.h>
> +#include <linux/leds.h>

I'd do empty line after the comment.

> +static u8 an30259a_get_dutymax(u8 brightness)
> +{
> +	u8 duty_max, floor, ceil;
> +
> +	/* squash 8 bit number into 7-bit PWM range */
> +	duty_max = brightness >> 1;

We should really start using max_brightness, so that userspace knows
what 

> +	/* bottom 3 bits are always set for DUTYMAX
> +	 * figure out the closest value
> +	 */

/*
 * Multiline comments like this.
 */

> +	/* slope time controls on/off cycle length */
> +	ret = regmap_write(led->chip->regmap, REG_SLOPE(num),
> +			   LED_SLOPETIME1(off) | LED_SLOPETIME2(on));
> +	if (ret)
> +		return ret;
> +
> +	/* Finally, enable slope mode. */

And yes, having sentences in all the comments would be nice. Or maybe
nowhere. But consistent ;-).

Since all I'm commenting is whitespace...

Acked-by: Pavel Machek <pavel@ucw.cz>

-- 
(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 --]

  reply	other threads:[~2018-03-07 22:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07  0:47 [PATCH v2 0/2] Panasonic AN30259A support Simon Shields
2018-03-07  0:47 ` [PATCH v2 1/2] dt-bindings: leds: document Panasonic AN30259A bindings Simon Shields
2018-03-07 21:58   ` Pavel Machek
2018-03-08  2:02   ` Rob Herring
2018-03-08 22:17   ` Jacek Anaszewski
2018-03-08 22:54     ` Pavel Machek
2018-03-09 22:33       ` Jacek Anaszewski
2018-03-07  0:47 ` [PATCH v2 2/2] leds: add Panasonic AN30259A support Simon Shields
2018-03-07 22:07   ` Pavel Machek [this message]
2018-03-08  0:48     ` Simon Shields
2018-03-08 22:17   ` 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=20180307220725.GC10438@amd \
    --to=pavel@ucw.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=simon@lineageos.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).