evklcd10x.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Board-specific setup code for the ATEVKLCD10X addon board to the ATNGW100
  3. * Network Gateway
  4. *
  5. * Copyright (C) 2008 Atmel Corporation
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/linkage.h>
  13. #include <linux/gpio.h>
  14. #include <linux/fb.h>
  15. #include <linux/platform_device.h>
  16. #include <video/atmel_lcdc.h>
  17. #include <asm/setup.h>
  18. #include <mach/at32ap700x.h>
  19. #include <mach/portmux.h>
  20. #include <mach/board.h>
  21. #include <sound/atmel-ac97c.h>
  22. static struct ac97c_platform_data __initdata ac97c0_data = {
  23. .reset_pin = GPIO_PIN_PB(19),
  24. };
  25. #ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
  26. static struct fb_videomode __initdata tcg057vglad_modes[] = {
  27. {
  28. .name = "640x480 @ 50",
  29. .refresh = 50,
  30. .xres = 640, .yres = 480,
  31. .pixclock = KHZ2PICOS(25180),
  32. .left_margin = 64, .right_margin = 96,
  33. .upper_margin = 34, .lower_margin = 11,
  34. .hsync_len = 64, .vsync_len = 15,
  35. .sync = 0,
  36. .vmode = FB_VMODE_NONINTERLACED,
  37. },
  38. };
  39. static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
  40. .manufacturer = "KYO",
  41. .monitor = "TCG057VGLAD",
  42. .modedb = tcg057vglad_modes,
  43. .modedb_len = ARRAY_SIZE(tcg057vglad_modes),
  44. .hfmin = 19948,
  45. .hfmax = 31478,
  46. .vfmin = 50,
  47. .vfmax = 67,
  48. .dclkmax = 28330000,
  49. };
  50. static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
  51. .default_bpp = 16,
  52. .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
  53. .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
  54. | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
  55. | ATMEL_LCDC_MEMOR_BIG),
  56. .default_monspecs = &atevklcd10x_default_monspecs,
  57. .guard_time = 2,
  58. };
  59. #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
  60. static struct fb_videomode __initdata tcg057qvlad_modes[] = {
  61. {
  62. .name = "320x240 @ 50",
  63. .refresh = 50,
  64. .xres = 320, .yres = 240,
  65. .pixclock = KHZ2PICOS(6300),
  66. .left_margin = 34, .right_margin = 46,
  67. .upper_margin = 7, .lower_margin = 15,
  68. .hsync_len = 64, .vsync_len = 12,
  69. .sync = 0,
  70. .vmode = FB_VMODE_NONINTERLACED,
  71. },
  72. };
  73. static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
  74. .manufacturer = "KYO",
  75. .monitor = "TCG057QVLAD",
  76. .modedb = tcg057qvlad_modes,
  77. .modedb_len = ARRAY_SIZE(tcg057qvlad_modes),
  78. .hfmin = 19948,
  79. .hfmax = 31478,
  80. .vfmin = 50,
  81. .vfmax = 67,
  82. .dclkmax = 7000000,
  83. };
  84. static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
  85. .default_bpp = 16,
  86. .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
  87. .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
  88. | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
  89. | ATMEL_LCDC_MEMOR_BIG),
  90. .default_monspecs = &atevklcd10x_default_monspecs,
  91. .guard_time = 2,
  92. };
  93. #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_POW_QVGA
  94. static struct fb_videomode __initdata ph320240t_modes[] = {
  95. {
  96. .name = "320x240 @ 60",
  97. .refresh = 60,
  98. .xres = 320, .yres = 240,
  99. .pixclock = KHZ2PICOS(6300),
  100. .left_margin = 38, .right_margin = 20,
  101. .upper_margin = 15, .lower_margin = 5,
  102. .hsync_len = 30, .vsync_len = 3,
  103. .sync = 0,
  104. .vmode = FB_VMODE_NONINTERLACED,
  105. },
  106. };
  107. static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
  108. .manufacturer = "POW",
  109. .monitor = "PH320240T",
  110. .modedb = ph320240t_modes,
  111. .modedb_len = ARRAY_SIZE(ph320240t_modes),
  112. .hfmin = 14400,
  113. .hfmax = 21600,
  114. .vfmin = 50,
  115. .vfmax = 90,
  116. .dclkmax = 6400000,
  117. };
  118. static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
  119. .default_bpp = 16,
  120. .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
  121. .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
  122. | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
  123. | ATMEL_LCDC_MEMOR_BIG),
  124. .default_monspecs = &atevklcd10x_default_monspecs,
  125. .guard_time = 2,
  126. };
  127. #endif
  128. static void atevklcd10x_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
  129. {
  130. gpio_set_value(GPIO_PIN_PB(15), on);
  131. }
  132. static int __init atevklcd10x_init(void)
  133. {
  134. /* PB15 is connected to the enable line on the boost regulator
  135. * controlling the backlight for the LCD panel.
  136. */
  137. at32_select_gpio(GPIO_PIN_PB(15), AT32_GPIOF_OUTPUT);
  138. gpio_request(GPIO_PIN_PB(15), "backlight");
  139. gpio_direction_output(GPIO_PIN_PB(15), 0);
  140. atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
  141. atevklcd10x_lcdc_power_control;
  142. at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
  143. fbmem_start, fbmem_size,
  144. #ifdef CONFIG_BOARD_ATNGW100_MKII
  145. ATMEL_LCDC_PRI_18BIT | ATMEL_LCDC_PC_DVAL
  146. #else
  147. ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL
  148. #endif
  149. );
  150. at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
  151. return 0;
  152. }
  153. postcore_initcall(atevklcd10x_init);