diff mbox

[V3,1/2] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight

Message ID 1363214006-10662-2-git-send-email-achew@nvidia.com (mailing list archive)
State New, archived
Headers show

Commit Message

achew@nvidia.com March 13, 2013, 10:33 p.m. UTC
The pwm-backlight driver now takes a mandatory regulator that is gotten
during driver probe.  Initialize a dummy regulator to satisfy this
requirement.

Signed-off-by: Andrew Chew <achew@nvidia.com>
---
Changed the device name of the backlight regulator supply to "pwm-backlight",
per Peter's comment.

Changed the name of the regulator to "backlight-enable", per Thierry's
suggestion.

 arch/arm/mach-omap2/board-4430sdp.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Tony Lindgren April 8, 2013, 9:46 p.m. UTC | #1
* Andrew Chew <achew@nvidia.com> [130313 15:37]:
> The pwm-backlight driver now takes a mandatory regulator that is gotten
> during driver probe.  Initialize a dummy regulator to satisfy this
> requirement.
> 
> Signed-off-by: Andrew Chew <achew@nvidia.com>
> ---
> Changed the device name of the backlight regulator supply to "pwm-backlight",
> per Peter's comment.
> 
> Changed the name of the regulator to "backlight-enable", per Thierry's
> suggestion.

Thanks applying into omap-for-v3.10/board. Note that I'm not taking the
second one, that should be resent to the related driver maintainers.
You can get that list by running scripts/get_maintainer.pl against it.

Regards,

Tony
 
