* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. @ 2013-03-19 18:59 Andrew Chew 2013-03-19 18:59 ` [PATCH V4 1/9] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight Andrew Chew ` (10 more replies) 0 siblings, 11 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel 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(-) -- 1.8.1.5 ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 1/9] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 18:59 ` [PATCH V4 2/9] ARM: S3C24XX: " Andrew Chew ` (9 subsequent siblings) 10 siblings, 0 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> --- arch/arm/mach-omap2/board-4430sdp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 35f3ad0..a01a39a 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -291,6 +291,10 @@ static struct platform_device sdp4430_leds_pwm = { }, }; +/* Dummy regulator for pwm-backlight driver */ +static struct regulator_consumer_supply backlight_supply = + REGULATOR_SUPPLY("enable", "pwm-backlight"); + static struct platform_pwm_backlight_data sdp4430_backlight_data = { .max_brightness = 127, .dft_brightness = 127, @@ -718,6 +722,8 @@ static void __init omap_4430sdp_init(void) omap4_i2c_init(); omap_sfh7741prox_init(); + regulator_register_always_on(-1, "backlight-enable", + &backlight_supply, 1, 0); platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); omap_serial_init(); omap_sdrc_init(NULL, NULL); -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 2/9] ARM: S3C24XX: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew 2013-03-19 18:59 ` [PATCH V4 1/9] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 18:59 ` [PATCH V4 3/9] ARM: pxa: " Andrew Chew ` (8 subsequent siblings) 10 siblings, 0 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- arch/arm/mach-s3c24xx/mach-h1940.c | 8 ++++++++ arch/arm/mach-s3c24xx/mach-rx1950.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index 8dd6601..d2594b8 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c @@ -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"); diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index e4d67a3..ac674b6 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c @@ -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, -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 3/9] ARM: pxa: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew 2013-03-19 18:59 ` [PATCH V4 1/9] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight Andrew Chew 2013-03-19 18:59 ` [PATCH V4 2/9] ARM: S3C24XX: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 18:59 ` [PATCH V4 4/9] ARM: EXYNOS: " Andrew Chew ` (7 subsequent siblings) 10 siblings, 0 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- 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(-) diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 8091aac..4df3c6c 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c @@ -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 diff --git a/arch/arm/mach-pxa/colibri-pxa270-income.c b/arch/arm/mach-pxa/colibri-pxa270-income.c index 2d4a7b4..0e8e594 100644 --- a/arch/arm/mach-pxa/colibri-pxa270-income.c +++ b/arch/arm/mach-pxa/colibri-pxa270-income.c @@ -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 diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index dca1070..bc3651d 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c @@ -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)); } diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 133109e..7063fad 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c @@ -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)); diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index 1255ee0..8882937 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.c @@ -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); diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index f44532f..a1bbf3a 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -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); diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 7a12c1b..a0a0fb6 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -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); } diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index f8979b9..581b72e 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c @@ -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(); diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index 17d4c53..d2e9fc5 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c @@ -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 diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 100b176f..31ce02f 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c @@ -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 diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index 0742721..eaca28e 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c @@ -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)); } diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index fb7f1d1..c4fcf27 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c @@ -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 */ diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index af41888..2cdb7cc 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c @@ -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); } diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index f55979c..8ca4f94 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c @@ -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); diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 9c363c0..6c80890 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c @@ -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(); diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index 989903a..55b9fae 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c @@ -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]); } diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 1f00d65..ab05f53 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c @@ -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) { -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 4/9] ARM: EXYNOS: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (2 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 3/9] ARM: pxa: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 18:59 ` [PATCH V4 5/9] unicore32: " Andrew Chew ` (6 subsequent siblings) 10 siblings, 0 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- arch/arm/mach-exynos/mach-nuri.c | 7 +++++++ arch/arm/plat-samsung/dev-backlight.c | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 1ea7973..35e881e 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c @@ -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)); } diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c index 5f197dc..7277821 100644 --- a/arch/arm/plat-samsung/dev-backlight.c +++ b/arch/arm/plat-samsung/dev-backlight.c @@ -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; } -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 5/9] unicore32: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (3 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 4/9] ARM: EXYNOS: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 18:59 ` [PATCH V4 6/9] ARM: mxs: " Andrew Chew ` (5 subsequent siblings) 10 siblings, 0 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- arch/unicore32/kernel/puv3-nb0916.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c index 181108b..ff84d77 100644 --- a/arch/unicore32/kernel/puv3-nb0916.c +++ b/arch/unicore32/kernel/puv3-nb0916.c @@ -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)); -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (4 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 5/9] unicore32: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-19 21:27 ` Marek Vasut 2013-03-20 3:13 ` Shawn Guo 2013-03-19 18:59 ` [PATCH V4 7/9] ARM: vt8500: " Andrew Chew ` (4 subsequent siblings) 10 siblings, 2 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- 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(+) diff --git a/arch/arm/boot/dts/imx23-evk.dts b/arch/arm/boot/dts/imx23-evk.dts index 035c13f..e48e36c 100644 --- a/arch/arm/boot/dts/imx23-evk.dts +++ b/arch/arm/boot/dts/imx23-evk.dts @@ -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>; }; }; diff --git a/arch/arm/boot/dts/imx28-apf28dev.dts b/arch/arm/boot/dts/imx28-apf28dev.dts index 6d8865b..866e26f 100644 --- a/arch/arm/boot/dts/imx28-apf28dev.dts +++ b/arch/arm/boot/dts/imx28-apf28dev.dts @@ -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>; }; }; diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts index a0d3e9f..a8477b6 100644 --- a/arch/arm/boot/dts/imx28-cfa10049.dts +++ b/arch/arm/boot/dts/imx28-cfa10049.dts @@ -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>; }; }; diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts index 2da316e..810f1e4 100644 --- a/arch/arm/boot/dts/imx28-evk.dts +++ b/arch/arm/boot/dts/imx28-evk.dts @@ -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>; }; }; diff --git a/arch/arm/boot/dts/imx28-tx28.dts b/arch/arm/boot/dts/imx28-tx28.dts index 37be532..ea3c88a 100644 --- a/arch/arm/boot/dts/imx28-tx28.dts +++ b/arch/arm/boot/dts/imx28-tx28.dts @@ -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>; }; }; -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 18:59 ` [PATCH V4 6/9] ARM: mxs: " Andrew Chew @ 2013-03-19 21:27 ` Marek Vasut 2013-03-19 21:31 ` Andrew Chew 2013-03-19 22:10 ` Stephen Warren 2013-03-20 3:13 ` Shawn Guo 1 sibling, 2 replies; 27+ messages in thread From: Marek Vasut @ 2013-03-19 21:27 UTC (permalink / raw) To: linux-arm-kernel Dear 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. > > Signed-off-by: Andrew Chew <achew@nvidia.com> Do we really need a mandatory regulator? Why can't it be optional? Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 21:27 ` Marek Vasut @ 2013-03-19 21:31 ` Andrew Chew 2013-03-19 21:35 ` Marek Vasut 2013-03-19 22:10 ` Stephen Warren 1 sibling, 1 reply; 27+ messages in thread From: Andrew Chew @ 2013-03-19 21:31 UTC (permalink / raw) To: linux-arm-kernel > Dear 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. > > > > Signed-off-by: Andrew Chew <achew@nvidia.com> > > 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. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 21:31 ` Andrew Chew @ 2013-03-19 21:35 ` Marek Vasut 0 siblings, 0 replies; 27+ messages in thread From: Marek Vasut @ 2013-03-19 21:35 UTC (permalink / raw) To: linux-arm-kernel Dear Andrew Chew, > > Dear 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. > > > > > > Signed-off-by: Andrew Chew <achew@nvidia.com> > > > > 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. 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 ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 21:27 ` Marek Vasut 2013-03-19 21:31 ` Andrew Chew @ 2013-03-19 22:10 ` Stephen Warren 2013-03-20 8:23 ` Mark Brown 1 sibling, 1 reply; 27+ messages in thread From: Stephen Warren @ 2013-03-19 22:10 UTC (permalink / raw) To: linux-arm-kernel On 03/19/2013 03:27 PM, Marek Vasut wrote: > Dear 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. >> >> Signed-off-by: Andrew Chew <achew@nvidia.com> > > 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. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 22:10 ` Stephen Warren @ 2013-03-20 8:23 ` Mark Brown 2013-03-20 14:03 ` Marek Vasut 0 siblings, 1 reply; 27+ messages in thread From: Mark Brown @ 2013-03-20 8:23 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 19, 2013 at 04:10:26PM -0600, Stephen Warren wrote: > On 03/19/2013 03:27 PM, Marek Vasut wrote: > > 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> ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-20 8:23 ` Mark Brown @ 2013-03-20 14:03 ` Marek Vasut 0 siblings, 0 replies; 27+ messages in thread From: Marek Vasut @ 2013-03-20 14:03 UTC (permalink / raw) To: linux-arm-kernel Hi Mark, > On Tue, Mar 19, 2013 at 04:10:26PM -0600, Stephen Warren wrote: > > On 03/19/2013 03:27 PM, Marek Vasut wrote: > > > 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. Thanks for clearing this! Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 6/9] ARM: mxs: Provide regulator to pwm-backlight 2013-03-19 18:59 ` [PATCH V4 6/9] ARM: mxs: " Andrew Chew 2013-03-19 21:27 ` Marek Vasut @ 2013-03-20 3:13 ` Shawn Guo 1 sibling, 0 replies; 27+ messages in thread From: Shawn Guo @ 2013-03-20 3:13 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 19, 2013 at 11:59:30AM -0700, Andrew Chew wrote: > The pwm-backlight driver now takes a mandatory regulator that is gotten > during driver probe. Initialize a dummy regulator to satisfy this > requirement. > > Signed-off-by: Andrew Chew <achew@nvidia.com> > --- > 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(+) > > diff --git a/arch/arm/boot/dts/imx23-evk.dts b/arch/arm/boot/dts/imx23-evk.dts > index 035c13f..e48e36c 100644 > --- a/arch/arm/boot/dts/imx23-evk.dts > +++ b/arch/arm/boot/dts/imx23-evk.dts > @@ -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 > + 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>; > }; > }; ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 7/9] ARM: vt8500: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (5 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 6/9] ARM: mxs: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-20 18:18 ` [Bulk] " Tony Prisk 2013-03-19 18:59 ` [PATCH V4 8/9] ARM: tegra: " Andrew Chew ` (3 subsequent siblings) 10 siblings, 1 reply; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- arch/arm/boot/dts/wm8850-w70v2.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts index fcc660c..47a0b1a 100644 --- a/arch/arm/boot/dts/wm8850-w70v2.dts +++ b/arch/arm/boot/dts/wm8850-w70v2.dts @@ -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>; }; }; -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [Bulk] [PATCH V4 7/9] ARM: vt8500: Provide regulator to pwm-backlight 2013-03-19 18:59 ` [PATCH V4 7/9] ARM: vt8500: " Andrew Chew @ 2013-03-20 18:18 ` Tony Prisk 0 siblings, 0 replies; 27+ messages in thread From: Tony Prisk @ 2013-03-20 18:18 UTC (permalink / raw) To: linux-arm-kernel On Tue, 2013-03-19 at 11:59 -0700, Andrew Chew wrote: > The pwm-backlight driver now takes a mandatory regulator that is gotten > during driver probe. Initialize a dummy regulator to satisfy this > requirement. > > Signed-off-by: Andrew Chew <achew@nvidia.com> > --- > arch/arm/boot/dts/wm8850-w70v2.dts | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts > index fcc660c..47a0b1a 100644 > --- a/arch/arm/boot/dts/wm8850-w70v2.dts > +++ b/arch/arm/boot/dts/wm8850-w70v2.dts > @@ -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>; > }; > }; 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. Acked-by: Tony Prisk <linux@prisktech.co.nz> Regards Tony P ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 8/9] ARM: tegra: Provide regulator to pwm-backlight 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (6 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 7/9] ARM: vt8500: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-21 20:01 ` Stephen Warren 2013-03-22 10:29 ` Thierry Reding 2013-03-19 18:59 ` [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator Andrew Chew ` (2 subsequent siblings) 10 siblings, 2 replies; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel The pwm-backlight driver now takes a mandatory regulator that is gotten during driver probe. Initialize a dummy regulator to satisfy this requirement. Signed-off-by: Andrew Chew <achew@nvidia.com> --- arch/arm/boot/dts/tegra20-medcom-wide.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts index a2d6d65..bf7fdd7 100644 --- a/arch/arm/boot/dts/tegra20-medcom-wide.dts +++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts @@ -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 { -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 8/9] ARM: tegra: Provide regulator to pwm-backlight 2013-03-19 18:59 ` [PATCH V4 8/9] ARM: tegra: " Andrew Chew @ 2013-03-21 20:01 ` Stephen Warren 2013-03-22 10:29 ` Thierry Reding 1 sibling, 0 replies; 27+ messages in thread From: Stephen Warren @ 2013-03-21 20:01 UTC (permalink / raw) To: linux-arm-kernel On 03/19/2013 12:59 PM, Andrew Chew wrote: > 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, Acked-by: Stephen Warren <swarren@nvidia.com> ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 8/9] ARM: tegra: Provide regulator to pwm-backlight 2013-03-19 18:59 ` [PATCH V4 8/9] ARM: tegra: " Andrew Chew 2013-03-21 20:01 ` Stephen Warren @ 2013-03-22 10:29 ` Thierry Reding 1 sibling, 0 replies; 27+ messages in thread From: Thierry Reding @ 2013-03-22 10:29 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 19, 2013 at 11:59:32AM -0700, Andrew Chew wrote: > The pwm-backlight driver now takes a mandatory regulator that is gotten > during driver probe. Initialize a dummy regulator to satisfy this > requirement. > > Signed-off-by: Andrew Chew <achew@nvidia.com> > --- > arch/arm/boot/dts/tegra20-medcom-wide.dts | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts > index a2d6d65..bf7fdd7 100644 > --- a/arch/arm/boot/dts/tegra20-medcom-wide.dts > +++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts > @@ -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> ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (7 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 8/9] ARM: tegra: " Andrew Chew @ 2013-03-19 18:59 ` Andrew Chew 2013-03-20 18:00 ` Stephen Warren 2013-03-20 2:14 ` [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Shawn Guo 2013-03-22 1:57 ` Alex Courbot 10 siblings, 1 reply; 27+ messages in thread From: Andrew Chew @ 2013-03-19 18:59 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Andrew Chew <achew@nvidia.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> --- .../bindings/video/backlight/pwm-backlight.txt | 14 +++++ drivers/video/backlight/pwm_bl.c | 59 ++++++++++++++++++---- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt index 1e4fc72..7e2e089 100644 --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt @@ -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>; }; diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 1fea627..e4922f5 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -20,10 +20,13 @@ #include <linux/pwm.h> #include <linux/pwm_backlight.h> #include <linux/slab.h> +#include <linux/regulator/consumer.h> struct pwm_bl_data { struct pwm_device *pwm; struct device *dev; + bool enabled; + struct regulator *enable_supply; unsigned int period; unsigned int lth_brightness; unsigned int *levels; @@ -35,6 +38,42 @@ struct pwm_bl_data { void (*exit)(struct device *); }; +static void pwm_backlight_enable(struct backlight_device *bl) +{ + struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); + int ret; + + /* Bail if we are already enabled. */ + if (pb->enabled) + return; + + pwm_enable(pb->pwm); + + ret = regulator_enable(pb->enable_supply); + if (ret) + dev_warn(&bl->dev, "Failed to enable regulator: %d", ret); + + pb->enabled = true; +} + +static void pwm_backlight_disable(struct backlight_device *bl) +{ + struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); + int ret; + + /* Bail if we are already disabled. */ + if (!pb->enabled) + return; + + ret = regulator_disable(pb->enable_supply); + if (ret) + dev_warn(&bl->dev, "Failed to disable regulator: %d", ret); + + pwm_disable(pb->pwm); + + pb->enabled = false; +} + static int pwm_backlight_update_status(struct backlight_device *bl) { struct pwm_bl_data *pb = bl_get_data(bl); @@ -51,7 +90,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) if (brightness == 0) { pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); + pwm_backlight_disable(bl); } else { int duty_cycle; @@ -65,7 +104,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) duty_cycle = pb->lth_brightness + (duty_cycle * (pb->period - pb->lth_brightness) / max); pwm_config(pb->pwm, duty_cycle, pb->period); - pwm_enable(pb->pwm); + pwm_backlight_enable(bl); } if (pb->notify_after) @@ -138,12 +177,6 @@ static int pwm_backlight_parse_dt(struct device *dev, data->max_brightness--; } - /* - * TODO: Most users of this driver use a number of GPIOs to control - * backlight power. Support for specifying these needs to be - * added. - */ - return 0; } @@ -206,6 +239,12 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->exit = data->exit; pb->dev = &pdev->dev; + pb->enable_supply = devm_regulator_get(&pdev->dev, "enable"); + if (IS_ERR(pb->enable_supply)) { + ret = PTR_ERR(pb->enable_supply); + goto err_alloc; + } + pb->pwm = devm_pwm_get(&pdev->dev, NULL); if (IS_ERR(pb->pwm)) { dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n"); @@ -268,7 +307,7 @@ static int pwm_backlight_remove(struct platform_device *pdev) backlight_device_unregister(bl); pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); + pwm_backlight_disable(bl); if (pb->exit) pb->exit(&pdev->dev); return 0; @@ -283,7 +322,7 @@ static int pwm_backlight_suspend(struct device *dev) if (pb->notify) pb->notify(pb->dev, 0); pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); + pwm_backlight_disable(bl); if (pb->notify_after) pb->notify_after(pb->dev, 0); return 0; -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator 2013-03-19 18:59 ` [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator Andrew Chew @ 2013-03-20 18:00 ` Stephen Warren 2013-03-20 22:19 ` Thierry Reding 0 siblings, 1 reply; 27+ messages in thread From: Stephen Warren @ 2013-03-20 18:00 UTC (permalink / raw) To: linux-arm-kernel On 03/19/2013 12:59 PM, Andrew Chew wrote: > 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. > diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > index 1e4fc72..7e2e089 100644 > --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > @@ -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"? ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator 2013-03-20 18:00 ` Stephen Warren @ 2013-03-20 22:19 ` Thierry Reding 0 siblings, 0 replies; 27+ messages in thread From: Thierry Reding @ 2013-03-20 22:19 UTC (permalink / raw) To: linux-arm-kernel On Wed, Mar 20, 2013 at 12:00:10PM -0600, Stephen Warren wrote: > On 03/19/2013 12:59 PM, Andrew Chew wrote: > > 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. > > > diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > > index 1e4fc72..7e2e089 100644 > > --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > > +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt > > @@ -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"? "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> ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (8 preceding siblings ...) 2013-03-19 18:59 ` [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator Andrew Chew @ 2013-03-20 2:14 ` Shawn Guo 2013-03-20 2:24 ` Alex Courbot 2013-03-22 1:57 ` Alex Courbot 10 siblings, 1 reply; 27+ messages in thread From: Shawn Guo @ 2013-03-20 2:14 UTC (permalink / raw) To: linux-arm-kernel On Tue, Mar 19, 2013 at 11:59:24AM -0700, Andrew Chew wrote: > 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 Shawn ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. 2013-03-20 2:14 ` [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Shawn Guo @ 2013-03-20 2:24 ` Alex Courbot 2013-03-20 3:08 ` Shawn Guo 2013-03-20 7:13 ` Tony Prisk 0 siblings, 2 replies; 27+ messages in thread From: Alex Courbot @ 2013-03-20 2:24 UTC (permalink / raw) To: linux-arm-kernel On 03/20/2013 11:14 AM, Shawn Guo wrote: > On Tue, Mar 19, 2013 at 11:59:24AM -0700, Andrew Chew wrote: >> 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. ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. 2013-03-20 2:24 ` Alex Courbot @ 2013-03-20 3:08 ` Shawn Guo 2013-03-20 7:13 ` Tony Prisk 1 sibling, 0 replies; 27+ messages in thread From: Shawn Guo @ 2013-03-20 3:08 UTC (permalink / raw) To: linux-arm-kernel On Wed, Mar 20, 2013 at 11:24:48AM +0900, Alex Courbot wrote: > On 03/20/2013 11:14 AM, Shawn Guo wrote: > >On Tue, Mar 19, 2013 at 11:59:24AM -0700, Andrew Chew wrote: > >>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. > Thanks for updating the status. > 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 ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. 2013-03-20 2:24 ` Alex Courbot 2013-03-20 3:08 ` Shawn Guo @ 2013-03-20 7:13 ` Tony Prisk 1 sibling, 0 replies; 27+ messages in thread From: Tony Prisk @ 2013-03-20 7:13 UTC (permalink / raw) To: linux-arm-kernel On Wed, 2013-03-20 at 11:24 +0900, Alex Courbot wrote: > On 03/20/2013 11:14 AM, Shawn Guo wrote: > > On Tue, Mar 19, 2013 at 11:59:24AM -0700, Andrew Chew wrote: > >> 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. 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 ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight. 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew ` (9 preceding siblings ...) 2013-03-20 2:14 ` [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Shawn Guo @ 2013-03-22 1:57 ` Alex Courbot 10 siblings, 0 replies; 27+ messages in thread From: Alex Courbot @ 2013-03-22 1:57 UTC (permalink / raw) To: linux-arm-kernel On 03/20/2013 03:59 AM, Andrew Chew wrote: > 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. For the series: Acked-by: Alexandre Courbot <acourbot@nvidia.com> Thanks, Alex. > > 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(-) > ^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2013-03-22 10:29 UTC | newest] Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-03-19 18:59 [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Andrew Chew 2013-03-19 18:59 ` [PATCH V4 1/9] ARM: OMAP: board-4430sdp: Provide regulator to pwm-backlight Andrew Chew 2013-03-19 18:59 ` [PATCH V4 2/9] ARM: S3C24XX: " Andrew Chew 2013-03-19 18:59 ` [PATCH V4 3/9] ARM: pxa: " Andrew Chew 2013-03-19 18:59 ` [PATCH V4 4/9] ARM: EXYNOS: " Andrew Chew 2013-03-19 18:59 ` [PATCH V4 5/9] unicore32: " Andrew Chew 2013-03-19 18:59 ` [PATCH V4 6/9] ARM: mxs: " Andrew Chew 2013-03-19 21:27 ` Marek Vasut 2013-03-19 21:31 ` Andrew Chew 2013-03-19 21:35 ` Marek Vasut 2013-03-19 22:10 ` Stephen Warren 2013-03-20 8:23 ` Mark Brown 2013-03-20 14:03 ` Marek Vasut 2013-03-20 3:13 ` Shawn Guo 2013-03-19 18:59 ` [PATCH V4 7/9] ARM: vt8500: " Andrew Chew 2013-03-20 18:18 ` [Bulk] " Tony Prisk 2013-03-19 18:59 ` [PATCH V4 8/9] ARM: tegra: " Andrew Chew 2013-03-21 20:01 ` Stephen Warren 2013-03-22 10:29 ` Thierry Reding 2013-03-19 18:59 ` [PATCH V4 9/9] pwm_bl: Add mandatory backlight enable regulator Andrew Chew 2013-03-20 18:00 ` Stephen Warren 2013-03-20 22:19 ` Thierry Reding 2013-03-20 2:14 ` [PATCH V4 0/9] Add mandatory regulator for all users of pwm-backlight Shawn Guo 2013-03-20 2:24 ` Alex Courbot 2013-03-20 3:08 ` Shawn Guo 2013-03-20 7:13 ` Tony Prisk 2013-03-22 1:57 ` Alex Courbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).