reset.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef _LINUX_RESET_H_
  2. #define _LINUX_RESET_H_
  3. struct device;
  4. struct device_node;
  5. struct reset_control;
  6. #ifdef CONFIG_RESET_CONTROLLER
  7. int reset_control_reset(struct reset_control *rstc);
  8. int reset_control_assert(struct reset_control *rstc);
  9. int reset_control_deassert(struct reset_control *rstc);
  10. int reset_control_status(struct reset_control *rstc);
  11. struct reset_control *reset_control_get(struct device *dev, const char *id);
  12. void reset_control_put(struct reset_control *rstc);
  13. struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
  14. int __must_check device_reset(struct device *dev);
  15. static inline int device_reset_optional(struct device *dev)
  16. {
  17. return device_reset(dev);
  18. }
  19. static inline struct reset_control *reset_control_get_optional(
  20. struct device *dev, const char *id)
  21. {
  22. return reset_control_get(dev, id);
  23. }
  24. static inline struct reset_control *devm_reset_control_get_optional(
  25. struct device *dev, const char *id)
  26. {
  27. return devm_reset_control_get(dev, id);
  28. }
  29. struct reset_control *of_reset_control_get(struct device_node *node,
  30. const char *id);
  31. struct reset_control *of_reset_control_get_by_index(
  32. struct device_node *node, int index);
  33. #else
  34. static inline int reset_control_reset(struct reset_control *rstc)
  35. {
  36. WARN_ON(1);
  37. return 0;
  38. }
  39. static inline int reset_control_assert(struct reset_control *rstc)
  40. {
  41. WARN_ON(1);
  42. return 0;
  43. }
  44. static inline int reset_control_deassert(struct reset_control *rstc)
  45. {
  46. WARN_ON(1);
  47. return 0;
  48. }
  49. static inline int reset_control_status(struct reset_control *rstc)
  50. {
  51. WARN_ON(1);
  52. return 0;
  53. }
  54. static inline void reset_control_put(struct reset_control *rstc)
  55. {
  56. WARN_ON(1);
  57. }
  58. static inline int device_reset_optional(struct device *dev)
  59. {
  60. return -ENOSYS;
  61. }
  62. static inline struct reset_control *__must_check reset_control_get(
  63. struct device *dev, const char *id)
  64. {
  65. WARN_ON(1);
  66. return ERR_PTR(-EINVAL);
  67. }
  68. static inline struct reset_control *__must_check devm_reset_control_get(
  69. struct device *dev, const char *id)
  70. {
  71. WARN_ON(1);
  72. return ERR_PTR(-EINVAL);
  73. }
  74. static inline struct reset_control *reset_control_get_optional(
  75. struct device *dev, const char *id)
  76. {
  77. return ERR_PTR(-ENOSYS);
  78. }
  79. static inline struct reset_control *devm_reset_control_get_optional(
  80. struct device *dev, const char *id)
  81. {
  82. return ERR_PTR(-ENOSYS);
  83. }
  84. static inline struct reset_control *of_reset_control_get(
  85. struct device_node *node, const char *id)
  86. {
  87. return ERR_PTR(-ENOSYS);
  88. }
  89. static inline struct reset_control *of_reset_control_get_by_index(
  90. struct device_node *node, int index)
  91. {
  92. return ERR_PTR(-ENOTSUPP);
  93. }
  94. #endif /* CONFIG_RESET_CONTROLLER */
  95. #endif