Skip to contentSkip to conversation

Add mandatory regulator for all users of pwm-backlight.

PATCH Superseded Andrew Chew 8 participants 27 messages Mar 19, 2013 – Mar 22, 2013

Subsystems (10)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add mandatory regulator for all users of pwm-backlight.

Many backlights are enabled via GPIO. We can generalize the GPIO to a fixed regulator.

The enable regulator needs to be mandatory because there was no good way to determine the difference between opting out of the regulator, and probe deferral.

This series of patches is intended to add a dummy regulator (or a GPIO regulator) for all users of the pwm-backlight.

The last patch in the series will always be the pwm-backlight change to add this mandatory regulator. Patches following up to that patch add the mandatory regulator on a per mach family basis. Once all users of pwm-backlight have been patched, this series can be applied in order to maintain bisectability.

All I did in every case was to provide a dummy fixed regulator to pwm-backlight. If your platform actually uses a regulator (or a GPIO) to enable the backlight, please either let me know so that I can make the modifications and give you something back to test. Or (better yet), provide me with a tested, alternate patch that I can fold into this patch series.

I made sure that where there was a defconfig for an affected board, that it builds. I did not test-build the unicore patch.

V3 and earlier versions of this series only had the OMAP patch, which I used for ironing out some early, obvious stuff. V4 and later is the complete patch set.

Andrew Chew (9):
ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight
ARM: S3C24XX: Provide regulator to pwm-backlight
ARM: pxa: Provide regulator to pwm-backlight
ARM: EXYNOS: Provide regulator to pwm-backlight
unicore32: Provide regulator to pwm-backlight
ARM: mxs: Provide regulator to pwm-backlight
ARM: vt8500: Provide regulator to pwm-backlight
ARM: tegra: Provide regulator to pwm-backlight
pwm_bl: Add mandatory backlight enable regulator

 .../bindings/video/backlight/pwm-backlight.txt     | 14 +++++
 arch/arm/boot/dts/imx23-evk.dts                    |  6 +++
 arch/arm/boot/dts/imx28-apf28dev.dts               |  6 +++
 arch/arm/boot/dts/imx28-cfa10049.dts               |  6 +++
 arch/arm/boot/dts/imx28-evk.dts                    |  6 +++
 arch/arm/boot/dts/imx28-tx28.dts                   |  6 +++
 arch/arm/boot/dts/tegra20-medcom-wide.dts          |  6 +++
 arch/arm/boot/dts/wm8850-w70v2.dts                 |  6 +++
 arch/arm/mach-exynos/mach-nuri.c                   |  7 +++
 arch/arm/mach-omap2/board-4430sdp.c                |  6 +++
 arch/arm/mach-pxa/cm-x300.c                        |  7 +++
 arch/arm/mach-pxa/colibri-pxa270-income.c          |  8 +++
 arch/arm/mach-pxa/ezx.c                            |  9 ++++
 arch/arm/mach-pxa/hx4700.c                         |  8 +++
 arch/arm/mach-pxa/lpd270.c                         |  9 ++++
 arch/arm/mach-pxa/magician.c                       |  8 +++
 arch/arm/mach-pxa/mainstone.c                      | 13 ++++-
 arch/arm/mach-pxa/mioa701.c                        |  8 +++
 arch/arm/mach-pxa/palm27x.c                        |  8 +++
 arch/arm/mach-pxa/palmtc.c                         |  8 +++
 arch/arm/mach-pxa/palmte2.c                        |  9 ++++
 arch/arm/mach-pxa/pcm990-baseboard.c               |  8 +++
 arch/arm/mach-pxa/raumfeld.c                       |  6 +++
 arch/arm/mach-pxa/tavorevb.c                       | 11 ++++
 arch/arm/mach-pxa/viper.c                          |  8 +++
 arch/arm/mach-pxa/z2.c                             | 10 ++++
 arch/arm/mach-pxa/zylonite.c                       |  7 +++
 arch/arm/mach-s3c24xx/mach-h1940.c                 |  8 +++
 arch/arm/mach-s3c24xx/mach-rx1950.c                |  9 ++++
 arch/arm/plat-samsung/dev-backlight.c              |  9 ++++
 arch/unicore32/kernel/puv3-nb0916.c                |  9 ++++
 drivers/video/backlight/pwm_bl.c                   | 59 ++++++++++++++++++----
 32 files changed, 297 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH v4 1/9 ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/mach-omap2/board-4430sdp.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-omap2/board-4430sdp.c +6 -0
index 35f3ad0..a01a39a 100644
@@ -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);
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH v4 2/9 ARM: S3C24XX: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/mach-s3c24xx/mach-h1940.c  | 8 ++++++++
 arch/arm/mach-s3c24xx/mach-rx1950.c | 9 +++++++++
 2 files changed, 17 insertions(+)
arch/arm/mach-s3c24xx/mach-h1940.c +8 -0
index 8dd6601..d2594b8 100644
@@ -24,6 +24,8 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/i2c.h>
 #include <linux/leds.h>
