Skip to contentSkip to conversation

Add mandatory regulator for all users of pwm-backlight.

PATCH New Andrew Chew 1 participant 10 messages Apr 1, 2013

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

v6 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 power 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 power 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.

V6:
Minor formatting and stylistic tweaks to pwm-backlight bindings document.

mach-tegra: Fixed missing reg property, and fleshed out backlight_power_reg
with some real information.

V5:
Changed the name of the supply from "enable" to "power". Renamed corresponding regulator dt nodes and regulators in board setup files. Backlight regulator nodes renamed to something less generic.

mach-mxs: Moved backlight power regulator into top-level regulators node.
mach-vt8500: Made the backlight power regulator controlled via <&gpio 0 7 0>.
mach-tegra: Moved the backlight power regulator to tegra20-tamonten.dtsi.

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 power 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                   | 11 ++++
 arch/arm/boot/dts/tegra20-medcom-wide.dts          |  1 +
 arch/arm/boot/dts/tegra20-tamonten.dtsi            | 10 ++++
 arch/arm/boot/dts/wm8850-w70v2.dts                 |  9 ++++
 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 ++++++++++++++++++----
 33 files changed, 310 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH v6 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..9b03bbd 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("power", "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-power",
+				     &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 v6 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..008be7e 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("power", "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-power",
+				     &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..f6978b6 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("power", "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-power",
+				     &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 v6 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..7e1887a 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("power", "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-power",
+		&backlight_supply, 1, 0);
 	platform_device_register(&cm_x300_backlight_device);
 }
 #else
arch/arm/mach-pxa/colibri-pxa270-income.c +8 -0
index 2d4a7b4..108f2a7 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("power", "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-power",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&income_backlight);
 }
 #else
arch/arm/mach-pxa/ezx.c +9 -0
index dca1070..2b39d5f 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("power", "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-power",
+				     &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..b2f444a 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("power", "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-power",
+				     &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..985f622 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("power", "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-power",
+				     &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..dcae8cc 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("power", "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-power",
+				     &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..c7b13be 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("power", "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-power",
+				     &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..ba9e1cb 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("power", "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-power",
+				     &backlight_supply, 1, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/palm27x.c +8 -0
index 17d4c53..fc34f2b 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("power", "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-power",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&palm27x_backlight);
 }
 #endif
arch/arm/mach-pxa/palmtc.c +8 -0
index 100b176f..b6b241c 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("power", "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-power",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&palmtc_backlight);
 }
 #else
arch/arm/mach-pxa/palmte2.c +9 -0
index 0742721..d181f65 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("power", "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-power",
+				     &backlight_supply, 1, 0);
+
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
arch/arm/mach-pxa/pcm990-baseboard.c +8 -0
index fb7f1d1..25c480d 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("power", "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-power",
+				     &backlight_supply, 1, 0);
 	platform_device_register(&pcm990_backlight_device);
 
 	/* MMC */
arch/arm/mach-pxa/raumfeld.c +6 -0
index af41888..aff0947 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("power", "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-power",
+					     &backlight_supply, 1, 0);
 		platform_device_register(&raumfeld_pwm_backlight_device);
 	}
 
arch/arm/mach-pxa/tavorevb.c +11 -0
index f55979c..db61de5 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("power", "pwm-backlight.0"),
+	REGULATOR_SUPPLY("power", "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-power",
+				     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..ed625d9 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("power", "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-power",
+				     &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..a7ff8a8 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("power", "pwm-backlight.0"),
+	REGULATOR_SUPPLY("power", "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-power",
+				     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..04409f1 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("power", "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-power",
+				     &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 v6 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..0223863 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("power", "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-power",
+				     &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..23ce16b 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("power", "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-power",
+				     &backlight_supply, 1, 0);
+
 	return 0;
 }
 
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH v6 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..839b536 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("power", "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-power",
+				     &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 v6 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     | 11 +++++++++++
 5 files changed, 35 insertions(+)
arch/arm/boot/dts/imx23-evk.dts +6 -0
index 035c13f..ce5048e 100644
@@ -95,6 +95,11 @@
 			regulator-max-microvolt = <3300000>;
 			gpio = <&gpio1 29 0>;
 		};
+
+		reg_backlight_power: fixed-regulator {
+			compatible = "regulator-fixed";
+			regulator-name = "backlight-power";
+	        };
 	};
 
 	backlight {
@@ -102,5 +107,6 @@
 		pwms = <&pwm 2 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&reg_backlight_power>;
 	};
 };
arch/arm/boot/dts/imx28-apf28dev.dts +6 -0
index 6d8865b..e354dc5 100644
@@ -132,6 +132,11 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio1 23 1>;
 		};
+
+		reg_backlight_power: fixed-regulator {
+			compatible = "regulator-fixed";
+			regulator-name = "backlight-power";
+		};
 	};
 
 	leds {
@@ -150,5 +155,6 @@
 		pwms = <&pwm 3 191000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&reg_backlight_power>;
 	};
 };
arch/arm/boot/dts/imx28-cfa10049.dts +6 -0
index a0d3e9f..a6eddd6 100644
@@ -205,6 +205,11 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio0 7 1>;
 		};
+
+		reg_backlight_power: fixed-regulator {
+			compatible = "regulator-fixed";
+			regulator-name = "backlight-power";
+		};
 	};
 
 	ahb at 80080000 {
@@ -304,5 +309,6 @@
 		pwms = <&pwm 3 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&reg_backlight_power>;
 	};
 };
