aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2008-04-09 14:27:10 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 06:29:07 -0400
commite07ff8d8091eff8e208fe1e406c15e5de0fffd63 (patch)
tree06a646e77f14f5d50fccdaa1d79186fb62df3546 /arch/arm/mach-pxa
parent350d115d1eaa29e64324847badf27c93159ba8e0 (diff)
[ARM] 4952/1: magician: add LCD detection, LCD power switching, update pxafb settings
All magician devices I've encountered so far have featured the Toppoly TD028STEB1 display, so the Samsung LTP280QV support is untested. The power-on sequence is not correct because pxafb doesn't yet support enabling the LCD controller in the middle of the it. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/magician.c121
1 files changed, 114 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
150static struct pxafb_mode_info toppoly_modes[] = { 151static struct pxafb_mode_info toppoly_modes[] = {
@@ -163,12 +164,99 @@ static struct pxafb_mode_info toppoly_modes[] = {
163 }, 164 },
164}; 165};
165 166
167static 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
183static 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
211static 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
166static struct pxafb_mach_info toppoly_info = { 244static 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
253static 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
359static void __init magician_init(void) 447static 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