max8998.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * max8998.h - Voltage regulator driver for the Maxim 8998
  4. *
  5. * Copyright (C) 2009-2010 Samsung Electrnoics
  6. * Kyungmin Park <[email protected]>
  7. * Marek Szyprowski <[email protected]>
  8. */
  9. #ifndef __LINUX_MFD_MAX8998_H
  10. #define __LINUX_MFD_MAX8998_H
  11. #include <linux/regulator/machine.h>
  12. /* MAX 8998 regulator ids */
  13. enum {
  14. MAX8998_LDO2 = 2,
  15. MAX8998_LDO3,
  16. MAX8998_LDO4,
  17. MAX8998_LDO5,
  18. MAX8998_LDO6,
  19. MAX8998_LDO7,
  20. MAX8998_LDO8,
  21. MAX8998_LDO9,
  22. MAX8998_LDO10,
  23. MAX8998_LDO11,
  24. MAX8998_LDO12,
  25. MAX8998_LDO13,
  26. MAX8998_LDO14,
  27. MAX8998_LDO15,
  28. MAX8998_LDO16,
  29. MAX8998_LDO17,
  30. MAX8998_BUCK1,
  31. MAX8998_BUCK2,
  32. MAX8998_BUCK3,
  33. MAX8998_BUCK4,
  34. MAX8998_EN32KHZ_AP,
  35. MAX8998_EN32KHZ_CP,
  36. MAX8998_ENVICHG,
  37. MAX8998_ESAFEOUT1,
  38. MAX8998_ESAFEOUT2,
  39. MAX8998_CHARGER,
  40. };
  41. /**
  42. * max8998_regulator_data - regulator data
  43. * @id: regulator id
  44. * @initdata: regulator init data (contraints, supplies, ...)
  45. * @reg_node: DT node of regulator (unused on non-DT platforms)
  46. */
  47. struct max8998_regulator_data {
  48. int id;
  49. struct regulator_init_data *initdata;
  50. struct device_node *reg_node;
  51. };
  52. /**
  53. * struct max8998_board - packages regulator init data
  54. * @regulators: array of defined regulators
  55. * @num_regulators: number of regulators used
  56. * @irq_base: base IRQ number for max8998, required for IRQs
  57. * @ono: power onoff IRQ number for max8998
  58. * @buck_voltage_lock: Do NOT change the values of the following six
  59. * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
  60. * be other than the preset values.
  61. * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
  62. * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
  63. * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
  64. * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
  65. * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
  66. * @buck2_set3: BUCK2 gpio pin to set output voltage
  67. * @buck2_default_idx: Default for BUCK2 gpio pin.
  68. * @wakeup: Allow to wake up from suspend
  69. * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
  70. * write before reading it.
  71. * @eoc: End of Charge Level in percent: 10% ~ 45% by 5% step
  72. * If it equals 0, leave it unchanged.
  73. * Otherwise, it is a invalid value.
  74. * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable.
  75. * If it equals 0, leave it unchanged.
  76. * Otherwise, it is a invalid value.
  77. * @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable.
  78. * If it equals 0, leave it unchanged.
  79. * Otherwise, leave it unchanged.
  80. */
  81. struct max8998_platform_data {
  82. struct max8998_regulator_data *regulators;
  83. int num_regulators;
  84. unsigned int irq_base;
  85. int ono;
  86. bool buck_voltage_lock;
  87. int buck1_voltage[4];
  88. int buck2_voltage[2];
  89. int buck1_set1;
  90. int buck1_set2;
  91. int buck1_default_idx;
  92. int buck2_set3;
  93. int buck2_default_idx;
  94. bool wakeup;
  95. bool rtc_delay;
  96. int eoc;
  97. int restart;
  98. int timeout;
  99. };
  100. #endif /* __LINUX_MFD_MAX8998_H */