tps6586x.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2010,2011
  4. * NVIDIA Corporation <www.nvidia.com>
  5. */
  6. #ifndef _TPS6586X_H_
  7. #define _TPS6586X_H_
  8. enum {
  9. /* SM0-2 PWM/PFM Mode Selection */
  10. TPS6586X_PWM_SM0 = 1 << 0,
  11. TPS6586X_PWM_SM1 = 1 << 1,
  12. TPS6586X_PWM_SM2 = 1 << 2,
  13. };
  14. /**
  15. * Enable PWM mode for selected SM0-2
  16. *
  17. * @param mask Mask of synchronous converter to enable (TPS6586X_PWM_...)
  18. * @return 0 if ok, -1 on error
  19. */
  20. int tps6586x_set_pwm_mode(int mask);
  21. /**
  22. * Adjust SM0 and SM1 voltages to the given targets in incremental steps.
  23. *
  24. * @param sm0_target Target voltage for SM0 in 25mW units, 0=725mV, 31=1.5V
  25. * @param sm1_target Target voltage for SM1 in 25mW units, 0=725mV, 31=1.5V
  26. * @param step Amount to change voltage in each step, in 25mW units
  27. * @param rate Slew ratein mV/us: 0=instantly, 1=0.11, 2=0.22,
  28. * 3=0.44, 4=0.88, 5=1.76, 6=3.52, 7=7.04
  29. * @param min_sm0_over_sm1 Minimum amount by which sm0 must exceed sm1.
  30. * If this condition is not met, no adjustment will be
  31. * done and an error will be reported. Use -1 to skip
  32. * this check.
  33. * @return 0 if ok, -1 on error
  34. */
  35. int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate,
  36. int min_sm0_over_sm1);
  37. /**
  38. * Set up the TPS6586X I2C bus number. This will be used for all operations
  39. * on the device. This function must be called before using other functions.
  40. *
  41. * @param bus I2C bus containing the TPS6586X chip
  42. * @return 0 (always succeeds)
  43. */
  44. int tps6586x_init(struct udevice *bus);
  45. #endif /* _TPS6586X_H_ */