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