mach-nuri.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. /*
  2. * linux/arch/arm/mach-exynos4/mach-nuri.c
  3. *
  4. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  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/platform_device.h>
  11. #include <linux/serial_core.h>
  12. #include <linux/input.h>
  13. #include <linux/i2c.h>
  14. #include <linux/i2c/atmel_mxt_ts.h>
  15. #include <linux/i2c-gpio.h>
  16. #include <linux/gpio_keys.h>
  17. #include <linux/gpio.h>
  18. #include <linux/power/max8903_charger.h>
  19. #include <linux/power/max17042_battery.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/regulator/fixed.h>
  22. #include <linux/mfd/max8997.h>
  23. #include <linux/mfd/max8997-private.h>
  24. #include <linux/mmc/host.h>
  25. #include <linux/fb.h>
  26. #include <linux/pwm_backlight.h>
  27. #include <linux/platform_data/s3c-hsotg.h>
  28. #include <drm/exynos_drm.h>
  29. #include <video/platform_lcd.h>
  30. #include <video/samsung_fimd.h>
  31. #include <media/m5mols.h>
  32. #include <media/s5k6aa.h>
  33. #include <media/s5p_fimc.h>
  34. #include <media/v4l2-mediabus.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/hardware/gic.h>
  37. #include <asm/mach-types.h>
  38. #include <plat/adc.h>
  39. #include <plat/regs-serial.h>
  40. #include <plat/cpu.h>
  41. #include <plat/devs.h>
  42. #include <plat/fb.h>
  43. #include <plat/sdhci.h>
  44. #include <linux/platform_data/usb-ehci-s5p.h>
  45. #include <plat/clock.h>
  46. #include <plat/gpio-cfg.h>
  47. #include <linux/platform_data/i2c-s3c2410.h>
  48. #include <plat/mfc.h>
  49. #include <plat/fimc-core.h>
  50. #include <plat/camport.h>
  51. #include <linux/platform_data/mipi-csis.h>
  52. #include <mach/map.h>
  53. #include "common.h"
  54. /* Following are default values for UCON, ULCON and UFCON UART registers */
  55. #define NURI_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 NURI_ULCON_DEFAULT S3C2410_LCON_CS8
  62. #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  63. S5PV210_UFCON_TXTRIG256 | \
  64. S5PV210_UFCON_RXTRIG256)
  65. enum fixed_regulator_id {
  66. FIXED_REG_ID_MMC = 0,
  67. FIXED_REG_ID_MAX8903,
  68. FIXED_REG_ID_CAM_A28V,
  69. FIXED_REG_ID_CAM_12V,
  70. FIXED_REG_ID_CAM_VT_15V,
  71. };
  72. static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
  73. {
  74. .hwport = 0,
  75. .ucon = NURI_UCON_DEFAULT,
  76. .ulcon = NURI_ULCON_DEFAULT,
  77. .ufcon = NURI_UFCON_DEFAULT,
  78. },
  79. {
  80. .hwport = 1,
  81. .ucon = NURI_UCON_DEFAULT,
  82. .ulcon = NURI_ULCON_DEFAULT,
  83. .ufcon = NURI_UFCON_DEFAULT,
  84. },
  85. {
  86. .hwport = 2,
  87. .ucon = NURI_UCON_DEFAULT,
  88. .ulcon = NURI_ULCON_DEFAULT,
  89. .ufcon = NURI_UFCON_DEFAULT,
  90. },
  91. {
  92. .hwport = 3,
  93. .ucon = NURI_UCON_DEFAULT,
  94. .ulcon = NURI_ULCON_DEFAULT,
  95. .ufcon = NURI_UFCON_DEFAULT,
  96. },
  97. };
  98. /* eMMC */
  99. static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
  100. .max_width = 8,
  101. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  102. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  103. MMC_CAP_ERASE),
  104. .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
  105. .cd_type = S3C_SDHCI_CD_PERMANENT,
  106. };
  107. static struct regulator_consumer_supply emmc_supplies[] = {
  108. REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
  109. REGULATOR_SUPPLY("vmmc", "dw_mmc"),
  110. };
  111. static struct regulator_init_data emmc_fixed_voltage_init_data = {
  112. .constraints = {
  113. .name = "VMEM_VDD_2.8V",
  114. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  115. },
  116. .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
  117. .consumer_supplies = emmc_supplies,
  118. };
  119. static struct fixed_voltage_config emmc_fixed_voltage_config = {
  120. .supply_name = "MASSMEMORY_EN (inverted)",
  121. .microvolts = 2800000,
  122. .gpio = EXYNOS4_GPL1(1),
  123. .enable_high = false,
  124. .init_data = &emmc_fixed_voltage_init_data,
  125. };
  126. static struct platform_device emmc_fixed_voltage = {
  127. .name = "reg-fixed-voltage",
  128. .id = FIXED_REG_ID_MMC,
  129. .dev = {
  130. .platform_data = &emmc_fixed_voltage_config,
  131. },
  132. };
  133. /* SD */
  134. static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
  135. .max_width = 4,
  136. .host_caps = MMC_CAP_4_BIT_DATA |
  137. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  138. .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
  139. .ext_cd_gpio_invert = 1,
  140. .cd_type = S3C_SDHCI_CD_GPIO,
  141. };
  142. /* WLAN */
  143. static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
  144. .max_width = 4,
  145. .host_caps = MMC_CAP_4_BIT_DATA |
  146. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  147. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  148. };
  149. static void __init nuri_sdhci_init(void)
  150. {
  151. s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
  152. s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
  153. s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
  154. }
  155. /* GPIO KEYS */
  156. static struct gpio_keys_button nuri_gpio_keys_tables[] = {
  157. {
  158. .code = KEY_VOLUMEUP,
  159. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  160. .desc = "gpio-keys: KEY_VOLUMEUP",
  161. .type = EV_KEY,
  162. .active_low = 1,
  163. .debounce_interval = 1,
  164. }, {
  165. .code = KEY_VOLUMEDOWN,
  166. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  167. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  168. .type = EV_KEY,
  169. .active_low = 1,
  170. .debounce_interval = 1,
  171. }, {
  172. .code = KEY_POWER,
  173. .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
  174. .desc = "gpio-keys: KEY_POWER",
  175. .type = EV_KEY,
  176. .active_low = 1,
  177. .wakeup = 1,
  178. .debounce_interval = 1,
  179. },
  180. };
  181. static struct gpio_keys_platform_data nuri_gpio_keys_data = {
  182. .buttons = nuri_gpio_keys_tables,
  183. .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
  184. };
  185. static struct platform_device nuri_gpio_keys = {
  186. .name = "gpio-keys",
  187. .dev = {
  188. .platform_data = &nuri_gpio_keys_data,
  189. },
  190. };
  191. #ifdef CONFIG_DRM_EXYNOS
  192. static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
  193. .panel = {
  194. .timing = {
  195. .xres = 1024,
  196. .yres = 600,
  197. .hsync_len = 40,
  198. .left_margin = 79,
  199. .right_margin = 200,
  200. .vsync_len = 10,
  201. .upper_margin = 10,
  202. .lower_margin = 11,
  203. .refresh = 60,
  204. },
  205. },
  206. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  207. VIDCON0_CLKSEL_LCD,
  208. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  209. .default_win = 3,
  210. .bpp = 32,
  211. };
  212. #else
  213. /* Frame Buffer */
  214. static struct s3c_fb_pd_win nuri_fb_win0 = {
  215. .max_bpp = 24,
  216. .default_bpp = 16,
  217. .xres = 1024,
  218. .yres = 600,
  219. .virtual_x = 1024,
  220. .virtual_y = 2 * 600,
  221. };
  222. static struct fb_videomode nuri_lcd_timing = {
  223. .left_margin = 64,
  224. .right_margin = 16,
  225. .upper_margin = 64,
  226. .lower_margin = 1,
  227. .hsync_len = 48,
  228. .vsync_len = 3,
  229. .xres = 1024,
  230. .yres = 600,
  231. .refresh = 60,
  232. };
  233. static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
  234. .win[0] = &nuri_fb_win0,
  235. .vtiming = &nuri_lcd_timing,
  236. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  237. VIDCON0_CLKSEL_LCD,
  238. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  239. .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
  240. };
  241. #endif
  242. static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
  243. {
  244. int gpio = EXYNOS4_GPE1(5);
  245. gpio_request(gpio, "LVDS_nSHDN");
  246. gpio_direction_output(gpio, power);
  247. gpio_free(gpio);
  248. }
  249. static int nuri_bl_init(struct device *dev)
  250. {
  251. return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
  252. "LCD_LD0_EN");
  253. }
  254. static int nuri_bl_notify(struct device *dev, int brightness)
  255. {
  256. if (brightness < 1)
  257. brightness = 0;
  258. gpio_set_value(EXYNOS4_GPE2(3), 1);
  259. return brightness;
  260. }
  261. static void nuri_bl_exit(struct device *dev)
  262. {
  263. gpio_free(EXYNOS4_GPE2(3));
  264. }
  265. /* nuri pwm backlight */
  266. static struct platform_pwm_backlight_data nuri_backlight_data = {
  267. .pwm_id = 0,
  268. .pwm_period_ns = 30000,
  269. .max_brightness = 100,
  270. .dft_brightness = 50,
  271. .init = nuri_bl_init,
  272. .notify = nuri_bl_notify,
  273. .exit = nuri_bl_exit,
  274. };
  275. static struct platform_device nuri_backlight_device = {
  276. .name = "pwm-backlight",
  277. .id = -1,
  278. .dev = {
  279. .parent = &s3c_device_timer[0].dev,
  280. .platform_data = &nuri_backlight_data,
  281. },
  282. };
  283. static struct plat_lcd_data nuri_lcd_platform_data = {
  284. .set_power = nuri_lcd_power_on,
  285. };
  286. static struct platform_device nuri_lcd_device = {
  287. .name = "platform-lcd",
  288. .id = -1,
  289. .dev = {
  290. .platform_data = &nuri_lcd_platform_data,
  291. },
  292. };
  293. /* I2C1 */
  294. static struct i2c_board_info i2c1_devs[] __initdata = {
  295. /* Gyro, To be updated */
  296. };
  297. /* TSP */
  298. static struct mxt_platform_data mxt_platform_data = {
  299. .x_line = 18,
  300. .y_line = 11,
  301. .x_size = 1024,
  302. .y_size = 600,
  303. .blen = 0x1,
  304. .threshold = 0x28,
  305. .voltage = 2800000, /* 2.8V */
  306. .orient = MXT_DIAGONAL_COUNTER,
  307. .irqflags = IRQF_TRIGGER_FALLING,
  308. };
  309. static struct s3c2410_platform_i2c i2c3_data __initdata = {
  310. .flags = 0,
  311. .bus_num = 3,
  312. .slave_addr = 0x10,
  313. .frequency = 400 * 1000,
  314. .sda_delay = 100,
  315. };
  316. static struct i2c_board_info i2c3_devs[] __initdata = {
  317. {
  318. I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
  319. .platform_data = &mxt_platform_data,
  320. .irq = IRQ_EINT(4),
  321. },
  322. };
  323. static void __init nuri_tsp_init(void)
  324. {
  325. int gpio;
  326. /* TOUCH_INT: XEINT_4 */
  327. gpio = EXYNOS4_GPX0(4);
  328. gpio_request(gpio, "TOUCH_INT");
  329. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  330. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  331. }
  332. static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
  333. REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
  334. };
  335. static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
  336. REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
  337. REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */
  338. };
  339. static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
  340. REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */
  341. };
  342. static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
  343. REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
  344. };
  345. static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
  346. REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
  347. };
  348. static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
  349. REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
  350. };
  351. static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
  352. REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
  353. REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
  354. };
  355. static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
  356. REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
  357. };
  358. static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
  359. REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
  360. };
  361. static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
  362. REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
  363. };
  364. static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
  365. REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
  366. };
  367. static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
  368. REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
  369. };
  370. static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
  371. REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
  372. };
  373. static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
  374. REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
  375. };
  376. static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
  377. REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
  378. };
  379. static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
  380. REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
  381. };
  382. static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
  383. REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
  384. };
  385. static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
  386. REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
  387. };
  388. static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
  389. REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
  390. };
  391. static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
  392. REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
  393. };
  394. static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
  395. REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
  396. };
  397. static struct regulator_consumer_supply __initdata max8997_charger_[] = {
  398. REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
  399. };
  400. static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
  401. REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
  402. };
  403. static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
  404. REGULATOR_SUPPLY("gps_clk", "bcm4751"),
  405. REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
  406. REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
  407. };
  408. static struct regulator_init_data __initdata max8997_ldo1_data = {
  409. .constraints = {
  410. .name = "VADC_3.3V_C210",
  411. .min_uV = 3300000,
  412. .max_uV = 3300000,
  413. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  414. .apply_uV = 1,
  415. .state_mem = {
  416. .disabled = 1,
  417. },
  418. },
  419. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
  420. .consumer_supplies = max8997_ldo1_,
  421. };
  422. static struct regulator_init_data __initdata max8997_ldo2_data = {
  423. .constraints = {
  424. .name = "VALIVE_1.1V_C210",
  425. .min_uV = 1100000,
  426. .max_uV = 1100000,
  427. .apply_uV = 1,
  428. .always_on = 1,
  429. .state_mem = {
  430. .enabled = 1,
  431. },
  432. },
  433. };
  434. static struct regulator_init_data __initdata max8997_ldo3_data = {
  435. .constraints = {
  436. .name = "VUSB_1.1V_C210",
  437. .min_uV = 1100000,
  438. .max_uV = 1100000,
  439. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  440. .apply_uV = 1,
  441. .state_mem = {
  442. .disabled = 1,
  443. },
  444. },
  445. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
  446. .consumer_supplies = max8997_ldo3_,
  447. };
  448. static struct regulator_init_data __initdata max8997_ldo4_data = {
  449. .constraints = {
  450. .name = "VMIPI_1.8V",
  451. .min_uV = 1800000,
  452. .max_uV = 1800000,
  453. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  454. .apply_uV = 1,
  455. .state_mem = {
  456. .disabled = 1,
  457. },
  458. },
  459. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
  460. .consumer_supplies = max8997_ldo4_,
  461. };
  462. static struct regulator_init_data __initdata max8997_ldo5_data = {
  463. .constraints = {
  464. .name = "VHSIC_1.2V_C210",
  465. .min_uV = 1200000,
  466. .max_uV = 1200000,
  467. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  468. .apply_uV = 1,
  469. .state_mem = {
  470. .disabled = 1,
  471. },
  472. },
  473. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
  474. .consumer_supplies = max8997_ldo5_,
  475. };
  476. static struct regulator_init_data __initdata max8997_ldo6_data = {
  477. .constraints = {
  478. .name = "VCC_1.8V_PDA",
  479. .min_uV = 1800000,
  480. .max_uV = 1800000,
  481. .apply_uV = 1,
  482. .always_on = 1,
  483. .state_mem = {
  484. .enabled = 1,
  485. },
  486. },
  487. .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
  488. .consumer_supplies = nuri_max8997_ldo6_consumer,
  489. };
  490. static struct regulator_init_data __initdata max8997_ldo7_data = {
  491. .constraints = {
  492. .name = "CAM_ISP_1.8V",
  493. .min_uV = 1800000,
  494. .max_uV = 1800000,
  495. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  496. .apply_uV = 1,
  497. .state_mem = {
  498. .disabled = 1,
  499. },
  500. },
  501. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
  502. .consumer_supplies = max8997_ldo7_,
  503. };
  504. static struct regulator_init_data __initdata max8997_ldo8_data = {
  505. .constraints = {
  506. .name = "VUSB+VDAC_3.3V_C210",
  507. .min_uV = 3300000,
  508. .max_uV = 3300000,
  509. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  510. .apply_uV = 1,
  511. .state_mem = {
  512. .disabled = 1,
  513. },
  514. },
  515. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
  516. .consumer_supplies = max8997_ldo8_,
  517. };
  518. static struct regulator_init_data __initdata max8997_ldo9_data = {
  519. .constraints = {
  520. .name = "VCC_2.8V_PDA",
  521. .min_uV = 2800000,
  522. .max_uV = 2800000,
  523. .apply_uV = 1,
  524. .always_on = 1,
  525. .state_mem = {
  526. .enabled = 1,
  527. },
  528. },
  529. };
  530. static struct regulator_init_data __initdata max8997_ldo10_data = {
  531. .constraints = {
  532. .name = "VPLL_1.1V_C210",
  533. .min_uV = 1100000,
  534. .max_uV = 1100000,
  535. .apply_uV = 1,
  536. .always_on = 1,
  537. .state_mem = {
  538. .disabled = 1,
  539. },
  540. },
  541. };
  542. static struct regulator_init_data __initdata max8997_ldo11_data = {
  543. .constraints = {
  544. .name = "LVDS_VDD3.3V",
  545. .min_uV = 3300000,
  546. .max_uV = 3300000,
  547. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  548. .apply_uV = 1,
  549. .boot_on = 1,
  550. .state_mem = {
  551. .disabled = 1,
  552. },
  553. },
  554. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
  555. .consumer_supplies = max8997_ldo11_,
  556. };
  557. static struct regulator_init_data __initdata max8997_ldo12_data = {
  558. .constraints = {
  559. .name = "VT_CAM_1.8V",
  560. .min_uV = 1800000,
  561. .max_uV = 1800000,
  562. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  563. .apply_uV = 1,
  564. .state_mem = {
  565. .disabled = 1,
  566. },
  567. },
  568. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
  569. .consumer_supplies = max8997_ldo12_,
  570. };
  571. static struct regulator_init_data __initdata max8997_ldo13_data = {
  572. .constraints = {
  573. .name = "VTF_2.8V",
  574. .min_uV = 2800000,
  575. .max_uV = 2800000,
  576. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  577. .apply_uV = 1,
  578. .state_mem = {
  579. .disabled = 1,
  580. },
  581. },
  582. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
  583. .consumer_supplies = max8997_ldo13_,
  584. };
  585. static struct regulator_init_data __initdata max8997_ldo14_data = {
  586. .constraints = {
  587. .name = "VCC_3.0V_MOTOR",
  588. .min_uV = 3000000,
  589. .max_uV = 3000000,
  590. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  591. .apply_uV = 1,
  592. .state_mem = {
  593. .disabled = 1,
  594. },
  595. },
  596. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
  597. .consumer_supplies = max8997_ldo14_,
  598. };
  599. static struct regulator_init_data __initdata max8997_ldo15_data = {
  600. .constraints = {
  601. .name = "VTOUCH_ADVV2.8V",
  602. .min_uV = 2800000,
  603. .max_uV = 2800000,
  604. .apply_uV = 1,
  605. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  606. .state_mem = {
  607. .disabled = 1,
  608. },
  609. },
  610. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
  611. .consumer_supplies = max8997_ldo15_,
  612. };
  613. static struct regulator_init_data __initdata max8997_ldo16_data = {
  614. .constraints = {
  615. .name = "CAM_SENSOR_IO_1.8V",
  616. .min_uV = 1800000,
  617. .max_uV = 1800000,
  618. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  619. .apply_uV = 1,
  620. .state_mem = {
  621. .disabled = 1,
  622. },
  623. },
  624. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
  625. .consumer_supplies = max8997_ldo16_,
  626. };
  627. static struct regulator_init_data __initdata max8997_ldo18_data = {
  628. .constraints = {
  629. .name = "VTOUCH_VDD2.8V",
  630. .min_uV = 2800000,
  631. .max_uV = 2800000,
  632. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  633. .apply_uV = 1,
  634. .state_mem = {
  635. .disabled = 1,
  636. },
  637. },
  638. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
  639. .consumer_supplies = max8997_ldo18_,
  640. };
  641. static struct regulator_init_data __initdata max8997_ldo21_data = {
  642. .constraints = {
  643. .name = "VDDQ_M1M2_1.2V",
  644. .min_uV = 1200000,
  645. .max_uV = 1200000,
  646. .apply_uV = 1,
  647. .always_on = 1,
  648. .state_mem = {
  649. .disabled = 1,
  650. },
  651. },
  652. };
  653. static struct regulator_init_data __initdata max8997_buck1_data = {
  654. .constraints = {
  655. .name = "VARM_1.2V_C210",
  656. .min_uV = 900000,
  657. .max_uV = 1350000,
  658. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  659. .always_on = 1,
  660. .state_mem = {
  661. .disabled = 1,
  662. },
  663. },
  664. .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
  665. .consumer_supplies = max8997_buck1_,
  666. };
  667. static struct regulator_init_data __initdata max8997_buck2_data = {
  668. .constraints = {
  669. .name = "VINT_1.1V_C210",
  670. .min_uV = 900000,
  671. .max_uV = 1200000,
  672. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  673. .always_on = 1,
  674. .state_mem = {
  675. .disabled = 1,
  676. },
  677. },
  678. .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
  679. .consumer_supplies = max8997_buck2_,
  680. };
  681. static struct regulator_init_data __initdata max8997_buck3_data = {
  682. .constraints = {
  683. .name = "VG3D_1.1V_C210",
  684. .min_uV = 900000,
  685. .max_uV = 1100000,
  686. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  687. REGULATOR_CHANGE_STATUS,
  688. .state_mem = {
  689. .disabled = 1,
  690. },
  691. },
  692. .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
  693. .consumer_supplies = max8997_buck3_,
  694. };
  695. static struct regulator_init_data __initdata max8997_buck4_data = {
  696. .constraints = {
  697. .name = "CAM_ISP_CORE_1.2V",
  698. .min_uV = 1200000,
  699. .max_uV = 1200000,
  700. .apply_uV = 1,
  701. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  702. .state_mem = {
  703. .disabled = 1,
  704. },
  705. },
  706. .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
  707. .consumer_supplies = max8997_buck4_,
  708. };
  709. static struct regulator_init_data __initdata max8997_buck5_data = {
  710. .constraints = {
  711. .name = "VMEM_1.2V_C210",
  712. .min_uV = 1200000,
  713. .max_uV = 1200000,
  714. .apply_uV = 1,
  715. .always_on = 1,
  716. .state_mem = {
  717. .enabled = 1,
  718. },
  719. },
  720. };
  721. static struct regulator_init_data __initdata max8997_buck6_data = {
  722. .constraints = {
  723. .name = "CAM_AF_2.8V",
  724. .min_uV = 2800000,
  725. .max_uV = 2800000,
  726. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  727. .state_mem = {
  728. .disabled = 1,
  729. },
  730. },
  731. .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
  732. .consumer_supplies = max8997_buck6_,
  733. };
  734. static struct regulator_init_data __initdata max8997_buck7_data = {
  735. .constraints = {
  736. .name = "VCC_SUB_2.0V",
  737. .min_uV = 2000000,
  738. .max_uV = 2000000,
  739. .apply_uV = 1,
  740. .always_on = 1,
  741. .state_mem = {
  742. .enabled = 1,
  743. },
  744. },
  745. };
  746. static struct regulator_init_data __initdata max8997_32khz_ap_data = {
  747. .constraints = {
  748. .name = "32KHz AP",
  749. .always_on = 1,
  750. .state_mem = {
  751. .enabled = 1,
  752. },
  753. },
  754. .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
  755. .consumer_supplies = max8997_32khz_ap_,
  756. };
  757. static struct regulator_init_data __initdata max8997_32khz_cp_data = {
  758. .constraints = {
  759. .name = "32KHz CP",
  760. .state_mem = {
  761. .disabled = 1,
  762. },
  763. },
  764. };
  765. static struct regulator_init_data __initdata max8997_vichg_data = {
  766. .constraints = {
  767. .name = "VICHG",
  768. .state_mem = {
  769. .disabled = 1,
  770. },
  771. },
  772. };
  773. static struct regulator_init_data __initdata max8997_esafeout1_data = {
  774. .constraints = {
  775. .name = "SAFEOUT1",
  776. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  777. .always_on = 1,
  778. .state_mem = {
  779. .disabled = 1,
  780. },
  781. },
  782. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
  783. .consumer_supplies = max8997_esafeout1_,
  784. };
  785. static struct regulator_init_data __initdata max8997_esafeout2_data = {
  786. .constraints = {
  787. .name = "SAFEOUT2",
  788. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  789. .state_mem = {
  790. .disabled = 1,
  791. },
  792. },
  793. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
  794. .consumer_supplies = max8997_esafeout2_,
  795. };
  796. static struct regulator_init_data __initdata max8997_charger_cv_data = {
  797. .constraints = {
  798. .name = "CHARGER_CV",
  799. .min_uV = 4200000,
  800. .max_uV = 4200000,
  801. .apply_uV = 1,
  802. },
  803. };
  804. static struct regulator_init_data __initdata max8997_charger_data = {
  805. .constraints = {
  806. .name = "CHARGER",
  807. .min_uA = 200000,
  808. .max_uA = 950000,
  809. .boot_on = 1,
  810. .valid_ops_mask = REGULATOR_CHANGE_STATUS |
  811. REGULATOR_CHANGE_CURRENT,
  812. },
  813. .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
  814. .consumer_supplies = max8997_charger_,
  815. };
  816. static struct regulator_init_data __initdata max8997_charger_topoff_data = {
  817. .constraints = {
  818. .name = "CHARGER TOPOFF",
  819. .min_uA = 50000,
  820. .max_uA = 200000,
  821. .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
  822. },
  823. .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
  824. .consumer_supplies = max8997_chg_toff_,
  825. };
  826. static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
  827. { MAX8997_LDO1, &max8997_ldo1_data },
  828. { MAX8997_LDO2, &max8997_ldo2_data },
  829. { MAX8997_LDO3, &max8997_ldo3_data },
  830. { MAX8997_LDO4, &max8997_ldo4_data },
  831. { MAX8997_LDO5, &max8997_ldo5_data },
  832. { MAX8997_LDO6, &max8997_ldo6_data },
  833. { MAX8997_LDO7, &max8997_ldo7_data },
  834. { MAX8997_LDO8, &max8997_ldo8_data },
  835. { MAX8997_LDO9, &max8997_ldo9_data },
  836. { MAX8997_LDO10, &max8997_ldo10_data },
  837. { MAX8997_LDO11, &max8997_ldo11_data },
  838. { MAX8997_LDO12, &max8997_ldo12_data },
  839. { MAX8997_LDO13, &max8997_ldo13_data },
  840. { MAX8997_LDO14, &max8997_ldo14_data },
  841. { MAX8997_LDO15, &max8997_ldo15_data },
  842. { MAX8997_LDO16, &max8997_ldo16_data },
  843. { MAX8997_LDO18, &max8997_ldo18_data },
  844. { MAX8997_LDO21, &max8997_ldo21_data },
  845. { MAX8997_BUCK1, &max8997_buck1_data },
  846. { MAX8997_BUCK2, &max8997_buck2_data },
  847. { MAX8997_BUCK3, &max8997_buck3_data },
  848. { MAX8997_BUCK4, &max8997_buck4_data },
  849. { MAX8997_BUCK5, &max8997_buck5_data },
  850. { MAX8997_BUCK6, &max8997_buck6_data },
  851. { MAX8997_BUCK7, &max8997_buck7_data },
  852. { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
  853. { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
  854. { MAX8997_ENVICHG, &max8997_vichg_data },
  855. { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
  856. { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
  857. { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
  858. { MAX8997_CHARGER, &max8997_charger_data },
  859. { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
  860. };
  861. static struct max8997_platform_data __initdata nuri_max8997_pdata = {
  862. .wakeup = 1,
  863. .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
  864. .regulators = nuri_max8997_regulators,
  865. .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
  866. .buck1_voltage[0] = 1350000, /* 1.35V */
  867. .buck1_voltage[1] = 1300000, /* 1.3V */
  868. .buck1_voltage[2] = 1250000, /* 1.25V */
  869. .buck1_voltage[3] = 1200000, /* 1.2V */
  870. .buck1_voltage[4] = 1150000, /* 1.15V */
  871. .buck1_voltage[5] = 1100000, /* 1.1V */
  872. .buck1_voltage[6] = 1000000, /* 1.0V */
  873. .buck1_voltage[7] = 950000, /* 0.95V */
  874. .buck2_voltage[0] = 1100000, /* 1.1V */
  875. .buck2_voltage[1] = 1000000, /* 1.0V */
  876. .buck2_voltage[2] = 950000, /* 0.95V */
  877. .buck2_voltage[3] = 900000, /* 0.9V */
  878. .buck2_voltage[4] = 1100000, /* 1.1V */
  879. .buck2_voltage[5] = 1000000, /* 1.0V */
  880. .buck2_voltage[6] = 950000, /* 0.95V */
  881. .buck2_voltage[7] = 900000, /* 0.9V */
  882. .buck5_voltage[0] = 1200000, /* 1.2V */
  883. .buck5_voltage[1] = 1200000, /* 1.2V */
  884. .buck5_voltage[2] = 1200000, /* 1.2V */
  885. .buck5_voltage[3] = 1200000, /* 1.2V */
  886. .buck5_voltage[4] = 1200000, /* 1.2V */
  887. .buck5_voltage[5] = 1200000, /* 1.2V */
  888. .buck5_voltage[6] = 1200000, /* 1.2V */
  889. .buck5_voltage[7] = 1200000, /* 1.2V */
  890. };
  891. /* GPIO I2C 5 (PMIC) */
  892. enum { I2C5_MAX8997 };
  893. static struct i2c_board_info i2c5_devs[] __initdata = {
  894. [I2C5_MAX8997] = {
  895. I2C_BOARD_INFO("max8997", 0xCC >> 1),
  896. .platform_data = &nuri_max8997_pdata,
  897. },
  898. };
  899. static struct max17042_platform_data nuri_battery_platform_data = {
  900. };
  901. /* GPIO I2C 9 (Fuel Gauge) */
  902. static struct i2c_gpio_platform_data i2c9_gpio_data = {
  903. .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
  904. .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
  905. };
  906. static struct platform_device i2c9_gpio = {
  907. .name = "i2c-gpio",
  908. .id = 9,
  909. .dev = {
  910. .platform_data = &i2c9_gpio_data,
  911. },
  912. };
  913. enum { I2C9_MAX17042};
  914. static struct i2c_board_info i2c9_devs[] __initdata = {
  915. [I2C9_MAX17042] = {
  916. I2C_BOARD_INFO("max17042", 0x36),
  917. .platform_data = &nuri_battery_platform_data,
  918. },
  919. };
  920. /* MAX8903 Secondary Charger */
  921. static struct regulator_consumer_supply supplies_max8903[] = {
  922. REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
  923. };
  924. static struct regulator_init_data max8903_charger_en_data = {
  925. .constraints = {
  926. .name = "VOUT_CHARGER",
  927. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  928. .boot_on = 1,
  929. },
  930. .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
  931. .consumer_supplies = supplies_max8903,
  932. };
  933. static struct fixed_voltage_config max8903_charger_en = {
  934. .supply_name = "VOUT_CHARGER",
  935. .microvolts = 5000000, /* Assume 5VDC */
  936. .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
  937. .enable_high = 0, /* Enable = Low */
  938. .enabled_at_boot = 1,
  939. .init_data = &max8903_charger_en_data,
  940. };
  941. static struct platform_device max8903_fixed_reg_dev = {
  942. .name = "reg-fixed-voltage",
  943. .id = FIXED_REG_ID_MAX8903,
  944. .dev = { .platform_data = &max8903_charger_en },
  945. };
  946. static struct max8903_pdata nuri_max8903 = {
  947. /*
  948. * cen: don't control with the driver, let it be
  949. * controlled by regulator above
  950. */
  951. .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
  952. /* uok, usus: not connected */
  953. .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
  954. /* flt: vcc_1.8V_pda */
  955. .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
  956. .dc_valid = true,
  957. .usb_valid = false, /* USB is not wired to MAX8903 */
  958. };
  959. static struct platform_device nuri_max8903_device = {
  960. .name = "max8903-charger",
  961. .dev = {
  962. .platform_data = &nuri_max8903,
  963. },
  964. };
  965. static void __init nuri_power_init(void)
  966. {
  967. int gpio;
  968. int ta_en = 0;
  969. gpio = EXYNOS4_GPX0(7);
  970. gpio_request(gpio, "AP_PMIC_IRQ");
  971. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  972. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  973. gpio = EXYNOS4_GPX2(3);
  974. gpio_request(gpio, "FUEL_ALERT");
  975. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  976. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  977. gpio = nuri_max8903.dok;
  978. gpio_request(gpio, "TA_nCONNECTED");
  979. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  980. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  981. ta_en = gpio_get_value(gpio) ? 0 : 1;
  982. gpio = nuri_max8903.chg;
  983. gpio_request(gpio, "TA_nCHG");
  984. gpio_direction_input(gpio);
  985. gpio = nuri_max8903.dcm;
  986. gpio_request(gpio, "CURR_ADJ");
  987. gpio_direction_output(gpio, ta_en);
  988. }
  989. /* USB EHCI */
  990. static struct s5p_ehci_platdata nuri_ehci_pdata;
  991. static void __init nuri_ehci_init(void)
  992. {
  993. struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
  994. s5p_ehci_set_platdata(pdata);
  995. }
  996. /* USB OTG */
  997. static struct s3c_hsotg_plat nuri_hsotg_pdata;
  998. /* CAMERA */
  999. static struct regulator_consumer_supply cam_vt_cam15_supply =
  1000. REGULATOR_SUPPLY("vdd_core", "6-003c");
  1001. static struct regulator_init_data cam_vt_cam15_reg_init_data = {
  1002. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  1003. .num_consumer_supplies = 1,
  1004. .consumer_supplies = &cam_vt_cam15_supply,
  1005. };
  1006. static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
  1007. .supply_name = "VT_CAM_1.5V",
  1008. .microvolts = 1500000,
  1009. .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
  1010. .enable_high = 1,
  1011. .init_data = &cam_vt_cam15_reg_init_data,
  1012. };
  1013. static struct platform_device cam_vt_cam15_fixed_rdev = {
  1014. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
  1015. .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
  1016. };
  1017. static struct regulator_consumer_supply cam_vdda_supply[] = {
  1018. REGULATOR_SUPPLY("vdda", "6-003c"),
  1019. REGULATOR_SUPPLY("a_sensor", "0-001f"),
  1020. };
  1021. static struct regulator_init_data cam_vdda_reg_init_data = {
  1022. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  1023. .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
  1024. .consumer_supplies = cam_vdda_supply,
  1025. };
  1026. static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
  1027. .supply_name = "CAM_IO_EN",
  1028. .microvolts = 2800000,
  1029. .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
  1030. .enable_high = 1,
  1031. .init_data = &cam_vdda_reg_init_data,
  1032. };
  1033. static struct platform_device cam_vdda_fixed_rdev = {
  1034. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
  1035. .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
  1036. };
  1037. static struct regulator_consumer_supply camera_8m_12v_supply =
  1038. REGULATOR_SUPPLY("dig_12", "0-001f");
  1039. static struct regulator_init_data cam_8m_12v_reg_init_data = {
  1040. .num_consumer_supplies = 1,
  1041. .consumer_supplies = &camera_8m_12v_supply,
  1042. .constraints = {
  1043. .valid_ops_mask = REGULATOR_CHANGE_STATUS
  1044. },
  1045. };
  1046. static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
  1047. .supply_name = "8M_1.2V",
  1048. .microvolts = 1200000,
  1049. .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
  1050. .enable_high = 1,
  1051. .init_data = &cam_8m_12v_reg_init_data,
  1052. };
  1053. static struct platform_device cam_8m_12v_fixed_rdev = {
  1054. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
  1055. .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
  1056. };
  1057. static struct s5p_platform_mipi_csis mipi_csis_platdata = {
  1058. .clk_rate = 166000000UL,
  1059. .lanes = 2,
  1060. .hs_settle = 12,
  1061. };
  1062. #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
  1063. #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
  1064. #define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
  1065. #define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
  1066. static struct s5k6aa_platform_data s5k6aa_pldata = {
  1067. .mclk_frequency = 24000000UL,
  1068. .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
  1069. .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
  1070. .bus_type = V4L2_MBUS_PARALLEL,
  1071. .horiz_flip = 1,
  1072. };
  1073. static struct i2c_board_info s5k6aa_board_info = {
  1074. I2C_BOARD_INFO("S5K6AA", 0x3c),
  1075. .platform_data = &s5k6aa_pldata,
  1076. };
  1077. static struct m5mols_platform_data m5mols_platdata = {
  1078. .gpio_reset = GPIO_CAM_MEGA_RST,
  1079. };
  1080. static struct i2c_board_info m5mols_board_info = {
  1081. I2C_BOARD_INFO("M5MOLS", 0x1F),
  1082. .platform_data = &m5mols_platdata,
  1083. };
  1084. static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
  1085. {
  1086. .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
  1087. V4L2_MBUS_VSYNC_ACTIVE_LOW,
  1088. .bus_type = FIMC_ITU_601,
  1089. .board_info = &s5k6aa_board_info,
  1090. .clk_frequency = 24000000UL,
  1091. .i2c_bus_num = 6,
  1092. }, {
  1093. .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
  1094. V4L2_MBUS_VSYNC_ACTIVE_LOW,
  1095. .bus_type = FIMC_MIPI_CSI2,
  1096. .board_info = &m5mols_board_info,
  1097. .clk_frequency = 24000000UL,
  1098. },
  1099. };
  1100. static struct s5p_platform_fimc fimc_md_platdata = {
  1101. .isp_info = nuri_camera_sensors,
  1102. .num_clients = ARRAY_SIZE(nuri_camera_sensors),
  1103. };
  1104. static struct gpio nuri_camera_gpios[] = {
  1105. { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
  1106. { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
  1107. { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
  1108. { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
  1109. };
  1110. static void __init nuri_camera_init(void)
  1111. {
  1112. s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
  1113. &s5p_device_mipi_csis0);
  1114. s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
  1115. &s5p_device_fimc_md);
  1116. if (gpio_request_array(nuri_camera_gpios,
  1117. ARRAY_SIZE(nuri_camera_gpios))) {
  1118. pr_err("%s: GPIO request failed\n", __func__);
  1119. return;
  1120. }
  1121. m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
  1122. if (!IS_ERR_VALUE(m5mols_board_info.irq))
  1123. s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
  1124. else
  1125. pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
  1126. /* Free GPIOs controlled directly by the sensor drivers. */
  1127. gpio_free(GPIO_CAM_VT_NRST);
  1128. gpio_free(GPIO_CAM_VT_NSTBY);
  1129. gpio_free(GPIO_CAM_MEGA_RST);
  1130. if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
  1131. pr_err("%s: Camera port A setup failed\n", __func__);
  1132. return;
  1133. }
  1134. /* Increase drive strength of the sensor clock output */
  1135. s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
  1136. }
  1137. static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
  1138. .frequency = 400000U,
  1139. .sda_delay = 200,
  1140. .bus_num = 6,
  1141. };
  1142. static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
  1143. .frequency = 400000U,
  1144. .sda_delay = 200,
  1145. };
  1146. /* DEVFREQ controlling memory/bus */
  1147. static struct platform_device exynos4_bus_devfreq = {
  1148. .name = "exynos4210-busfreq",
  1149. };
  1150. static struct platform_device *nuri_devices[] __initdata = {
  1151. /* Samsung Platform Devices */
  1152. &s3c_device_i2c5, /* PMIC should initialize first */
  1153. &s3c_device_i2c0,
  1154. &s3c_device_i2c6,
  1155. &emmc_fixed_voltage,
  1156. &s5p_device_mipi_csis0,
  1157. &s5p_device_fimc0,
  1158. &s5p_device_fimc1,
  1159. &s5p_device_fimc2,
  1160. &s5p_device_fimc3,
  1161. &s5p_device_fimd0,
  1162. &s3c_device_hsmmc0,
  1163. &s3c_device_hsmmc2,
  1164. &s3c_device_hsmmc3,
  1165. &s3c_device_wdt,
  1166. &s3c_device_timer[0],
  1167. &s5p_device_ehci,
  1168. &s3c_device_i2c3,
  1169. &i2c9_gpio,
  1170. &s3c_device_adc,
  1171. &s5p_device_g2d,
  1172. &s5p_device_jpeg,
  1173. &s3c_device_rtc,
  1174. &s5p_device_mfc,
  1175. &s5p_device_mfc_l,
  1176. &s5p_device_mfc_r,
  1177. &s5p_device_fimc_md,
  1178. &s3c_device_usb_hsotg,
  1179. /* NURI Devices */
  1180. &nuri_gpio_keys,
  1181. &nuri_lcd_device,
  1182. &nuri_backlight_device,
  1183. &max8903_fixed_reg_dev,
  1184. &nuri_max8903_device,
  1185. &cam_vt_cam15_fixed_rdev,
  1186. &cam_vdda_fixed_rdev,
  1187. &cam_8m_12v_fixed_rdev,
  1188. &exynos4_bus_devfreq,
  1189. #ifdef CONFIG_DRM_EXYNOS
  1190. &exynos_device_drm,
  1191. #endif
  1192. };
  1193. static void __init nuri_map_io(void)
  1194. {
  1195. exynos_init_io(NULL, 0);
  1196. s3c24xx_init_clocks(clk_xusbxti.rate);
  1197. s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
  1198. }
  1199. static void __init nuri_reserve(void)
  1200. {
  1201. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  1202. }
  1203. static void __init nuri_machine_init(void)
  1204. {
  1205. nuri_sdhci_init();
  1206. nuri_tsp_init();
  1207. nuri_power_init();
  1208. s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
  1209. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  1210. s3c_i2c3_set_platdata(&i2c3_data);
  1211. i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
  1212. s3c_i2c5_set_platdata(NULL);
  1213. i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
  1214. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  1215. i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
  1216. i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
  1217. s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
  1218. #ifdef CONFIG_DRM_EXYNOS
  1219. s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
  1220. exynos4_fimd0_gpio_setup_24bpp();
  1221. #else
  1222. s5p_fimd0_set_platdata(&nuri_fb_pdata);
  1223. #endif
  1224. nuri_camera_init();
  1225. nuri_ehci_init();
  1226. s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
  1227. /* Last */
  1228. platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
  1229. }
  1230. MACHINE_START(NURI, "NURI")
  1231. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  1232. .atag_offset = 0x100,
  1233. .smp = smp_ops(exynos_smp_ops),
  1234. .init_irq = exynos4_init_irq,
  1235. .map_io = nuri_map_io,
  1236. .handle_irq = gic_handle_irq,
  1237. .init_machine = nuri_machine_init,
  1238. .init_late = exynos_init_late,
  1239. .timer = &exynos4_timer,
  1240. .reserve = &nuri_reserve,
  1241. .restart = exynos4_restart,
  1242. MACHINE_END