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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
From 964c2a99d0b9db59bc716022c7f9f6da580f44d6 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Date: Fri, 12 Jun 2009 11:17:15 +0300
Subject: [PATCH 110/146] DSS2: isolate the SDI pads when SDI is disabled
When SDI is disabled there is still ~1.6mA drain through the VSDI_CSI
regulator. This seems to be internal to the SDI module, since even
disconnecting the LCD panel doesn't get rid of the drain. Also
disabling/resetting the SDI or the DSS module doesn't help. The only
solution is to configure the SDI pads to safe mode with pull up
resistors enabled on them when SDI gets disabled.
Bootloader / platform code is still responsible for setting up the
muxing, so in the driver check if all required pads are in SDI mode
or all of them are in non-configured state.
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Conflicts:
arch/arm/plat-omap/include/mach/display.h
---
arch/arm/plat-omap/include/mach/display.h | 2 +
drivers/video/omap2/dss/sdi.c | 110 ++++++++++++++++++++++++++++-
2 files changed, 111 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/include/mach/display.h b/arch/arm/plat-omap/include/mach/display.h
index 3d8ed69..0695497 100644
--- a/arch/arm/plat-omap/include/mach/display.h
+++ b/arch/arm/plat-omap/include/mach/display.h
@@ -344,6 +344,8 @@ struct omap_dss_device {
struct {
u8 datapairs;
+ unsigned pad_off_pe : 1; /* pull pads if disabled */
+ unsigned pad_off_pu : 1; /* pull up */
} sdi;
struct {
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 86b9a56..c484e0c 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -23,17 +23,120 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
+#include <linux/io.h>
#include <mach/board.h>
#include <mach/display.h>
#include "dss.h"
+#define CONTROL_PADCONF_BASE 0x48002000
+
+#define OMAP_SDI_PAD_DIS(pe,pu) ((7 << 0) | /* MODE 7 = safe */ \
+ (((pe) ? 1 : 0) << 3) | /* PULL_ENA */ \
+ (((pu) ? 1 : 0) << 4) | /* PULL_UP */ \
+ (1 << 8)) /* INPUT_EN */
+
+#define OMAP_SDI_PAD_EN (1 << 0) /* MODE 1 = SDI_xx */
+
+#define OMAP_SDI_PAD_MASK OMAP_SDI_PAD_DIS(1, 1)
static struct {
bool skip_init;
bool update_enabled;
} sdi;
+/* CONTROL_PADCONF_DSS_DATAXX */
+const u16 sdi_pads[] =
+{
+ 0x0f0, /* 10[ 7..0]:SDI_DAT1N */
+ 0x0f2, /* 10[15..0]:SDI_DAT1P */
+ 0x0f4, /* 12[ 7..0]:SDI_DAT2N */
+ 0x0f6, /* 12[15..0]:SDI_DAT2P */
+ 0x0f8, /* 14[ 7..0]:SDI_DAT3N */
+ 0x0fa, /* 14[15..0]:SDI_DAT3P */
+ 0x108, /* 22[ 7..0]:SDI_CLKN */
+ 0x10a, /* 22[15..0]:SDI_CLKP */
+};
+
+/*
+ * Check if bootloader / platform code has configured the SDI pads properly.
+ * This means it either configured all required pads for SDI mode, or that it
+ * left all the required pads unconfigured.
+ */
+static int sdi_pad_init(struct omap_dss_device *dssdev)
+{
+ unsigned req_map;
+ bool configured = false;
+ bool unconfigured = false;
+ int data_pairs;
+ int i;
+
+ data_pairs = dssdev->phy.sdi.datapairs;
+ req_map = (1 << (data_pairs * 2)) - 1; /* data lanes */
+ req_map |= 3 << 6; /* clk lane */
+ for (i = 0; i < ARRAY_SIZE(sdi_pads); i++) {
+ u32 reg;
+ u32 val;
+
+ if (!((1 << i) & req_map))
+ /* Ignore unneded pads. */
+ continue;
+ reg = CONTROL_PADCONF_BASE + sdi_pads[i];
+ val = omap_readw(reg);
+ switch (val & 0x07) { /* pad mode */
+ case 1:
+ if (unconfigured)
+ break;
+ /* Is the pull configuration ok for SDI mode? */
+ if ((val & OMAP_SDI_PAD_MASK) != OMAP_SDI_PAD_EN)
+ break;
+ configured = true;
+ break;
+ case 0:
+ case 7:
+ if (configured)
+ break;
+ unconfigured = true;
+ break;
+ default:
+ break;
+ }
+ }
+ if (i != ARRAY_SIZE(sdi_pads)) {
+ DSSERR("SDI: invalid pad configuration\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static void sdi_pad_config(struct omap_dss_device *dssdev, bool enable)
+{
+ int data_pairs;
+ bool pad_off_pe, pad_off_pu;
+ unsigned req_map;
+ int i;
+
+ data_pairs = dssdev->phy.sdi.datapairs;
+ pad_off_pe = dssdev->phy.sdi.pad_off_pe;
+ pad_off_pu = dssdev->phy.sdi.pad_off_pu;
+ req_map = (1 << (data_pairs * 2)) - 1; /* data lanes */
+ req_map |= 3 << 6; /* clk lane */
+ for (i = 0; i < ARRAY_SIZE(sdi_pads); i++) {
+ u32 reg;
+ u16 val;
+
+ if (!((1 << i) & req_map))
+ continue;
+ if (enable)
+ val = OMAP_SDI_PAD_EN;
+ else
+ val = OMAP_SDI_PAD_DIS(pad_off_pe, pad_off_pu);
+ reg = CONTROL_PADCONF_BASE + sdi_pads[i];
+ omap_writew(val, reg);
+ }
+}
+
static void sdi_basic_init(void)
{
dispc_set_parallel_interface_mode(OMAP_DSS_PARALLELMODE_BYPASS);
@@ -64,6 +167,8 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
goto err1;
}
+ sdi_pad_config(dssdev, 1);
+
/* In case of skip_init sdi_init has already enabled the clocks */
if (!sdi.skip_init)
dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
@@ -153,6 +258,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev)
dss_sdi_disable();
dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
+ sdi_pad_config(dssdev, 0);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
@@ -172,6 +278,7 @@ static int sdi_display_suspend(struct omap_dss_device *dssdev)
dss_sdi_disable();
dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
+ sdi_pad_config(dssdev, 0);
dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
@@ -183,6 +290,7 @@ static int sdi_display_resume(struct omap_dss_device *dssdev)
if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
return -EINVAL;
+ sdi_pad_config(dssdev, 1);
dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
dss_sdi_enable();
@@ -240,7 +348,7 @@ int sdi_init_display(struct omap_dss_device *dssdev)
dssdev->get_update_mode = sdi_display_get_update_mode;
dssdev->get_timings = sdi_get_timings;
- return 0;
+ return sdi_pad_init(dssdev);
}
int sdi_init(bool skip_init)
--
1.6.2.4
|