max8998.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * max8998.h - Voltage regulator driver for the Maxim 8998
  3. *
  4. * Copyright (C) 2009-2010 Samsung Electrnoics
  5. * Kyungmin Park <kyungmin.park@samsung.com>
  6. * Marek Szyprowski <m.szyprowski@samsung.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef __LINUX_MFD_MAX8998_H
  23. #define __LINUX_MFD_MAX8998_H
  24. #include <linux/regulator/machine.h>
  25. /* MAX 8998 regulator ids */
  26. enum {
  27. MAX8998_LDO2 = 2,
  28. MAX8998_LDO3,
  29. MAX8998_LDO4,
  30. MAX8998_LDO5,
  31. MAX8998_LDO6,
  32. MAX8998_LDO7,
  33. MAX8998_LDO8,
  34. MAX8998_LDO9,
  35. MAX8998_LDO10,
  36. MAX8998_LDO11,
  37. MAX8998_LDO12,
  38. MAX8998_LDO13,
  39. MAX8998_LDO14,
  40. MAX8998_LDO15,
  41. MAX8998_LDO16,
  42. MAX8998_LDO17,
  43. MAX8998_BUCK1,
  44. MAX8998_BUCK2,
  45. MAX8998_BUCK3,
  46. MAX8998_BUCK4,
  47. MAX8998_EN32KHZ_AP,
  48. MAX8998_EN32KHZ_CP,
  49. MAX8998_ENVICHG,
  50. MAX8998_ESAFEOUT1,
  51. MAX8998_ESAFEOUT2,
  52. };
  53. /**
  54. * max8998_regulator_data - regulator data
  55. * @id: regulator id
  56. * @initdata: regulator init data (contraints, supplies, ...)
  57. * @reg_node: DT node of regulator (unused on non-DT platforms)
  58. */
  59. struct max8998_regulator_data {
  60. int id;
  61. struct regulator_init_data *initdata;
  62. struct device_node *reg_node;
  63. };
  64. /**
  65. * struct max8998_board - packages regulator init data
  66. * @regulators: array of defined regulators
  67. * @num_regulators: number of regulators used
  68. * @irq_base: base IRQ number for max8998, required for IRQs
  69. * @ono: power onoff IRQ number for max8998
  70. * @buck_voltage_lock: Do NOT change the values of the following six
  71. * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
  72. * be other than the preset values.
  73. * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
  74. * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
  75. * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
  76. * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
  77. * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
  78. * @buck2_set3: BUCK2 gpio pin to set output voltage
  79. * @buck2_default_idx: Default for BUCK2 gpio pin.
  80. * @wakeup: Allow to wake up from suspend
  81. * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
  82. * write before reading it.
  83. * @eoc: End of Charge Level in percent: 10% ~ 45% by 5% step
  84. * If it equals 0, leave it unchanged.
  85. * Otherwise, it is a invalid value.
  86. * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable.
  87. * If it equals 0, leave it unchanged.
  88. * Otherwise, it is a invalid value.
  89. * @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable.
  90. * If it equals 0, leave it unchanged.
  91. * Otherwise, leave it unchanged.
  92. */
  93. struct max8998_platform_data {
  94. struct max8998_regulator_data *regulators;
  95. int num_regulators;
  96. unsigned int irq_base;
  97. int ono;
  98. bool buck_voltage_lock;
  99. int buck1_voltage[4];
  100. int buck2_voltage[2];
  101. int buck1_set1;
  102. int buck1_set2;
  103. int buck1_default_idx;
  104. int buck2_set3;
  105. int buck2_default_idx;
  106. bool wakeup;
  107. bool rtc_delay;
  108. int eoc;
  109. int restart;
  110. int timeout;
  111. };
  112. #endif /* __LINUX_MFD_MAX8998_H */