aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/corgi_lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/backlight/corgi_lcd.c')
-rw-r--r--drivers/video/backlight/corgi_lcd.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index bf69e50d262e..068f14864099 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -86,6 +86,7 @@ struct corgi_lcd {
86 struct lcd_device *lcd_dev; 86 struct lcd_device *lcd_dev;
87 struct backlight_device *bl_dev; 87 struct backlight_device *bl_dev;
88 88
89 int limit_mask;
89 int intensity; 90 int intensity;
90 int power; 91 int power;
91 int mode; 92 int mode;
@@ -97,6 +98,11 @@ struct corgi_lcd {
97 98
98static int corgi_ssp_lcdtg_send(struct corgi_lcd *lcd, int reg, uint8_t val); 99static int corgi_ssp_lcdtg_send(struct corgi_lcd *lcd, int reg, uint8_t val);
99 100
101static struct corgi_lcd *the_corgi_lcd;
102static unsigned long corgibl_flags;
103#define CORGIBL_SUSPENDED 0x01
104#define CORGIBL_BATTLOW 0x02
105
100/* 106/*
101 * This is only a psuedo I2C interface. We can't use the standard kernel 107 * This is only a psuedo I2C interface. We can't use the standard kernel
102 * routines as the interface is write only. We just assume the data is acked... 108 * routines as the interface is write only. We just assume the data is acked...
@@ -413,9 +419,25 @@ static int corgi_bl_update_status(struct backlight_device *bd)
413 if (bd->props.fb_blank != FB_BLANK_UNBLANK) 419 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
414 intensity = 0; 420 intensity = 0;
415 421
422 if (corgibl_flags & CORGIBL_SUSPENDED)
423 intensity = 0;
424 if (corgibl_flags & CORGIBL_BATTLOW)
425 intensity &= lcd->limit_mask;
426
416 return corgi_bl_set_intensity(lcd, intensity); 427 return corgi_bl_set_intensity(lcd, intensity);
417} 428}
418 429
430void corgibl_limit_intensity(int limit)
431{
432 if (limit)
433 corgibl_flags |= CORGIBL_BATTLOW;
434 else
435 corgibl_flags &= ~CORGIBL_BATTLOW;
436
437 backlight_update_status(the_corgi_lcd->bl_dev);
438}
439EXPORT_SYMBOL(corgibl_limit_intensity);
440
419static struct backlight_ops corgi_bl_ops = { 441static struct backlight_ops corgi_bl_ops = {
420 .get_brightness = corgi_bl_get_intensity, 442 .get_brightness = corgi_bl_get_intensity,
421 .update_status = corgi_bl_update_status, 443 .update_status = corgi_bl_update_status,
@@ -426,6 +448,7 @@ static int corgi_lcd_suspend(struct spi_device *spi, pm_message_t state)
426{ 448{
427 struct corgi_lcd *lcd = dev_get_drvdata(&spi->dev); 449 struct corgi_lcd *lcd = dev_get_drvdata(&spi->dev);
428 450
451 corgibl_flags |= CORGIBL_SUSPENDED;
429 corgi_bl_set_intensity(lcd, 0); 452 corgi_bl_set_intensity(lcd, 0);
430 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 453 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
431 return 0; 454 return 0;
@@ -435,6 +458,7 @@ static int corgi_lcd_resume(struct spi_device *spi)
435{ 458{
436 struct corgi_lcd *lcd = dev_get_drvdata(&spi->dev); 459 struct corgi_lcd *lcd = dev_get_drvdata(&spi->dev);
437 460
461 corgibl_flags &= ~CORGIBL_SUSPENDED;
438 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK); 462 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK);
439 backlight_update_status(lcd->bl_dev); 463 backlight_update_status(lcd->bl_dev);
440 return 0; 464 return 0;
@@ -488,6 +512,9 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi)
488 dev_set_drvdata(&spi->dev, lcd); 512 dev_set_drvdata(&spi->dev, lcd);
489 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK); 513 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK);
490 backlight_update_status(lcd->bl_dev); 514 backlight_update_status(lcd->bl_dev);
515
516 lcd->limit_mask = pdata->limit_mask;
517 the_corgi_lcd = lcd;
491 return 0; 518 return 0;
492 519
493err_unregister_lcd: 520err_unregister_lcd: