All of lore.kernel.org
 help / color / mirror / Atom feed
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] leds: Add LED class driver for regulator driven LEDs.
Date: Wed, 2 Dec 2009 20:40:26 +0000	[thread overview]
Message-ID: <20091202204026.GA18311@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <20091202212521.500f7a46.ospite@studenti.unina.it>

On Wed, Dec 02, 2009 at 09:25:21PM +0100, Antonio Ospite wrote:
> Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> > There's no need to do this since the regulator API matches consumers
> > based on struct device as well as name so you can have as many LEDs as
> > you like all using the same supply name mapping to different regulators.

> I need some more explanation here, I am currently using the driver with
> this code:

> +/* VVIB: Vibrator on A780, A1200, A910, E6, E2 */
> +static struct regulator_consumer_supply pcap_regulator_VVIB_consumers
> [] = {
> +	{ .dev_name = "leds-regulator", .supply = "vibrator", },

So you're instantiating the device with .id set to -1 (as your code
below shows), meaning there's only one leds-regulator in the system and
there's no need to number them.  If you had more than one of them then
you'd number them and then have something like:

	{ .dev_name = "leds-regulator.0", supply = "vled" },
	{ .dev_name = "leds-regulator.1", supply = "vled" },

when setting up the supplies.

> If I set the .supply value fixed, how can I assign different
> regulators to different leds? Should I use the address to the platform
> device (a780_vibrator in this case) for .dev when defining the
> regulator in the first place?

There is no need to use the .dev field, that is kept to avoid build
breakage transitioning to dev_name.

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Antonio Ospite <ospite@studenti.unina.it>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Daniel Ribeiro <drwyrm@gmail.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	openezx-devel@lists.openezx.org
Subject: Re: [PATCH] leds: Add LED class driver for regulator driven LEDs.
Date: Wed, 2 Dec 2009 20:40:26 +0000	[thread overview]
Message-ID: <20091202204026.GA18311@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <20091202212521.500f7a46.ospite@studenti.unina.it>

On Wed, Dec 02, 2009 at 09:25:21PM +0100, Antonio Ospite wrote:
> Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> > There's no need to do this since the regulator API matches consumers
> > based on struct device as well as name so you can have as many LEDs as
> > you like all using the same supply name mapping to different regulators.

> I need some more explanation here, I am currently using the driver with
> this code:

> +/* VVIB: Vibrator on A780, A1200, A910, E6, E2 */
> +static struct regulator_consumer_supply pcap_regulator_VVIB_consumers
> [] = {
> +	{ .dev_name = "leds-regulator", .supply = "vibrator", },

So you're instantiating the device with .id set to -1 (as your code
below shows), meaning there's only one leds-regulator in the system and
there's no need to number them.  If you had more than one of them then
you'd number them and then have something like:

	{ .dev_name = "leds-regulator.0", supply = "vled" },
	{ .dev_name = "leds-regulator.1", supply = "vled" },

when setting up the supplies.

> If I set the .supply value fixed, how can I assign different
> regulators to different leds? Should I use the address to the platform
> device (a780_vibrator in this case) for .dev when defining the
> regulator in the first place?

There is no need to use the .dev field, that is kept to avoid build
breakage transitioning to dev_name.

  reply	other threads:[~2009-12-02 20:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 17:40 [PATCH] leds: Add LED class driver for regulator driven LEDs Antonio Ospite
2009-12-02 18:06 ` Mark Brown
2009-12-02 18:06   ` Mark Brown
2009-12-02 20:25   ` Antonio Ospite
2009-12-02 20:25     ` Antonio Ospite
2009-12-02 20:40     ` Mark Brown [this message]
2009-12-02 20:40       ` Mark Brown
2009-12-02 20:48       ` Antonio Ospite
2009-12-02 20:48         ` Antonio Ospite
2009-12-04 12:39   ` Antonio Ospite
2009-12-04 12:39     ` Antonio Ospite
2009-12-04 12:45     ` Mark Brown
2009-12-04 12:45       ` Mark Brown
2009-12-02 18:23 ` Liam Girdwood
2009-12-02 18:23   ` Liam Girdwood
2009-12-02 20:31   ` Antonio Ospite
2009-12-02 20:31     ` Antonio Ospite
2009-12-02 20:41     ` Mark Brown
2009-12-02 20:41       ` Mark Brown
2009-12-04 12:57       ` Antonio Ospite
2009-12-04 12:57         ` Antonio Ospite
2009-12-07 11:49         ` Mark Brown
2009-12-07 11:49           ` Mark Brown
2009-12-07 14:08 ` [PATCH v2] " Antonio Ospite
2009-12-15 10:22   ` Antonio Ospite
2009-12-15 10:22     ` Antonio Ospite
2009-12-15 10:58   ` Mark Brown
2009-12-15 10:58     ` Mark Brown

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=20091202204026.GA18311@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.