public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: Daniel Mack <daniel@caiaq.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LED: add driver for LT3593 controlled LEDs
Date: Wed, 14 Oct 2009 19:13:21 +0100	[thread overview]
Message-ID: <1255544001.14634.8.camel@ted> (raw)
In-Reply-To: <1254865260-13570-1-git-send-email-daniel@caiaq.de>

On Wed, 2009-10-07 at 05:41 +0800, Daniel Mack wrote:
> The LT3593 is a step-up DC/DC converter designed to drive up to ten
> white LEDs in series. The current flow can be set with a control pin.
> 
> This driver controls any number of such devices connected on generic
> GPIOs and exports the function as as platform_driver.
> 
> The gpio_led platform data struct definition is reused for this purpose.
> 
> Successfully tested on a PXA embedded board.

Looks good to me, just some minor comments:

> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/leds.h>
> +#include <linux/workqueue.h>
> +#include <linux/delay.h>
> +
> +#include <asm/gpio.h>

Should this be <linux/gpio.h> ?

> +static void lt3593_led_work(struct work_struct *work)
> +{
> +	int pulses;
> +	struct lt3593_led_data	*led_dat =
> +		container_of(work, struct lt3593_led_data, work);

There's a tab above which caught my eye. I'd have ignored it if I wasn't
mentioning the above...

> +	pulses = 32 - (led_dat->new_level * 32) / 255;
> +
> +	if (pulses == 0) {
> +		gpio_set_value_cansleep(led_dat->gpio, 0);
> +		mdelay(1);
> +		gpio_set_value_cansleep(led_dat->gpio, 1);
> +		return;
> +	}

mdelay is frowned upon

> +	gpio_set_value_cansleep(led_dat->gpio, 1);
> +
> +	while (pulses--) {
> +		gpio_set_value_cansleep(led_dat->gpio, 0);
> +		udelay(1);
> +		gpio_set_value_cansleep(led_dat->gpio, 1);
> +		udelay(1);
> +	}

and likewise udelay but I guess we can't do much else with this
hardware...

Otherwise it looks good, just check the include please and then I'll
apply it.

Cheers,

Richard


  parent reply	other threads:[~2009-10-14 22:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 21:41 [PATCH] LED: add driver for LT3593 controlled LEDs Daniel Mack
2009-10-14 11:54 ` Daniel Mack
2009-10-14 18:13 ` Richard Purdie [this message]
2009-10-15  0:59   ` Daniel Mack
2009-10-21 19:35     ` Daniel Mack
2009-11-03 10:03     ` Daniel Mack
2009-11-06 16:13       ` Richard Purdie

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=1255544001.14634.8.camel@ted \
    --to=rpurdie@rpsys.net \
    --cc=daniel@caiaq.de \
    --cc=linux-kernel@vger.kernel.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