summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches/0244-fix-suspend-backlight-timing-gta01.patch.patch
blob: 1349820954f5af7b5c94df0533e071c9ebe6c4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
From 26a1d7115299dcb17a9e9effc780ceba58afa91b Mon Sep 17 00:00:00 2001
From: Mike Westerhof <mwester@dls.net>
Date: Sun, 10 Aug 2008 09:13:46 +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 <mwester@dls.net>
---
 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(&gta01bl.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,
 							   &gta01bl_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.3