diff options
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 121 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/magician.h | 2 |
2 files changed, 116 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index d152a086e734..7de3bfe543b4 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/delay.h> | ||
19 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
20 | #include <linux/input.h> | 21 | #include <linux/input.h> |
21 | #include <linux/mfd/htc-egpio.h> | 22 | #include <linux/mfd/htc-egpio.h> |
@@ -144,7 +145,7 @@ static struct platform_device egpio = { | |||
144 | }; | 145 | }; |
145 | 146 | ||
146 | /* | 147 | /* |
147 | * LCD - Toppoly TD028STEB1 | 148 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
148 | */ | 149 | */ |
149 | 150 | ||
150 | static struct pxafb_mode_info toppoly_modes[] = { | 151 | static struct pxafb_mode_info toppoly_modes[] = { |
@@ -163,12 +164,99 @@ static struct pxafb_mode_info toppoly_modes[] = { | |||
163 | }, | 164 | }, |
164 | }; | 165 | }; |
165 | 166 | ||
167 | static struct pxafb_mode_info samsung_modes[] = { | ||
168 | { | ||
169 | .pixclock = 96153, | ||
170 | .bpp = 16, | ||
171 | .xres = 240, | ||
172 | .yres = 320, | ||
173 | .hsync_len = 8, | ||
174 | .vsync_len = 4, | ||
175 | .left_margin = 9, | ||
176 | .upper_margin = 4, | ||
177 | .right_margin = 9, | ||
178 | .lower_margin = 4, | ||
179 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
180 | }, | ||
181 | }; | ||
182 | |||
183 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) | ||
184 | { | ||
185 | pr_debug("Toppoly LCD power\n"); | ||
186 | |||
187 | if (on) { | ||
188 | pr_debug("on\n"); | ||
189 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); | ||
190 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
191 | udelay(2000); | ||
192 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
193 | udelay(2000); | ||
194 | /* FIXME: enable LCDC here */ | ||
195 | udelay(2000); | ||
196 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
197 | udelay(2000); | ||
198 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
199 | } else { | ||
200 | pr_debug("off\n"); | ||
201 | msleep(15); | ||
202 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
203 | udelay(500); | ||
204 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
205 | udelay(1000); | ||
206 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
207 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) | ||
212 | { | ||
213 | pr_debug("Samsung LCD power\n"); | ||
214 | |||
215 | if (on) { | ||
216 | pr_debug("on\n"); | ||
217 | if (system_rev < 3) | ||
218 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); | ||
219 | else | ||
220 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
221 | mdelay(10); | ||
222 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
223 | mdelay(10); | ||
224 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
225 | mdelay(30); | ||
226 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
227 | mdelay(10); | ||
228 | } else { | ||
229 | pr_debug("off\n"); | ||
230 | mdelay(10); | ||
231 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
232 | mdelay(30); | ||
233 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
234 | mdelay(10); | ||
235 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
236 | mdelay(10); | ||
237 | if (system_rev < 3) | ||
238 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); | ||
239 | else | ||
240 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
241 | } | ||
242 | } | ||
243 | |||
166 | static struct pxafb_mach_info toppoly_info = { | 244 | static struct pxafb_mach_info toppoly_info = { |
167 | .modes = toppoly_modes, | 245 | .modes = toppoly_modes, |
168 | .num_modes = 1, | 246 | .num_modes = 1, |
169 | .fixed_modes = 1, | 247 | .fixed_modes = 1, |
170 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 248 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
171 | .lccr3 = LCCR3_PixRsEdg, | 249 | .lccr3 = LCCR3_PixRsEdg, |
250 | .pxafb_lcd_power = toppoly_lcd_power, | ||
251 | }; | ||
252 | |||
253 | static struct pxafb_mach_info samsung_info = { | ||
254 | .modes = samsung_modes, | ||
255 | .num_modes = 1, | ||
256 | .fixed_modes = 1, | ||
257 | .lccr0 = LCCR0_LDDALT | LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
258 | .lccr3 = LCCR3_PixFlEdg, | ||
259 | .pxafb_lcd_power = samsung_lcd_power, | ||
172 | }; | 260 | }; |
173 | 261 | ||
174 | /* | 262 | /* |
@@ -358,12 +446,31 @@ static struct platform_device *devices[] __initdata = { | |||
358 | 446 | ||
359 | static void __init magician_init(void) | 447 | static void __init magician_init(void) |
360 | { | 448 | { |
449 | void __iomem *cpld; | ||
450 | int lcd_select; | ||
451 | |||
361 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 452 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
362 | pxa_set_i2c_info(NULL); | 453 | pxa_set_i2c_info(NULL); |
363 | pxa_set_mci_info(&magician_mci_info); | 454 | pxa_set_mci_info(&magician_mci_info); |
364 | pxa_set_ohci_info(&magician_ohci_info); | 455 | pxa_set_ohci_info(&magician_ohci_info); |
365 | pxa_set_ficp_info(&magician_ficp_info); | 456 | pxa_set_ficp_info(&magician_ficp_info); |
366 | set_pxa_fb_info(&toppoly_info); | 457 | |
458 | /* Check LCD type we have */ | ||
459 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); | ||
460 | if (cpld) { | ||
461 | u8 board_id = __raw_readb(cpld+0x14); | ||
462 | system_rev = board_id & 0x7; | ||
463 | lcd_select = board_id & 0x8; | ||
464 | iounmap(cpld); | ||
465 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); | ||
466 | if (lcd_select && (system_rev < 3)) | ||
467 | pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); | ||
468 | pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); | ||
469 | pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); | ||
470 | pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); | ||
471 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); | ||
472 | } else | ||
473 | pr_err("LCD detection: CPLD mapping failed\n"); | ||
367 | } | 474 | } |
368 | 475 | ||
369 | 476 | ||
diff --git a/include/asm-arm/arch-pxa/magician.h b/include/asm-arm/arch-pxa/magician.h index 216921db9d63..b34fd5683e2d 100644 --- a/include/asm-arm/arch-pxa/magician.h +++ b/include/asm-arm/arch-pxa/magician.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define GPIO48_MAGICIAN_UNKNOWN 48 | 35 | #define GPIO48_MAGICIAN_UNKNOWN 48 |
36 | #define GPIO56_MAGICIAN_UNKNOWN 56 | 36 | #define GPIO56_MAGICIAN_UNKNOWN 56 |
37 | #define GPIO57_MAGICIAN_CAM_RESET 57 | 37 | #define GPIO57_MAGICIAN_CAM_RESET 57 |
38 | #define GPIO75_MAGICIAN_SAMSUNG_POWER 75 | ||
38 | #define GPIO83_MAGICIAN_nIR_EN 83 | 39 | #define GPIO83_MAGICIAN_nIR_EN 83 |
39 | #define GPIO86_MAGICIAN_GSM_RESET 86 | 40 | #define GPIO86_MAGICIAN_GSM_RESET 86 |
40 | #define GPIO87_MAGICIAN_GSM_SELECT 87 | 41 | #define GPIO87_MAGICIAN_GSM_SELECT 87 |
@@ -82,6 +83,7 @@ | |||
82 | #define GPIO48_MAGICIAN_UNKNOWN_MD (48 | GPIO_OUT) | 83 | #define GPIO48_MAGICIAN_UNKNOWN_MD (48 | GPIO_OUT) |
83 | #define GPIO56_MAGICIAN_UNKNOWN_MD (56 | GPIO_OUT) | 84 | #define GPIO56_MAGICIAN_UNKNOWN_MD (56 | GPIO_OUT) |
84 | #define GPIO57_MAGICIAN_CAM_RESET_MD (57 | GPIO_OUT) | 85 | #define GPIO57_MAGICIAN_CAM_RESET_MD (57 | GPIO_OUT) |
86 | #define GPIO75_MAGICIAN_SAMSUNG_POWER_MD (75 | GPIO_OUT) | ||
85 | #define GPIO83_MAGICIAN_nIR_EN_MD (83 | GPIO_OUT) | 87 | #define GPIO83_MAGICIAN_nIR_EN_MD (83 | GPIO_OUT) |
86 | #define GPIO86_MAGICIAN_GSM_RESET_MD (86 | GPIO_OUT) | 88 | #define GPIO86_MAGICIAN_GSM_RESET_MD (86 | GPIO_OUT) |
87 | #define GPIO87_MAGICIAN_GSM_SELECT_MD (87 | GPIO_OUT) | 89 | #define GPIO87_MAGICIAN_GSM_SELECT_MD (87 | GPIO_OUT) |