@@ -497,6 +499,9 @@ static void h1940_backlight_exit(struct device *dev)
 	gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
 
 static struct platform_pwm_backlight_data backlight_data = {
 	.pwm_id         = 0,
@@ -720,6 +725,9 @@ static void __init h1940_init(void)
 	gpio_request(H1940_LATCH_SD_POWER, "SD power");
 	gpio_direction_output(H1940_LATCH_SD_POWER, 0);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 
 	gpio_request(S3C2410_GPA(1), "Red LED blink");
arch/arm/mach-s3c24xx/mach-rx1950.c +9 -0
index e4d67a3..ac674b6 100644
@@ -25,6 +25,8 @@
 #include <linux/gpio_keys.h>
 #include <linux/device.h>
 #include <linux/pda_power.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/pwm.h>
 #include <linux/s3c_adc_battery.h>
@@ -518,6 +520,10 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
 	return brightness;
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static struct platform_pwm_backlight_data rx1950_backlight_data = {
 	.pwm_id = 0,
 	.max_brightness = 24,
@@ -795,6 +801,9 @@ static void __init rx1950_init_machine(void)
 	gpio_direction_output(S3C2410_GPA(4), 0);
 	gpio_direction_output(S3C2410_GPJ(6), 0);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
 
 	i2c_register_board_info(0, rx1950_i2c_devices,
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH v4 3/9 ARM: pxa: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/mach-pxa/cm-x300.c               |  7 +++++++
 arch/arm/mach-pxa/colibri-pxa270-income.c |  8 ++++++++
 arch/arm/mach-pxa/ezx.c                   |  9 +++++++++
 arch/arm/mach-pxa/hx4700.c                |  8 ++++++++
 arch/arm/mach-pxa/lpd270.c                |  9 +++++++++
 arch/arm/mach-pxa/magician.c              |  8 ++++++++
 arch/arm/mach-pxa/mainstone.c             | 13 ++++++++++++-
 arch/arm/mach-pxa/mioa701.c               |  8 ++++++++
 arch/arm/mach-pxa/palm27x.c               |  8 ++++++++
 arch/arm/mach-pxa/palmtc.c                |  8 ++++++++
 arch/arm/mach-pxa/palmte2.c               |  9 +++++++++
 arch/arm/mach-pxa/pcm990-baseboard.c      |  8 ++++++++
 arch/arm/mach-pxa/raumfeld.c              |  6 ++++++
 arch/arm/mach-pxa/tavorevb.c              | 11 +++++++++++
 arch/arm/mach-pxa/viper.c                 |  8 ++++++++
 arch/arm/mach-pxa/z2.c                    | 10 ++++++++++
 arch/arm/mach-pxa/zylonite.c              |  7 +++++++
 17 files changed, 144 insertions(+), 1 deletion(-)
arch/arm/mach-pxa/cm-x300.c +7 -0
index 8091aac..4df3c6c 100644
@@ -34,6 +34,7 @@
 
 #include <linux/mfd/da903x.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/power_supply.h>
 #include <linux/apm-emulation.h>
 
@@ -305,6 +306,10 @@ static inline void cm_x300_init_lcd(void) {}
 #endif
 
 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data cm_x300_backlight_data = {
 	.pwm_id		= 2,
 	.max_brightness	= 100,
@@ -322,6 +327,8 @@ static struct platform_device cm_x300_backlight_device = {
 
 static void cm_x300_init_bl(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+		&backlight_supply, 1, 0);
 	platform_device_register(&cm_x300_backlight_device);
 }
 #else
arch/arm/mach-pxa/colibri-pxa270-income.c +8 -0
index 2d4a7b4..0e8e594 100644
@@ -20,6 +20,8 @@
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/i2c/pxa-i2c.h>
 
@@ -184,6 +186,10 @@ static inline void income_lcd_init(void) {}
  * Backlight
  ******************************************************************************/
 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data income_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 0x3ff,
@@ -201,6 +207,8 @@ static struct platform_device income_backlight = {
 
 static void __init income_pwm_init(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&income_backlight);
 }
 #else
arch/arm/mach-pxa/ezx.c +9 -0
index dca1070..bc3651d 100644
@@ -15,6 +15,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/input.h>
 #include <linux/gpio.h>
@@ -49,6 +51,10 @@
 #define GPIO19_GEN1_CAM_RST		19
 #define GPIO28_GEN2_CAM_RST		28
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data ezx_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 1023,
@@ -792,6 +798,9 @@ static void __init a780_init(void)
 		platform_device_register(&a780_camera);
 	}
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
 	platform_add_devices(ARRAY_AND_SIZE(a780_devices));
 }
arch/arm/mach-pxa/hx4700.c +8 -0
index 133109e..7063fad 100644
@@ -33,6 +33,7 @@
 #include <linux/regulator/driver.h>
 #include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/max1586.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/spi.h>
@@ -556,6 +557,10 @@ static struct platform_device hx4700_lcd = {
  * Backlight
  */
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static struct platform_pwm_backlight_data backlight_data = {
 	.pwm_id         = -1,	/* Superseded by pwm_lookup */
 	.max_brightness = 200,
@@ -876,6 +881,9 @@ static void __init hx4700_init(void)
 	pxa_set_btuart_info(NULL);
 	pxa_set_stuart_info(NULL);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
 
arch/arm/mach-pxa/lpd270.c +9 -0
index 1255ee0..8882937 100644
@@ -23,6 +23,8 @@
 #include <linux/ioport.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 
 #include <asm/types.h>
@@ -264,6 +266,10 @@ static struct platform_device lpd270_flash_device[2] = {
 	},
 };
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data lpd270_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 1,
@@ -466,6 +472,9 @@ static void __init lpd270_init(void)
 	 */
 	ARB_CNTRL = ARB_CORE_PARK | 0x234;
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
 	pxa_set_ac97_info(NULL);
arch/arm/mach-pxa/magician.c +8 -0
index f44532f..a1bbf3a 100644
@@ -27,6 +27,7 @@
 #include <linux/pwm_backlight.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/gpio-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -373,6 +374,10 @@ static void magician_backlight_exit(struct device *dev)
 	gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios));
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static struct platform_pwm_backlight_data backlight_data = {
 	.pwm_id         = 0,
 	.max_brightness = 272,
@@ -742,6 +747,9 @@ static void __init magician_init(void)
 	pxa_set_btuart_info(NULL);
 	pxa_set_stuart_info(NULL);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(ARRAY_AND_SIZE(devices));
 
 	pxa_set_ficp_info(&magician_ficp_info);
arch/arm/mach-pxa/mainstone.c +12 -1
index 7a12c1b..a0a0fb6 100644
@@ -25,6 +25,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -333,6 +335,10 @@ static struct platform_device mst_flash_device[2] = {
 };
 
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data mainstone_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 1023,
@@ -350,7 +356,12 @@ static struct platform_device mainstone_backlight_device = {
 
 static void __init mainstone_backlight_register(void)
 {
-	int ret = platform_device_register(&mainstone_backlight_device);
+	int ret;
+
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
+	ret = platform_device_register(&mainstone_backlight_device);
 	if (ret)
 		printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
 }
arch/arm/mach-pxa/mioa701.c +8 -0
index f8979b9..581b72e 100644
@@ -37,6 +37,8 @@
 #include <linux/wm97xx.h>
 #include <linux/mtd/physmap.h>
 #include <linux/usb/gpio_vbus.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/max1586.h>
 #include <linux/slab.h>
 #include <linux/i2c/pxa-i2c.h>
@@ -179,6 +181,10 @@ static unsigned long mioa701_pin_config[] = {
 	MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),
 };
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 /* LCD Screen and Backlight */
 static struct platform_pwm_backlight_data mioa701_backlight_data = {
 	.pwm_id		= 0,
@@ -739,6 +745,8 @@ static void __init mioa701_machine_init(void)
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
 	pm_power_off = mioa701_poweroff;
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/palm27x.c +8 -0
index 17d4c53..d2e9fc5 100644
@@ -20,6 +20,8 @@
 #include <linux/wm97xx.h>
 #include <linux/power_supply.h>
 #include <linux/usb/gpio_vbus.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/max1586.h>
 #include <linux/i2c/pxa-i2c.h>
 
@@ -317,6 +319,10 @@ static void palm27x_backlight_exit(struct device *dev)
 		gpio_free(palm_lcd_power);
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data palm27x_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 0xfe,
@@ -339,6 +345,8 @@ void __init palm27x_pwm_init(int bl, int lcd)
 {
 	palm_bl_power	= bl;
 	palm_lcd_power	= lcd;
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&palm27x_backlight);
 }
 #endif
arch/arm/mach-pxa/palmtc.c +8 -0
index 100b176f..31ce02f 100644
@@ -18,6 +18,8 @@
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/input.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/gpio.h>
 #include <linux/input/matrix_keypad.h>
@@ -197,6 +199,10 @@ static void palmtc_backlight_exit(struct device *dev)
 	gpio_free(GPIO_NR_PALMTC_BL_POWER);
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data palmtc_backlight_data = {
 	.pwm_id		= 1,
 	.max_brightness	= PALMTC_MAX_INTENSITY,
@@ -217,6 +223,8 @@ static struct platform_device palmtc_backlight = {
 
 static void __init palmtc_pwm_init(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&palmtc_backlight);
 }
 #else
arch/arm/mach-pxa/palmte2.c +9 -0
index 0742721..eaca28e 100644
@@ -21,6 +21,8 @@
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/pda_power.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/gpio.h>
 #include <linux/wm97xx.h>
@@ -160,6 +162,10 @@ static void palmte2_backlight_exit(struct device *dev)
 	gpio_free_array(ARRAY_AND_SIZE(palmte_bl_gpios));
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data palmte2_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= PALMTE2_MAX_INTENSITY,
@@ -354,6 +360,9 @@ static void __init palmte2_init(void)
 	pxa_set_ac97_info(&palmte2_ac97_pdata);
 	pxa_set_ficp_info(&palmte2_ficp_platform_data);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
arch/arm/mach-pxa/pcm990-baseboard.c +8 -0
index fb7f1d1..c4fcf27 100644
@@ -24,6 +24,8 @@
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 
 #include <media/mt9v022.h>
@@ -148,6 +150,10 @@ static struct pxafb_mach_info pcm990_fbinfo __initdata = {
 };
 #endif
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data pcm990_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 1023,
@@ -539,6 +545,8 @@ void __init pcm990_baseboard_init(void)
 #ifndef CONFIG_PCM990_DISPLAY_NONE
 	pxa_set_fb_info(NULL, &pcm990_fbinfo);
 #endif
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&pcm990_backlight_device);
 
 	/* MMC */
arch/arm/mach-pxa/raumfeld.c +6 -0
index af41888..2cdb7cc 100644
@@ -531,6 +531,10 @@ static void __init raumfeld_w1_init(void)
  * Framebuffer device
  */
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 /* PWM controlled backlight */
 static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = {
 	.pwm_id		= 0,
@@ -617,6 +621,8 @@ static void __init raumfeld_lcd_init(void)
 	} else {
 		mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT;
 		pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1);
+		regulator_register_always_on(-1, "backlight-enable",
+					     &backlight_supply, 1, 0);
 		platform_device_register(&raumfeld_pwm_backlight_device);
 	}
 
arch/arm/mach-pxa/tavorevb.c +11 -0
index f55979c..8ca4f94 100644
@@ -18,6 +18,8 @@
 #include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/smc91x.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 
 #include <asm/mach-types.h>
@@ -164,6 +166,12 @@ static inline void tavorevb_init_keypad(void) {}
 #endif /* CONFIG_KEYBOARD_PXA27x || CONFIG_KEYBOARD_PXA27x_MODULE */
 
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply[] = {
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0"),
+	REGULATOR_SUPPLY("enable", "pwm-backlight.1"),
+};
+
 static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
 	[0] = {
 		/* primary backlight */
@@ -464,6 +472,9 @@ static struct pxafb_mach_info tavorevb_lcd_info = {
 
 static void __init tavorevb_init_lcd(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+				     backlight_supply,
+				     ARRAY_SIZE(backlight_supply), 0);
 	platform_device_register(&tavorevb_backlight_devices[0]);
 	platform_device_register(&tavorevb_backlight_devices[1]);
 	pxa_set_fb_info(NULL, &tavorevb_lcd_info);
arch/arm/mach-pxa/viper.c +8 -0
index 9c363c0..6c80890 100644
@@ -39,6 +39,8 @@
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/serial_8250.h>
 #include <linux/smc91x.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/usb/isp116x.h>
 #include <linux/mtd/mtd.h>
@@ -396,6 +398,10 @@ static void viper_backlight_exit(struct device *dev)
 	gpio_free(VIPER_BCKLIGHT_EN_GPIO);
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data viper_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 100,
@@ -940,6 +946,8 @@ static void __init viper_init(void)
 		smc91x_device.num_resources--;
 
 	pxa_set_i2c_info(NULL);
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
 	platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs));
 
 	viper_init_vcore_gpios();
arch/arm/mach-pxa/z2.c +10 -0
index 989903a..55b9fae 100644
@@ -29,6 +29,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/delay.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
@@ -199,6 +200,12 @@ static inline void z2_nor_init(void) {}
  * Backlight
  ******************************************************************************/
 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply[] = {
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0"),
+	REGULATOR_SUPPLY("enable", "pwm-backlight.1"),
+};
+
 static struct platform_pwm_backlight_data z2_backlight_data[] = {
 	[0] = {
 		/* Keypad Backlight */
@@ -234,6 +241,9 @@ static struct platform_device z2_backlight_devices[2] = {
 };
 static void __init z2_pwm_init(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+				     backlight_supply,
+				     ARRAY_SIZE(backlight_supply), 0);
 	platform_device_register(&z2_backlight_devices[0]);
 	platform_device_register(&z2_backlight_devices[1]);
 }
arch/arm/mach-pxa/zylonite.c +7 -0
index 1f00d65..ab05f53 100644
@@ -120,6 +120,10 @@ static inline void zylonite_init_leds(void) {}
 #endif
 
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight.0");
+
 static struct platform_pwm_backlight_data zylonite_backlight_data = {
 	.pwm_id		= 3,
 	.max_brightness	= 100,
@@ -205,6 +209,9 @@ static struct pxafb_mach_info zylonite_sharp_lcd_info = {
 
 static void __init zylonite_init_lcd(void)
 {
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_device_register(&zylonite_backlight_device);
 
 	if (lcd_id & 0x20) {
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH v4 4/9 ARM: EXYNOS: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/mach-exynos/mach-nuri.c      | 7 +++++++
 arch/arm/plat-samsung/dev-backlight.c | 9 +++++++++
 2 files changed, 16 insertions(+)
arch/arm/mach-exynos/mach-nuri.c +7 -0
index 1ea7973..35e881e 100644
@@ -294,6 +294,10 @@ static void nuri_bl_exit(struct device *dev)
 	gpio_free(EXYNOS4_GPE2(3));
 }
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 /* nuri pwm backlight */
 static struct platform_pwm_backlight_data nuri_backlight_data = {
 	.pwm_id			= 0,
@@ -1368,6 +1372,9 @@ static void __init nuri_machine_init(void)
 	nuri_ehci_init();
 	s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	/* Last */
 	platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
 }
arch/arm/plat-samsung/dev-backlight.c +9 -0
index 5f197dc..7277821 100644
@@ -14,12 +14,18 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/io.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/backlight.h>
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static int samsung_bl_init(struct device *dev)
 {
 	int ret = 0;
@@ -37,6 +43,9 @@ static int samsung_bl_init(struct device *dev)
 	/* Configure GPIO pin with specific GPIO function for PWM timer */
 	s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	return 0;
 }
 
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH v4 5/9 unicore32: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/unicore32/kernel/puv3-nb0916.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/unicore32/kernel/puv3-nb0916.c +9 -0
index 181108b..ff84d77 100644
@@ -19,6 +19,8 @@
 #include <linux/reboot.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/pwm_backlight.h>
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
@@ -49,6 +51,10 @@ static struct resource puv3_i2c_resources[] = {
 	}
 };
 
+/* Dummy regulator for pwm-backlight driver */
+static struct regulator_consumer_supply backlight_supply =
+	REGULATOR_SUPPLY("enable", "pwm-backlight");
+
 static struct platform_pwm_backlight_data nb0916_backlight_data = {
 	.pwm_id		= 0,
 	.max_brightness	= 100,
@@ -111,6 +117,9 @@ int __init mach_nb0916_init(void)
 	platform_device_register_simple("PKUnity-v3-I2C", -1,
 			puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources));
 
+	regulator_register_always_on(-1, "backlight-enable",
+				     &backlight_supply, 1, 0);
+
 	platform_device_register_data(&platform_bus, "pwm-backlight", -1,
 			&nb0916_backlight_data, sizeof(nb0916_backlight_data));
 
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/imx23-evk.dts      | 6 ++++++
 arch/arm/boot/dts/imx28-apf28dev.dts | 6 ++++++
 arch/arm/boot/dts/imx28-cfa10049.dts | 6 ++++++
 arch/arm/boot/dts/imx28-evk.dts      | 6 ++++++
 arch/arm/boot/dts/imx28-tx28.dts     | 6 ++++++
 5 files changed, 30 insertions(+)
arch/arm/boot/dts/imx23-evk.dts +6 -0
index 035c13f..e48e36c 100644
@@ -97,10 +97,16 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+        };
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 2 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
arch/arm/boot/dts/imx28-apf28dev.dts +6 -0
index 6d8865b..866e26f 100644
@@ -144,11 +144,17 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 
 		pwms = <&pwm 3 191000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
arch/arm/boot/dts/imx28-cfa10049.dts +6 -0
index a0d3e9f..a8477b6 100644
@@ -299,10 +299,16 @@
 		rotary-encoder,relative-axis;
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 3 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
arch/arm/boot/dts/imx28-evk.dts +6 -0
index 2da316e..810f1e4 100644
@@ -307,10 +307,16 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 2 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
arch/arm/boot/dts/imx28-tx28.dts +6 -0
index 37be532..ea3c88a 100644
@@ -107,10 +107,16 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
Signature · 1 line
1.8.1.5
#7 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

Dear Andrew Chew,

Quoted 5 lines

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

Do we really need a mandatory regulator? Why can't it be optional?

Best regards,
Marek Vasut

#8 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

Quoted 6 lines

Dear Andrew Chew,

Quoted 4 lines

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

Quoted 6 lines
Quoted 1 line

Do we really need a mandatory regulator? Why can't it be optional?

Best regards,
Marek Vasut

Because for those using board setup code (and not devicetree), it was not possible to distinguish between opting out of the regulator, and deferred probe, without adding something to the platform data that board setup code needed to fill in anyway.

#9 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

Dear Andrew Chew,

Quoted 10 lines
Quoted 10 lines

Dear Andrew Chew,

Quoted 5 lines

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

Do we really need a mandatory regulator? Why can't it be optional?

Quoted 7 lines
Quoted 2 lines

Best regards,
Marek Vasut

Because for those using board setup code (and not devicetree), it was not possible to distinguish between opting out of the regulator, and deferred probe, without adding something to the platform data that board setup code needed to fill in anyway.

Sure, but this adds a bit of overhead for the DT platforms, no?

Other than this curiosity, I have no problems with this stuff.

Best regards,
Marek Vasut

#10 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

Dear Andrew Chew,

Quoted 5 lines

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

Do we really need a mandatory regulator? Why can't it be optional?

IIRC, the previous advice I've seen is that if a device (driver) uses a regulator, it must /require/ a regulator, and if a particular board doesn't actually have a SW-controlled regulator, then a fixed- or dummy- regulator should be provided to satisfy this requirement.

CC'ing Mark Brown to make sure I really do Recall Correctly.

#11 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

Quoted 10 lines · Stephen Warren
Quoted 1 line · Marek Vasut

Do we really need a mandatory regulator? Why can't it be optional?

IIRC, the previous advice I've seen is that if a device (driver) uses a regulator, it must /require/ a regulator, and if a particular board doesn't actually have a SW-controlled regulator, then a fixed- or dummy- regulator should be provided to satisfy this requirement.

CC'ing Mark Brown to make sure I really do Recall Correctly.

Yes, and it should be fixed rather than dummy. The issue is partly that
it's probably important that the device has power so we don't want to
just ignore errors and partly that this is something which applies to
essentially all devices so whatever we do for this case ought to be done
by the core so all devices can benefit and we don't have to duplicate
lots of code in individual drivers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130320/4d5a045b/attachment-0001.sig>

#12 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

Hi Mark,

Quoted 9 lines · Stephen Warren
Quoted 8 lines · Marek Vasut
Quoted 1 line

Do we really need a mandatory regulator? Why can't it be optional?

IIRC, the previous advice I've seen is that if a device (driver) uses a regulator, it must /require/ a regulator, and if a particular board doesn't actually have a SW-controlled regulator, then a fixed- or dummy- regulator should be provided to satisfy this requirement.

Quoted 8 lines
Quoted 1 line

CC'ing Mark Brown to make sure I really do Recall Correctly.

Yes, and it should be fixed rather than dummy. The issue is partly that it's probably important that the device has power so we don't want to just ignore errors and partly that this is something which applies to essentially all devices so whatever we do for this case ought to be done by the core so all devices can benefit and we don't have to duplicate lots of code in individual drivers.

Thanks for clearing this!

Best regards,
Marek Vasut

#13 lore raw

PATCH v4 6/9 ARM: mxs: Provide regulator to pwm-backlight

In reply to Andrew Chew
Quoted 18 lines · Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/imx23-evk.dts      | 6 ++++++
 arch/arm/boot/dts/imx28-apf28dev.dts | 6 ++++++
 arch/arm/boot/dts/imx28-cfa10049.dts | 6 ++++++
 arch/arm/boot/dts/imx28-evk.dts      | 6 ++++++
 arch/arm/boot/dts/imx28-tx28.dts     | 6 ++++++
 5 files changed, 30 insertions(+)
arch/arm/boot/dts/imx23-evk.dts +0 -0
index 035c13f..e48e36c 100644

arch/arm/boot/dts/imx23-evk.dts line 100

Quoted 4 lines
arch/arm/boot/dts/imx23-evk.dts +1 -0
@@ -97,10 +97,16 @@
 		};
 	};
 
+	bl_en: fixed-regulator {

The node name is too generic. Very likely we have other fixed regulator in a dts.

For mxs, we have all such board level regulators defined in node "regulators" as children.

Shawn

Quoted 12 lines
arch/arm/boot/dts/imx23-evk.dts +5 -0
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+        };
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 2 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 };
#14 lore raw