>  arch/arm/mach-omap2/board-4430sdp.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 35f3ad0..a01a39a 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -291,6 +291,10 @@ static struct platform_device sdp4430_leds_pwm = {
>  	},
>  };
>  
> +/* Dummy regulator for pwm-backlight driver */
> +static struct regulator_consumer_supply backlight_supply =
> +	REGULATOR_SUPPLY("enable", "pwm-backlight");
> +
>  static struct platform_pwm_backlight_data sdp4430_backlight_data = {
>  	.max_brightness = 127,
>  	.dft_brightness = 127,
> @@ -718,6 +722,8 @@ static void __init omap_4430sdp_init(void)
>  
>  	omap4_i2c_init();
>  	omap_sfh7741prox_init();
> +	regulator_register_always_on(-1, "backlight-enable",
> +				     &backlight_supply, 1, 0);
>  	platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
>  	omap_serial_init();
>  	omap_sdrc_init(NULL, NULL);
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding April 8, 2013, 9:56 p.m. UTC | #2
On Mon, Apr 08, 2013 at 02:46:24PM -0700, Tony Lindgren wrote:
> * Andrew Chew <achew@nvidia.com> [130313 15:37]:
> > The pwm-backlight driver now takes a mandatory regulator that is gotten
> > during driver probe.  Initialize a dummy regulator to satisfy this
> > requirement.
> > 
> > Signed-off-by: Andrew Chew <achew@nvidia.com>
> > ---
> > Changed the device name of the backlight regulator supply to "pwm-backlight",
> > per Peter's comment.
> > 
> > Changed the name of the regulator to "backlight-enable", per Thierry's
> > suggestion.
> 
> Thanks applying into omap-for-v3.10/board. Note that I'm not taking the
> second one, that should be resent to the related driver maintainers.
> You can get that list by running scripts/get_maintainer.pl against it.

The plan was to take these all through one tree, preferably the PWM tree
because it's all PWM related and the pwm-backlight change will go
through that tree as well. Technically these individual patches can be
applied as is and aren't harmful, but keeping track of the dependencies
might be difficult if they go in via separate trees.

Thierry
Tony Lindgren April 8, 2013, 10:16 p.m. UTC | #3
* Thierry Reding <thierry.reding@avionic-design.de> [130408 15:01]:
> On Mon, Apr 08, 2013 at 02:46:24PM -0700, Tony Lindgren wrote:
> > * Andrew Chew <achew@nvidia.com> [130313 15:37]:
> > > The pwm-backlight driver now takes a mandatory regulator that is gotten
> > > during driver probe.  Initialize a dummy regulator to satisfy this
> > > requirement.
> > > 
> > > Signed-off-by: Andrew Chew <achew@nvidia.com>
> > > ---
> > > Changed the device name of the backlight regulator supply to "pwm-backlight",
> > > per Peter's comment.
> > > 
> > > Changed the name of the regulator to "backlight-enable", per Thierry's
> > > suggestion.
> > 
> > Thanks applying into omap-for-v3.10/board. Note that I'm not taking the
> > second one, that should be resent to the related driver maintainers.
> > You can get that list by running scripts/get_maintainer.pl against it.
> 
> The plan was to take these all through one tree, preferably the PWM tree
> because it's all PWM related and the pwm-backlight change will go
> through that tree as well. Technically these individual patches can be
> applied as is and aren't harmful, but keeping track of the dependencies
> might be difficult if they go in via separate trees.

Registering the regulator alone should not do anything. Also the driver
should do the right thing if the regulator is not yet registered.

Can you please check your driver patch so the driver won't do anything
if the regulator is not (yet) registered and repost it alone as I've
already applied the board-*.c change.

The reason why we want to do queue these patches separately is to cut
away the dependency between drivers and the core arch/arm changes. 
Otherwise we'll end up with pointless merge conflicts as we've seen
earlier several times with the USB patches for example.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding April 9, 2013, 7:56 a.m. UTC | #4
On Mon, Apr 08, 2013 at 03:16:57PM -0700, Tony Lindgren wrote:
> * Thierry Reding <thierry.reding@avionic-design.de> [130408 15:01]:
> > On Mon, Apr 08, 2013 at 02:46:24PM -0700, Tony Lindgren wrote:
> > > * Andrew Chew <achew@nvidia.com> [130313 15:37]:
> > > > The pwm-backlight driver now takes a mandatory regulator that is gotten
> > > > during driver probe.  Initialize a dummy regulator to satisfy this
> > > > requirement.
> > > > 
> > > > Signed-off-by: Andrew Chew <achew@nvidia.com>
> > > > ---
> > > > Changed the device name of the backlight regulator supply to "pwm-backlight",
> > > > per Peter's comment.
> > > > 
> > > > Changed the name of the regulator to "backlight-enable", per Thierry's
> > > > suggestion.
> > > 
> > > Thanks applying into omap-for-v3.10/board. Note that I'm not taking the
> > > second one, that should be resent to the related driver maintainers.
> > > You can get that list by running scripts/get_maintainer.pl against it.
> > 
> > The plan was to take these all through one tree, preferably the PWM tree
> > because it's all PWM related and the pwm-backlight change will go
> > through that tree as well. Technically these individual patches can be
> > applied as is and aren't harmful, but keeping track of the dependencies
> > might be difficult if they go in via separate trees.
> 
> Registering the regulator alone should not do anything. Also the driver
> should do the right thing if the regulator is not yet registered.
> 
> Can you please check your driver patch so the driver won't do anything
> if the regulator is not (yet) registered and repost it alone as I've
> already applied the board-*.c change.

That's not the way that the regulator subsystem works, unfortunately.
There's no way you can distinguish between the case where a regulator
just hasn't been registered yet, or whether it's missing. That's the
whole reason why we need to add the dummy regulators in the first
place.

> The reason why we want to do queue these patches separately is to cut
> away the dependency between drivers and the core arch/arm changes. 
> Otherwise we'll end up with pointless merge conflicts as we've seen
> earlier several times with the USB patches for example.

We could possibly postpone merging the pwm-backlight changes until all
other patches have been merged. If you have this in you for-3.10 branch
I guess it will go into linux-next when the 3.9 merge window closes? If
so I could possibly base my for-3.10 branch on your branch if you can
provide a stable one that you can guarantee not to rebase. There are
other alternatives too, but certainly the easiest would've been to take
all patches through the PWM tree. The potential for merge conflicts
should be rather minimal.

Thierry
Tony Lindgren April 9, 2013, 4:40 p.m. UTC | #5
* Thierry Reding <thierry.reding@avionic-design.de> [130409 01:00]:
> On Mon, Apr 08, 2013 at 03:16:57PM -0700, Tony Lindgren wrote:
> > * Thierry Reding <thierry.reding@avionic-design.de> [130408 15:01]:
> > > On Mon, Apr 08, 2013 at 02:46:24PM -0700, Tony Lindgren wrote:
> > > > * Andrew Chew <achew@nvidia.com> [130313 15:37]:
> > > > > The pwm-backlight driver now takes a mandatory regulator that is gotten
> > > > > during driver probe.  Initialize a dummy regulator to satisfy this
> > > > > requirement.
> > > > > 
> > > > > Signed-off-by: Andrew Chew <achew@nvidia.com>
> > > > > ---
> > > > > Changed the device name of the backlight regulator supply to "pwm-backlight",
> > > > > per Peter's comment.
> > > > > 
> > > > > Changed the name of the regulator to "backlight-enable", per Thierry's
> > > > > suggestion.
> > > > 
> > > > Thanks applying into omap-for-v3.10/board. Note that I'm not taking the
> > > > second one, that should be resent to the related driver maintainers.
> > > > You can get that list by running scripts/get_maintainer.pl against it.
> > > 
> > > The plan was to take these all through one tree, preferably the PWM tree
> > > because it's all PWM related and the pwm-backlight change will go
> > > through that tree as well. Technically these individual patches can be
> > > applied as is and aren't harmful, but keeping track of the dependencies
> > > might be difficult if they go in via separate trees.
> > 
> > Registering the regulator alone should not do anything. Also the driver
> > should do the right thing if the regulator is not yet registered.
> > 
> > Can you please check your driver patch so the driver won't do anything
> > if the regulator is not (yet) registered and repost it alone as I've
> > already applied the board-*.c change.
> 
> That's not the way that the regulator subsystem works, unfortunately.
> There's no way you can distinguish between the case where a regulator
> just hasn't been registered yet, or whether it's missing. That's the
> whole reason why we need to add the dummy regulators in the first
> place.

But then the regulator is not found and the driver should just exit,
or do nothing. If this is an optional regulator, then that should be
indicated in some platform data flags?
 
> > The reason why we want to do queue these patches separately is to cut
> > away the dependency between drivers and the core arch/arm changes. 
> > Otherwise we'll end up with pointless merge conflicts as we've seen
> > earlier several times with the USB patches for example.
> 
> We could possibly postpone merging the pwm-backlight changes until all
> other patches have been merged. If you have this in you for-3.10 branch
> I guess it will go into linux-next when the 3.9 merge window closes? If
> so I could possibly base my for-3.10 branch on your branch if you can
> provide a stable one that you can guarantee not to rebase. There are
> other alternatives too, but certainly the easiest would've been to take
> all patches through the PWM tree. The potential for merge conflicts
> should be rather minimal.

The driver parts really must be done in independently from any platform
data or .dts changes. The only common part needed should be changes
to include/linux/platform_data/*.h files.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding April 9, 2013, 7:40 p.m. UTC | #6
On Tue, Apr 09, 2013 at 09:40:04AM -0700, Tony Lindgren wrote:
[...]
> But then the regulator is not found and the driver should just exit,
> or do nothing. If this is an optional regulator, then that should be
> indicated in some platform data flags?

Yes, if the regulator isn't found then the driver fails. However the
goal was to maintain bisectability. If we apply them in the wrong order
we can't guarantee that because pwm-backlight will fail to work between
both patches.

> The driver parts really must be done in independently from any platform
> data or .dts changes. The only common part needed should be changes
> to include/linux/platform_data/*.h files.

We don't even need to touch platform data because the regulators are
looked up via a global table. And the changes are all done independently
but as I mentioned above, bisectability isn't maintained, so the
preferred patch order is the one in which pwm-backlight keeps working at
each point in the commit history.

Thierry
Tony Lindgren April 9, 2013, 8:17 p.m. UTC | #7
* Thierry Reding <thierry.reding@avionic-design.de> [130409 12:45]:
> On Tue, Apr 09, 2013 at 09:40:04AM -0700, Tony Lindgren wrote:
> [...]
> > But then the regulator is not found and the driver should just exit,
> > or do nothing. If this is an optional regulator, then that should be
> > indicated in some platform data flags?
> 
> Yes, if the regulator isn't found then the driver fails. However the
> goal was to maintain bisectability. If we apply them in the wrong order
> we can't guarantee that because pwm-backlight will fail to work between
> both patches.

But it's fixing something that's not working anyways for board-4430sdp.c,
It seems so as these patches just add new features?
 
> > The driver parts really must be done in independently from any platform
> > data or .dts changes. The only common part needed should be changes
> > to include/linux/platform_data/*.h files.
> 
> We don't even need to touch platform data because the regulators are
> looked up via a global table. And the changes are all done independently
> but as I mentioned above, bisectability isn't maintained, so the
> preferred patch order is the one in which pwm-backlight keeps working at
> each point in the commit history.

Bisectability is a good point. But in the 4430sdp case I'm sure it's enough
that it builds and boots no matter how the patches get merged :)

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding April 9, 2013, 8:57 p.m. UTC | #8
On Tue, Apr 09, 2013 at 01:17:46PM -0700, Tony Lindgren wrote:
> * Thierry Reding <thierry.reding@avionic-design.de> [130409 12:45]:
> > On Tue, Apr 09, 2013 at 09:40:04AM -0700, Tony Lindgren wrote:
> > [...]
> > > But then the regulator is not found and the driver should just exit,
> > > or do nothing. If this is an optional regulator, then that should be
> > > indicated in some platform data flags?
> > 
> > Yes, if the regulator isn't found then the driver fails. However the
> > goal was to maintain bisectability. If we apply them in the wrong order
> > we can't guarantee that because pwm-backlight will fail to work between
> > both patches.
> 
> But it's fixing something that's not working anyways for board-4430sdp.c,
> It seems so as these patches just add new features?

Not quite. It's adding a dummy regulator to represent hardware where the
enable pin is always high. So I think pwm-backlight will work in the
current state, but if we make the pwm-backlight driver change without
adding the dummy regulator, then pwm-backlight will fail to probe and
therefore the PWM won't be enabled either and the display will stay
black.

> > > The driver parts really must be done in independently from any platform
> > > data or .dts changes. The only common part needed should be changes
> > > to include/linux/platform_data/*.h files.
> > 
> > We don't even need to touch platform data because the regulators are
> > looked up via a global table. And the changes are all done independently
> > but as I mentioned above, bisectability isn't maintained, so the
> > preferred patch order is the one in which pwm-backlight keeps working at
> > each point in the commit history.
> 
> Bisectability is a good point. But in the 4430sdp case I'm sure it's enough
> that it builds and boots no matter how the patches get merged :)

If you don't mind some intermediary breakage, I will no longer object.

Thierry
Tony Lindgren April 9, 2013, 10:27 p.m. UTC | #9
* Thierry Reding <thierry.reding@avionic-design.de> [130409 14:01]:
> On Tue, Apr 09, 2013 at 01:17:46PM -0700, Tony Lindgren wrote:
> > * Thierry Reding <thierry.reding@avionic-design.de> [130409 12:45]:
> > > On Tue, Apr 09, 2013 at 09:40:04AM -0700, Tony Lindgren wrote:
> > > [...]
> > > > But then the regulator is not found and the driver should just exit,
> > > > or do nothing. If this is an optional regulator, then that should be
> > > > indicated in some platform data flags?
> > > 
> > > Yes, if the regulator isn't found then the driver fails. However the
> > > goal was to maintain bisectability. If we apply them in the wrong order
> > > we can't guarantee that because pwm-backlight will fail to work between
> > > both patches.
> > 
> > But it's fixing something that's not working anyways for board-4430sdp.c,
> > It seems so as these patches just add new features?
> 
> Not quite. It's adding a dummy regulator to represent hardware where the
> enable pin is always high. So I think pwm-backlight will work in the
> current state, but if we make the pwm-backlight driver change without
> adding the dummy regulator, then pwm-backlight will fail to probe and
> therefore the PWM won't be enabled either and the display will stay
> black.

OK
 
> > > > The driver parts really must be done in independently from any platform
> > > > data or .dts changes. The only common part needed should be changes
> > > > to include/linux/platform_data/*.h files.
> > > 
> > > We don't even need to touch platform data because the regulators are
> > > looked up via a global table. And the changes are all done independently
> > > but as I mentioned above, bisectability isn't maintained, so the
> > > preferred patch order is the one in which pwm-backlight keeps working at
> > > each point in the commit history.
> > 
> > Bisectability is a good point. But in the 4430sdp case I'm sure it's enough
> > that it builds and boots no matter how the patches get merged :)
> 
> If you don't mind some intermediary breakage, I will no longer object.

In this case it should be fine. If you are worried about it, you could
add something that enables the new features in the driver only in
a follow-up patch after the merge window. But I doubt that it's needed.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 35f3ad0..a01a39a 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -291,6 +291,10 @@  static struct platform_device sdp4430_leds_pwm = {
 	},
 };
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static struct platform_pwm_backlight_data sdp4430_backlight_data = {
 	.max_brightness = 127,
 	.dft_brightness = 127,
@@ -718,6 +722,8 @@  static void __init omap_4430sdp_init(void)
 
 	omap4_i2c_init();
 	omap_sfh7741prox_init();
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
 	omap_serial_init();
 	omap_sdrc_init(NULL, NULL);