Add pcf50633 backlight driver
Subsystems (5)
cover Add pcf50633 backlight driver
Hi
This patch series adds a backlight driver for the pcf50633.
The first patch adds the backlight driver, the second patch registers the backlight driver in the pcf50633 core driver and the third patch replaces the platform backlight driver in mach-gta02 with the pcf50633 backlight driver.
- Lars
Lars-Peter Clausen (3):
backlight/mfd: Add pcf50633 backlight driver
pcf50633: Register a pcf50633-backlight device in pcf50633 core
driver.
gta02: Use pcf50633 backlight driver instead of platform backlight
driver.
arch/arm/mach-s3c2440/mach-gta02.c | 76 ++--------- drivers/mfd/pcf50633-core.c | 3 + drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/pcf50633-backlight.c | 190 ++++++++++++++++++++++++++ include/linux/mfd/pcf50633/backlight.h | 51 +++++++ include/linux/mfd/pcf50633/core.h | 4 + 7 files changed, 265 insertions(+), 67 deletions(-) create mode 100644 drivers/video/backlight/pcf50633-backlight.c create mode 100644 include/linux/mfd/pcf50633/backlight.h
PATCH 1/3 backlight: Add pcf50633 backlight driver
This patch adds a backlight driver for controlling the pcf50633 LED module.
--- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/pcf50633-backlight.c | 190 ++++++++++++++++++++++++++ include/linux/mfd/pcf50633/backlight.h | 51 +++++++ 4 files changed, 249 insertions(+), 0 deletions(-) create mode 100644 drivers/video/backlight/pcf50633-backlight.c create mode 100644 include/linux/mfd/pcf50633/backlight.h
drivers/video/backlight/Kconfig +7 -0
@@ -270,6 +270,13 @@ config BACKLIGHT_88PM860X help Say Y to enable the backlight driver for Marvell 88PM8606. +config BACKLIGHT_PCF50633 + tristate "Backlight driver for NXP PCF50633 MFD" + depends on BACKLIGHT_CLASS_DEVICE && MFD_PCF50633 + help + If you have a backlight driven by a NXP PCF50633 MFD, say Y here to + enable its driver. + endif # BACKLIGHT_CLASS_DEVICE endif # BACKLIGHT_LCD_SUPPORT
drivers/video/backlight/Makefile +1 -0
@@ -31,4 +31,5 @@ obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o +obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
drivers/video/backlight/pcf50633-backlight.c new file +190 -0
190 lines not on this page · raw message
include/linux/mfd/pcf50633/backlight.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.5.6.5
PATCH 2/3 MFD: pcf50633: Register a pcf50633-backlight device in pcf50633 core driver.
In reply to Lars-Peter ClausenRegister a device newly added pcf50633-backlight driver as a child device in the pcf50633 core driver.
--- drivers/mfd/pcf50633-core.c | 3 +++ include/linux/mfd/pcf50633/core.h | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-)
drivers/mfd/pcf50633-core.c +3 -0
@@ -305,6 +305,9 @@ static int __devinit pcf50633_probe(struct i2c_client *client, &pcf->mbc_pdev);pcf50633_client_dev_register (pcf,"pcf50633-adc" , &pcf->adc_pdev); +pcf50633_client_dev_register (pcf,"pcf50633-backlight" , + &pcf->bl_pdev); +for (i =0 ; i <PCF50633_NUM_REGULATORS ; i++) {struct platform_device *pdev;
include/linux/mfd/pcf50633/core.h +4 -0
@@ -18,6 +18,7 @@#include <linux/regulator/driver.h> #include <linux/regulator/machine.h> #include <linux/power_supply.h> +#include <linux/mfd/pcf50633/backlight.h> struct pcf50633 ;
@@ -43,6 +44,8 @@ struct pcf50633_platform_data {void (*force_shutdown)(struct pcf50633 *);u8 resumers[5 ]; + +struct pcf50633_bl_platform_data *backlight_data; };struct pcf50633_irq {
@@ -152,6 +155,7 @@ struct pcf50633 {struct platform_device *mbc_pdev;struct platform_device *adc_pdev;struct platform_device *input_pdev; +struct platform_device *bl_pdev;struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS ]; };
Signature · 1 line
1.5.6.5
PATCH 3/3 gta02: Use pcf50633 backlight driver instead of platform backlight driver.
In reply to Lars-Peter ClausenUse the pcf50633 backlight driver instead of the platform backlight driver.
--- arch/arm/mach-s3c2440/mach-gta02.c | 76 ++++------------------------------- 1 files changed, 9 insertions(+), 67 deletions(-)
arch/arm/mach-s3c2440/mach-gta02.c +9 -67
@@ -49,7 +49,6 @@#include <linux/io.h> #include <linux/i2c.h> -#include <linux/backlight.h> #include <linux/regulator/machine.h> #include <linux/mfd/pcf50633/core.h>
@@ -57,6 +56,7 @@#include <linux/mfd/pcf50633/adc.h> #include <linux/mfd/pcf50633/gpio.h> #include <linux/mfd/pcf50633/pmic.h> +#include <linux/mfd/pcf50633/backlight.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -254,6 +254,12 @@ static char *gta02_batteries[] = { "battery", }; +static struct pcf50633_bl_platform_data gta02_backlight_data = { + .default_brightness =0x3f , + .default_brightness_limit =0 , + .ramp_time =5 , +}; +struct pcf50633_platform_data gta02_pcf_pdata = { .resumers = { [0] = PCF50633_INT1_USBINS |
@@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = { .charger_reference_current_ma = 1000, + .backlight_data = >a02_backlight_data, + .reg_init_data = { [PCF50633_REGULATOR_AUTO] = { .constraints = {
@@ -478,71 +486,6 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = { }; - - -static void gta02_bl_set_intensity (int intensity) -{ -struct pcf50633 *pcf = gta02_pcf; -int old_intensity =pcf50633_reg_read (pcf,PCF50633_REG_LEDOUT ); - -/* We map 8-bit intensity to 6-bit intensity in hardware. */ - intensity >>=2 ; - -/* -* This can happen during, eg, print of panic on blanked console, -* but we can't service i2c without interrupts active, so abort. -*/ -if (in_atomic ()) { -printk (KERN_ERR "gta02_bl_set_intensity called while atomic\n" ); -return ; - } - - old_intensity =pcf50633_reg_read (pcf,PCF50633_REG_LEDOUT ); -if (intensity == old_intensity) -return ; - -/* We can't do this anywhere else. */ -pcf50633_reg_write (pcf,PCF50633_REG_LEDDIM ,5 ); - -if (!(pcf50633_reg_read (pcf,PCF50633_REG_LEDENA ) &3 )) - old_intensity =0 ; - -/* -* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60) -* if seen, you have to re-enable the LED unit. -*/ -if (!intensity || !old_intensity) -pcf50633_reg_write (pcf,PCF50633_REG_LEDENA ,0 ); - -/* Illegal to set LEDOUT to 0. */ -if (!intensity) -pcf50633_reg_set_bit_mask (pcf,PCF50633_REG_LEDOUT ,0x3f ,2 ); -else -pcf50633_reg_set_bit_mask (pcf,PCF50633_REG_LEDOUT ,0x3f , - intensity); - -if (intensity) -pcf50633_reg_write (pcf,PCF50633_REG_LEDENA ,2 ); - -} - -static struct generic_bl_info gta02_bl_info = { - .name ="gta02-bl" , - .max_intensity =0xff , - .default_intensity =0xff , - .set_bl_intensity = gta02_bl_set_intensity, -}; - -static struct platform_device gta02_bl_dev = { - .name ="generic-bl" , - .id =1 , - .dev = { - .platform_data = >a02_bl_info, - }, -}; - - -/* USB */ static struct s3c2410_hcd_info gta02_usb_info__initdata = { .port[0 ] = {
@@ -579,7 +522,6 @@ static struct platform_device *gta02_devices[] __initdata = {/* These guys DO need to be children of PMU. */ static struct platform_device *gta02_devices_pmu_children[] = { - >a02_bl_dev, };
Signature · 1 line
1.5.6.5
Re: [PATCH 3/3] gta02: Use pcf50633 backlight driver instead of platform backlight driver.
Quoted 4 lines · Lars-Peter Clausen
Use the pcf50633 backlight driver instead of the platform backlight driver.
Signed-off-by Lars-Peter Clausen <[email protected]>Cc Ben Dooks <[email protected]>
ok, does anyone else have a comment on this?
---
Quoted 128 lines
arch/arm/mach-s3c2440/mach-gta02.c | 76 ++++------------------------------- 1 files changed, 9 insertions(+), 67 deletions(-)arch/arm/mach-s3c2440/mach-gta02.c +9
-67@@ -49,7 +49,6 @@#include <linux/io.h> #include <linux/i2c.h> -#include <linux/backlight.h> #include <linux/regulator/machine.h> #include <linux/mfd/pcf50633/core.h> @@ -57,6 +56,7 @@#include <linux/mfd/pcf50633/adc.h> #include <linux/mfd/pcf50633/gpio.h> #include <linux/mfd/pcf50633/pmic.h> +#include <linux/mfd/pcf50633/backlight.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> @@ -254,6 +254,12 @@ static char *gta02_batteries[] = { "battery", }; +static struct pcf50633_bl_platform_data gta02_backlight_data = { + .default_brightness =0x3f , + .default_brightness_limit =0 , + .ramp_time =5 , +}; +struct pcf50633_platform_data gta02_pcf_pdata = { .resumers = { [0] = PCF50633_INT1_USBINS |@@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = { .charger_reference_current_ma = 1000, + .backlight_data = >a02_backlight_data, + .reg_init_data = { [PCF50633_REGULATOR_AUTO] = { .constraints = {@@ -478,71 +486,6 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = { }; - - -static void gta02_bl_set_intensity (int intensity) -{ -struct pcf50633 *pcf = gta02_pcf; -int old_intensity =pcf50633_reg_read (pcf,PCF50633_REG_LEDOUT ); - -/* We map 8-bit intensity to 6-bit intensity in hardware. */ - intensity >>=2 ; - -/* -* This can happen during, eg, print of panic on blanked console, -* but we can't service i2c without interrupts active, so abort. -*/ -if (in_atomic ()) { -printk (KERN_ERR "gta02_bl_set_intensity called while atomic\n" ); -return ; - } - - old_intensity =pcf50633_reg_read (pcf,PCF50633_REG_LEDOUT ); -if (intensity == old_intensity) -return ; - -/* We can't do this anywhere else. */ -pcf50633_reg_write (pcf,PCF50633_REG_LEDDIM ,5 ); - -if (!(pcf50633_reg_read (pcf,PCF50633_REG_LEDENA ) &3 )) - old_intensity =0 ; - -/* -* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60) -* if seen, you have to re-enable the LED unit. -*/ -if (!intensity || !old_intensity) -pcf50633_reg_write (pcf,PCF50633_REG_LEDENA ,0 ); - -/* Illegal to set LEDOUT to 0. */ -if (!intensity) -pcf50633_reg_set_bit_mask (pcf,PCF50633_REG_LEDOUT ,0x3f ,2 ); -else -pcf50633_reg_set_bit_mask (pcf,PCF50633_REG_LEDOUT ,0x3f , - intensity); - -if (intensity) -pcf50633_reg_write (pcf,PCF50633_REG_LEDENA ,2 ); - -} - -static struct generic_bl_info gta02_bl_info = { - .name ="gta02-bl" , - .max_intensity =0xff , - .default_intensity =0xff , - .set_bl_intensity = gta02_bl_set_intensity, -}; - -static struct platform_device gta02_bl_dev = { - .name ="generic-bl" , - .id =1 , - .dev = { - .platform_data = >a02_bl_info, - }, -}; - - -/* USB */ static struct s3c2410_hcd_info gta02_usb_info__initdata = { .port[0 ] = {@@ -579,7 +522,6 @@ static struct platform_device *gta02_devices[] __initdata = {/* These guys DO need to be children of PMU. */ static struct platform_device *gta02_devices_pmu_children[] = { - >a02_bl_dev, };Signature · 1 line
1.5.6.5
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Re: [PATCH 3/3] gta02: Use pcf50633 backlight driver instead of platform backlight driver.
Quoted 7 lines · Ben Dooks
Quoted 4 lines · Lars-Peter Clausen
Use the pcf50633 backlight driver instead of the platform backlight driver.
Signed-off-by Lars-Peter Clausen <[email protected]>Cc Ben Dooks <[email protected]>ok, does anyone else have a comment on this?
Looks like a sensible idea to me but I'm travelling and don't have time to properly review the patches right now.
The main question is who takes which patches. I can take the main new backlight one, the other two I need opinions from the mfd (Samuel) and gta02 (?) maintainers...
Cheers,
Richard
Samuel Ortiz
Acked-byRe: [PATCH 3/3] gta02: Use pcf50633 backlight driver instead of platform backlight driver.
Hi Richard,
Quoted 7 lines · Richard Purdie
Quoted 6 lines · Ben Dooks
Quoted 4 lines · Lars-Peter Clausen
Use the pcf50633 backlight driver instead of the platform backlight driver.
Signed-off-by Lars-Peter Clausen <[email protected]>Cc Ben Dooks <[email protected]>
Quoted 8 lines
Quoted 1 line
ok, does anyone else have a comment on this?
Looks like a sensible idea to me but I'm travelling and don't have time to properly review the patches right now.
The main question is who takes which patches. I can take the main new backlight one, the other two I need opinions from the mfd (Samuel) and gta02 (?) maintainers...
The MFD patch looks good to me, you can add my:
Cheers,
Samuel.
Quoted 6 lines
Cheers,
Richard
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 3/3] gta02: Use pcf50633 backlight driver instead of platform backlight driver.
Quoted 10 lines · Samuel Ortiz
Quoted 9 lines · Richard Purdie
Quoted 7 lines · Ben Dooks
Quoted 4 lines · Lars-Peter Clausen
Use the pcf50633 backlight driver instead of the platform backlight driver.
Signed-off-by Lars-Peter Clausen <[email protected]>Cc Ben Dooks <[email protected]>ok, does anyone else have a comment on this?
Quoted 8 lines
Quoted 6 lines
Looks like a sensible idea to me but I'm travelling and don't have time to properly review the patches right now.
The main question is who takes which patches. I can take the main new backlight one, the other two I need opinions from the mfd (Samuel) and gta02 (?) maintainers...
The MFD patch looks good to me, you can add my:
Acked-by Samuel Ortiz <[email protected]>
Thanks, I've queued these in the backlight tree.
Cheers,
Richard