mach-nuri.c 36 KB

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