Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_RESET_H_ |
| 2 | #define _LINUX_RESET_H_ |
| 3 | |
| 4 | struct device; |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 5 | struct device_node; |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 6 | struct reset_control; |
| 7 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 8 | #ifdef CONFIG_RESET_CONTROLLER |
| 9 | |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 10 | int reset_control_reset(struct reset_control *rstc); |
| 11 | int reset_control_assert(struct reset_control *rstc); |
| 12 | int reset_control_deassert(struct reset_control *rstc); |
| 13 | |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 14 | struct reset_control *reset_control_get(struct device *dev, const char *id); |
| 15 | void reset_control_put(struct reset_control *rstc); |
| 16 | struct reset_control *devm_reset_control_get(struct device *dev, const char *id); |
| 17 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 18 | int __must_check device_reset(struct device *dev); |
| 19 | |
| 20 | static inline int device_reset_optional(struct device *dev) |
| 21 | { |
| 22 | return device_reset(dev); |
| 23 | } |
| 24 | |
| 25 | static inline struct reset_control *reset_control_get_optional( |
| 26 | struct device *dev, const char *id) |
| 27 | { |
| 28 | return reset_control_get(dev, id); |
| 29 | } |
| 30 | |
| 31 | static inline struct reset_control *devm_reset_control_get_optional( |
| 32 | struct device *dev, const char *id) |
| 33 | { |
| 34 | return devm_reset_control_get(dev, id); |
| 35 | } |
| 36 | |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 37 | struct reset_control *of_reset_control_get(struct device_node *node, |
| 38 | const char *id); |
| 39 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 40 | #else |
| 41 | |
| 42 | static inline int reset_control_reset(struct reset_control *rstc) |
| 43 | { |
| 44 | WARN_ON(1); |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | static inline int reset_control_assert(struct reset_control *rstc) |
| 49 | { |
| 50 | WARN_ON(1); |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static inline int reset_control_deassert(struct reset_control *rstc) |
| 55 | { |
| 56 | WARN_ON(1); |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | static inline void reset_control_put(struct reset_control *rstc) |
| 61 | { |
| 62 | WARN_ON(1); |
| 63 | } |
| 64 | |
| 65 | static inline int device_reset_optional(struct device *dev) |
| 66 | { |
| 67 | return -ENOSYS; |
| 68 | } |
| 69 | |
| 70 | static inline struct reset_control *reset_control_get_optional( |
| 71 | struct device *dev, const char *id) |
| 72 | { |
| 73 | return ERR_PTR(-ENOSYS); |
| 74 | } |
| 75 | |
| 76 | static inline struct reset_control *devm_reset_control_get_optional( |
| 77 | struct device *dev, const char *id) |
| 78 | { |
| 79 | return ERR_PTR(-ENOSYS); |
| 80 | } |
| 81 | |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 82 | static inline struct reset_control *of_reset_control_get( |
| 83 | struct device_node *node, const char *id) |
| 84 | { |
| 85 | return ERR_PTR(-ENOSYS); |
| 86 | } |
| 87 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 88 | #endif /* CONFIG_RESET_CONTROLLER */ |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 89 | |
| 90 | #endif |