Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_RESET_H_ |
| 2 | #define _LINUX_RESET_H_ |
| 3 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 4 | #include <linux/device.h> |
| 5 | |
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); |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 13 | int reset_control_status(struct reset_control *rstc); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 14 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 15 | struct reset_control *__of_reset_control_get(struct device_node *node, |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 16 | const char *id, int index, bool shared, |
| 17 | bool optional); |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 18 | struct reset_control *__reset_control_get(struct device *dev, const char *id, |
| 19 | int index, bool shared, |
| 20 | bool optional); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 21 | void reset_control_put(struct reset_control *rstc); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 22 | struct reset_control *__devm_reset_control_get(struct device *dev, |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 23 | const char *id, int index, bool shared, |
| 24 | bool optional); |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 25 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 26 | int __must_check device_reset(struct device *dev); |
| 27 | |
| 28 | static inline int device_reset_optional(struct device *dev) |
| 29 | { |
| 30 | return device_reset(dev); |
| 31 | } |
| 32 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 33 | #else |
| 34 | |
| 35 | static inline int reset_control_reset(struct reset_control *rstc) |
| 36 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | static inline int reset_control_assert(struct reset_control *rstc) |
| 41 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | static inline int reset_control_deassert(struct reset_control *rstc) |
| 46 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 47 | return 0; |
| 48 | } |
| 49 | |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 50 | static inline int reset_control_status(struct reset_control *rstc) |
| 51 | { |
Dinh Nguyen | 729de41 | 2014-10-10 10:21:14 -0500 | [diff] [blame] | 52 | return 0; |
| 53 | } |
| 54 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 55 | static inline void reset_control_put(struct reset_control *rstc) |
| 56 | { |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 57 | } |
| 58 | |
Daniel Lezcano | 4113652 | 2016-04-01 21:38:16 +0200 | [diff] [blame] | 59 | static inline int __must_check device_reset(struct device *dev) |
| 60 | { |
| 61 | WARN_ON(1); |
| 62 | return -ENOTSUPP; |
| 63 | } |
| 64 | |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 65 | static inline int device_reset_optional(struct device *dev) |
| 66 | { |
Philipp Zabel | 39b4da7 | 2015-10-29 09:55:00 +0100 | [diff] [blame] | 67 | return -ENOTSUPP; |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 68 | } |
| 69 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 70 | static inline struct reset_control *__of_reset_control_get( |
| 71 | struct device_node *node, |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 72 | const char *id, int index, bool shared, |
| 73 | bool optional) |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 74 | { |
Philipp Zabel | 0ca10b6 | 2017-03-20 11:25:16 +0100 | [diff] [blame] | 75 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 76 | } |
| 77 | |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 78 | static inline struct reset_control *__reset_control_get( |
| 79 | struct device *dev, const char *id, |
| 80 | int index, bool shared, bool optional) |
| 81 | { |
| 82 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
| 83 | } |
| 84 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 85 | static inline struct reset_control *__devm_reset_control_get( |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 86 | struct device *dev, const char *id, |
| 87 | int index, bool shared, bool optional) |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 88 | { |
Philipp Zabel | 0ca10b6 | 2017-03-20 11:25:16 +0100 | [diff] [blame] | 89 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | #endif /* CONFIG_RESET_CONTROLLER */ |
| 93 | |
| 94 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 95 | * reset_control_get_exclusive - Lookup and obtain an exclusive reference |
| 96 | * to a reset controller. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 97 | * @dev: device to be reset by the controller |
| 98 | * @id: reset line name |
| 99 | * |
| 100 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 101 | * If this function is called more then once for the same reset_control it will |
| 102 | * return -EBUSY. |
| 103 | * |
| 104 | * See reset_control_get_shared for details on shared references to |
| 105 | * reset-controls. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 106 | * |
| 107 | * Use of id names is optional. |
| 108 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 109 | static inline struct reset_control * |
| 110 | __must_check reset_control_get_exclusive(struct device *dev, const char *id) |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 111 | { |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 112 | #ifndef CONFIG_RESET_CONTROLLER |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 113 | WARN_ON(1); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 114 | #endif |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 115 | return __reset_control_get(dev, id, 0, false, false); |
Axel Lin | 5bcd0b7 | 2015-09-01 07:56:38 +0800 | [diff] [blame] | 116 | } |
| 117 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 118 | /** |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 119 | * reset_control_get_shared - Lookup and obtain a shared reference to a |
| 120 | * reset controller. |
| 121 | * @dev: device to be reset by the controller |
| 122 | * @id: reset line name |
| 123 | * |
| 124 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 125 | * This function is intended for use with reset-controls which are shared |
| 126 | * between hardware-blocks. |
| 127 | * |
| 128 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 129 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 130 | * and only (re-)assert the reset after reset_control_assert has been called |
| 131 | * as many times as reset_control_deassert was called. Also see the remark |
| 132 | * about shared reset-controls in the reset_control_assert docs. |
| 133 | * |
| 134 | * Calling reset_control_assert without first calling reset_control_deassert |
| 135 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 136 | * also not allowed on a shared reset control. |
| 137 | * |
| 138 | * Use of id names is optional. |
| 139 | */ |
| 140 | static inline struct reset_control *reset_control_get_shared( |
| 141 | struct device *dev, const char *id) |
| 142 | { |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 143 | return __reset_control_get(dev, id, 0, true, false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 144 | } |
| 145 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 146 | static inline struct reset_control *reset_control_get_optional_exclusive( |
Lee Jones | 3c35f6e | 2016-06-06 16:56:49 +0100 | [diff] [blame] | 147 | struct device *dev, const char *id) |
| 148 | { |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 149 | return __reset_control_get(dev, id, 0, false, true); |
Lee Jones | 3c35f6e | 2016-06-06 16:56:49 +0100 | [diff] [blame] | 150 | } |
| 151 | |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 152 | static inline struct reset_control *reset_control_get_optional_shared( |
| 153 | struct device *dev, const char *id) |
| 154 | { |
Philipp Zabel | 62e24c5 | 2016-02-05 13:41:39 +0100 | [diff] [blame] | 155 | return __reset_control_get(dev, id, 0, true, true); |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 156 | } |
| 157 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 158 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 159 | * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference |
| 160 | * to a reset controller. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 161 | * @node: device to be reset by the controller |
| 162 | * @id: reset line name |
| 163 | * |
| 164 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 165 | * |
| 166 | * Use of id names is optional. |
| 167 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 168 | static inline struct reset_control *of_reset_control_get_exclusive( |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 169 | struct device_node *node, const char *id) |
| 170 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 171 | return __of_reset_control_get(node, id, 0, false, false); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | /** |
Lee Jones | 40faee8e | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 175 | * of_reset_control_get_shared - Lookup and obtain an shared reference |
| 176 | * to a reset controller. |
| 177 | * @node: device to be reset by the controller |
| 178 | * @id: reset line name |
| 179 | * |
| 180 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 181 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 182 | * and only (re-)assert the reset after reset_control_assert has been called |
| 183 | * as many times as reset_control_deassert was called. Also see the remark |
| 184 | * about shared reset-controls in the reset_control_assert docs. |
| 185 | * |
| 186 | * Calling reset_control_assert without first calling reset_control_deassert |
| 187 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 188 | * also not allowed on a shared reset control. |
| 189 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 190 | * |
| 191 | * Use of id names is optional. |
| 192 | */ |
| 193 | static inline struct reset_control *of_reset_control_get_shared( |
| 194 | struct device_node *node, const char *id) |
| 195 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 196 | return __of_reset_control_get(node, id, 0, true, false); |
Lee Jones | 40faee8e | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 200 | * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive |
| 201 | * reference to a reset controller |
| 202 | * by index. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 203 | * @node: device to be reset by the controller |
| 204 | * @index: index of the reset controller |
| 205 | * |
| 206 | * This is to be used to perform a list of resets for a device or power domain |
| 207 | * in whatever order. Returns a struct reset_control or IS_ERR() condition |
| 208 | * containing errno. |
| 209 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 210 | static inline struct reset_control *of_reset_control_get_exclusive_by_index( |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 211 | struct device_node *node, int index) |
| 212 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 213 | return __of_reset_control_get(node, NULL, index, false, false); |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | /** |
Lee Jones | 40faee8e | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 217 | * of_reset_control_get_shared_by_index - Lookup and obtain an shared |
| 218 | * reference to a reset controller |
| 219 | * by index. |
| 220 | * @node: device to be reset by the controller |
| 221 | * @index: index of the reset controller |
| 222 | * |
| 223 | * When a reset-control is shared, the behavior of reset_control_assert / |
| 224 | * deassert is changed, the reset-core will keep track of a deassert_count |
| 225 | * and only (re-)assert the reset after reset_control_assert has been called |
| 226 | * as many times as reset_control_deassert was called. Also see the remark |
| 227 | * about shared reset-controls in the reset_control_assert docs. |
| 228 | * |
| 229 | * Calling reset_control_assert without first calling reset_control_deassert |
| 230 | * is not allowed on a shared reset control. Calling reset_control_reset is |
| 231 | * also not allowed on a shared reset control. |
| 232 | * Returns a struct reset_control or IS_ERR() condition containing errno. |
| 233 | * |
| 234 | * This is to be used to perform a list of resets for a device or power domain |
| 235 | * in whatever order. Returns a struct reset_control or IS_ERR() condition |
| 236 | * containing errno. |
| 237 | */ |
| 238 | static inline struct reset_control *of_reset_control_get_shared_by_index( |
| 239 | struct device_node *node, int index) |
| 240 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 241 | return __of_reset_control_get(node, NULL, index, true, false); |
Lee Jones | 40faee8e | 2016-06-06 16:56:51 +0100 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 245 | * devm_reset_control_get_exclusive - resource managed |
| 246 | * reset_control_get_exclusive() |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 247 | * @dev: device to be reset by the controller |
| 248 | * @id: reset line name |
| 249 | * |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 250 | * Managed reset_control_get_exclusive(). For reset controllers returned |
| 251 | * from this function, reset_control_put() is called automatically on driver |
| 252 | * detach. |
| 253 | * |
| 254 | * See reset_control_get_exclusive() for more information. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 255 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 256 | static inline struct reset_control * |
| 257 | __must_check devm_reset_control_get_exclusive(struct device *dev, |
| 258 | const char *id) |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 259 | { |
| 260 | #ifndef CONFIG_RESET_CONTROLLER |
| 261 | WARN_ON(1); |
| 262 | #endif |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 263 | return __devm_reset_control_get(dev, id, 0, false, false); |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 264 | } |
| 265 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 266 | /** |
| 267 | * devm_reset_control_get_shared - resource managed reset_control_get_shared() |
| 268 | * @dev: device to be reset by the controller |
| 269 | * @id: reset line name |
| 270 | * |
| 271 | * Managed reset_control_get_shared(). For reset controllers returned from |
| 272 | * this function, reset_control_put() is called automatically on driver detach. |
| 273 | * See reset_control_get_shared() for more information. |
| 274 | */ |
| 275 | static inline struct reset_control *devm_reset_control_get_shared( |
| 276 | struct device *dev, const char *id) |
| 277 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 278 | return __devm_reset_control_get(dev, id, 0, true, false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 279 | } |
| 280 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 281 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 282 | struct device *dev, const char *id) |
| 283 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 284 | return __devm_reset_control_get(dev, id, 0, false, true); |
Philipp Zabel | b424080 | 2014-03-07 15:18:47 +0100 | [diff] [blame] | 285 | } |
| 286 | |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 287 | static inline struct reset_control *devm_reset_control_get_optional_shared( |
| 288 | struct device *dev, const char *id) |
| 289 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 290 | return __devm_reset_control_get(dev, id, 0, true, true); |
Lee Jones | c33d61a | 2016-06-06 16:56:52 +0100 | [diff] [blame] | 291 | } |
| 292 | |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 293 | /** |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 294 | * devm_reset_control_get_exclusive_by_index - resource managed |
| 295 | * reset_control_get_exclusive() |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 296 | * @dev: device to be reset by the controller |
| 297 | * @index: index of the reset controller |
| 298 | * |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 299 | * Managed reset_control_get_exclusive(). For reset controllers returned from |
| 300 | * this function, reset_control_put() is called automatically on driver |
| 301 | * detach. |
| 302 | * |
| 303 | * See reset_control_get_exclusive() for more information. |
Hans de Goede | 6c96f05 | 2016-02-23 18:46:24 +0100 | [diff] [blame] | 304 | */ |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 305 | static inline struct reset_control * |
| 306 | devm_reset_control_get_exclusive_by_index(struct device *dev, int index) |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 307 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 308 | return __devm_reset_control_get(dev, NULL, index, false, false); |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 309 | } |
| 310 | |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 311 | /** |
| 312 | * devm_reset_control_get_shared_by_index - resource managed |
| 313 | * reset_control_get_shared |
| 314 | * @dev: device to be reset by the controller |
| 315 | * @index: index of the reset controller |
| 316 | * |
| 317 | * Managed reset_control_get_shared(). For reset controllers returned from |
| 318 | * this function, reset_control_put() is called automatically on driver detach. |
| 319 | * See reset_control_get_shared() for more information. |
| 320 | */ |
Lee Jones | 0bcc0ea | 2016-06-06 16:56:53 +0100 | [diff] [blame] | 321 | static inline struct reset_control * |
| 322 | devm_reset_control_get_shared_by_index(struct device *dev, int index) |
Hans de Goede | 0b52297 | 2016-02-23 18:46:26 +0100 | [diff] [blame] | 323 | { |
Ramiro Oliveira | bb47523 | 2017-01-13 17:57:41 +0000 | [diff] [blame] | 324 | return __devm_reset_control_get(dev, NULL, index, true, false); |
Hans de Goede | e3ec0a8 | 2014-04-13 14:09:15 +0200 | [diff] [blame] | 325 | } |
| 326 | |
Lee Jones | a53e35d | 2016-06-06 16:56:50 +0100 | [diff] [blame] | 327 | /* |
| 328 | * TEMPORARY calls to use during transition: |
| 329 | * |
| 330 | * of_reset_control_get() => of_reset_control_get_exclusive() |
| 331 | * |
| 332 | * These inline function calls will be removed once all consumers |
| 333 | * have been moved over to the new explicit API. |
| 334 | */ |
| 335 | static inline struct reset_control *reset_control_get( |
| 336 | struct device *dev, const char *id) |
| 337 | { |
| 338 | return reset_control_get_exclusive(dev, id); |
| 339 | } |
| 340 | |
| 341 | static inline struct reset_control *reset_control_get_optional( |
| 342 | struct device *dev, const char *id) |
| 343 | { |
| 344 | return reset_control_get_optional_exclusive(dev, id); |
| 345 | } |
| 346 | |
| 347 | static inline struct reset_control *of_reset_control_get( |
| 348 | struct device_node *node, const char *id) |
| 349 | { |
| 350 | return of_reset_control_get_exclusive(node, id); |
| 351 | } |
| 352 | |
| 353 | static inline struct reset_control *of_reset_control_get_by_index( |
| 354 | struct device_node *node, int index) |
| 355 | { |
| 356 | return of_reset_control_get_exclusive_by_index(node, index); |
| 357 | } |
| 358 | |
| 359 | static inline struct reset_control *devm_reset_control_get( |
| 360 | struct device *dev, const char *id) |
| 361 | { |
| 362 | return devm_reset_control_get_exclusive(dev, id); |
| 363 | } |
| 364 | |
| 365 | static inline struct reset_control *devm_reset_control_get_optional( |
| 366 | struct device *dev, const char *id) |
| 367 | { |
| 368 | return devm_reset_control_get_optional_exclusive(dev, id); |
| 369 | |
| 370 | } |
| 371 | |
| 372 | static inline struct reset_control *devm_reset_control_get_by_index( |
| 373 | struct device *dev, int index) |
| 374 | { |
| 375 | return devm_reset_control_get_exclusive_by_index(dev, index); |
| 376 | } |
Philipp Zabel | 61fc413 | 2012-11-19 17:23:13 +0100 | [diff] [blame] | 377 | #endif |