PATCH v4 7/9 ARM: vt8500: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/wm8850-w70v2.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/wm8850-w70v2.dts +6 -0
index fcc660c..47a0b1a 100644
@@ -37,11 +37,17 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 50000 1>;	/* duty inverted */
 
 		brightness-levels = <0 40 60 80 100 130 190 255>;
 		default-brightness-level = <5>;
+		enable-supply = <&bl_en>;
 	};
 };
Signature · 1 line
1.8.1.5
#15 lore raw

PATCH v4 7/9 ARM: vt8500: Provide regulator to pwm-backlight

Quoted 21 lines · Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/wm8850-w70v2.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/wm8850-w70v2.dts +4 -0
index fcc660c..47a0b1a 100644
@@ -37,11 +37,17 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};

arch/arm/boot/dts/wm8850-w70v2.dts line 53

Quoted 10 lines
arch/arm/boot/dts/wm8850-w70v2.dts +2 -0
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 50000 1>;	/* duty inverted */
 
 		brightness-levels = <0 40 60 80 100 130 190 255>;
 		default-brightness-level = <5>;
+		enable-supply = <&bl_en>;
 	};
 };

This board will use either <&gpio 0 7 0> or <&pinctrl 7 0>, dependant on the pinctrl driver patchset going through.

If you want it to 'work', feel free to add a regulator for the <&gpio 0 7 0> case - otherwise just leave the dummy and I'll patch it later once the pinctrl driver is finished.

