pmbus.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Hardware monitoring driver for PMBus devices
  4. *
  5. * Copyright (c) 2010, 2011 Ericsson AB.
  6. */
  7. #ifndef _PMBUS_H_
  8. #define _PMBUS_H_
  9. #include <linux/bits.h>
  10. /* flags */
  11. /*
  12. * PMBUS_SKIP_STATUS_CHECK
  13. *
  14. * During register detection, skip checking the status register for
  15. * communication or command errors.
  16. *
  17. * Some PMBus chips respond with valid data when trying to read an unsupported
  18. * register. For such chips, checking the status register is mandatory when
  19. * trying to determine if a chip register exists or not.
  20. * Other PMBus chips don't support the STATUS_CML register, or report
  21. * communication errors for no explicable reason. For such chips, checking
  22. * the status register must be disabled.
  23. */
  24. #define PMBUS_SKIP_STATUS_CHECK BIT(0)
  25. /*
  26. * PMBUS_WRITE_PROTECTED
  27. * Set if the chip is write protected and write protection is not determined
  28. * by the standard WRITE_PROTECT command.
  29. */
  30. #define PMBUS_WRITE_PROTECTED BIT(1)
  31. /*
  32. * PMBUS_NO_CAPABILITY
  33. *
  34. * Some PMBus chips don't respond with valid data when reading the CAPABILITY
  35. * register. For such chips, this flag should be set so that the PMBus core
  36. * driver doesn't use CAPABILITY to determine it's behavior.
  37. */
  38. #define PMBUS_NO_CAPABILITY BIT(2)
  39. /*
  40. * PMBUS_READ_STATUS_AFTER_FAILED_CHECK
  41. *
  42. * Some PMBus chips end up in an undefined state when trying to read an
  43. * unsupported register. For such chips, it is necessary to reset the
  44. * chip pmbus controller to a known state after a failed register check.
  45. * This can be done by reading a known register. By setting this flag the
  46. * driver will try to read the STATUS register after each failed
  47. * register check. This read may fail, but it will put the chip in a
  48. * known state.
  49. */
  50. #define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3)
  51. /*
  52. * PMBUS_NO_WRITE_PROTECT
  53. *
  54. * Some PMBus chips respond with invalid data when reading the WRITE_PROTECT
  55. * register. For such chips, this flag should be set so that the PMBus core
  56. * driver doesn't use the WRITE_PROTECT command to determine its behavior.
  57. */
  58. #define PMBUS_NO_WRITE_PROTECT BIT(4)
  59. /*
  60. * PMBUS_USE_COEFFICIENTS_CMD
  61. *
  62. * When this flag is set the PMBus core driver will use the COEFFICIENTS
  63. * register to initialize the coefficients for the direct mode format.
  64. */
  65. #define PMBUS_USE_COEFFICIENTS_CMD BIT(5)
  66. struct pmbus_platform_data {
  67. u32 flags; /* Device specific flags */
  68. /* regulator support */
  69. int num_regulators;
  70. struct regulator_init_data *reg_init_data;
  71. };
  72. #endif /* _PMBUS_H_ */