max8997.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * max8997.h - Driver for the Maxim 8997/8966
  3. *
  4. * Copyright (C) 2009-2010 Samsung Electrnoics
  5. * MyungJoo Ham <myungjoo.ham@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * This driver is based on max8998.h
  22. *
  23. * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
  24. * Except Fuel Gauge, every device shares the same I2C bus and included in
  25. * this mfd driver. Although the fuel gauge is included in the chip, it is
  26. * excluded from the driver because a) it has a different I2C bus from
  27. * others and b) it can be enabled simply by using MAX17042 driver.
  28. */
  29. #ifndef __LINUX_MFD_MAX8998_H
  30. #define __LINUX_MFD_MAX8998_H
  31. #include <linux/regulator/consumer.h>
  32. /* MAX8997/8966 regulator IDs */
  33. enum max8998_regulators {
  34. MAX8997_LDO1 = 0,
  35. MAX8997_LDO2,
  36. MAX8997_LDO3,
  37. MAX8997_LDO4,
  38. MAX8997_LDO5,
  39. MAX8997_LDO6,
  40. MAX8997_LDO7,
  41. MAX8997_LDO8,
  42. MAX8997_LDO9,
  43. MAX8997_LDO10,
  44. MAX8997_LDO11,
  45. MAX8997_LDO12,
  46. MAX8997_LDO13,
  47. MAX8997_LDO14,
  48. MAX8997_LDO15,
  49. MAX8997_LDO16,
  50. MAX8997_LDO17,
  51. MAX8997_LDO18,
  52. MAX8997_LDO21,
  53. MAX8997_BUCK1,
  54. MAX8997_BUCK2,
  55. MAX8997_BUCK3,
  56. MAX8997_BUCK4,
  57. MAX8997_BUCK5,
  58. MAX8997_BUCK6,
  59. MAX8997_BUCK7,
  60. MAX8997_EN32KHZ_AP,
  61. MAX8997_EN32KHZ_CP,
  62. MAX8997_ENVICHG,
  63. MAX8997_ESAFEOUT1,
  64. MAX8997_ESAFEOUT2,
  65. MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
  66. MAX8997_CHARGER, /* charger current, MBCCTRL4 */
  67. MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
  68. MAX8997_REG_MAX,
  69. };
  70. struct max8997_regulator_data {
  71. int id;
  72. struct regulator_init_data *initdata;
  73. };
  74. struct max8997_platform_data {
  75. /* IRQ */
  76. int irq_base;
  77. int ono;
  78. int wakeup;
  79. /* ---- PMIC ---- */
  80. struct max8997_regulator_data *regulators;
  81. int num_regulators;
  82. /*
  83. * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
  84. * With buckx_gpiodvs enabled, the buckx cannot be controlled
  85. * independently. To control buckx (of 1, 2, and 5) independently,
  86. * disable buckx_gpiodvs and control with BUCKxDVS1 register.
  87. *
  88. * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
  89. * on buckx will change the voltage of bucky at the same time.
  90. *
  91. */
  92. bool ignore_gpiodvs_side_effect;
  93. int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
  94. int buck125_default_idx; /* Default value of SET1, 2, 3 */
  95. unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
  96. bool buck1_gpiodvs;
  97. unsigned int buck2_voltage[8];
  98. bool buck2_gpiodvs;
  99. unsigned int buck5_voltage[8];
  100. bool buck5_gpiodvs;
  101. /* ---- Charger control ---- */
  102. /* eoc stands for 'end of charge' */
  103. int eoc_mA; /* 50 ~ 200mA by 10mA step */
  104. /* charge Full Timeout */
  105. int timeout; /* 0 (no timeout), 5, 6, 7 hours */
  106. /* MUIC: Not implemented */
  107. /* HAPTIC: Not implemented */
  108. /* RTC: Not implemented */
  109. /* Flash: Not implemented */
  110. };
  111. #endif /* __LINUX_MFD_MAX8998_H */