From 9ee405d79609106ea330b21d54f30b853e262296 Mon Sep 17 00:00:00 2001 From: Mike Westerhof Date: Fri, 8 Aug 2008 13:10:59 +0100 Subject: [PATCH] fix-suspend-backlight-timing-gta01.patch This patch adds the gta01 backlight callback that defers the restoring of the backlight until after the jbt driver has resumed. This doesn't eliminate the flashing of the LCD on the gta01, but it reduces it considerably. Signed-off-by: Mike Westerhof --- arch/arm/mach-s3c2410/mach-gta01.c | 9 ++++++++- drivers/video/backlight/gta01_bl.c | 15 ++++++++++++++- include/asm-arm/arch-s3c2410/gta01.h | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index f3f87cf..9e42df0 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -507,14 +507,20 @@ static struct s3c2410_ts_mach_info gta01_ts_cfg = { /* SPI */ -void gta01_jbt6k74_reset(int devidx, int level) +static void gta01_jbt6k74_reset(int devidx, int level) { /* empty place holder; gta01 does not yet use this */ printk(KERN_DEBUG "gta01_jbt6k74_reset\n"); } +static void gta01_jbt6k74_resuming(int devidx) +{ + gta01bl_deferred_resume(); +} + const struct jbt6k74_platform_data gta01_jbt6k74_pdata = { .reset = gta01_jbt6k74_reset, + .resuming = gta01_jbt6k74_resuming, }; static struct spi_board_info gta01_spi_board_info[] = { @@ -584,6 +590,7 @@ static struct gta01bl_machinfo backlight_machinfo = { .default_intensity = 1, .max_intensity = 1, .limit_mask = 1, + .defer_resume_backlight = 1, }; static struct resource gta01_bl_resources[] = { diff --git a/drivers/video/backlight/gta01_bl.c b/drivers/video/backlight/gta01_bl.c index 301ec9c..34c19c8 100644 --- a/drivers/video/backlight/gta01_bl.c +++ b/drivers/video/backlight/gta01_bl.c @@ -57,6 +57,8 @@ struct gta01bl_data { static struct gta01bl_data gta01bl; +static int gta01bl_defer_resume_backlight; + #define GTA01BL_SUSPENDED 0x01 #define GTA01BL_BATTLOW 0x02 @@ -132,10 +134,12 @@ static int gta01bl_suspend(struct platform_device *dev, pm_message_t state) { gta01bl_flags |= GTA01BL_SUSPENDED; gta01bl_send_intensity(gta01_backlight_device); + neo1973_gpb_setpin(GTA01_GPIO_BACKLIGHT, 0); + s3c2410_gpio_cfgpin(GTA01_GPIO_BACKLIGHT, S3C2410_GPIO_OUTPUT); return 0; } -static int gta01bl_resume(struct platform_device *dev) +void gta01bl_deferred_resume(void) { mutex_lock(>a01bl.mutex); gta01bl_init_hw(); @@ -143,6 +147,13 @@ static int gta01bl_resume(struct platform_device *dev) gta01bl_flags &= ~GTA01BL_SUSPENDED; gta01bl_send_intensity(gta01_backlight_device); +} +EXPORT_SYMBOL_GPL(gta01bl_deferred_resume); + +static int gta01bl_resume(struct platform_device *dev) +{ + if (! gta01bl_defer_resume_backlight) + gta01bl_deferred_resume(); return 0; } #else @@ -199,6 +210,8 @@ static int __init gta01bl_probe(struct platform_device *pdev) if (!machinfo->limit_mask) machinfo->limit_mask = -1; + gta01bl_defer_resume_backlight = machinfo->defer_resume_backlight; + gta01_backlight_device = backlight_device_register("gta01-bl", &pdev->dev, NULL, >a01bl_ops); diff --git a/include/asm-arm/arch-s3c2410/gta01.h b/include/asm-arm/arch-s3c2410/gta01.h index 1cc2099..989aa55 100644 --- a/include/asm-arm/arch-s3c2410/gta01.h +++ b/include/asm-arm/arch-s3c2410/gta01.h @@ -12,10 +12,14 @@ #define GTA01Bv4_SYSTEM_REV 0x00000240 /* Backlight */ + +extern void gta01bl_deferred_resume(void); + struct gta01bl_machinfo { unsigned int default_intensity; unsigned int max_intensity; unsigned int limit_mask; + unsigned int defer_resume_backlight; }; /* Definitions common to all revisions */ -- 1.5.6.5