pm8xxx-regulator.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __REGULATOR_PM8XXX_REGULATOR_H__
  13. #define __REGULATOR_PM8XXX_REGULATOR_H__
  14. #include <linux/kernel.h>
  15. #include <linux/regulator/machine.h>
  16. #define PM8XXX_REGULATOR_DEV_NAME "pm8xxx-regulator"
  17. /* Pin control input pins. */
  18. #define PM8XXX_VREG_PIN_CTRL_NONE 0x00
  19. #define PM8XXX_VREG_PIN_CTRL_EN0 0x01
  20. #define PM8XXX_VREG_PIN_CTRL_EN1 0x02
  21. #define PM8XXX_VREG_PIN_CTRL_EN2 0x04
  22. #define PM8XXX_VREG_PIN_CTRL_EN3 0x08
  23. #define PM8XXX_VREG_PIN_CTRL_ALL 0x0F
  24. #define PM8921_VREG_PIN_CTRL_NONE PM8XXX_VREG_PIN_CTRL_NONE
  25. #define PM8921_VREG_PIN_CTRL_D1 PM8XXX_VREG_PIN_CTRL_EN0
  26. #define PM8921_VREG_PIN_CTRL_A0 PM8XXX_VREG_PIN_CTRL_EN1
  27. #define PM8921_VREG_PIN_CTRL_A1 PM8XXX_VREG_PIN_CTRL_EN2
  28. #define PM8921_VREG_PIN_CTRL_A2 PM8XXX_VREG_PIN_CTRL_EN3
  29. /* Minimum high power mode loads in uA. */
  30. #define PM8XXX_VREG_LDO_50_HPM_MIN_LOAD 5000
  31. #define PM8XXX_VREG_LDO_150_HPM_MIN_LOAD 10000
  32. #define PM8XXX_VREG_LDO_300_HPM_MIN_LOAD 10000
  33. #define PM8XXX_VREG_LDO_600_HPM_MIN_LOAD 10000
  34. #define PM8XXX_VREG_LDO_1200_HPM_MIN_LOAD 10000
  35. #define PM8XXX_VREG_SMPS_1500_HPM_MIN_LOAD 100000
  36. #define PM8XXX_VREG_SMPS_2000_HPM_MIN_LOAD 100000
  37. #define REGULATOR_TEST_BANKS_MAX 8
  38. /**
  39. * enum pm8xxx_vreg_pin_function - action to perform when pin control is active
  40. * %PM8XXX_VREG_PIN_FN_ENABLE: pin control enables the regulator
  41. * %PM8XXX_VREG_PIN_FN_MODE: pin control changes mode from LPM to HPM
  42. */
  43. enum pm8xxx_vreg_pin_function {
  44. PM8XXX_VREG_PIN_FN_ENABLE = 0,
  45. PM8XXX_VREG_PIN_FN_MODE,
  46. };
  47. /**
  48. * struct pm8xxx_regulator_platform_data - PMIC 8921 regulator platform data
  49. * @init_data: regulator constraints
  50. * @id: regulator id. Any value unique among pm8xxx_regulator
  51. * devices is acceptable.
  52. * @pull_down_enable: 0 = no pulldown, 1 = pulldown when regulator disabled
  53. * @pin_ctrl: pin control inputs to use for the regulator; should be
  54. * a combination of PM8XXX_VREG_PIN_CTRL_* values
  55. * @pin_fn: action to perform when pin control pin is active
  56. * @system_uA: current drawn from regulator not accounted for by any
  57. * regulator framework consumer
  58. * @enable_time: time in us taken to enable a regulator to the maximum
  59. * allowed voltage for the system. This is dependent upon
  60. * the load and capacitance for a regulator on the board.
  61. * @slew_rate: worst case rate of change of regulator output voltage
  62. * in units of uV/us (V/s). This is dependent upon the
  63. * load and capacitance for a regulator on the board.
  64. * @ocp_enable: enable over current protection logic (available for
  65. * LVS and MVS type switches)
  66. * @ocp_enable_time: time in us to delay between enabling the switch and then
  67. * enabling OCP for it. This delay is needed to avoid
  68. * false triggering due to inrush current.
  69. */
  70. struct pm8xxx_regulator_platform_data {
  71. struct regulator_init_data init_data;
  72. int id;
  73. unsigned pull_down_enable;
  74. unsigned pin_ctrl;
  75. enum pm8xxx_vreg_pin_function pin_fn;
  76. int system_uA;
  77. int enable_time;
  78. int slew_rate;
  79. unsigned ocp_enable;
  80. int ocp_enable_time;
  81. };
  82. #endif