mach-nuri.c 36 KB

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