I only know of one user who is disabling the backlight gpio at present, and he is doing it with a gpio-led node.

The backlight is enabled by uboot on all boards with an LCD present, so this is just a power-saving feature for us - nothing breaks by having a dummy.

Regards
Tony P

#16 lore raw

PATCH v4 8/9 ARM: tegra: Provide regulator to pwm-backlight

In reply to Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/tegra20-medcom-wide.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/tegra20-medcom-wide.dts +6 -0
index a2d6d65..bf7fdd7 100644
@@ -26,12 +26,18 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 5000000>;
 
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
 
 	sound {
Signature · 1 line
1.8.1.5
#17 lore raw

PATCH v4 8/9 ARM: tegra: Provide regulator to pwm-backlight

Quoted 3 lines · Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

I assume these patches will get merged through the PWM tree? If so,

#18 lore raw

PATCH v4 8/9 ARM: tegra: Provide regulator to pwm-backlight

In reply to Andrew Chew
Quoted 14 lines · Andrew Chew

The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement.

---
 arch/arm/boot/dts/tegra20-medcom-wide.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/tegra20-medcom-wide.dts +0 -0
index a2d6d65..bf7fdd7 100644

arch/arm/boot/dts/tegra20-medcom-wide.dts line 32

Quoted 7 lines
arch/arm/boot/dts/tegra20-medcom-wide.dts +4 -0
@@ -26,12 +26,18 @@
 		};
 	};
 
