aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 14:34:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 14:34:55 -0400
commitcad719d86e9dbd06634eaba6401e022c8101d6b2 (patch)
treeee0aa444e817e5cd29a9dea58dc36d0f3c65a50d /arch
parent3ddab4788d4980b1b3dc324fdd105adab3812418 (diff)
parent67e67df8da723debf24f7763605776891203e8d5 (diff)
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
* '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()
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c2440/mach-gta02.c76
1 files changed, 9 insertions, 67 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 45799c608d8f..9e39faa283b9 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -49,7 +49,6 @@
49#include <linux/io.h> 49#include <linux/io.h>
50 50
51#include <linux/i2c.h> 51#include <linux/i2c.h>
52#include <linux/backlight.h>
53#include <linux/regulator/machine.h> 52#include <linux/regulator/machine.h>
54 53
55#include <linux/mfd/pcf50633/core.h> 54#include <linux/mfd/pcf50633/core.h>
@@ -57,6 +56,7 @@
57#include <linux/mfd/pcf50633/adc.h> 56#include <linux/mfd/pcf50633/adc.h>
58#include <linux/mfd/pcf50633/gpio.h> 57#include <linux/mfd/pcf50633/gpio.h>
59#include <linux/mfd/pcf50633/pmic.h> 58#include <linux/mfd/pcf50633/pmic.h>
59#include <linux/mfd/pcf50633/backlight.h>
60 60
61#include <asm/mach/arch.h> 61#include <asm/mach/arch.h>
62#include <asm/mach/map.h> 62#include <asm/mach/map.h>
@@ -254,6 +254,12 @@ static char *gta02_batteries[] = {
254 "battery", 254 "battery",
255}; 255};
256 256
257static struct pcf50633_bl_platform_data gta02_backlight_data = {
258 .default_brightness = 0x3f,
259 .default_brightness_limit = 0,
260 .ramp_time = 5,
261};
262
257struct pcf50633_platform_data gta02_pcf_pdata = { 263struct pcf50633_platform_data gta02_pcf_pdata = {
258 .resumers = { 264 .resumers = {
259 [0] = PCF50633_INT1_USBINS | 265 [0] = PCF50633_INT1_USBINS |
@@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = {
271 277
272 .charger_reference_current_ma = 1000, 278 .charger_reference_current_ma = 1000,
273 279
280 .backlight_data = &gta02_backlight_data,
281
274 .reg_init_data = { 282 .reg_init_data = {
275 [PCF50633_REGULATOR_AUTO] = { 283 [PCF50633_REGULATOR_AUTO] = {
276 .constraints = { 284 .constraints = {
@@ -478,71 +486,6 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {
478 486
479}; 487};
480 488
481
482
483static void gta02_bl_set_intensity(int intensity)
484{
485 struct pcf50633 *pcf = gta02_pcf;
486 int old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
487
488 /* We map 8-bit intensity to 6-bit intensity in hardware. */
489 intensity >>= 2;
490
491 /*
492 * This can happen during, eg, print of panic on blanked console,
493 * but we can't service i2c without interrupts active, so abort.
494 */
495 if (in_atomic()) {
496 printk(KERN_ERR "gta02_bl_set_intensity called while atomic\n");
497 return;
498 }
499
500 old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
501 if (intensity == old_intensity)
502 return;
503
504 /* We can't do this anywhere else. */
505 pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 5);
506
507 if (!(pcf50633_reg_read(pcf, PCF50633_REG_LEDENA) & 3))
508 old_intensity = 0;
509
510 /*
511 * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
512 * if seen, you have to re-enable the LED unit.
513 */
514 if (!intensity || !old_intensity)
515 pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0);
516
517 /* Illegal to set LEDOUT to 0. */
518 if (!intensity)
519 pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
520 else
521 pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
522 intensity);
523
524 if (intensity)
525 pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 2);
526
527}
528
529static struct generic_bl_info gta02_bl_info = {
530 .name = "gta02-bl",
531 .max_intensity = 0xff,
532 .default_intensity = 0xff,
533 .set_bl_intensity = gta02_bl_set_intensity,
534};
535
536static struct platform_device gta02_bl_dev = {
537 .name = "generic-bl",
538 .id = 1,
539 .dev = {
540 .platform_data = &gta02_bl_info,
541 },
542};
543
544
545
546/* USB */ 489/* USB */
547static struct s3c2410_hcd_info gta02_usb_info __initdata = { 490static struct s3c2410_hcd_info gta02_usb_info __initdata = {
548 .port[0] = { 491 .port[0] = {
@@ -579,7 +522,6 @@ static struct platform_device *gta02_devices[] __initdata = {
579/* These guys DO need to be children of PMU. */ 522/* These guys DO need to be children of PMU. */
580 523
581static struct platform_device *gta02_devices_pmu_children[] = { 524static struct platform_device *gta02_devices_pmu_children[] = {
582 &gta02_bl_dev,
583}; 525};
584 526
585 527