arch/arm/boot/dts/imx28-evk.dts +6 -0
index 2da316e..7ba7216 100644
@@ -285,6 +285,11 @@
 			gpio = <&gpio3 8 0>;
 			enable-active-high;
 		};
+
+		reg_backlight_power: fixed-regulator {
+			compatible = "regulator-fixed";
+			regulator-name = "backlight-power";
+		};
 	};
 
 	sound {
@@ -312,5 +317,6 @@
 		pwms = <&pwm 2 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&reg_backlight_power>;
 	};
 };
arch/arm/boot/dts/imx28-tx28.dts +11 -0
index 37be532..7fa5a44 100644
@@ -97,6 +97,16 @@
 		};
 	};
 
+	regulators {
+		compatible = "simple-bus";
+
+		reg_backlight_power: fixed-regulator {
+			compatible = "regulator-fixed";
+			regulator-name = "backlight-power";
+		};
+	};
+
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -112,5 +122,6 @@
 		pwms = <&pwm 0 5000000>;
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&reg_backlight_power>;
 	};
 };
Signature · 1 line
1.8.1.5
#7 lore raw

PATCH v6 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 | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/wm8850-w70v2.dts +9 -0
index fcc660c..25c96d0 100644
@@ -37,11 +37,20 @@
 		};
 	};
 
+	backlight_power: fixed-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "backlight-power";
+		enable-active-high;
+		regulator-boot-on;
+		gpio = <&gpio 0 7 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>;
+		power-supply = <&backlight_power>;
 	};
 };
Signature · 1 line
1.8.1.5
#8 lore raw

PATCH v6 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 |  1 +
 arch/arm/boot/dts/tegra20-tamonten.dtsi   | 10 ++++++++++
 2 files changed, 11 insertions(+)
arch/arm/boot/dts/tegra20-medcom-wide.dts +1 -0
index a2d6d65..90d665e 100644
@@ -32,6 +32,7 @@
 
 		brightness-levels = <0 4 8 16 32 64 128 255>;
 		default-brightness-level = <6>;
+		power-supply = <&backlight_power_reg>;
 	};
 
 	sound {
arch/arm/boot/dts/tegra20-tamonten.dtsi +10 -0
index 6e9d91f..1ea3e42 100644
@@ -485,5 +485,15 @@
 			regulator-max-microvolt = <5000000>;
 			regulator-always-on;
 		};
+
+		backlight_power_reg: regulator at 1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "lcd_bl_en";
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			gpio = <&gpio 13 0>; /* gpio PB5 */
+			enable-active-high;
+		};
 	};
 };
Signature · 1 line
1.8.1.5
#9 lore raw

PATCH v6 9/9 pwm_bl: Add mandatory backlight power regulator

In reply to Andrew Chew

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

If a power regulator is not needed, then a dummy fixed 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 power 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..efbd799 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)
+  - power-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 power-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>;
+		power-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