core.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * core.h
  3. *
  4. * copyright (c) 2011 Samsung Electronics Co., Ltd
  5. * http://www.samsung.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. */
  13. #ifndef __LINUX_MFD_SEC_CORE_H
  14. #define __LINUX_MFD_SEC_CORE_H
  15. /* Macros to represent minimum voltages for LDO/BUCK */
  16. #define MIN_3000_MV 3000000
  17. #define MIN_2500_MV 2500000
  18. #define MIN_2000_MV 2000000
  19. #define MIN_1800_MV 1800000
  20. #define MIN_1500_MV 1500000
  21. #define MIN_1400_MV 1400000
  22. #define MIN_1000_MV 1000000
  23. #define MIN_900_MV 900000
  24. #define MIN_850_MV 850000
  25. #define MIN_800_MV 800000
  26. #define MIN_750_MV 750000
  27. #define MIN_600_MV 600000
  28. #define MIN_500_MV 500000
  29. /* Macros to represent steps for LDO/BUCK */
  30. #define STEP_50_MV 50000
  31. #define STEP_25_MV 25000
  32. #define STEP_12_5_MV 12500
  33. #define STEP_6_25_MV 6250
  34. enum sec_device_type {
  35. S5M8751X,
  36. S5M8763X,
  37. S5M8767X,
  38. S2MPA01,
  39. S2MPS11X,
  40. S2MPS13X,
  41. S2MPS14X,
  42. S2MPU02,
  43. };
  44. /**
  45. * struct sec_pmic_dev - s2m/s5m master device for sub-drivers
  46. * @dev: Master device of the chip
  47. * @pdata: Platform data populated with data from DTS
  48. * or board files
  49. * @regmap_pmic: Regmap associated with PMIC's I2C address
  50. * @i2c: I2C client of the main driver
  51. * @device_type: Type of device, matches enum sec_device_type
  52. * @irq_base: Base IRQ number for device, required for IRQs
  53. * @irq: Generic IRQ number for device
  54. * @irq_data: Runtime data structure for IRQ controller
  55. * @wakeup: Whether or not this is a wakeup device
  56. */
  57. struct sec_pmic_dev {
  58. struct device *dev;
  59. struct sec_platform_data *pdata;
  60. struct regmap *regmap_pmic;
  61. struct i2c_client *i2c;
  62. unsigned long device_type;
  63. int irq_base;
  64. int irq;
  65. struct regmap_irq_chip_data *irq_data;
  66. bool wakeup;
  67. };
  68. int sec_irq_init(struct sec_pmic_dev *sec_pmic);
  69. void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
  70. int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
  71. struct sec_platform_data {
  72. struct sec_regulator_data *regulators;
  73. struct sec_opmode_data *opmode;
  74. int device_type;
  75. int num_regulators;
  76. int irq_base;
  77. int (*cfg_pmic_irq)(void);
  78. bool wakeup;
  79. bool buck_voltage_lock;
  80. int buck_gpios[3];
  81. int buck_ds[3];
  82. unsigned int buck2_voltage[8];
  83. bool buck2_gpiodvs;
  84. unsigned int buck3_voltage[8];
  85. bool buck3_gpiodvs;
  86. unsigned int buck4_voltage[8];
  87. bool buck4_gpiodvs;
  88. int buck_set1;
  89. int buck_set2;
  90. int buck_set3;
  91. int buck2_enable;
  92. int buck3_enable;
  93. int buck4_enable;
  94. int buck_default_idx;
  95. int buck2_default_idx;
  96. int buck3_default_idx;
  97. int buck4_default_idx;
  98. int buck_ramp_delay;
  99. int buck2_ramp_delay;
  100. int buck34_ramp_delay;
  101. int buck5_ramp_delay;
  102. int buck16_ramp_delay;
  103. int buck7810_ramp_delay;
  104. int buck9_ramp_delay;
  105. int buck24_ramp_delay;
  106. int buck3_ramp_delay;
  107. int buck7_ramp_delay;
  108. int buck8910_ramp_delay;
  109. bool buck1_ramp_enable;
  110. bool buck2_ramp_enable;
  111. bool buck3_ramp_enable;
  112. bool buck4_ramp_enable;
  113. bool buck6_ramp_enable;
  114. int buck2_init;
  115. int buck3_init;
  116. int buck4_init;
  117. /* Whether or not manually set PWRHOLD to low during shutdown. */
  118. bool manual_poweroff;
  119. /* Disable the WRSTBI (buck voltage warm reset) when probing? */
  120. bool disable_wrstbi;
  121. };
  122. /**
  123. * sec_regulator_data - regulator data
  124. * @id: regulator id
  125. * @initdata: regulator init data (contraints, supplies, ...)
  126. */
  127. struct sec_regulator_data {
  128. int id;
  129. struct regulator_init_data *initdata;
  130. struct device_node *reg_node;
  131. int ext_control_gpio;
  132. };
  133. /*
  134. * sec_opmode_data - regulator operation mode data
  135. * @id: regulator id
  136. * @mode: regulator operation mode
  137. */
  138. struct sec_opmode_data {
  139. int id;
  140. unsigned int mode;
  141. };
  142. /*
  143. * samsung regulator operation mode
  144. * SEC_OPMODE_OFF Regulator always OFF
  145. * SEC_OPMODE_ON Regulator always ON
  146. * SEC_OPMODE_LOWPOWER Regulator is on in low-power mode
  147. * SEC_OPMODE_SUSPEND Regulator is changed by PWREN pin
  148. * If PWREN is high, regulator is on
  149. * If PWREN is low, regulator is off
  150. */
  151. enum sec_opmode {
  152. SEC_OPMODE_OFF,
  153. SEC_OPMODE_ON,
  154. SEC_OPMODE_LOWPOWER,
  155. SEC_OPMODE_SUSPEND,
  156. };
  157. #endif /* __LINUX_MFD_SEC_CORE_H */