s2mpb02-regulator.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * s2mpb02-regulator.h - Voltage regulator driver for the Samsung s2mpb02
  3. *
  4. * Copyright (C) 2014 Samsung Electrnoics
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef __LINUX_MFD_S2MPB02_REGULATOR_H
  21. #define __LINUX_MFD_S2MPB02_REGULATOR_H
  22. /* S2MPB02 registers */
  23. enum s2mpb02_reg {
  24. S2MPB02_REG_ID,
  25. S2MPB02_REG_INT1,
  26. S2MPB02_REG_INT1M,
  27. S2MPB02_REG_ST1,
  28. S2MPB02_REG_CTRL,
  29. S2MPB02_REG_RSVD5,
  30. S2MPB02_REG_RSVD6,
  31. S2MPB02_REG_RSVD7,
  32. S2MPB02_REG_RSVD8,
  33. S2MPB02_REG_BBEN_DBT,
  34. S2MPB02_REG_RSVDA,
  35. S2MPB02_REG_B1CTRL1,
  36. S2MPB02_REG_B1CTRL2,
  37. S2MPB02_REG_B2CTRL1,
  38. S2MPB02_REG_B2CTRL2,
  39. S2MPB02_REG_BB1CTRL1,
  40. S2MPB02_REG_BB1CTRL2,
  41. S2MPB02_REG_BUCK_RAMP,
  42. S2MPB02_REG_FLED_CTRL1,
  43. S2MPB02_REG_FLED_CTRL2,
  44. S2MPB02_REG_FLED_CUR1,
  45. S2MPB02_REG_FLED_TIME1,
  46. S2MPB02_REG_FLED_CUR2,
  47. S2MPB02_REG_FLED_TIME2,
  48. S2MPB02_REG_FLED_IRON1,
  49. S2MPB02_REG_FLED_IRON2,
  50. S2MPB02_REG_FLED_IRD1,
  51. S2MPB02_REG_FLED_IRD2,
  52. S2MPB02_REG_BST_CTRL1,
  53. S2MPB02_REG_BST_CTRL2,
  54. S2MPB02_REG_L1CTRL,
  55. S2MPB02_REG_L2CTRL,
  56. S2MPB02_REG_L3CTRL,
  57. S2MPB02_REG_L4CTRL,
  58. S2MPB02_REG_L5CTRL,
  59. S2MPB02_REG_L6CTRL,
  60. S2MPB02_REG_L7CTRL,
  61. S2MPB02_REG_L8CTRL,
  62. S2MPB02_REG_L9CTRL,
  63. S2MPB02_REG_L10CTRL,
  64. S2MPB02_REG_L11CTRL,
  65. S2MPB02_REG_L12CTRL,
  66. S2MPB02_REG_L13CTRL,
  67. S2MPB02_REG_L14CTRL,
  68. S2MPB02_REG_L15CTRL,
  69. S2MPB02_REG_L16CTRL,
  70. S2MPB02_REG_L17CTRL,
  71. S2MPB02_REG_L18CTRL,
  72. S2MPB02_REG_LDO_DSCH1,
  73. S2MPB02_REG_LDO_DSCH2,
  74. S2MPB02_REG_LDO_DSCH3,
  75. };
  76. /* S2MPB02 regulator ids */
  77. enum S2MPB02_regulators {
  78. S2MPB02_LDO1,
  79. S2MPB02_LDO2,
  80. S2MPB02_LDO3,
  81. S2MPB02_LDO4,
  82. S2MPB02_LDO5,
  83. S2MPB02_LDO6,
  84. S2MPB02_LDO7,
  85. S2MPB02_LDO8,
  86. S2MPB02_LDO9,
  87. S2MPB02_LDO10,
  88. S2MPB02_LDO11,
  89. S2MPB02_LDO12,
  90. S2MPB02_LDO13,
  91. S2MPB02_LDO14,
  92. S2MPB02_LDO15,
  93. S2MPB02_LDO16,
  94. S2MPB02_LDO17,
  95. S2MPB02_LDO18,
  96. S2MPB02_BUCK1,
  97. S2MPB02_BUCK2,
  98. S2MPB02_BB1,
  99. S2MPB02_REG_MAX,
  100. };
  101. #define S2MPB02_BUCK_MIN1 400000
  102. #define S2MPB02_BUCK_MIN2 2600000
  103. #define S2MPB02_LDO_MIN1 600000
  104. #define S2MPB02_BUCK_STEP1 6250
  105. #define S2MPB02_BUCK_STEP2 12500
  106. #define S2MPB02_LDO_STEP1 12500
  107. #define S2MPB02_LDO_STEP2 25000
  108. #define S2MPB02_LDO_VSEL_MASK 0x7F
  109. #define S2MPB02_BUCK_VSEL_MASK 0xFF
  110. #define S2MPB02_BUCK_ENABLE_MASK 0xC0
  111. #define S2MPB02_LDO_ENABLE_MASK 0x80
  112. #define S2MPB02_RAMP_DELAY 12000
  113. #define S2MPB02_ENABLE_TIME_LDO 180
  114. #define S2MPB02_ENABLE_TIME_BUCK 100
  115. #define S2MPB02_ENABLE_TIME_BB 210
  116. #define S2MPB02_BUCK_ENABLE_SHIFT 0x06
  117. #define S2MPB02_LDO_ENABLE_SHIFT 0x07
  118. #define S2MPB02_LDO_N_VOLTAGES (S2MPB02_LDO_VSEL_MASK + 1)
  119. #define S2MPB02_BUCK_N_VOLTAGES (S2MPB02_BUCK_VSEL_MASK + 1)
  120. #define S2MPB02_REGULATOR_MAX (S2MPB02_REG_MAX)
  121. #define DVS_DEFAULT_VALUE (0x90)
  122. #endif /* __LINUX_MFD_S2MPB02_PRIV_H */