Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  gta02: Use pcf50633 backlight driver instead of platform backlight driver.
  backlight: pcf50633: Register a pcf50633-backlight device in pcf50633 core driver.
  backlight: Add pcf50633 backlight driver
  backlight: 88pm860x_bl: fix error handling in pm860x_backlight_probe
  backlight: max8925_bl: Fix error handling path
  backlight: l4f00242t03: fix error handling in l4f00242t03_probe
  backlight: add S6E63M0 AMOLED LCD Panel driver
  backlight: adp8860: add support for ADP8861 & ADP8863
  backlight: mbp_nvidia_bl - Fix DMI_SYS_VENDOR for MacBook1,1
  backlight: Add Cirrus EP93xx backlight driver
  backlight: l4f00242t03: Fix regulators handling code in remove function
  backlight: fix adp8860_bl build errors
  backlight: new driver for the ADP8860 backlight parts
  backlight: 88pm860x_bl - potential memory leak
  backlight: mbp_nvidia_bl - add support for older MacBookPro and MacBook 6,1.
  backlight: Kconfig cleanup
  backlight: backlight_device_register() return ERR_PTR()
  • Loading branch information
Linus Torvalds committed May 27, 2010
2 parents 3ddab47 + 67e67df commit cad719d
Show file tree
Hide file tree
Showing 18 changed files with 2,750 additions and 120 deletions.
76 changes: 9 additions & 67 deletions arch/arm/mach-s3c2440/mach-gta02.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
#include <linux/io.h>

#include <linux/i2c.h>
#include <linux/backlight.h>
#include <linux/regulator/machine.h>

#include <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/mbc.h>
#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>
Expand Down Expand Up @@ -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 |
Expand All @@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = {

.charger_reference_current_ma = 1000,

.backlight_data = &gta02_backlight_data,

.reg_init_data = {
[PCF50633_REGULATOR_AUTO] = {
.constraints = {
Expand Down Expand Up @@ -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 = &gta02_bl_info,
},
};



/* USB */
static struct s3c2410_hcd_info gta02_usb_info __initdata = {
.port[0] = {
Expand Down Expand Up @@ -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[] = {
&gta02_bl_dev,
};


Expand Down
3 changes: 3 additions & 0 deletions drivers/mfd/pcf50633-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,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;
Expand Down
2 changes: 2 additions & 0 deletions drivers/video/backlight/88pm860x_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
data->port = __check_device(pdata, name);
if (data->port < 0) {
dev_err(&pdev->dev, "wrong platform data is assigned");
kfree(data);
return -EINVAL;
}

Expand Down Expand Up @@ -266,6 +267,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
backlight_update_status(bl);
return 0;
out:
backlight_device_unregister(bl);
kfree(data);
return ret;
}
Expand Down
Loading

0 comments on commit cad719d

Please sign in to comment.