tps6586x.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * (C) Copyright 2010,2011
  3. * NVIDIA Corporation <www.nvidia.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __H_
  24. #define _TPS6586X_H_
  25. enum {
  26. /* SM0-2 PWM/PFM Mode Selection */
  27. TPS6586X_PWM_SM0 = 1 << 0,
  28. TPS6586X_PWM_SM1 = 1 << 1,
  29. TPS6586X_PWM_SM2 = 1 << 2,
  30. };
  31. /**
  32. * Enable PWM mode for selected SM0-2
  33. *
  34. * @param mask Mask of synchronous converter to enable (TPS6586X_PWM_...)
  35. * @return 0 if ok, -1 on error
  36. */
  37. int tps6586x_set_pwm_mode(int mask);
  38. /**
  39. * Adjust SM0 and SM1 voltages to the given targets in incremental steps.
  40. *
  41. * @param sm0_target Target voltage for SM0 in 25mW units, 0=725mV, 31=1.5V
  42. * @param sm1_target Target voltage for SM1 in 25mW units, 0=725mV, 31=1.5V
  43. * @param step Amount to change voltage in each step, in 25mW units
  44. * @param rate Slew ratein mV/us: 0=instantly, 1=0.11, 2=0.22,
  45. * 3=0.44, 4=0.88, 5=1.76, 6=3.52, 7=7.04
  46. * @param min_sm0_over_sm1 Minimum amount by which sm0 must exceed sm1.
  47. * If this condition is not met, no adjustment will be
  48. * done and an error will be reported. Use -1 to skip
  49. * this check.
  50. * @return 0 if ok, -1 on error
  51. */
  52. int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate,
  53. int min_sm0_over_sm1);
  54. /**
  55. * Set up the TPS6586X I2C bus number. This will be used for all operations
  56. * on the device. This function must be called before using other functions.
  57. *
  58. * @param bus I2C bus number containing the TPS6586X chip
  59. * @return 0 (always succeeds)
  60. */
  61. int tps6586x_init(int bus);
  62. #endif /* _TPS6586X_H_ */