+	bl_en: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "bl-en-supply";
+	};

This should go into the top-level regulators node which this DTS inherits from tegra20-tamonten.dtsi.

I think it'd be nice to rename it to something like backlight_reg for consistency with other regulators in that node.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130322/b3014e2c/attachment.sig>

#19 lore raw

PATCH v4 9/9 pwm_bl: Add mandatory backlight enable regulator

In reply to Andrew Chew

Many backlights need to be explicitly enabled. Typically, this is done with a GPIO. For flexibility, we generalize the enable mechanism to a regulator.

If an enable regulator is not needed, then a dummy regulator can be given to the backlight driver. If a GPIO is used to enable the backlight, then a fixed regulator can be instantiated to control the GPIO.

The backlight enable regulator can be specified in the device tree node for the backlight, or can be done with legacy board setup code in the usual way.

---
 .../bindings/video/backlight/pwm-backlight.txt     | 14 +++++
 drivers/video/backlight/pwm_bl.c                   | 59 ++++++++++++++++++----
 2 files changed, 63 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +14 -0
index 1e4fc72..7e2e089 100644
@@ -10,6 +10,11 @@ Required properties:
       last value in the array represents a 100% duty cycle (brightest).
   - default-brightness-level: the default brightness level (index into the
       array defined by the "brightness-levels" property)
