mach-nuri.c 37 KB

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