power-domain-uclass.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2016, NVIDIA CORPORATION.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #ifndef _POWER_DOMAIN_UCLASS_H
  7. #define _POWER_DOMAIN_UCLASS_H
  8. /* See power-domain.h for background documentation. */
  9. #include <power-domain.h>
  10. struct udevice;
  11. /**
  12. * struct power_domain_ops - The functions that a power domain controller driver
  13. * must implement.
  14. */
  15. struct power_domain_ops {
  16. /**
  17. * of_xlate - Translate a client's device-tree (OF) power domain
  18. * specifier.
  19. *
  20. * The power domain core calls this function as the first step in
  21. * implementing a client's power_domain_get() call.
  22. *
  23. * If this function pointer is set to NULL, the power domain core will
  24. * use a default implementation, which assumes #power-domain-cells =
  25. * <1>, and that the DT cell contains a simple integer power domain ID.
  26. *
  27. * At present, the power domain API solely supports device-tree. If
  28. * this changes, other xxx_xlate() functions may be added to support
  29. * those other mechanisms.
  30. *
  31. * @power_domain: The power domain struct to hold the
  32. * translation result.
  33. * @args: The power domain specifier values from device
  34. * tree.
  35. * @return 0 if OK, or a negative error code.
  36. */
  37. int (*of_xlate)(struct power_domain *power_domain,
  38. struct fdtdec_phandle_args *args);
  39. /**
  40. * request - Request a translated power domain.
  41. *
  42. * The power domain core calls this function as the second step in
  43. * implementing a client's power_domain_get() call, following a
  44. * successful xxx_xlate() call.
  45. *
  46. * @power_domain: The power domain to request; this has been
  47. * filled in by a previous xxx_xlate() function
  48. * call.
  49. * @return 0 if OK, or a negative error code.
  50. */
  51. int (*request)(struct power_domain *power_domain);
  52. /**
  53. * free - Free a previously requested power domain.
  54. *
  55. * This is the implementation of the client power_domain_free() API.
  56. *
  57. * @power_domain: The power domain to free.
  58. * @return 0 if OK, or a negative error code.
  59. */
  60. int (*free)(struct power_domain *power_domain);
  61. /**
  62. * on - Power on a power domain.
  63. *
  64. * @power_domain: The power domain to turn on.
  65. * @return 0 if OK, or a negative error code.
  66. */
  67. int (*on)(struct power_domain *power_domain);
  68. /**
  69. * off - Power off a power domain.
  70. *
  71. * @power_domain: The power domain to turn off.
  72. * @return 0 if OK, or a negative error code.
  73. */
  74. int (*off)(struct power_domain *power_domain);
  75. };
  76. #endif