board-harmony-power.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) 2010 NVIDIA, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. * 02111-1307, USA
  17. */
  18. #include <linux/i2c.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <linux/regulator/machine.h>
  22. #include <linux/mfd/tps6586x.h>
  23. #include <mach/irqs.h>
  24. #include "board-harmony.h"
  25. #define PMC_CTRL 0x0
  26. #define PMC_CTRL_INTR_LOW (1 << 17)
  27. static struct regulator_consumer_supply tps658621_ldo0_supply[] = {
  28. REGULATOR_SUPPLY("pex_clk", NULL),
  29. };
  30. static struct regulator_init_data ldo0_data = {
  31. .constraints = {
  32. .min_uV = 1250 * 1000,
  33. .max_uV = 3300 * 1000,
  34. .valid_modes_mask = (REGULATOR_MODE_NORMAL |
  35. REGULATOR_MODE_STANDBY),
  36. .valid_ops_mask = (REGULATOR_CHANGE_MODE |
  37. REGULATOR_CHANGE_STATUS |
  38. REGULATOR_CHANGE_VOLTAGE),
  39. },
  40. .num_consumer_supplies = ARRAY_SIZE(tps658621_ldo0_supply),
  41. .consumer_supplies = tps658621_ldo0_supply,
  42. };
  43. #define HARMONY_REGULATOR_INIT(_id, _minmv, _maxmv) \
  44. static struct regulator_init_data _id##_data = { \
  45. .constraints = { \
  46. .min_uV = (_minmv)*1000, \
  47. .max_uV = (_maxmv)*1000, \
  48. .valid_modes_mask = (REGULATOR_MODE_NORMAL | \
  49. REGULATOR_MODE_STANDBY), \
  50. .valid_ops_mask = (REGULATOR_CHANGE_MODE | \
  51. REGULATOR_CHANGE_STATUS | \
  52. REGULATOR_CHANGE_VOLTAGE), \
  53. }, \
  54. }
  55. HARMONY_REGULATOR_INIT(sm0, 725, 1500);
  56. HARMONY_REGULATOR_INIT(sm1, 725, 1500);
  57. HARMONY_REGULATOR_INIT(sm2, 3000, 4550);
  58. HARMONY_REGULATOR_INIT(ldo1, 725, 1500);
  59. HARMONY_REGULATOR_INIT(ldo2, 725, 1500);
  60. HARMONY_REGULATOR_INIT(ldo3, 1250, 3300);
  61. HARMONY_REGULATOR_INIT(ldo4, 1700, 2475);
  62. HARMONY_REGULATOR_INIT(ldo5, 1250, 3300);
  63. HARMONY_REGULATOR_INIT(ldo6, 1250, 3300);
  64. HARMONY_REGULATOR_INIT(ldo7, 1250, 3300);
  65. HARMONY_REGULATOR_INIT(ldo8, 1250, 3300);
  66. HARMONY_REGULATOR_INIT(ldo9, 1250, 3300);
  67. #define TPS_REG(_id, _data) \
  68. { \
  69. .id = TPS6586X_ID_##_id, \
  70. .name = "tps6586x-regulator", \
  71. .platform_data = _data, \
  72. }
  73. static struct tps6586x_subdev_info tps_devs[] = {
  74. TPS_REG(SM_0, &sm0_data),
  75. TPS_REG(SM_1, &sm1_data),
  76. TPS_REG(SM_2, &sm2_data),
  77. TPS_REG(LDO_0, &ldo0_data),
  78. TPS_REG(LDO_1, &ldo1_data),
  79. TPS_REG(LDO_2, &ldo2_data),
  80. TPS_REG(LDO_3, &ldo3_data),
  81. TPS_REG(LDO_4, &ldo4_data),
  82. TPS_REG(LDO_5, &ldo5_data),
  83. TPS_REG(LDO_6, &ldo6_data),
  84. TPS_REG(LDO_7, &ldo7_data),
  85. TPS_REG(LDO_8, &ldo8_data),
  86. TPS_REG(LDO_9, &ldo9_data),
  87. };
  88. static struct tps6586x_platform_data tps_platform = {
  89. .irq_base = TEGRA_NR_IRQS,
  90. .num_subdevs = ARRAY_SIZE(tps_devs),
  91. .subdevs = tps_devs,
  92. .gpio_base = HARMONY_GPIO_TPS6586X(0),
  93. };
  94. static struct i2c_board_info __initdata harmony_regulators[] = {
  95. {
  96. I2C_BOARD_INFO("tps6586x", 0x34),
  97. .irq = INT_EXTERNAL_PMU,
  98. .platform_data = &tps_platform,
  99. },
  100. };
  101. int __init harmony_regulator_init(void)
  102. {
  103. i2c_register_board_info(3, harmony_regulators, 1);
  104. return 0;
  105. }