+  - enable-supply: A phandle to the regulator device tree node. This
+      regulator will be turned on and off as the pwm is enabled and disabled.
+      Many backlights are enabled via a GPIO. In this case, we instantiate
+      a fixed regulator and give that to enable-supply. If a regulator
+      is not needed, then provide a dummy fixed regulator.
 
 Optional properties:
   - pwm-names: a list of names for the PWM devices specified in the
@@ -19,10 +24,19 @@ Optional properties:
 
 Example:
 
+	bl_en: fixed-regulator {
+                compatible = "regulator-fixed";
+                regulator-name = "bl-en-supply";
+                regulator-boot-on;
+                gpio = <&some_gpio>;
+                enable-active-high;
+	};
+
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 5000000>;
 
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		enable-supply = <&bl_en>;
 	};
drivers/video/backlight/pwm_bl.c +49 -10

111 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#20 lore raw

PATCH v4 9/9 pwm_bl: Add mandatory backlight enable regulator

Quoted 17 lines · Andrew Chew

Many backlights need to be explicitly enabled. Typically, this is done with a GPIO. For flexibility, we generalize the enable mechanism to a regulator.

If an enable regulator is not needed, then a dummy regulator can be given to the backlight driver. If a GPIO is used to enable the backlight, then a fixed regulator can be instantiated to control the GPIO.

The backlight enable regulator can be specified in the device tree node for the backlight, or can be done with legacy board setup code in the usual way.

Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +0 -0
index 1e4fc72..7e2e089 100644

Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt Required properties: · line 17

Quoted 8 lines
Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +5 -0
@@ -10,6 +10,11 @@ Required properties:
       last value in the array represents a 100% duty cycle (brightest).
   - default-brightness-level: the default brightness level (index into the
       array defined by the "brightness-levels" property)
+  - enable-supply: A phandle to the regulator device tree node. This
+      regulator will be turned on and off as the pwm is enabled and disabled.
+      Many backlights are enabled via a GPIO. In this case, we instantiate
+      a fixed regulator and give that to enable-supply. If a regulator
+      is not needed, then provide a dummy fixed regulator.

"enable" doesn't seem like the right name here; if this really is an "enable" input, then it's not a regulator. If you're calling it "enable" because the regulator is usually controlled by a GPIO that enables it, then what you really have is a regulator that provides power to the backlight, and the method that you enable that regulator is irrelevant.

Put another way, wouldn't "power" be a better name, thus making the property "power-supply"? Although that property name migth be considered to have some negative correlation with other concepts, so if people object to that, perhaps e.g. "vdd-supply"?

#21 lore raw

PATCH v4 9/9 pwm_bl: Add mandatory backlight enable regulator

Quoted 33 lines · Stephen Warren
Quoted 17 lines · Andrew Chew

Many backlights need to be explicitly enabled. Typically, this is done with a GPIO. For flexibility, we generalize the enable mechanism to a regulator.

If an enable regulator is not needed, then a dummy regulator can be given to the backlight driver. If a GPIO is used to enable the backlight, then a fixed regulator can be instantiated to control the GPIO.

The backlight enable regulator can be specified in the device tree node for the backlight, or can be done with legacy board setup code in the usual way.

Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +0 -0
index 1e4fc72..7e2e089 100644

Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt Required properties: · line 17

Quoted 8 lines
Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +5 -0
@@ -10,6 +10,11 @@ Required properties:
       last value in the array represents a 100% duty cycle (brightest).
   - default-brightness-level: the default brightness level (index into the
       array defined by the "brightness-levels" property)
+  - enable-supply: A phandle to the regulator device tree node. This
+      regulator will be turned on and off as the pwm is enabled and disabled.
+      Many backlights are enabled via a GPIO. In this case, we instantiate
+      a fixed regulator and give that to enable-supply. If a regulator
+      is not needed, then provide a dummy fixed regulator.

"enable" doesn't seem like the right name here; if this really is an "enable" input, then it's not a regulator. If you're calling it "enable" because the regulator is usually controlled by a GPIO that enables it, then what you really have is a regulator that provides power to the backlight, and the method that you enable that regulator is irrelevant.

Quoted 4 lines

Put another way, wouldn't "power" be a better name, thus making the property "power-supply"? Although that property name migth be considered to have some negative correlation with other concepts, so if people object to that, perhaps e.g. "vdd-supply"?

"power" sounds like a reasonable name to me.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130320/e3abc94f/attachment-0001.sig>

#23 lore raw

v4 cover Add mandatory regulator for all users of pwm-backlight.

Quoted 9 lines · Shawn Guo
Quoted 3 lines · Andrew Chew

Many backlights are enabled via GPIO. We can generalize the GPIO to a fixed regulator.

I think we should push the series of "Runtime Interpreted Power Sequences" moving forward, which should be useful this case and many other cases as well.

http://thread.gmane.org/gmane.linux.kernel/1395912

That's still the medium-term plan. But doing this correctly requires some improvements to be done in the GPIO subsystem, which I am pushing at the moment.

Eventually power sequences should handle this kind of scenario, but by the meantime it cannot hurt to get the job done.

Alex.

#24 lore raw

v4 cover Add mandatory regulator for all users of pwm-backlight.

Quoted 9 lines · Alex Courbot
Quoted 8 lines · Shawn Guo
Quoted 3 lines · Andrew Chew

Many backlights are enabled via GPIO. We can generalize the GPIO to a fixed regulator.

I think we should push the series of "Runtime Interpreted Power Sequences" moving forward, which should be useful this case and many other cases as well.

Quoted 6 lines
Quoted 1 line

http://thread.gmane.org/gmane.linux.kernel/1395912

That's still the medium-term plan. But doing this correctly requires some improvements to be done in the GPIO subsystem, which I am pushing at the moment.

Thanks for updating the status.

Quoted 3 lines

Eventually power sequences should handle this kind of scenario, but by the meantime it cannot hurt to get the job done.

It just makes us a little sick that a dummy fixed regulator is added all over the places merely for pwm-backlight to retrieve a GPIO from device tree.

Shawn

#25 lore raw

v4 cover Add mandatory regulator for all users of pwm-backlight.

