hiddenDangerAnalysis.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /* linux/arch/arm/mach-s5pv210/mach-goni.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/init.h>
  13. #include <linux/serial_core.h>
  14. #include <linux/fb.h>
  15. #include <linux/i2c.h>
  16. #include <linux/i2c-gpio.h>
  17. #include <linux/i2c/atmel_mxt_ts.h>
  18. #include <linux/mfd/max8998.h>
  19. #include <linux/mfd/wm8994/pdata.h>
  20. #include <linux/regulator/fixed.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/spi_gpio.h>
  23. #include <linux/lcd.h>
  24. #include <linux/gpio_keys.h>
  25. #include <linux/input.h>
  26. #include <linux/gpio.h>
  27. #include <linux/mmc/host.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/platform_data/s3c-hsotg.h>
  30. #include <asm/hardware/vic.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <asm/setup.h>
  34. #include <asm/mach-types.h>
  35. #include <video/samsung_fimd.h>
  36. #include <mach/map.h>
  37. #include <mach/regs-clock.h>
  38. #include <plat/gpio-cfg.h>
  39. #include <plat/regs-serial.h>
  40. #include <plat/devs.h>
  41. #include <plat/cpu.h>
  42. #include <plat/fb.h>
  43. #include <linux/platform_data/i2c-s3c2410.h>
  44. #include <plat/keypad.h>
  45. #include <plat/sdhci.h>
  46. #include <plat/clock.h>
  47. #include <plat/s5p-time.h>
  48. #include <plat/mfc.h>
  49. #include <plat/camport.h>
  50. #include <media/v4l2-mediabus.h>
  51. #include <media/s5p_fimc.h>
  52. #include <media/noon010pc30.h>
  53. #include "common.h"
  54. /* Following are default values for UCON, ULCON and UFCON UART registers */
  55. #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  56. S3C2410_UCON_RXILEVEL | \
  57. S3C2410_UCON_TXIRQMODE | \
  58. S3C2410_UCON_RXIRQMODE | \
  59. S3C2410_UCON_RXFIFO_TOI | \
  60. S3C2443_UCON_RXERR_IRQEN)
  61. #define GONI_ULCON_DEFAULT S3C2410_LCON_CS8
  62. #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
  63. static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
  64. [0] = {
  65. .hwport = 0,
  66. .flags = 0,
  67. .ucon = GONI_UCON_DEFAULT,
  68. .ulcon = GONI_ULCON_DEFAULT,
  69. .ufcon = GONI_UFCON_DEFAULT |
  70. S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
  71. },
  72. [1] = {
  73. .hwport = 1,
  74. .flags = 0,
  75. .ucon = GONI_UCON_DEFAULT,
  76. .ulcon = GONI_ULCON_DEFAULT,
  77. .ufcon = GONI_UFCON_DEFAULT |
  78. S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
  79. },
  80. [2] = {
  81. .hwport = 2,
  82. .flags = 0,
  83. .ucon = GONI_UCON_DEFAULT,
  84. .ulcon = GONI_ULCON_DEFAULT,
  85. .ufcon = GONI_UFCON_DEFAULT |
  86. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  87. },
  88. [3] = {
  89. .hwport = 3,
  90. .flags = 0,
  91. .ucon = GONI_UCON_DEFAULT,
  92. .ulcon = GONI_ULCON_DEFAULT,
  93. .ufcon = GONI_UFCON_DEFAULT |
  94. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  95. },
  96. };
  97. /* Frame Buffer */
  98. static struct s3c_fb_pd_win goni_fb_win0 = {
  99. .max_bpp = 32,
  100. .default_bpp = 16,
  101. .xres = 480,
  102. .yres = 800,
  103. .virtual_x = 480,
  104. .virtual_y = 2 * 800,
  105. };
  106. static struct fb_videomode goni_lcd_timing = {
  107. .left_margin = 16,
  108. .right_margin = 16,
  109. .upper_margin = 2,
  110. .lower_margin = 28,
  111. .hsync_len = 2,
  112. .vsync_len = 1,
  113. .xres = 480,
  114. .yres = 800,
  115. .refresh = 55,
  116. };
  117. static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
  118. .win[0] = &goni_fb_win0,
  119. .vtiming = &goni_lcd_timing,
  120. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  121. VIDCON0_CLKSEL_LCD,
  122. .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
  123. | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  124. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  125. };
  126. static int lcd_power_on(struct lcd_device *ld, int enable)
  127. {
  128. return 1;
  129. }
  130. static int reset_lcd(struct lcd_device *ld)
  131. {
  132. static unsigned int first = 1;
  133. int reset_gpio = -1;
  134. reset_gpio = S5PV210_MP05(5);
  135. if (first) {
  136. gpio_request(reset_gpio, "MLCD_RST");
  137. first = 0;
  138. }
  139. gpio_direction_output(reset_gpio, 1);
  140. return 1;
  141. }
  142. static struct lcd_platform_data goni_lcd_platform_data = {
  143. .reset = reset_lcd,
  144. .power_on = lcd_power_on,
  145. .lcd_enabled = 0,
  146. .reset_delay = 120, /* 120ms */
  147. .power_on_delay = 25, /* 25ms */
  148. .power_off_delay = 200, /* 200ms */
  149. };
  150. #define LCD_BUS_NUM 3
  151. static struct spi_board_info spi_board_info[] __initdata = {
  152. {
  153. .modalias = "s6e63m0",
  154. .platform_data = &goni_lcd_platform_data,
  155. .max_speed_hz = 1200000,
  156. .bus_num = LCD_BUS_NUM,
  157. .chip_select = 0,
  158. .mode = SPI_MODE_3,
  159. .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
  160. },
  161. };
  162. static struct spi_gpio_platform_data lcd_spi_gpio_data = {
  163. .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
  164. .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
  165. .miso = SPI_GPIO_NO_MISO,
  166. .num_chipselect = 1,
  167. };
  168. static struct platform_device goni_spi_gpio = {
  169. .name = "spi_gpio",
  170. .id = LCD_BUS_NUM,
  171. .dev = {
  172. .parent = &s3c_device_fb.dev,
  173. .platform_data = &lcd_spi_gpio_data,
  174. },
  175. };
  176. /* KEYPAD */
  177. static uint32_t keymap[] __initdata = {
  178. /* KEY(row, col, keycode) */
  179. KEY(0, 1, KEY_MENU), /* Send */
  180. KEY(0, 2, KEY_BACK), /* End */
  181. KEY(1, 1, KEY_CONFIG), /* Half shot */
  182. KEY(1, 2, KEY_VOLUMEUP),
  183. KEY(2, 1, KEY_CAMERA), /* Full shot */
  184. KEY(2, 2, KEY_VOLUMEDOWN),
  185. };
  186. static struct matrix_keymap_data keymap_data __initdata = {
  187. .keymap = keymap,
  188. .keymap_size = ARRAY_SIZE(keymap),
  189. };
  190. static struct samsung_keypad_platdata keypad_data __initdata = {
  191. .keymap_data = &keymap_data,
  192. .rows = 3,
  193. .cols = 3,
  194. };
  195. /* Radio */
  196. static struct i2c_board_info i2c1_devs[] __initdata = {
  197. {
  198. I2C_BOARD_INFO("si470x", 0x10),
  199. },
  200. };
  201. static void __init goni_radio_init(void)
  202. {
  203. int gpio;
  204. gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
  205. gpio_request(gpio, "FM_INT");
  206. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  207. i2c1_devs[0].irq = gpio_to_irq(gpio);
  208. gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
  209. gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "FM_RST");
  210. }
  211. /* TSP */
  212. static struct mxt_platform_data qt602240_platform_data = {
  213. .x_line = 17,
  214. .y_line = 11,
  215. .x_size = 800,
  216. .y_size = 480,
  217. .blen = 0x21,
  218. .threshold = 0x28,
  219. .voltage = 2800000, /* 2.8V */
  220. .orient = MXT_DIAGONAL,