mach-nuri.c 36 KB

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