aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h2
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c80
2 files changed, 66 insertions, 16 deletions
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index ef7d8cf4174d..97e42bfce81e 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -20,7 +20,7 @@
20 20
21/* SD layer latch */ 21/* SD layer latch */
22 22
23#define H1940_LATCH_SDQ1 H1940_LATCH_GPIO(0) 23#define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0)
24#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1) 24#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
25#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2) 25#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
26#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3) 26#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index cc8660ec8844..974c6e4fb6ad 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -106,13 +106,7 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
106 106
107/* Board control latch control */ 107/* Board control latch control */
108 108
109static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_LCD_P4) | 109static unsigned int latch_state;
110 H1940_LATCH_BIT(H1940_LATCH_SM803_ENABLE) |
111 H1940_LATCH_BIT(H1940_LATCH_SDQ1) |
112 H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
113 H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
114 H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
115 H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
116 110
117static void h1940_latch_control(unsigned int clear, unsigned int set) 111static void h1940_latch_control(unsigned int clear, unsigned int set)
118{ 112{
@@ -275,15 +269,32 @@ static int h1940_backlight_init(struct device *dev)
275 gpio_direction_output(S3C2410_GPB(0), 0); 269 gpio_direction_output(S3C2410_GPB(0), 0);
276 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); 270 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
277 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); 271 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
272 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
278 273
279 return 0; 274 return 0;
280} 275}
281 276
277static int h1940_backlight_notify(struct device *dev, int brightness)
278{
279 if (!brightness) {
280 gpio_direction_output(S3C2410_GPB(0), 1);
281 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
282 } else {
283 gpio_direction_output(S3C2410_GPB(0), 0);
284 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
285 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
286 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
287 }
288 return brightness;
289}
290
282static void h1940_backlight_exit(struct device *dev) 291static void h1940_backlight_exit(struct device *dev)
283{ 292{
284 gpio_direction_output(S3C2410_GPB(0), 1); 293 gpio_direction_output(S3C2410_GPB(0), 1);
294 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
285} 295}
286 296
297
287static struct platform_pwm_backlight_data backlight_data = { 298static struct platform_pwm_backlight_data backlight_data = {
288 .pwm_id = 0, 299 .pwm_id = 0,
289 .max_brightness = 100, 300 .max_brightness = 100,
@@ -291,6 +302,7 @@ static struct platform_pwm_backlight_data backlight_data = {
291 /* tcnt = 0x31 */ 302 /* tcnt = 0x31 */
292 .pwm_period_ns = 36296, 303 .pwm_period_ns = 36296,
293 .init = h1940_backlight_init, 304 .init = h1940_backlight_init,
305 .notify = h1940_backlight_notify,
294 .exit = h1940_backlight_exit, 306 .exit = h1940_backlight_exit,
295}; 307};
296 308
@@ -309,19 +321,37 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
309 int value; 321 int value;
310 322
311 if (!power) { 323 if (!power) {
312 /* set to 3ec */ 324 gpio_set_value(S3C2410_GPC(0), 0);
313 gpio_direction_output(S3C2410_GPC(0), 0);
314 /* wait for 3ac */ 325 /* wait for 3ac */
315 do { 326 do {
316 value = gpio_get_value(S3C2410_GPC(6)); 327 value = gpio_get_value(S3C2410_GPC(6));
317 } while (value); 328 } while (value);
318 /* set to 38c */ 329
319 gpio_direction_output(S3C2410_GPC(5), 0); 330 gpio_set_value(H1940_LATCH_LCD_P2, 0);
331 gpio_set_value(H1940_LATCH_LCD_P3, 0);
332 gpio_set_value(H1940_LATCH_LCD_P4, 0);
333
334 gpio_direction_output(S3C2410_GPC(1), 0);
335 gpio_direction_output(S3C2410_GPC(4), 0);
336
337 gpio_set_value(H1940_LATCH_LCD_P1, 0);
338 gpio_set_value(H1940_LATCH_LCD_P0, 0);
339
340 gpio_set_value(S3C2410_GPC(5), 0);
341
320 } else { 342 } else {
321 /* Set to 3ac */ 343 gpio_set_value(H1940_LATCH_LCD_P0, 1);
322 gpio_direction_output(S3C2410_GPC(5), 1); 344 gpio_set_value(H1940_LATCH_LCD_P1, 1);
323 /* Set to 3ad */ 345
324 gpio_direction_output(S3C2410_GPC(0), 1); 346 s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
347 s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
348
349 gpio_set_value(S3C2410_GPC(5), 1);
350 gpio_set_value(S3C2410_GPC(0), 1);
351
352 gpio_set_value(H1940_LATCH_LCD_P3, 1);
353 gpio_set_value(H1940_LATCH_LCD_P2, 1);
354 gpio_set_value(H1940_LATCH_LCD_P4, 1);
325 } 355 }
326} 356}
327 357
@@ -366,6 +396,8 @@ static void __init h1940_map_io(void)
366#endif 396#endif
367 s3c_pm_init(); 397 s3c_pm_init();
368 398
399 /* Add latch gpio chip, set latch initial value */
400 h1940_latch_control(0, 0);
369 WARN_ON(gpiochip_add(&h1940_latch_gpiochip)); 401 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
370} 402}
371 403
@@ -404,9 +436,27 @@ static void __init h1940_init(void)
404 writel(tmp, S3C2410_UPLLCON); 436 writel(tmp, S3C2410_UPLLCON);
405 437
406 gpio_request(S3C2410_GPC(0), "LCD power"); 438 gpio_request(S3C2410_GPC(0), "LCD power");
439 gpio_request(S3C2410_GPC(1), "LCD power");
440 gpio_request(S3C2410_GPC(4), "LCD power");
407 gpio_request(S3C2410_GPC(5), "LCD power"); 441 gpio_request(S3C2410_GPC(5), "LCD power");
408 gpio_request(S3C2410_GPC(6), "LCD power"); 442 gpio_request(S3C2410_GPC(6), "LCD power");
443 gpio_request(H1940_LATCH_LCD_P0, "LCD power");
444 gpio_request(H1940_LATCH_LCD_P1, "LCD power");
445 gpio_request(H1940_LATCH_LCD_P2, "LCD power");
446 gpio_request(H1940_LATCH_LCD_P3, "LCD power");
447 gpio_request(H1940_LATCH_LCD_P4, "LCD power");
448 gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
449 gpio_direction_output(S3C2410_GPC(0), 0);
450 gpio_direction_output(S3C2410_GPC(1), 0);
451 gpio_direction_output(S3C2410_GPC(4), 0);
452 gpio_direction_output(S3C2410_GPC(5), 0);
409 gpio_direction_input(S3C2410_GPC(6)); 453 gpio_direction_input(S3C2410_GPC(6));
454 gpio_direction_output(H1940_LATCH_LCD_P0, 0);
455 gpio_direction_output(H1940_LATCH_LCD_P1, 0);
456 gpio_direction_output(H1940_LATCH_LCD_P2, 0);
457 gpio_direction_output(H1940_LATCH_LCD_P3, 0);
458 gpio_direction_output(H1940_LATCH_LCD_P4, 0);
459 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
410 460
411 gpio_request(H1940_LATCH_USB_DP, "USB pullup"); 461 gpio_request(H1940_LATCH_USB_DP, "USB pullup");
412 gpio_direction_output(H1940_LATCH_USB_DP, 0); 462 gpio_direction_output(H1940_LATCH_USB_DP, 0);