/arch/arm/mach-msm/board-qrdc.c

https://bitbucket.org/sammyz/iscream_thunderc-2.6.35-rebase · C · 4213 lines · 3554 code · 458 blank · 201 comment · 246 complexity · 89f1b7783fc1bdce4c6c17cc22a92312 MD5 · raw file

Large files are truncated click here to view the full file

  1. /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. * 02110-1301, USA.
  16. *
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <linux/irq.h>
  22. #include <linux/io.h>
  23. #include <linux/mfd/pmic8058.h>
  24. #include <linux/mfd/bahama.h>
  25. #include <linux/input/pmic8058-keypad.h>
  26. #include <linux/pmic8058-pwrkey.h>
  27. #include <linux/pmic8058-vibrator.h>
  28. #include <linux/leds.h>
  29. #include <linux/pmic8058-othc.h>
  30. #include <linux/mfd/pmic8901.h>
  31. #include <linux/regulator/pmic8901-regulator.h>
  32. #include <linux/bootmem.h>
  33. #include <linux/pwm.h>
  34. #include <linux/pmic8058-pwm.h>
  35. #include <linux/leds-pmic8058.h>
  36. #include <linux/mfd/marimba.h>
  37. #include <linux/i2c.h>
  38. #include <linux/i2c/sx150x.h>
  39. #include <linux/smsc911x.h>
  40. #include <linux/spi/spi.h>
  41. #include <linux/input/tdisc_shinetsu.h>
  42. #include <linux/input/cy8c_ts.h>
  43. #include <linux/input/qci_kbd.h>
  44. #include <linux/mfd/wm8994/core.h>
  45. #include <linux/mfd/wm8994/pdata.h>
  46. #ifdef CONFIG_ANDROID_PMEM
  47. #include <linux/android_pmem.h>
  48. #endif
  49. #include <asm/mach-types.h>
  50. #include <asm/mach/arch.h>
  51. #include <asm/setup.h>
  52. #include <mach/mpp.h>
  53. #include <mach/board.h>
  54. #include <mach/irqs.h>
  55. #include <mach/msm_spi.h>
  56. #include <mach/msm_serial_hs.h>
  57. #include <mach/msm_iomap.h>
  58. #include <asm/mach/mmc.h>
  59. #include <mach/msm_battery.h>
  60. #include <mach/msm_hsusb.h>
  61. #include <mach/msm_xo.h>
  62. #include <mach/msm_bus_board.h>
  63. #include <mach/tpm_st_i2c.h>
  64. #include <mach/socinfo.h>
  65. #ifdef CONFIG_USB_ANDROID
  66. #include <linux/usb/android_composite.h>
  67. #endif
  68. #include <linux/regulator/consumer.h>
  69. #include <linux/regulator/machine.h>
  70. #include "devices.h"
  71. #include "devices-msm8x60.h"
  72. #include "cpuidle.h"
  73. #include "pm.h"
  74. #include "rpm.h"
  75. #include "mpm.h"
  76. #include "spm.h"
  77. #include "rpm_log.h"
  78. #include "timer.h"
  79. #include "saw-regulator.h"
  80. #include "rpm-regulator.h"
  81. #include "gpiomux.h"
  82. #include "gpiomux-8x60.h"
  83. #define MSM_SHARED_RAM_PHYS 0x40000000
  84. /* Macros assume PMIC GPIOs start at 0 */
  85. #define PM8058_GPIO_BASE NR_MSM_GPIOS
  86. #define PM8058_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + PM8058_GPIO_BASE)
  87. #define PM8058_GPIO_SYS_TO_PM(sys_gpio) (sys_gpio - PM8058_GPIO_BASE)
  88. #define PM8058_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
  89. #define PM8901_GPIO_BASE (PM8058_GPIO_BASE + \
  90. PM8058_GPIOS + PM8058_MPPS)
  91. #define PM8901_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio + PM8901_GPIO_BASE)
  92. #define PM8901_GPIO_SYS_TO_PM(sys_gpio) (sys_gpio - PM901_GPIO_BASE)
  93. #define PM8901_IRQ_BASE (PM8058_IRQ_BASE + \
  94. NR_PMIC8058_IRQS)
  95. #define GPIO_EXPANDER_GPIO_BASE \
  96. (PM8901_GPIO_BASE + PM8901_MPPS)
  97. #define GPIO_EXPANDER_IRQ_BASE (PM8901_IRQ_BASE + NR_PMIC8901_IRQS)
  98. /*
  99. * The UI_INTx_N lines are pmic gpio lines which connect i2c
  100. * gpio expanders to the pm8058.
  101. */
  102. #define UI_INT1_N 25
  103. #define UI_INT2_N 34
  104. #define UI_INT3_N 14
  105. static struct msm_spm_platform_data msm_spm_data[] __initdata = {
  106. [0] = {
  107. .reg_base_addr = MSM_SAW0_BASE,
  108. .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x0F,
  109. .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68,
  110. .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0xFFFFFFFF,
  111. .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFFFFFFFF,
  112. .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x01,
  113. .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07,
  114. .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00,
  115. .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01,
  116. .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00,
  117. .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00,
  118. .awake_vlevel = 0x9C,
  119. .retention_vlevel = 0x81,
  120. .collapse_vlevel = 0x20,
  121. .retention_mid_vlevel = 0x94,
  122. .collapse_mid_vlevel = 0x8C,
  123. .vctl_timeout_us = 50,
  124. },
  125. [1] = {
  126. .reg_base_addr = MSM_SAW1_BASE,
  127. .reg_init_values[MSM_SPM_REG_SAW_CFG] = 0x0F,
  128. .reg_init_values[MSM_SPM_REG_SAW_SPM_CTL] = 0x68,
  129. .reg_init_values[MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY] = 0xFFFFFFFF,
  130. .reg_init_values[MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY] = 0xFFFFFFFF,
  131. .reg_init_values[MSM_SPM_REG_SAW_SLP_CLK_EN] = 0x13,
  132. .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN] = 0x07,
  133. .reg_init_values[MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN] = 0x00,
  134. .reg_init_values[MSM_SPM_REG_SAW_SLP_CLMP_EN] = 0x01,
  135. .reg_init_values[MSM_SPM_REG_SAW_SLP_RST_EN] = 0x00,
  136. .reg_init_values[MSM_SPM_REG_SAW_SPM_MPM_CFG] = 0x00,
  137. .awake_vlevel = 0x9C,
  138. .retention_vlevel = 0x81,
  139. .collapse_vlevel = 0x20,
  140. .retention_mid_vlevel = 0x94,
  141. .collapse_mid_vlevel = 0x8C,
  142. .vctl_timeout_us = 50,
  143. },
  144. };
  145. static struct msm_acpu_clock_platform_data msm8x60_acpu_clock_data = {
  146. };
  147. static struct regulator_consumer_supply saw_s0_supply =
  148. REGULATOR_SUPPLY("8901_s0", NULL);
  149. static struct regulator_consumer_supply saw_s1_supply =
  150. REGULATOR_SUPPLY("8901_s1", NULL);
  151. static struct regulator_init_data saw_s0_init_data = {
  152. .constraints = {
  153. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  154. .min_uV = 840000,
  155. .max_uV = 1200000,
  156. },
  157. .num_consumer_supplies = 1,
  158. .consumer_supplies = &saw_s0_supply,
  159. };
  160. static struct regulator_init_data saw_s1_init_data = {
  161. .constraints = {
  162. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  163. .min_uV = 840000,
  164. .max_uV = 1200000,
  165. },
  166. .num_consumer_supplies = 1,
  167. .consumer_supplies = &saw_s1_supply,
  168. };
  169. static struct platform_device msm_device_saw_s0 = {
  170. .name = "saw-regulator",
  171. .id = SAW_VREG_ID_S0,
  172. .dev = {
  173. .platform_data = &saw_s0_init_data,
  174. },
  175. };
  176. static struct platform_device msm_device_saw_s1 = {
  177. .name = "saw-regulator",
  178. .id = SAW_VREG_ID_S1,
  179. .dev = {
  180. .platform_data = &saw_s1_init_data,
  181. },
  182. };
  183. static struct resource smsc911x_resources[] = {
  184. [0] = {
  185. .flags = IORESOURCE_MEM,
  186. .start = 0x1b800000,
  187. .end = 0x1b8000ff
  188. },
  189. [1] = {
  190. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  191. },
  192. };
  193. static struct smsc911x_platform_config smsc911x_config = {
  194. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  195. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  196. .flags = SMSC911X_USE_16BIT
  197. };
  198. static struct platform_device smsc911x_device = {
  199. .name = "smsc911x",
  200. .id = 0,
  201. .num_resources = ARRAY_SIZE(smsc911x_resources),
  202. .resource = smsc911x_resources,
  203. .dev = {
  204. .platform_data = &smsc911x_config
  205. }
  206. };
  207. static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
  208. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  209. .supported = 1,
  210. .suspend_enabled = 0,
  211. .idle_enabled = 0,
  212. .latency = 4000,
  213. .residency = 13000,
  214. },
  215. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  216. .supported = 1,
  217. .suspend_enabled = 0,
  218. .idle_enabled = 0,
  219. .latency = 500,
  220. .residency = 6000,
  221. },
  222. [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  223. .supported = 1,
  224. .suspend_enabled = 1,
  225. .idle_enabled = 1,
  226. .latency = 2,
  227. .residency = 0,
  228. },
  229. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
  230. .supported = 1,
  231. .suspend_enabled = 0,
  232. .idle_enabled = 0,
  233. .latency = 600,
  234. .residency = 7200,
  235. },
  236. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
  237. .supported = 1,
  238. .suspend_enabled = 0,
  239. .idle_enabled = 0,
  240. .latency = 500,
  241. .residency = 6000,
  242. },
  243. [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
  244. .supported = 1,
  245. .suspend_enabled = 1,
  246. .idle_enabled = 1,
  247. .latency = 2,
  248. .residency = 0,
  249. },
  250. };
  251. static struct msm_cpuidle_state msm_cstates[] __initdata = {
  252. {0, 0, "C0", "WFI",
  253. MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
  254. {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
  255. MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
  256. {0, 2, "C2", "POWER_COLLAPSE",
  257. MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
  258. {1, 0, "C0", "WFI",
  259. MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
  260. {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
  261. MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
  262. };
  263. #if defined(CONFIG_USB_GADGET_MSM_72K) || defined(CONFIG_USB_EHCI_MSM)
  264. static struct regulator *ldo6_3p3;
  265. static struct regulator *ldo7_1p8;
  266. static struct regulator *vdd_cx;
  267. static int msm_hsusb_ldo_init(int init)
  268. {
  269. if (init) {
  270. ldo6_3p3 = regulator_get(NULL, "8058_l6");
  271. if (IS_ERR(ldo6_3p3))
  272. return PTR_ERR(ldo6_3p3);
  273. ldo7_1p8 = regulator_get(NULL, "8058_l7");
  274. if (IS_ERR(ldo7_1p8)) {
  275. regulator_put(ldo6_3p3);
  276. return PTR_ERR(ldo7_1p8);
  277. }
  278. /*digital core voltage for usb phy*/
  279. vdd_cx = regulator_get(NULL, "8058_s1");
  280. if (IS_ERR(vdd_cx)) {
  281. regulator_put(ldo6_3p3);
  282. regulator_put(ldo7_1p8);
  283. return PTR_ERR(vdd_cx);
  284. }
  285. regulator_set_voltage(vdd_cx, 1000000, 1200000);
  286. regulator_set_voltage(ldo7_1p8, 1800000, 1800000);
  287. regulator_set_voltage(ldo6_3p3, 3050000, 3050000);
  288. } else {
  289. regulator_put(ldo6_3p3);
  290. regulator_put(ldo7_1p8);
  291. regulator_put(vdd_cx);
  292. }
  293. return 0;
  294. }
  295. static int msm_hsusb_ldo_enable(int on)
  296. {
  297. static int ldo_status;
  298. int ret = 0;
  299. if (!ldo7_1p8 || IS_ERR(ldo7_1p8)) {
  300. pr_err("%s: ldo7_1p8 is not initialized\n", __func__);
  301. return -ENODEV;
  302. }
  303. if (!ldo6_3p3 || IS_ERR(ldo6_3p3)) {
  304. pr_err("%s: ldo6_3p3 is not initialized\n", __func__);
  305. return -ENODEV;
  306. }
  307. if (!vdd_cx || IS_ERR(vdd_cx)) {
  308. pr_err("%s: vdd_cx is not initialized\n", __func__);
  309. return -ENODEV;
  310. }
  311. if (ldo_status == on)
  312. return 0;
  313. ldo_status = on;
  314. if (on) {
  315. ret = regulator_enable(ldo7_1p8);
  316. if (ret) {
  317. pr_err("%s: Unable to enable the regulator:"
  318. "ldo7_1p8\n", __func__);
  319. ldo_status = !on;
  320. return ret;
  321. }
  322. ret = regulator_enable(ldo6_3p3);
  323. if (ret) {
  324. pr_err("%s: Unable to enable the regulator:"
  325. "ldo6_3p3\n", __func__);
  326. regulator_disable(ldo7_1p8);
  327. ldo_status = !on;
  328. return ret;
  329. }
  330. ret = regulator_enable(vdd_cx);
  331. if (ret) {
  332. pr_err("%s: Unable to enable VDDCX digital core:"
  333. " vdd_dig\n", __func__);
  334. regulator_disable(ldo6_3p3);
  335. regulator_disable(ldo7_1p8);
  336. ldo_status = !on;
  337. return ret;
  338. }
  339. } else {
  340. /* calling regulator_disable when its already disabled might
  341. * * print WARN_ON. Trying to avoid it by regulator_is_enable
  342. * * */
  343. if (regulator_is_enabled(ldo6_3p3)) {
  344. ret = regulator_disable(ldo6_3p3);
  345. if (ret) {
  346. pr_err("%s: Unable to disable the regulator:"
  347. "ldo6_3p3\n", __func__);
  348. ldo_status = !on;
  349. return ret;
  350. }
  351. }
  352. if (regulator_is_enabled(ldo7_1p8)) {
  353. ret = regulator_disable(ldo7_1p8);
  354. if (ret) {
  355. pr_err("%s: Unable to enable the regulator:"
  356. " ldo7_1p8\n", __func__);
  357. ldo_status = !on;
  358. return ret;
  359. }
  360. }
  361. if (regulator_is_enabled(vdd_cx)) {
  362. ret = regulator_disable(vdd_cx);
  363. if (ret) {
  364. pr_err("%s: Unable to enable the regulator:"
  365. "vdd_cx\n", __func__);
  366. ldo_status = !on;
  367. return ret;
  368. }
  369. }
  370. }
  371. pr_debug("reg (%s)\n", on ? "ENABLED" : "DISABLED");
  372. return 0;
  373. }
  374. #endif
  375. #ifdef CONFIG_USB_EHCI_MSM
  376. static void msm_hsusb_vbus_power(unsigned phy_info, int on)
  377. {
  378. static struct regulator *votg_5v_switch;
  379. static struct regulator *ext_5v_reg;
  380. static int vbus_is_on;
  381. /* If VBUS is already on (or off), do nothing. */
  382. if (on == vbus_is_on)
  383. return;
  384. if (!votg_5v_switch) {
  385. votg_5v_switch = regulator_get(NULL, "8901_usb_otg");
  386. if (IS_ERR(votg_5v_switch)) {
  387. pr_err("%s: unable to get votg_5v_switch\n", __func__);
  388. return;
  389. }
  390. }
  391. if (!ext_5v_reg) {
  392. ext_5v_reg = regulator_get(NULL, "8901_mpp0");
  393. if (IS_ERR(ext_5v_reg)) {
  394. pr_err("%s: unable to get ext_5v_reg\n", __func__);
  395. return;
  396. }
  397. }
  398. if (on) {
  399. if (regulator_enable(ext_5v_reg)) {
  400. pr_err("%s: Unable to enable the regulator:"
  401. " ext_5v_reg\n", __func__);
  402. return;
  403. }
  404. if (regulator_enable(votg_5v_switch)) {
  405. pr_err("%s: Unable to enable the regulator:"
  406. " votg_5v_switch\n", __func__);
  407. return;
  408. }
  409. } else {
  410. if (regulator_disable(votg_5v_switch))
  411. pr_err("%s: Unable to enable the regulator:"
  412. " votg_5v_switch\n", __func__);
  413. if (regulator_disable(ext_5v_reg))
  414. pr_err("%s: Unable to enable the regulator:"
  415. " ext_5v_reg\n", __func__);
  416. }
  417. vbus_is_on = on;
  418. }
  419. static struct msm_usb_host_platform_data msm_usb_host_pdata = {
  420. .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
  421. .power_budget = 390,
  422. };
  423. #endif
  424. #if defined(CONFIG_BATTERY_MSM8X60) && !defined(CONFIG_USB_EHCI_MSM)
  425. static int msm_hsusb_pmic_vbus_notif_init(void (*callback)(int online),
  426. int init)
  427. {
  428. if (init) {
  429. /* TBD: right API will get filled here as a part of
  430. * PMIC chanrger patch and removes thsi comments.*/
  431. } else {
  432. /* TBD: right API will get filled here as a part of
  433. * PMIC chanrger patch and removes thsi comments.*/
  434. }
  435. return 0;
  436. }
  437. #endif
  438. #define USB_SWITCH_EN_GPIO 132 /* !CS of analog switch */
  439. #define USB_SWITCH_CNTL_GPIO 131 /* 0: Host, 1: Peripheral */
  440. #define USB_HUB_RESET_GPIO 34 /* 0: HUB is RESET */
  441. static int msm_otg_init_analog_switch_gpio(int on)
  442. {
  443. int rc = 0;
  444. if (on) {
  445. /* USB SWITCH ENABLE*/
  446. rc = gpio_request(USB_SWITCH_EN_GPIO, "USB_SWITCH_ENABLE");
  447. if (rc) {
  448. pr_err("%s: SW_EN gpio %d request failed\n", __func__,
  449. USB_SWITCH_EN_GPIO);
  450. return rc;
  451. }
  452. /* USB SWITCH CONTROL */
  453. rc = gpio_request(USB_SWITCH_CNTL_GPIO, "USB_SWITCH_CONTROL");
  454. if (rc) {
  455. pr_err("%s: SW_CNTL gpio %d request failed\n", __func__,
  456. USB_SWITCH_CNTL_GPIO);
  457. goto fail_gpio_usb_switch_en;
  458. }
  459. /* USB HUB RESET */
  460. rc = gpio_request(USB_HUB_RESET_GPIO, "USB_HUB_RESET");
  461. if (rc) {
  462. pr_err("%s: HUB_RESET gpio %d request failed\n",
  463. __func__, USB_HUB_RESET_GPIO);
  464. goto fail_gpio_usb_switch_cntl;
  465. }
  466. /* Set direction of USB SWITCH ENABLE gpio */
  467. rc = gpio_direction_output(USB_SWITCH_EN_GPIO, 0);
  468. if (rc) {
  469. pr_err("%s: gpio_direction_output failed for %d\n",
  470. __func__, USB_SWITCH_EN_GPIO);
  471. goto fail_gpio_usb_hub_reset;
  472. }
  473. /* Set direction of USB SWITCH CONTROL gpio */
  474. rc = gpio_direction_output(USB_SWITCH_CNTL_GPIO, 0);
  475. if (rc) {
  476. pr_err("%s: gpio_direction_output failed for %d\n",
  477. __func__, USB_SWITCH_CNTL_GPIO);
  478. goto fail_gpio_usb_hub_reset;
  479. }
  480. /* Set direction of USB HUB RESET gpio */
  481. rc = gpio_direction_output(USB_HUB_RESET_GPIO, 0);
  482. if (rc) {
  483. pr_err("%s: gpio_direction_output failed for %d\n",
  484. __func__, USB_HUB_RESET_GPIO);
  485. goto fail_gpio_usb_hub_reset;
  486. }
  487. return rc;
  488. }
  489. fail_gpio_usb_hub_reset:
  490. gpio_free(USB_HUB_RESET_GPIO);
  491. fail_gpio_usb_switch_cntl:
  492. gpio_free(USB_SWITCH_CNTL_GPIO);
  493. fail_gpio_usb_switch_en:
  494. gpio_free(USB_SWITCH_EN_GPIO);
  495. return rc;
  496. }
  497. static void msm_otg_setup_analog_switch_gpio(enum usb_switch_control mode)
  498. {
  499. switch (mode) {
  500. case USB_SWITCH_HOST:
  501. /* Configure analog switch as USB host. */
  502. gpio_set_value(USB_SWITCH_EN_GPIO, 0);
  503. gpio_set_value(USB_SWITCH_CNTL_GPIO, 0);
  504. /* Bring HUB out of RESET */
  505. gpio_set_value(USB_HUB_RESET_GPIO, 1);
  506. break;
  507. case USB_SWITCH_PERIPHERAL:
  508. /* Configure analog switch as USB peripheral. */
  509. gpio_set_value(USB_SWITCH_EN_GPIO, 0);
  510. gpio_set_value(USB_SWITCH_CNTL_GPIO, 1);
  511. gpio_set_value(USB_HUB_RESET_GPIO, 0);
  512. break;
  513. case USB_SWITCH_DISABLE:
  514. default:
  515. /* Disable Switch */
  516. gpio_set_value(USB_SWITCH_EN_GPIO, 1);
  517. gpio_set_value(USB_HUB_RESET_GPIO, 0);
  518. }
  519. }
  520. #if defined(CONFIG_USB_GADGET_MSM_72K) || defined(CONFIG_USB_EHCI_MSM)
  521. static struct msm_otg_platform_data msm_otg_pdata = {
  522. /* if usb link is in sps there is no need for
  523. * usb pclk as dayatona fabric clock will be
  524. * used instead
  525. */
  526. .usb_in_sps = 1,
  527. .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
  528. .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
  529. .se1_gating = SE1_GATING_DISABLE,
  530. .init_gpio = msm_otg_init_analog_switch_gpio,
  531. .setup_gpio = msm_otg_setup_analog_switch_gpio,
  532. #ifdef CONFIG_USB_EHCI_MSM
  533. .vbus_power = msm_hsusb_vbus_power,
  534. #endif
  535. #if defined(CONFIG_BATTERY_MSM8X60) && !defined(CONFIG_USB_EHCI_MSM)
  536. .pmic_vbus_notif_init = msm_hsusb_pmic_vbus_notif_init,
  537. #endif
  538. .otg_mode = OTG_USER_CONTROL,
  539. .usb_mode = USB_HOST_MODE,
  540. .ldo_init = msm_hsusb_ldo_init,
  541. .ldo_enable = msm_hsusb_ldo_enable,
  542. };
  543. #endif
  544. #ifdef CONFIG_USB_ANDROID
  545. static char *usb_functions_default[] = {
  546. "diag",
  547. "modem",
  548. "nmea",
  549. "rmnet",
  550. "usb_mass_storage",
  551. };
  552. static char *usb_functions_default_adb[] = {
  553. "diag",
  554. "adb",
  555. "modem",
  556. "nmea",
  557. "rmnet",
  558. "usb_mass_storage",
  559. };
  560. static char *usb_functions_rndis[] = {
  561. "rndis",
  562. };
  563. static char *usb_functions_rndis_adb[] = {
  564. "rndis",
  565. "adb",
  566. };
  567. static char *usb_functions_all[] = {
  568. #ifdef CONFIG_USB_ANDROID_RNDIS
  569. "rndis",
  570. #endif
  571. #ifdef CONFIG_USB_ANDROID_DIAG
  572. "diag",
  573. #endif
  574. "adb",
  575. #ifdef CONFIG_USB_F_SERIAL
  576. "modem",
  577. "nmea",
  578. #endif
  579. #ifdef CONFIG_USB_ANDROID_RMNET
  580. "rmnet",
  581. #endif
  582. "usb_mass_storage",
  583. #ifdef CONFIG_USB_ANDROID_ACM
  584. "acm",
  585. #endif
  586. };
  587. static struct android_usb_product usb_products[] = {
  588. {
  589. .product_id = 0x9026,
  590. .num_functions = ARRAY_SIZE(usb_functions_default),
  591. .functions = usb_functions_default,
  592. },
  593. {
  594. .product_id = 0x9025,
  595. .num_functions = ARRAY_SIZE(usb_functions_default_adb),
  596. .functions = usb_functions_default_adb,
  597. },
  598. {
  599. .product_id = 0xf00e,
  600. .num_functions = ARRAY_SIZE(usb_functions_rndis),
  601. .functions = usb_functions_rndis,
  602. },
  603. {
  604. .product_id = 0x9024,
  605. .num_functions = ARRAY_SIZE(usb_functions_rndis_adb),
  606. .functions = usb_functions_rndis_adb,
  607. },
  608. };
  609. static struct usb_mass_storage_platform_data mass_storage_pdata = {
  610. .nluns = 1,
  611. .vendor = "Qualcomm Incorporated",
  612. .product = "Mass storage",
  613. };
  614. static struct platform_device usb_mass_storage_device = {
  615. .name = "usb_mass_storage",
  616. .id = -1,
  617. .dev = {
  618. .platform_data = &mass_storage_pdata,
  619. },
  620. };
  621. static struct usb_ether_platform_data rndis_pdata = {
  622. /* ethaddr is filled by board_serialno_setup */
  623. .vendorID = 0x05C6,
  624. .vendorDescr = "Qualcomm Incorporated",
  625. };
  626. static struct platform_device rndis_device = {
  627. .name = "rndis",
  628. .id = -1,
  629. .dev = {
  630. .platform_data = &rndis_pdata,
  631. },
  632. };
  633. static struct android_usb_platform_data android_usb_pdata = {
  634. .vendor_id = 0x05C6,
  635. .product_id = 0x9026,
  636. .version = 0x0100,
  637. .product_name = "Qualcomm HSUSB Device",
  638. .manufacturer_name = "Qualcomm Incorporated",
  639. .num_products = ARRAY_SIZE(usb_products),
  640. .products = usb_products,
  641. .num_functions = ARRAY_SIZE(usb_functions_all),
  642. .functions = usb_functions_all,
  643. .serial_number = "1234567890ABCDEF",
  644. };
  645. static struct platform_device android_usb_device = {
  646. .name = "android_usb",
  647. .id = -1,
  648. .dev = {
  649. .platform_data = &android_usb_pdata,
  650. },
  651. };
  652. static int __init board_serialno_setup(char *serialno)
  653. {
  654. int i;
  655. char *src = serialno;
  656. /* create a fake MAC address from our serial number.
  657. * first byte is 0x02 to signify locally administered.
  658. */
  659. rndis_pdata.ethaddr[0] = 0x02;
  660. for (i = 0; *src; i++) {
  661. /* XOR the USB serial across the remaining bytes */
  662. rndis_pdata.ethaddr[i % (ETH_ALEN - 1) + 1] ^= *src++;
  663. }
  664. android_usb_pdata.serial_number = serialno;
  665. return 1;
  666. }
  667. __setup("androidboot.serialno=", board_serialno_setup);
  668. #endif
  669. #ifdef CONFIG_MSM_VPE
  670. static struct resource msm_vpe_resources[] = {
  671. {
  672. .start = 0x05300000,
  673. .end = 0x05300000 + SZ_1M - 1,
  674. .flags = IORESOURCE_MEM,
  675. },
  676. {
  677. .start = INT_VPE,
  678. .end = INT_VPE,
  679. .flags = IORESOURCE_IRQ,
  680. },
  681. };
  682. static struct platform_device msm_vpe_device = {
  683. .name = "msm_vpe",
  684. .id = 0,
  685. .num_resources = ARRAY_SIZE(msm_vpe_resources),
  686. .resource = msm_vpe_resources,
  687. };
  688. #endif
  689. #ifdef CONFIG_MSM_GEMINI
  690. static struct resource msm_gemini_resources[] = {
  691. {
  692. .start = 0x04600000,
  693. .end = 0x04600000 + SZ_1M - 1,
  694. .flags = IORESOURCE_MEM,
  695. },
  696. {
  697. .start = INT_JPEG,
  698. .end = INT_JPEG,
  699. .flags = IORESOURCE_IRQ,
  700. },
  701. };
  702. static struct platform_device msm_gemini_device = {
  703. .name = "msm_gemini",
  704. .resource = msm_gemini_resources,
  705. .num_resources = ARRAY_SIZE(msm_gemini_resources),
  706. };
  707. #endif
  708. #ifdef CONFIG_I2C_QUP
  709. static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
  710. {
  711. }
  712. static struct msm_i2c_platform_data msm_gsbi3_qup_i2c_pdata = {
  713. .clk_freq = 100000,
  714. .src_clk_rate = 24000000,
  715. .clk = "gsbi_qup_clk",
  716. .pclk = "gsbi_pclk",
  717. .use_gsbi_shared_mode = 1,
  718. .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
  719. };
  720. static struct msm_i2c_platform_data msm_gsbi4_qup_i2c_pdata = {
  721. .clk_freq = 100000,
  722. .src_clk_rate = 24000000,
  723. .clk = "gsbi_qup_clk",
  724. .pclk = "gsbi_pclk",
  725. .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
  726. };
  727. static struct msm_i2c_platform_data msm_gsbi7_qup_i2c_pdata = {
  728. .clk_freq = 100000,
  729. .src_clk_rate = 24000000,
  730. .clk = "gsbi_qup_clk",
  731. .pclk = "gsbi_pclk",
  732. .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
  733. };
  734. static struct msm_i2c_platform_data msm_gsbi8_qup_i2c_pdata = {
  735. .clk_freq = 100000,
  736. .src_clk_rate = 24000000,
  737. .clk = "gsbi_qup_clk",
  738. .pclk = "gsbi_pclk",
  739. .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
  740. };
  741. static struct msm_i2c_platform_data msm_gsbi9_qup_i2c_pdata = {
  742. .clk_freq = 100000,
  743. .src_clk_rate = 24000000,
  744. .clk = "gsbi_qup_clk",
  745. .pclk = "gsbi_pclk",
  746. .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
  747. };
  748. #endif
  749. #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE)
  750. static struct msm_spi_platform_data msm_gsbi1_qup_spi_pdata = {
  751. .max_clock_speed = 24000000,
  752. .clk_name = "gsbi_qup_clk",
  753. .pclk_name = "gsbi_pclk",
  754. };
  755. #endif
  756. #ifdef CONFIG_I2C_SSBI
  757. /* PMIC SSBI */
  758. static struct msm_ssbi_platform_data msm_ssbi1_pdata = {
  759. .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
  760. };
  761. /* PMIC SSBI */
  762. static struct msm_ssbi_platform_data msm_ssbi2_pdata = {
  763. .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
  764. };
  765. /* CODEC/TSSC SSBI */
  766. static struct msm_ssbi_platform_data msm_ssbi3_pdata = {
  767. .controller_type = MSM_SBI_CTRL_SSBI,
  768. };
  769. #endif
  770. #ifdef CONFIG_BATTERY_MSM
  771. /* Use basic value for fake MSM battery */
  772. static struct msm_psy_batt_pdata msm_psy_batt_data = {
  773. .avail_chg_sources = AC_CHG,
  774. };
  775. static struct platform_device msm_batt_device = {
  776. .name = "msm-battery",
  777. .id = -1,
  778. .dev.platform_data = &msm_psy_batt_data,
  779. };
  780. #endif
  781. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
  782. /* prim = 1366 (rounds up to 1376) x 768 x 4(bpp) x 2(pages)
  783. * hdmi = 1920 x 1080 x 2(bpp) x 1(page)
  784. * Note: must be multiple of 4096 */
  785. #define MSM_FB_SIZE 0xC08000
  786. #else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
  787. #define MSM_FB_SIZE 0x811000
  788. #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
  789. #define MSM_PMEM_SF_SIZE 0x1700000
  790. #define MSM_PMEM_KERNEL_EBI1_SIZE 0x600000
  791. #define MSM_PMEM_ADSP_SIZE 0x2000000
  792. #define MSM_SMI_BASE 0x38000000
  793. /* Kernel SMI PMEM Region for video core, used for Firmware */
  794. /* and encoder,decoder scratch buffers */
  795. /* Kernel SMI PMEM Region Should always precede the user space */
  796. /* SMI PMEM Region, as the video core will use offset address */
  797. /* from the Firmware base */
  798. #define PMEM_KERNEL_SMI_BASE (MSM_SMI_BASE)
  799. #define PMEM_KERNEL_SMI_SIZE 0x1000000
  800. /* User space SMI PMEM Region for video core*/
  801. /* used for encoder, decoder input & output buffers */
  802. #define MSM_PMEM_SMIPOOL_BASE (PMEM_KERNEL_SMI_BASE + PMEM_KERNEL_SMI_SIZE)
  803. #define MSM_PMEM_SMIPOOL_SIZE 0x2800000
  804. static unsigned fb_size = MSM_FB_SIZE;
  805. static int __init fb_size_setup(char *p)
  806. {
  807. fb_size = memparse(p, NULL);
  808. return 0;
  809. }
  810. early_param("fb_size", fb_size_setup);
  811. #ifdef CONFIG_KERNEL_PMEM_EBI_REGION
  812. static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
  813. static int __init pmem_kernel_ebi1_size_setup(char *p)
  814. {
  815. pmem_kernel_ebi1_size = memparse(p, NULL);
  816. return 0;
  817. }
  818. early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
  819. #endif
  820. #ifdef CONFIG_ANDROID_PMEM
  821. static unsigned pmem_sf_size = MSM_PMEM_SF_SIZE;
  822. static int __init pmem_sf_size_setup(char *p)
  823. {
  824. pmem_sf_size = memparse(p, NULL);
  825. return 0;
  826. }
  827. early_param("pmem_sf_size", pmem_sf_size_setup);
  828. static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
  829. static int __init pmem_adsp_size_setup(char *p)
  830. {
  831. pmem_adsp_size = memparse(p, NULL);
  832. return 0;
  833. }
  834. early_param("pmem_adsp_size", pmem_adsp_size_setup);
  835. #endif
  836. static struct resource msm_fb_resources[] = {
  837. {
  838. .flags = IORESOURCE_DMA,
  839. }
  840. };
  841. static int msm_fb_detect_panel(const char *name)
  842. {
  843. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
  844. if (!strcmp(name, "hdmi_msm"))
  845. return 0;
  846. #endif
  847. if (!strcmp(name, "lcdc_qrdc"))
  848. return 0;
  849. pr_warning("%s: not supported '%s'", __func__, name);
  850. return -ENODEV;
  851. }
  852. static void lcd_panel_power(int on);
  853. static int msm_fb_lcdc_gpio_config(int on);
  854. static int vga_enabled;
  855. static int vga_enable(int select_vga)
  856. {
  857. int rc = 0;
  858. vga_enabled = select_vga;
  859. rc = msm_fb_lcdc_gpio_config(1);
  860. if (rc)
  861. return rc;
  862. lcd_panel_power(1);
  863. return 0;
  864. }
  865. static struct msm_panel_common_pdata lcdc_qrdc_panel_data = {
  866. .vga_switch = vga_enable,
  867. };
  868. static struct platform_device lcdc_qrdc_panel_device = {
  869. .name = "lcdc_qrdc",
  870. .id = 0,
  871. .dev = {
  872. .platform_data = &lcdc_qrdc_panel_data,
  873. }
  874. };
  875. static struct msm_fb_platform_data msm_fb_pdata = {
  876. .detect_client = msm_fb_detect_panel,
  877. };
  878. static struct platform_device msm_fb_device = {
  879. .name = "msm_fb",
  880. .id = 0,
  881. .num_resources = ARRAY_SIZE(msm_fb_resources),
  882. .resource = msm_fb_resources,
  883. .dev = {
  884. .platform_data = &msm_fb_pdata,
  885. }
  886. };
  887. #ifdef CONFIG_KERNEL_PMEM_EBI_REGION
  888. static struct android_pmem_platform_data android_pmem_kernel_ebi1_pdata = {
  889. .name = PMEM_KERNEL_EBI1_DATA_NAME,
  890. .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
  891. .cached = 0,
  892. };
  893. static struct platform_device android_pmem_kernel_ebi1_device = {
  894. .name = "android_pmem",
  895. .id = 1,
  896. .dev = { .platform_data = &android_pmem_kernel_ebi1_pdata },
  897. };
  898. #endif
  899. #ifdef CONFIG_KERNEL_PMEM_SMI_REGION
  900. static struct android_pmem_platform_data android_pmem_kernel_smi_pdata = {
  901. .name = PMEM_KERNEL_SMI_DATA_NAME,
  902. /* defaults to bitmap don't edit */
  903. .cached = 0,
  904. };
  905. static struct platform_device android_pmem_kernel_smi_device = {
  906. .name = "android_pmem",
  907. .id = 6,
  908. .dev = { .platform_data = &android_pmem_kernel_smi_pdata },
  909. };
  910. #endif
  911. #ifdef CONFIG_ANDROID_PMEM
  912. static struct android_pmem_platform_data android_pmem_pdata = {
  913. .name = "pmem",
  914. .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
  915. .cached = 0,
  916. };
  917. static struct platform_device android_pmem_device = {
  918. .name = "android_pmem",
  919. .id = 0,
  920. .dev = {.platform_data = &android_pmem_pdata},
  921. };
  922. static struct android_pmem_platform_data android_pmem_adsp_pdata = {
  923. .name = "pmem_adsp",
  924. .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
  925. .cached = 0,
  926. };
  927. static struct platform_device android_pmem_adsp_device = {
  928. .name = "android_pmem",
  929. .id = 2,
  930. .dev = { .platform_data = &android_pmem_adsp_pdata },
  931. };
  932. static struct android_pmem_platform_data android_pmem_smipool_pdata = {
  933. .name = "pmem_smipool",
  934. .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
  935. .cached = 0,
  936. };
  937. static struct platform_device android_pmem_smipool_device = {
  938. .name = "android_pmem",
  939. .id = 7,
  940. .dev = { .platform_data = &android_pmem_smipool_pdata },
  941. };
  942. #endif
  943. #define GPIO_BACKLIGHT_PWM0 0
  944. #define GPIO_BACKLIGHT_PWM1 1
  945. static int pmic_backlight_gpio[2]
  946. = { GPIO_BACKLIGHT_PWM0, GPIO_BACKLIGHT_PWM1 };
  947. static struct msm_panel_common_pdata lcdc_samsung_panel_data = {
  948. .gpio_num = pmic_backlight_gpio, /* two LPG CHANNELS for backlight */
  949. };
  950. static struct platform_device lcdc_samsung_panel_device = {
  951. .name = "lcdc_samsung_wsvga",
  952. .id = 0,
  953. .dev = {
  954. .platform_data = &lcdc_samsung_panel_data,
  955. }
  956. };
  957. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
  958. static struct resource hdmi_msm_resources[] = {
  959. {
  960. .name = "hdmi_msm_qfprom_addr",
  961. .start = 0x00700000,
  962. .end = 0x007060FF,
  963. .flags = IORESOURCE_MEM,
  964. },
  965. {
  966. .name = "hdmi_msm_hdmi_addr",
  967. .start = 0x04A00000,
  968. .end = 0x04A00FFF,
  969. .flags = IORESOURCE_MEM,
  970. },
  971. {
  972. .name = "hdmi_msm_irq",
  973. .start = HDMI_IRQ,
  974. .end = HDMI_IRQ,
  975. .flags = IORESOURCE_IRQ,
  976. },
  977. };
  978. static int hdmi_enable_5v(int on);
  979. static int hdmi_core_power(int on, int show);
  980. static int hdmi_cec_power(int on);
  981. static struct msm_hdmi_platform_data hdmi_msm_data = {
  982. .irq = HDMI_IRQ,
  983. .enable_5v = hdmi_enable_5v,
  984. .core_power = hdmi_core_power,
  985. .cec_power = hdmi_cec_power,
  986. };
  987. static struct platform_device hdmi_msm_device = {
  988. .name = "hdmi_msm",
  989. .id = 0,
  990. .num_resources = ARRAY_SIZE(hdmi_msm_resources),
  991. .resource = hdmi_msm_resources,
  992. .dev.platform_data = &hdmi_msm_data,
  993. };
  994. #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
  995. static struct platform_device mipi_dsi_video_toshiba_wvga_panel_device = {
  996. .name = "dsi_video_toshiba_wvga",
  997. .id = 0,
  998. };
  999. static void __init msm8x60_allocate_memory_regions(void)
  1000. {
  1001. void *addr;
  1002. unsigned long size;
  1003. size = MSM_FB_SIZE;
  1004. addr = alloc_bootmem(size);
  1005. msm_fb_resources[0].start = __pa(addr);
  1006. msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
  1007. pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
  1008. size, addr, __pa(addr));
  1009. #ifdef CONFIG_KERNEL_PMEM_EBI_REGION
  1010. size = pmem_kernel_ebi1_size;
  1011. if (size) {
  1012. addr = alloc_bootmem_aligned(size, 0x100000);
  1013. android_pmem_kernel_ebi1_pdata.start = __pa(addr);
  1014. android_pmem_kernel_ebi1_pdata.size = size;
  1015. pr_info("allocating %lu bytes at %p (%lx physical) for kernel"
  1016. " ebi1 pmem arena\n", size, addr, __pa(addr));
  1017. }
  1018. #endif
  1019. #ifdef CONFIG_KERNEL_PMEM_SMI_REGION
  1020. size = PMEM_KERNEL_SMI_SIZE;
  1021. if (size) {
  1022. android_pmem_kernel_smi_pdata.start = PMEM_KERNEL_SMI_BASE;
  1023. android_pmem_kernel_smi_pdata.size = size;
  1024. pr_info("allocating %lu bytes at %lx physical for kernel"
  1025. " smi pmem arena\n", size,
  1026. (unsigned long) PMEM_KERNEL_SMI_BASE);
  1027. }
  1028. #endif
  1029. #ifdef CONFIG_ANDROID_PMEM
  1030. size = pmem_adsp_size;
  1031. if (size) {
  1032. addr = alloc_bootmem(size);
  1033. android_pmem_adsp_pdata.start = __pa(addr);
  1034. android_pmem_adsp_pdata.size = size;
  1035. pr_info("allocating %lu bytes at %p (%lx physical) for adsp "
  1036. "pmem arena\n", size, addr, __pa(addr));
  1037. }
  1038. size = MSM_PMEM_SMIPOOL_SIZE;
  1039. if (size) {
  1040. android_pmem_smipool_pdata.start = MSM_PMEM_SMIPOOL_BASE;
  1041. android_pmem_smipool_pdata.size = size;
  1042. pr_info("allocating %lu bytes at %lx physical for user"
  1043. " smi pmem arena\n", size,
  1044. (unsigned long) MSM_PMEM_SMIPOOL_BASE);
  1045. }
  1046. size = pmem_sf_size;
  1047. if (size) {
  1048. addr = alloc_bootmem(size);
  1049. android_pmem_pdata.start = __pa(addr);
  1050. android_pmem_pdata.size = size;
  1051. pr_info("allocating %lu bytes at %p (%lx physical) for sf "
  1052. "pmem arena\n", size, addr, __pa(addr));
  1053. }
  1054. #endif
  1055. }
  1056. #ifdef CONFIG_SERIAL_MSM_HS
  1057. static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
  1058. .inject_rx_on_wakeup = 1,
  1059. .rx_to_inject = 0xFD,
  1060. };
  1061. #endif
  1062. #if defined(CONFIG_MSM_RPM_LOG) || defined(CONFIG_MSM_RPM_LOG_MODULE)
  1063. static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
  1064. .phys_addr_base = 0x00106000,
  1065. .reg_offsets = {
  1066. [MSM_RPM_LOG_PAGE_INDICES] = 0x00000C80,
  1067. [MSM_RPM_LOG_PAGE_BUFFER] = 0x00000CA0,
  1068. },
  1069. .phys_size = SZ_8K,
  1070. .log_len = 4096, /* log's buffer length in bytes */
  1071. .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
  1072. };
  1073. static struct platform_device msm_rpm_log_device = {
  1074. .name = "msm_rpm_log",
  1075. .id = -1,
  1076. .dev = {
  1077. .platform_data = &msm_rpm_log_pdata,
  1078. },
  1079. };
  1080. #endif
  1081. static struct regulator_consumer_supply rpm_vreg_supply[RPM_VREG_ID_MAX] = {
  1082. [RPM_VREG_ID_PM8058_L0] = REGULATOR_SUPPLY("8058_l0", NULL),
  1083. [RPM_VREG_ID_PM8058_L1] = REGULATOR_SUPPLY("8058_l1", NULL),
  1084. [RPM_VREG_ID_PM8058_L2] = REGULATOR_SUPPLY("8058_l2", NULL),
  1085. [RPM_VREG_ID_PM8058_L3] = REGULATOR_SUPPLY("8058_l3", NULL),
  1086. [RPM_VREG_ID_PM8058_L4] = REGULATOR_SUPPLY("8058_l4", NULL),
  1087. [RPM_VREG_ID_PM8058_L5] = REGULATOR_SUPPLY("8058_l5", NULL),
  1088. [RPM_VREG_ID_PM8058_L6] = REGULATOR_SUPPLY("8058_l6", NULL),
  1089. [RPM_VREG_ID_PM8058_L7] = REGULATOR_SUPPLY("8058_l7", NULL),
  1090. [RPM_VREG_ID_PM8058_L8] = REGULATOR_SUPPLY("8058_l8", NULL),
  1091. [RPM_VREG_ID_PM8058_L9] = REGULATOR_SUPPLY("8058_l9", NULL),
  1092. [RPM_VREG_ID_PM8058_L10] = REGULATOR_SUPPLY("8058_l10", NULL),
  1093. [RPM_VREG_ID_PM8058_L11] = REGULATOR_SUPPLY("8058_l11", NULL),
  1094. [RPM_VREG_ID_PM8058_L12] = REGULATOR_SUPPLY("8058_l12", NULL),
  1095. [RPM_VREG_ID_PM8058_L13] = REGULATOR_SUPPLY("8058_l13", NULL),
  1096. [RPM_VREG_ID_PM8058_L14] = REGULATOR_SUPPLY("8058_l14", NULL),
  1097. [RPM_VREG_ID_PM8058_L15] = REGULATOR_SUPPLY("8058_l15", NULL),
  1098. [RPM_VREG_ID_PM8058_L16] = REGULATOR_SUPPLY("8058_l16", NULL),
  1099. [RPM_VREG_ID_PM8058_L17] = REGULATOR_SUPPLY("8058_l17", NULL),
  1100. [RPM_VREG_ID_PM8058_L18] = REGULATOR_SUPPLY("8058_l18", NULL),
  1101. [RPM_VREG_ID_PM8058_L19] = REGULATOR_SUPPLY("8058_l19", NULL),
  1102. [RPM_VREG_ID_PM8058_L20] = REGULATOR_SUPPLY("8058_l20", NULL),
  1103. [RPM_VREG_ID_PM8058_L21] = REGULATOR_SUPPLY("8058_l21", NULL),
  1104. [RPM_VREG_ID_PM8058_L22] = REGULATOR_SUPPLY("8058_l22", NULL),
  1105. [RPM_VREG_ID_PM8058_L23] = REGULATOR_SUPPLY("8058_l23", NULL),
  1106. [RPM_VREG_ID_PM8058_L24] = REGULATOR_SUPPLY("8058_l24", NULL),
  1107. [RPM_VREG_ID_PM8058_L25] = REGULATOR_SUPPLY("8058_l25", NULL),
  1108. [RPM_VREG_ID_PM8058_S0] = REGULATOR_SUPPLY("8058_s0", NULL),
  1109. [RPM_VREG_ID_PM8058_S1] = REGULATOR_SUPPLY("8058_s1", NULL),
  1110. [RPM_VREG_ID_PM8058_S2] = REGULATOR_SUPPLY("8058_s2", NULL),
  1111. [RPM_VREG_ID_PM8058_S3] = REGULATOR_SUPPLY("8058_s3", NULL),
  1112. [RPM_VREG_ID_PM8058_S4] = REGULATOR_SUPPLY("8058_s4", NULL),
  1113. [RPM_VREG_ID_PM8058_LVS0] = REGULATOR_SUPPLY("8058_lvs0", NULL),
  1114. [RPM_VREG_ID_PM8058_LVS1] = REGULATOR_SUPPLY("8058_lvs1", NULL),
  1115. [RPM_VREG_ID_PM8058_NCP] = REGULATOR_SUPPLY("8058_ncp", NULL),
  1116. [RPM_VREG_ID_PM8901_L0] = REGULATOR_SUPPLY("8901_l0", NULL),
  1117. [RPM_VREG_ID_PM8901_L1] = REGULATOR_SUPPLY("8901_l1", NULL),
  1118. [RPM_VREG_ID_PM8901_L2] = REGULATOR_SUPPLY("8901_l2", NULL),
  1119. [RPM_VREG_ID_PM8901_L3] = REGULATOR_SUPPLY("8901_l3", NULL),
  1120. [RPM_VREG_ID_PM8901_L4] = REGULATOR_SUPPLY("8901_l4", NULL),
  1121. [RPM_VREG_ID_PM8901_L5] = REGULATOR_SUPPLY("8901_l5", NULL),
  1122. [RPM_VREG_ID_PM8901_L6] = REGULATOR_SUPPLY("8901_l6", NULL),
  1123. [RPM_VREG_ID_PM8901_S2] = REGULATOR_SUPPLY("8901_s2", NULL),
  1124. [RPM_VREG_ID_PM8901_S3] = REGULATOR_SUPPLY("8901_s3", NULL),
  1125. [RPM_VREG_ID_PM8901_S4] = REGULATOR_SUPPLY("8901_s4", NULL),
  1126. [RPM_VREG_ID_PM8901_LVS0] = REGULATOR_SUPPLY("8901_lvs0", NULL),
  1127. [RPM_VREG_ID_PM8901_LVS1] = REGULATOR_SUPPLY("8901_lvs1", NULL),
  1128. [RPM_VREG_ID_PM8901_LVS2] = REGULATOR_SUPPLY("8901_lvs2", NULL),
  1129. [RPM_VREG_ID_PM8901_LVS3] = REGULATOR_SUPPLY("8901_lvs3", NULL),
  1130. [RPM_VREG_ID_PM8901_MVS0] = REGULATOR_SUPPLY("8901_mvs0", NULL),
  1131. };
  1132. #define RPM_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
  1133. _default_uV, _peak_uA, _avg_uA, _pull_down, _pin_ctrl, \
  1134. _freq, _pin_fn, _rpm_mode, _state, _sleep_selectable, \
  1135. _always_on) \
  1136. [RPM_VREG_ID_##_id] = { \
  1137. .init_data = { \
  1138. .constraints = { \
  1139. .valid_modes_mask = _modes, \
  1140. .valid_ops_mask = _ops, \
  1141. .min_uV = _min_uV, \
  1142. .max_uV = _max_uV, \
  1143. .input_uV = _min_uV, \
  1144. .apply_uV = _apply_uV, \
  1145. .always_on = _always_on, \
  1146. }, \
  1147. .num_consumer_supplies = 1, \
  1148. .consumer_supplies = \
  1149. &rpm_vreg_supply[RPM_VREG_ID_##_id], \
  1150. }, \
  1151. .default_uV = _default_uV, \
  1152. .peak_uA = _peak_uA, \
  1153. .avg_uA = _avg_uA, \
  1154. .pull_down_enable = _pull_down, \
  1155. .pin_ctrl = _pin_ctrl, \
  1156. .freq = _freq, \
  1157. .pin_fn = _pin_fn, \
  1158. .mode = _rpm_mode, \
  1159. .state = _state, \
  1160. .sleep_selectable = _sleep_selectable, \
  1161. }
  1162. /*
  1163. * The default LPM/HPM state of an RPM controlled regulator can be controlled
  1164. * via the peak_uA value specified in the table below. If the value is less
  1165. * than the low power threshold for the regulator, then the regulator will be
  1166. * set to LPM. Otherwise, it will be set to HPM.
  1167. *
  1168. * This value can be further overridden by specifying an initial mode via
  1169. * .init_data.constraints.initial_mode.
  1170. */
  1171. #define RPM_VREG_INIT_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, \
  1172. _max_uV, _init_peak_uA, _pin_ctrl) \
  1173. RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_FAST | \
  1174. REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | \
  1175. REGULATOR_MODE_STANDBY, REGULATOR_CHANGE_VOLTAGE | \
  1176. REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
  1177. REGULATOR_CHANGE_DRMS, 0, _min_uV, _init_peak_uA, \
  1178. _init_peak_uA, _pd, _pin_ctrl, RPM_VREG_FREQ_NONE, \
  1179. RPM_VREG_PIN_FN_ENABLE, RPM_VREG_MODE_NONE, \
  1180. RPM_VREG_STATE_OFF, _sleep_selectable, _always_on)
  1181. #define RPM_VREG_INIT_LDO_PF(_id, _always_on, _pd, _sleep_selectable, _min_uV, \
  1182. _max_uV, _init_peak_uA, _pin_ctrl, _pin_fn) \
  1183. RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_FAST | \
  1184. REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | \
  1185. REGULATOR_MODE_STANDBY, REGULATOR_CHANGE_VOLTAGE | \
  1186. REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
  1187. REGULATOR_CHANGE_DRMS, 0, _min_uV, _init_peak_uA, \
  1188. _init_peak_uA, _pd, _pin_ctrl, RPM_VREG_FREQ_NONE, \
  1189. _pin_fn, RPM_VREG_MODE_NONE, RPM_VREG_STATE_OFF, \
  1190. _sleep_selectable, _always_on)
  1191. #define RPM_VREG_INIT_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, \
  1192. _max_uV, _init_peak_uA, _pin_ctrl, _freq) \
  1193. RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_FAST | \
  1194. REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | \
  1195. REGULATOR_MODE_STANDBY, REGULATOR_CHANGE_VOLTAGE | \
  1196. REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
  1197. REGULATOR_CHANGE_DRMS, 0, _min_uV, _init_peak_uA, \
  1198. _init_peak_uA, _pd, _pin_ctrl, _freq, \
  1199. RPM_VREG_PIN_FN_ENABLE, RPM_VREG_MODE_NONE, \
  1200. RPM_VREG_STATE_OFF, _sleep_selectable, _always_on)
  1201. #define RPM_VREG_INIT_VS(_id, _always_on, _pd, _sleep_selectable, _pin_ctrl) \
  1202. RPM_VREG_INIT(_id, 0, 0, REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE, \
  1203. REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE, 0, 0, \
  1204. 1000, 1000, _pd, _pin_ctrl, RPM_VREG_FREQ_NONE, \
  1205. RPM_VREG_PIN_FN_ENABLE, RPM_VREG_MODE_NONE, \
  1206. RPM_VREG_STATE_OFF, _sleep_selectable, _always_on)
  1207. #define RPM_VREG_INIT_NCP(_id, _always_on, _pd, _sleep_selectable, _min_uV, \
  1208. _max_uV, _pin_ctrl) \
  1209. RPM_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
  1210. REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, \
  1211. _min_uV, 1000, 1000, _pd, _pin_ctrl, RPM_VREG_FREQ_NONE, \
  1212. RPM_VREG_PIN_FN_ENABLE, RPM_VREG_MODE_NONE, \
  1213. RPM_VREG_STATE_OFF, _sleep_selectable, _always_on)
  1214. #define LDO50HMIN RPM_VREG_LDO_50_HPM_MIN_LOAD
  1215. #define LDO150HMIN RPM_VREG_LDO_150_HPM_MIN_LOAD
  1216. #define LDO300HMIN RPM_VREG_LDO_300_HPM_MIN_LOAD
  1217. #define SMPS_HMIN RPM_VREG_SMPS_HPM_MIN_LOAD
  1218. #define FTS_HMIN RPM_VREG_FTSMPS_HPM_MIN_LOAD
  1219. static struct rpm_vreg_pdata rpm_vreg_init_pdata[RPM_VREG_ID_MAX] = {
  1220. RPM_VREG_INIT_LDO_PF(PM8058_L0, 0, 1, 0, 1200000, 1200000, LDO150HMIN,
  1221. RPM_VREG_PIN_CTRL_NONE, RPM_VREG_PIN_FN_SLEEP_B),
  1222. RPM_VREG_INIT_LDO(PM8058_L1, 0, 1, 0, 1200000, 1200000, LDO300HMIN, 0),
  1223. RPM_VREG_INIT_LDO(PM8058_L2, 0, 1, 0, 1800000, 2600000, LDO300HMIN, 0),
  1224. RPM_VREG_INIT_LDO(PM8058_L3, 0, 1, 0, 1800000, 1800000, LDO150HMIN, 0),
  1225. RPM_VREG_INIT_LDO(PM8058_L4, 0, 1, 0, 2850000, 2850000, LDO50HMIN, 0),
  1226. RPM_VREG_INIT_LDO(PM8058_L5, 0, 1, 0, 2850000, 2850000, LDO300HMIN, 0),
  1227. RPM_VREG_INIT_LDO(PM8058_L6, 0, 1, 0, 3000000, 3600000, LDO50HMIN, 0),
  1228. RPM_VREG_INIT_LDO(PM8058_L7, 0, 1, 0, 1800000, 1800000, LDO50HMIN, 0),
  1229. RPM_VREG_INIT_LDO(PM8058_L8, 0, 1, 0, 2900000, 3050000, LDO300HMIN, 0),
  1230. RPM_VREG_INIT_LDO(PM8058_L9, 0, 1, 0, 1800000, 1800000, LDO300HMIN, 0),
  1231. RPM_VREG_INIT_LDO(PM8058_L10, 0, 1, 0, 2600000, 2600000, LDO300HMIN, 0),
  1232. RPM_VREG_INIT_LDO(PM8058_L11, 0, 1, 0, 1500000, 1500000, LDO150HMIN, 0),
  1233. RPM_VREG_INIT_LDO(PM8058_L12, 0, 1, 0, 2900000, 2900000, LDO150HMIN, 0),
  1234. RPM_VREG_INIT_LDO(PM8058_L13, 0, 1, 0, 2050000, 2050000, LDO300HMIN, 0),
  1235. RPM_VREG_INIT_LDO(PM8058_L14, 0, 0, 0, 2850000, 2850000, LDO300HMIN, 0),
  1236. RPM_VREG_INIT_LDO(PM8058_L15, 0, 1, 0, 2850000, 2850000, LDO300HMIN, 0),
  1237. RPM_VREG_INIT_LDO(PM8058_L16, 1, 1, 1, 1800000, 1800000, LDO300HMIN, 0),
  1238. RPM_VREG_INIT_LDO(PM8058_L17, 0, 1, 0, 2600000, 2600000, LDO150HMIN, 0),
  1239. RPM_VREG_INIT_LDO(PM8058_L18, 0, 1, 1, 2200000, 2200000, LDO150HMIN, 0),
  1240. RPM_VREG_INIT_LDO(PM8058_L19, 0, 1, 0, 2500000, 2500000, LDO150HMIN, 0),
  1241. RPM_VREG_INIT_LDO(PM8058_L20, 0, 1, 0, 1800000, 1800000, LDO150HMIN, 0),
  1242. RPM_VREG_INIT_LDO_PF(PM8058_L21, 1, 1, 0, 1200000, 1200000, LDO150HMIN,
  1243. RPM_VREG_PIN_CTRL_NONE, RPM_VREG_PIN_FN_SLEEP_B),
  1244. RPM_VREG_INIT_LDO(PM8058_L22, 0, 1, 0, 1200000, 1200000, LDO300HMIN, 0),
  1245. RPM_VREG_INIT_LDO(PM8058_L23, 0, 1, 0, 1200000, 1200000, LDO300HMIN, 0),
  1246. RPM_VREG_INIT_LDO(PM8058_L24, 0, 1, 0, 1200000, 1200000, LDO150HMIN, 0),
  1247. RPM_VREG_INIT_LDO(PM8058_L25, 0, 1, 0, 1200000, 1200000, LDO150HMIN, 0),
  1248. RPM_VREG_INIT_SMPS(PM8058_S0, 0, 1, 1, 500000, 1200000, SMPS_HMIN, 0,
  1249. RPM_VREG_FREQ_1p75),
  1250. RPM_VREG_INIT_SMPS(PM8058_S1, 0, 1, 1, 500000, 1200000, SMPS_HMIN, 0,
  1251. RPM_VREG_FREQ_1p75),
  1252. RPM_VREG_INIT_SMPS(PM8058_S2, 0, 1, 0, 1200000, 1400000, SMPS_HMIN,
  1253. RPM_VREG_PIN_CTRL_A0, RPM_VREG_FREQ_1p75),
  1254. RPM_VREG_INIT_SMPS(PM8058_S3, 1, 1, 0, 1800000, 1800000, SMPS_HMIN, 0,
  1255. RPM_VREG_FREQ_1p75),
  1256. RPM_VREG_INIT_SMPS(PM8058_S4, 1, 1, 0, 2200000, 2200000, SMPS_HMIN, 0,
  1257. RPM_VREG_FREQ_1p75),
  1258. RPM_VREG_INIT_VS(PM8058_LVS0, 0, 1, 0, 0),
  1259. RPM_VREG_INIT_VS(PM8058_LVS1, 0, 1, 0, 0),
  1260. RPM_VREG_INIT_NCP(PM8058_NCP, 0, 1, 0, 1800000, 1800000, 0),
  1261. RPM_VREG_INIT_LDO(PM8901_L0, 0, 1, 0, 1200000, 1200000, LDO300HMIN,
  1262. RPM_VREG_PIN_CTRL_A0),
  1263. RPM_VREG_INIT_LDO(PM8901_L1, 0, 1, 0, 3300000, 3300000, LDO300HMIN, 0),
  1264. RPM_VREG_INIT_LDO(PM8901_L2, 0, 1, 0, 2850000, 3300000, LDO300HMIN, 0),
  1265. RPM_VREG_INIT_LDO(PM8901_L3, 0, 1, 0, 3300000, 3300000, LDO300HMIN, 0),
  1266. RPM_VREG_INIT_LDO(PM8901_L4, 0, 1, 0, 2600000, 2600000, LDO300HMIN, 0),
  1267. RPM_VREG_INIT_LDO(PM8901_L5, 0, 1, 0, 2850000, 2850000, LDO300HMIN, 0),
  1268. RPM_VREG_INIT_LDO(PM8901_L6, 0, 1, 0, 2200000, 2200000, LDO300HMIN, 0),
  1269. RPM_VREG_INIT_SMPS(PM8901_S2, 0, 1, 0, 1300000, 1300000, FTS_HMIN, 0,
  1270. RPM_VREG_FREQ_1p75),
  1271. RPM_VREG_INIT_SMPS(PM8901_S3, 0, 1, 0, 1100000, 1100000, FTS_HMIN, 0,
  1272. RPM_VREG_FREQ_1p75),
  1273. RPM_VREG_INIT_SMPS(PM8901_S4, 0, 1, 0, 1225000, 1225000, FTS_HMIN,
  1274. RPM_VREG_PIN_CTRL_A0, RPM_VREG_FREQ_1p75),
  1275. RPM_VREG_INIT_VS(PM8901_LVS0, 1, 1, 0, 0),
  1276. RPM_VREG_INIT_VS(PM8901_LVS1, 0, 1, 0, 0),
  1277. RPM_VREG_INIT_VS(PM8901_LVS2, 0, 1, 0, 0),
  1278. RPM_VREG_INIT_VS(PM8901_LVS3, 0, 1, 0, 0),
  1279. RPM_VREG_INIT_VS(PM8901_MVS0, 0, 1, 0, 0),
  1280. };
  1281. #define RPM_VREG(_id) \
  1282. [_id] = { \
  1283. .name = "rpm-regulator", \
  1284. .id = _id, \
  1285. .dev = { \
  1286. .platform_data = &rpm_vreg_init_pdata[_id], \
  1287. }, \
  1288. }
  1289. static struct platform_device rpm_vreg_device[RPM_VREG_ID_MAX] = {
  1290. RPM_VREG(RPM_VREG_ID_PM8058_L0),
  1291. RPM_VREG(RPM_VREG_ID_PM8058_L1),
  1292. RPM_VREG(RPM_VREG_ID_PM8058_L2),
  1293. RPM_VREG(RPM_VREG_ID_PM8058_L3),
  1294. RPM_VREG(RPM_VREG_ID_PM8058_L4),
  1295. RPM_VREG(RPM_VREG_ID_PM8058_L5),
  1296. RPM_VREG(RPM_VREG_ID_PM8058_L6),
  1297. RPM_VREG(RPM_VREG_ID_PM8058_L7),
  1298. RPM_VREG(RPM_VREG_ID_PM8058_L8),
  1299. RPM_VREG(RPM_VREG_ID_PM8058_L9),
  1300. RPM_VREG(RPM_VREG_ID_PM8058_L10),
  1301. RPM_VREG(RPM_VREG_ID_PM8058_L11),
  1302. RPM_VREG(RPM_VREG_ID_PM8058_L12),
  1303. RPM_VREG(RPM_VREG_ID_PM8058_L13),
  1304. RPM_VREG(RPM_VREG_ID_PM8058_L14),
  1305. RPM_VREG(RPM_VREG_ID_PM8058_L15),
  1306. RPM_VREG(RPM_VREG_ID_PM8058_L16),
  1307. RPM_VREG(RPM_VREG_ID_PM8058_L17),
  1308. RPM_VREG(RPM_VREG_ID_PM8058_L18),
  1309. RPM_VREG(RPM_VREG_ID_PM8058_L19),
  1310. RPM_VREG(RPM_VREG_ID_PM8058_L20),
  1311. RPM_VREG(RPM_VREG_ID_PM8058_L21),
  1312. RPM_VREG(RPM_VREG_ID_PM8058_L22),
  1313. RPM_VREG(RPM_VREG_ID_PM8058_L23),
  1314. RPM_VREG(RPM_VREG_ID_PM8058_L24),
  1315. RPM_VREG(RPM_VREG_ID_PM8058_L25),
  1316. RPM_VREG(RPM_VREG_ID_PM8058_S0),
  1317. RPM_VREG(RPM_VREG_ID_PM8058_S1),
  1318. RPM_VREG(RPM_VREG_ID_PM8058_S2),
  1319. RPM_VREG(RPM_VREG_ID_PM8058_S3),
  1320. RPM_VREG(RPM_VREG_ID_PM8058_S4),
  1321. RPM_VREG(RPM_VREG_ID_PM8058_LVS0),
  1322. RPM_VREG(RPM_VREG_ID_PM8058_LVS1),
  1323. RPM_VREG(RPM_VREG_ID_PM8058_NCP),
  1324. RPM_VREG(RPM_VREG_ID_PM8901_L0),
  1325. RPM_VREG(RPM_VREG_ID_PM8901_L1),
  1326. RPM_VREG(RPM_VREG_ID_PM8901_L2),
  1327. RPM_VREG(RPM_VREG_ID_PM8901_L3),
  1328. RPM_VREG(RPM_VREG_ID_PM8901_L4),
  1329. RPM_VREG(RPM_VREG_ID_PM8901_L5),
  1330. RPM_VREG(RPM_VREG_ID_PM8901_L6),
  1331. RPM_VREG(RPM_VREG_ID_PM8901_S2),
  1332. RPM_VREG(RPM_VREG_ID_PM8901_S3),
  1333. RPM_VREG(RPM_VREG_ID_PM8901_S4),
  1334. RPM_VREG(RPM_VREG_ID_PM8901_LVS0),
  1335. RPM_VREG(RPM_VREG_ID_PM8901_LVS1),
  1336. RPM_VREG(RPM_VREG_ID_PM8901_LVS2),
  1337. RPM_VREG(RPM_VREG_ID_PM8901_LVS3),
  1338. RPM_VREG(RPM_VREG_ID_PM8901_MVS0),
  1339. };
  1340. static struct platform_device *early_regulators[] __initdata = {
  1341. &msm_device_saw_s0,
  1342. &msm_device_saw_s1,
  1343. #ifdef CONFIG_PMIC8058
  1344. &rpm_vreg_device[RPM_VREG_ID_PM8058_S0],
  1345. &rpm_vreg_device[RPM_VREG_ID_PM8058_S1],
  1346. #endif
  1347. };
  1348. static struct platform_device *early_devices[] __initdata = {
  1349. #ifdef CONFIG_MSM_BUS_SCALING
  1350. &msm_bus_apps_fabric,
  1351. &msm_bus_sys_fabric,
  1352. &msm_bus_mm_fabric,
  1353. &msm_bus_sys_fpb,
  1354. &msm_bus_cpss_fpb,
  1355. #endif
  1356. };
  1357. static struct resource msm_aux_pcm_resources[] = {
  1358. {
  1359. .name = "aux_pcm_dout",
  1360. .start = 111,
  1361. .end = 111,
  1362. .flags = IORESOURCE_IO,
  1363. },
  1364. {
  1365. .name = "aux_pcm_din",
  1366. .start = 112,
  1367. .end = 112,
  1368. .flags = IORESOURCE_IO,
  1369. },
  1370. {
  1371. .name = "aux_pcm_syncout",
  1372. .start = 113,
  1373. .end = 113,
  1374. .flags = IORESOURCE_IO,
  1375. },
  1376. {
  1377. .name = "aux_pcm_clkin_a",
  1378. .start = 114,
  1379. .end = 114,
  1380. .flags = IORESOURCE_IO,
  1381. },
  1382. };
  1383. static struct platform_device msm_aux_pcm_device = {
  1384. .name = "msm_aux_pcm",
  1385. .id = 0,
  1386. .num_resources = ARRAY_SIZE(msm_aux_pcm_resources),
  1387. .resource = msm_aux_pcm_resources,
  1388. };
  1389. static struct platform_device *qrdc_devices[] __initdata = {
  1390. &msm_device_smd,
  1391. &smsc911x_device,
  1392. &msm_device_uart_dm3,
  1393. #ifdef CONFIG_I2C_QUP
  1394. &msm_gsbi3_qup_i2c_device,
  1395. &msm_gsbi4_qup_i2c_device,
  1396. &msm_gsbi7_qup_i2c_device,
  1397. &msm_gsbi8_qup_i2c_device,
  1398. &msm_gsbi9_qup_i2c_device,
  1399. #endif
  1400. #if defined(CONFIG_SPI_QUP) || defined(CONFIG_SPI_QUP_MODULE)
  1401. &msm_gsbi1_qup_spi_device,
  1402. #endif
  1403. #ifdef CONFIG_SERIAL_MSM_HS
  1404. &msm_device_uart_dm1,
  1405. #endif
  1406. #ifdef CONFIG_I2C_SSBI
  1407. &msm_device_ssbi1,
  1408. &msm_device_ssbi2,
  1409. &msm_device_ssbi3,
  1410. #endif
  1411. #if defined(CONFIG_USB_GADGET_MSM_72K) || defined(CONFIG_USB_EHCI_HCD)
  1412. &msm_device_otg,
  1413. #endif
  1414. #ifdef CONFIG_USB_GADGET_MSM_72K
  1415. &msm_device_gadget_peripheral,
  1416. #endif
  1417. #ifdef CONFIG_USB_ANDROID
  1418. &usb_mass_storage_device,
  1419. &rndis_device,
  1420. &android_usb_device,
  1421. #endif
  1422. #ifdef CONFIG_BATTERY_MSM
  1423. &msm_batt_device,
  1424. #endif
  1425. #ifdef CONFIG_KERNEL_PMEM_EBI_REGION
  1426. &android_pmem_kernel_ebi1_device,
  1427. #endif
  1428. #ifdef CONFIG_KERNEL_PMEM_SMI_REGION
  1429. &android_pmem_kernel_smi_device,
  1430. #endif
  1431. #ifdef CONFIG_ANDROID_PMEM
  1432. &android_pmem_device,
  1433. &android_pmem_adsp_device,
  1434. &android_pmem_smipool_device,
  1435. #endif
  1436. #ifdef CONFIG_MSM_ROTATOR
  1437. &msm_rotator_device,
  1438. #endif
  1439. &msm_fb_device,
  1440. &lcdc_qrdc_panel_device,
  1441. &msm_device_kgsl,
  1442. &lcdc_samsung_panel_device,
  1443. #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
  1444. &hdmi_msm_device,
  1445. #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
  1446. &mipi_dsi_video_toshiba_wvga_panel_device,
  1447. #ifdef CONFIG_MSM_GEMINI
  1448. &msm_gemini_device,
  1449. #endif
  1450. #ifdef CONFIG_MSM_VPE
  1451. &msm_vpe_device,
  1452. #endif
  1453. #if defined(CONFIG_MSM_RPM_LOG) || defined(CONFIG_MSM_RPM_LOG_MODULE)
  1454. &msm_rpm_log_device,
  1455. #endif
  1456. &msm_device_vidc,
  1457. &msm_aux_pcm_device,
  1458. #ifdef CONFIG_PMIC8058
  1459. &rpm_vreg_device[RPM_VREG_ID_PM8058_L0],
  1460. &rpm_vreg_device[RPM_VREG_ID_PM8058_L1],
  1461. &rpm_vreg_device[RPM_VREG_ID_PM8058_L2],
  1462. &rpm_vreg_device[RPM_VREG_ID_PM8058_L3],
  1463. &rpm_vreg_device[RPM_VREG_ID_PM8058_L4],
  1464. &rpm_vreg_device[RPM_VREG_ID_PM8058_L5],
  1465. &rpm_vreg_device[RPM_VREG_ID_PM8058_L6],
  1466. &rpm_vreg_device[RPM_VREG_ID_PM8058_L7],
  1467. &rpm_vreg_device[RPM_VREG_ID_PM8058_L8],
  1468. &rpm_vreg_device[RPM_VREG_ID_PM8058_L9],
  1469. &rpm_vreg_device[RPM_VREG_ID_PM8058_L10],
  1470. &rpm_vreg_device[RPM_VREG_ID_PM8058_L11],
  1471. &rpm_vreg_device[RPM_VREG_ID_PM8058_L12],
  1472. &rpm_vreg_device[RPM_VREG_ID_PM8058_L13],
  1473. &rpm_vreg_device[RPM_VREG_ID_PM8058_L14],
  1474. &rpm_vreg_device[RPM_VREG_ID_PM8058_L15],
  1475. &rpm_vreg_device[RPM_VREG_ID_PM8058_L16],
  1476. &rpm_vreg_device[RPM_VREG_ID_PM8058_L17],
  1477. &rpm_vreg_device[RPM_VREG_ID_PM8058_L18],
  1478. &rpm_vreg_device[RPM_VREG_ID_PM8058_L19],
  1479. &rpm_vreg_device[RPM_VREG_ID_PM8058_L20],
  1480. &rpm_vreg_device[RPM_VREG_ID_PM8058_L21],
  1481. &rpm_vreg_device[RPM_VREG_ID_PM8058_L22],
  1482. &rpm_vreg_device[RPM_VREG_ID_PM8058_L23],
  1483. &rpm_vreg_device[RPM_VREG_ID_PM8058_L24],
  1484. &rpm_vreg_device[RPM_VREG_ID_PM8058_L25],
  1485. &rpm_vreg_device[RPM_VREG_ID_PM8058_S2],
  1486. &rpm_vreg_device[RPM_VREG_ID_PM8058_S3],
  1487. &rpm_vreg_device[RPM_VREG_ID_PM8058_S4],
  1488. &rpm_vreg_device[RPM_VREG_ID_PM8058_LVS0],
  1489. &rpm_vreg_device[RPM_VREG_ID_PM8058_LVS1],
  1490. &rpm_vreg_device[RPM_VREG_ID_PM8058_NCP],
  1491. #endif
  1492. #ifdef CONFIG_PMIC8901
  1493. &rpm_vreg_device[RPM_VREG_ID_PM8901_L0],
  1494. &rpm_vreg_device[RPM_VREG_ID_PM8901_L1],
  1495. &rpm_vreg_device[RPM_VREG_ID_PM8901_L2],
  1496. &rpm_vreg_device[RPM_VREG_ID_PM8901_L3],
  1497. &rpm_vreg_device[RPM_VREG_ID_PM8901_L4],
  1498. &rpm_vreg_device[RPM_VREG_ID_PM8901_L5],
  1499. &rpm_vreg_device[RPM_VREG_ID_PM8901_L6],
  1500. &rpm_vreg_device[RPM_VREG_ID_PM8901_S2],
  1501. &rpm_vreg_device[RPM_VREG_ID_PM8901_S3],
  1502. &rpm_vreg_device[RPM_VREG_ID_PM8901_S4],
  1503. &rpm_vreg_device[RPM_VREG_ID_PM8901_LVS0],
  1504. &rpm_vreg_device[RPM_VREG_ID_PM8901_LVS1],
  1505. &rpm_vreg_device[RPM_VREG_ID_PM8901_LVS2],
  1506. &rpm_vreg_device[RPM_VREG_ID_PM8901_LVS3],
  1507. &rpm_vreg_device[RPM_VREG_ID_PM8901_MVS0],
  1508. #endif
  1509. };
  1510. #ifdef CONFIG_PMIC8058
  1511. #define PMIC_GPIO_SDC3_DET 22
  1512. #define PMIC_GPIO_EXT_POWER 1
  1513. static int pm8058_gpios_init(void)
  1514. {
  1515. int i;
  1516. int rc;
  1517. struct pm8058_gpio_cfg {
  1518. int gpio;
  1519. struct pm8058_gpio cfg;
  1520. };
  1521. struct pm8058_gpio_cfg gpio_cfgs[] = {
  1522. { /* External power enable */
  1523. PMIC_GPIO_EXT_POWER - 1,
  1524. {
  1525. .direction = PM_GPIO_DIR_OUT,
  1526. .output_value = 1,
  1527. .pull = PM_GPIO_PULL_UP_30,
  1528. .vin_sel = 2,
  1529. .function = PM_GPIO_FUNC_NORMAL,
  1530. .inv_int_pol = 0,
  1531. },
  1532. },
  1533. { /* FFA ethernet */
  1534. 6,
  1535. {
  1536. .direction = PM_GPIO_DIR_IN,
  1537. .pull = PM_GPIO_PULL_DN,
  1538. .vin_sel = 2,
  1539. .function = PM_GPIO_FUNC_NORMAL,
  1540. .inv_int_pol = 0,
  1541. },
  1542. },
  1543. #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION