max77826.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * max77826.h - Regulator driver for the Maxim 77826
  3. *
  4. * Copyright (C) 2013 Samsung Electronics
  5. * Chiwoong Byun <woong.byun@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 max77686.h
  22. */
  23. #ifndef __LINUX_REGULATOR_MAX77826_H
  24. #define __LINUX_REGULATOR_MAX77826_H
  25. #include <linux/regulator/machine.h>
  26. /* MAX77826 regulator ids */
  27. enum max77826_regulators {
  28. MAX77826_LDO1 = 0,
  29. MAX77826_LDO2,
  30. MAX77826_LDO3,
  31. MAX77826_LDO4,
  32. MAX77826_LDO5,
  33. MAX77826_LDO6,
  34. MAX77826_LDO7,
  35. MAX77826_LDO8,
  36. MAX77826_LDO9,
  37. MAX77826_LDO10,
  38. MAX77826_LDO11,
  39. MAX77826_LDO12,
  40. MAX77826_LDO13,
  41. MAX77826_LDO14,
  42. MAX77826_LDO15,
  43. MAX77826_BUCK1,
  44. MAX77826_BUCK2,
  45. MAX77826_REG_MAX,
  46. };
  47. /* MAX77826 PMIC Registers. */
  48. enum max77826_pmic_registers {
  49. MAX77826_REG_INT_SRC = 0x00,
  50. MAX77826_REG_SYS_INT,
  51. MAX77826_REG_INT1,
  52. MAX77826_REG_INT2,
  53. MAX77826_REG_BB_INT,
  54. MAX77826_REG_INT_SRC_M,
  55. MAX77826_REG_TOPSYS_INT_M,
  56. MAX77826_REG_INT1_M,
  57. MAX77826_REG_INT2_M,
  58. MAX77826_REG_BB_INT_M,
  59. MAX77826_REG_TOPSYS_STAT,
  60. MAX77826_REG_STAT1,
  61. MAX77826_REG_STAT2,
  62. MAX77826_REG_BB_STAT,
  63. /* 0x0E - 0x0F: Reserved */
  64. MAX77826_REG_LDO_OPMD1 = 0x10,
  65. MAX77826_REG_LDO_OPMD2,
  66. MAX77826_REG_LDO_OPMD3,
  67. MAX77826_REG_LDO_OPMD4,
  68. MAX77826_REG_B_BB_OPMD,
  69. /* 0x15 - 0x1F: Reserved */
  70. MAX77826_REG_LDO1_CFG = 0x20,
  71. MAX77826_REG_LDO2_CFG,
  72. MAX77826_REG_LDO3_CFG,
  73. MAX77826_REG_LDO4_CFG,
  74. MAX77826_REG_LDO5_CFG,
  75. MAX77826_REG_LDO6_CFG,
  76. MAX77826_REG_LDO7_CFG,
  77. MAX77826_REG_LDO8_CFG,
  78. MAX77826_REG_LDO9_CFG,
  79. MAX77826_REG_LDO10_CFG,
  80. MAX77826_REG_LDO11_CFG,
  81. MAX77826_REG_LDO12_CFG,
  82. MAX77826_REG_LDO13_CFG,
  83. MAX77826_REG_LDO14_CFG,
  84. MAX77826_REG_LDO15_CFG,
  85. /* 0x2F: Reserved */
  86. MAX77826_REG_BUCK_CFG = 0x30,
  87. MAX77826_REG_BUCK_VOUT,
  88. MAX77826_REG_BB_CFG,
  89. MAX77826_REG_BB_VOUT,
  90. /* 0x34 - 0x3F: Reserved */
  91. MAX77826_REG_BUCK_SS_FREQ = 0x40,
  92. MAX77826_REG_UVLO_FALL,
  93. /* 0x42 - 0xCE: Reserved */
  94. MAX77826_REG_DEVICE_ID = 0xCF,
  95. };
  96. struct max77826_dev {
  97. struct device *dev;
  98. struct mutex io_lock;
  99. struct i2c_client *i2c;
  100. int num_regulators;
  101. struct regulator_dev **rdev;
  102. };
  103. struct max77826_regulator_subdev {
  104. int id;
  105. struct regulator_init_data *initdata;
  106. };
  107. struct max77826_platform_data {
  108. char *name;
  109. int num_regulators;
  110. struct max77826_regulator_subdev *regulators;
  111. };
  112. #endif /* __LINUX_REGULATOR_MAX77826_H */