In reply to Alex Courbot
Quoted 11 lines · Alex Courbot
Quoted 9 lines · Shawn Guo
Quoted 3 lines · Andrew Chew

Many backlights are enabled via GPIO. We can generalize the GPIO to a fixed regulator.

I think we should push the series of "Runtime Interpreted Power Sequences" moving forward, which should be useful this case and many other cases as well.

http://thread.gmane.org/gmane.linux.kernel/1395912

Quoted 8 lines

That's still the medium-term plan. But doing this correctly requires some improvements to be done in the GPIO subsystem, which I am pushing at the moment.

Eventually power sequences should handle this kind of scenario, but by the meantime it cannot hurt to get the job done.

Alex.

I don't mind this patch personally, so take this query as more of a 'generalization' than a problem with this patch:

This patch changes the binding for an already used device (by addition of a required property), which isn't so bad BUT, as Alex pointed out, the binding will probably end up being changed again once power sequencing is sorted out.

I realise it's still early days and things need to be tried-and-tested first, but wasn't the point of the bindings that they should be finalized (as best as possible anyway) the first time, so we don't have to worry about incompatibilities between bindings and drivers?

Regards

Tony P

#26 lore raw

v4 cover Add mandatory regulator for all users of pwm-backlight.

In reply to Andrew Chew
Quoted 23 lines · Andrew Chew

Many backlights are enabled via GPIO. We can generalize the GPIO to a fixed regulator.

The enable regulator needs to be mandatory because there was no good way to determine the difference between opting out of the regulator, and probe deferral.

This series of patches is intended to add a dummy regulator (or a GPIO regulator) for all users of the pwm-backlight.

The last patch in the series will always be the pwm-backlight change to add this mandatory regulator. Patches following up to that patch add the mandatory regulator on a per mach family basis. Once all users of pwm-backlight have been patched, this series can be applied in order to maintain bisectability.

All I did in every case was to provide a dummy fixed regulator to pwm-backlight. If your platform actually uses a regulator (or a GPIO) to enable the backlight, please either let me know so that I can make the modifications and give you something back to test. Or (better yet), provide me with a tested, alternate patch that I can fold into this patch series.

Quoted 6 lines

I made sure that where there was a defconfig for an affected board, that it builds. I did not test-build the unicore patch.

V3 and earlier versions of this series only had the OMAP patch, which I used for ironing out some early, obvious stuff. V4 and later is the complete patch set.

For the series:

Thanks,
Alex.

Quoted 46 lines

Andrew Chew (9):
ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight
ARM: S3C24XX: Provide regulator to pwm-backlight
ARM: pxa: Provide regulator to pwm-backlight
ARM: EXYNOS: Provide regulator to pwm-backlight
unicore32: Provide regulator to pwm-backlight
ARM: mxs: Provide regulator to pwm-backlight
ARM: vt8500: Provide regulator to pwm-backlight
ARM: tegra: Provide regulator to pwm-backlight
pwm_bl: Add mandatory backlight enable regulator

  .../bindings/video/backlight/pwm-backlight.txt     | 14 +++++
  arch/arm/boot/dts/imx23-evk.dts                    |  6 +++
  arch/arm/boot/dts/imx28-apf28dev.dts               |  6 +++
  arch/arm/boot/dts/imx28-cfa10049.dts               |  6 +++
  arch/arm/boot/dts/imx28-evk.dts                    |  6 +++
  arch/arm/boot/dts/imx28-tx28.dts                   |  6 +++
  arch/arm/boot/dts/tegra20-medcom-wide.dts          |  6 +++
  arch/arm/boot/dts/wm8850-w70v2.dts                 |  6 +++
  arch/arm/mach-exynos/mach-nuri.c                   |  7 +++
  arch/arm/mach-omap2/board-4430sdp.c                |  6 +++
  arch/arm/mach-pxa/cm-x300.c                        |  7 +++
  arch/arm/mach-pxa/colibri-pxa270-income.c          |  8 +++
  arch/arm/mach-pxa/ezx.c                            |  9 ++++
  arch/arm/mach-pxa/hx4700.c                         |  8 +++
  arch/arm/mach-pxa/lpd270.c                         |  9 ++++
  arch/arm/mach-pxa/magician.c                       |  8 +++
  arch/arm/mach-pxa/mainstone.c                      | 13 ++++-
  arch/arm/mach-pxa/mioa701.c                        |  8 +++
  arch/arm/mach-pxa/palm27x.c                        |  8 +++
  arch/arm/mach-pxa/palmtc.c                         |  8 +++
  arch/arm/mach-pxa/palmte2.c                        |  9 ++++
  arch/arm/mach-pxa/pcm990-baseboard.c               |  8 +++
  arch/arm/mach-pxa/raumfeld.c                       |  6 +++
  arch/arm/mach-pxa/tavorevb.c                       | 11 ++++
  arch/arm/mach-pxa/viper.c                          |  8 +++
  arch/arm/mach-pxa/z2.c                             | 10 ++++
  arch/arm/mach-pxa/zylonite.c                       |  7 +++
  arch/arm/mach-s3c24xx/mach-h1940.c                 |  8 +++
  arch/arm/mach-s3c24xx/mach-rx1950.c                |  9 ++++
  arch/arm/plat-samsung/dev-backlight.c              |  9 ++++
  arch/unicore32/kernel/puv3-nb0916.c                |  9 ++++
  drivers/video/backlight/pwm_bl.c                   | 59 ++++++++++++++++++----
  32 files changed, 297 insertions(+), 11 deletions(-)