1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_RESET_H_
3 #define _LINUX_RESET_H_
6 #include <linux/errno.h>
7 #include <linux/types.h>
14 * struct reset_control_bulk_data - Data used for bulk reset control operations.
16 * @id: reset control consumer ID
17 * @rstc: struct reset_control * to store the associated reset control
19 * The reset APIs provide a series of reset_control_bulk_*() API calls as
20 * a convenience to consumers which require multiple reset controls.
21 * This structure is used to manage data for these calls.
23 struct reset_control_bulk_data {
25 struct reset_control *rstc;
28 #ifdef CONFIG_RESET_CONTROLLER
30 int reset_control_reset(struct reset_control *rstc);
31 int reset_control_rearm(struct reset_control *rstc);
32 int reset_control_assert(struct reset_control *rstc);
33 int reset_control_deassert(struct reset_control *rstc);
34 int reset_control_status(struct reset_control *rstc);
35 int reset_control_acquire(struct reset_control *rstc);
36 void reset_control_release(struct reset_control *rstc);
38 int reset_control_bulk_reset(int num_rstcs, struct reset_control_bulk_data *rstcs);
39 int reset_control_bulk_assert(int num_rstcs, struct reset_control_bulk_data *rstcs);
40 int reset_control_bulk_deassert(int num_rstcs, struct reset_control_bulk_data *rstcs);
41 int reset_control_bulk_acquire(int num_rstcs, struct reset_control_bulk_data *rstcs);
42 void reset_control_bulk_release(int num_rstcs, struct reset_control_bulk_data *rstcs);
44 struct reset_control *__of_reset_control_get(struct device_node *node,
45 const char *id, int index, bool shared,
46 bool optional, bool acquired);
47 struct reset_control *__reset_control_get(struct device *dev, const char *id,
48 int index, bool shared,
49 bool optional, bool acquired);
50 void reset_control_put(struct reset_control *rstc);
51 int __reset_control_bulk_get(struct device *dev, int num_rstcs,
52 struct reset_control_bulk_data *rstcs,
53 bool shared, bool optional, bool acquired);
54 void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs);
56 int __device_reset(struct device *dev, bool optional);
57 struct reset_control *__devm_reset_control_get(struct device *dev,
58 const char *id, int index, bool shared,
59 bool optional, bool acquired);
60 int __devm_reset_control_bulk_get(struct device *dev, int num_rstcs,
61 struct reset_control_bulk_data *rstcs,
62 bool shared, bool optional, bool acquired);
64 struct reset_control *devm_reset_control_array_get(struct device *dev,
65 bool shared, bool optional);
66 struct reset_control *of_reset_control_array_get(struct device_node *np,
67 bool shared, bool optional,
70 int reset_control_get_count(struct device *dev);
74 static inline int reset_control_reset(struct reset_control *rstc)
79 static inline int reset_control_rearm(struct reset_control *rstc)
84 static inline int reset_control_assert(struct reset_control *rstc)
89 static inline int reset_control_deassert(struct reset_control *rstc)
94 static inline int reset_control_status(struct reset_control *rstc)
99 static inline int reset_control_acquire(struct reset_control *rstc)
104 static inline void reset_control_release(struct reset_control *rstc)
108 static inline void reset_control_put(struct reset_control *rstc)
112 static inline int __device_reset(struct device *dev, bool optional)
114 return optional ? 0 : -ENOTSUPP;
117 static inline struct reset_control *__of_reset_control_get(
118 struct device_node *node,
119 const char *id, int index, bool shared,
120 bool optional, bool acquired)
122 return optional ? NULL : ERR_PTR(-ENOTSUPP);
125 static inline struct reset_control *__reset_control_get(
126 struct device *dev, const char *id,
127 int index, bool shared, bool optional,
130 return optional ? NULL : ERR_PTR(-ENOTSUPP);
134 reset_control_bulk_reset(int num_rstcs, struct reset_control_bulk_data *rstcs)
140 reset_control_bulk_assert(int num_rstcs, struct reset_control_bulk_data *rstcs)
146 reset_control_bulk_deassert(int num_rstcs, struct reset_control_bulk_data *rstcs)
152 reset_control_bulk_acquire(int num_rstcs, struct reset_control_bulk_data *rstcs)
158 reset_control_bulk_release(int num_rstcs, struct reset_control_bulk_data *rstcs)
163 __reset_control_bulk_get(struct device *dev, int num_rstcs,
164 struct reset_control_bulk_data *rstcs,
165 bool shared, bool optional, bool acquired)
167 return optional ? 0 : -EOPNOTSUPP;
171 reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs)
175 static inline struct reset_control *__devm_reset_control_get(
176 struct device *dev, const char *id,
177 int index, bool shared, bool optional,
180 return optional ? NULL : ERR_PTR(-ENOTSUPP);
184 __devm_reset_control_bulk_get(struct device *dev, int num_rstcs,
185 struct reset_control_bulk_data *rstcs,
186 bool shared, bool optional, bool acquired)
188 return optional ? 0 : -EOPNOTSUPP;
191 static inline struct reset_control *
192 devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
194 return optional ? NULL : ERR_PTR(-ENOTSUPP);
197 static inline struct reset_control *
198 of_reset_control_array_get(struct device_node *np, bool shared, bool optional,
201 return optional ? NULL : ERR_PTR(-ENOTSUPP);
204 static inline int reset_control_get_count(struct device *dev)
209 #endif /* CONFIG_RESET_CONTROLLER */
211 static inline int __must_check device_reset(struct device *dev)
213 return __device_reset(dev, false);
216 static inline int device_reset_optional(struct device *dev)
218 return __device_reset(dev, true);
222 * reset_control_get_exclusive - Lookup and obtain an exclusive reference
223 * to a reset controller.
224 * @dev: device to be reset by the controller
225 * @id: reset line name
227 * Returns a struct reset_control or IS_ERR() condition containing errno.
228 * If this function is called more than once for the same reset_control it will
231 * See reset_control_get_shared() for details on shared references to
234 * Use of id names is optional.
236 static inline struct reset_control *
237 __must_check reset_control_get_exclusive(struct device *dev, const char *id)
239 return __reset_control_get(dev, id, 0, false, false, true);
243 * reset_control_bulk_get_exclusive - Lookup and obtain exclusive references to
244 * multiple reset controllers.
245 * @dev: device to be reset by the controller
246 * @num_rstcs: number of entries in rstcs array
247 * @rstcs: array of struct reset_control_bulk_data with reset line names set
249 * Fills the rstcs array with pointers to exclusive reset controls and
250 * returns 0, or an IS_ERR() condition containing errno.
252 static inline int __must_check
253 reset_control_bulk_get_exclusive(struct device *dev, int num_rstcs,
254 struct reset_control_bulk_data *rstcs)
256 return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, true);
260 * reset_control_get_exclusive_released - Lookup and obtain a temoprarily
261 * exclusive reference to a reset
263 * @dev: device to be reset by the controller
264 * @id: reset line name
266 * Returns a struct reset_control or IS_ERR() condition containing errno.
267 * reset-controls returned by this function must be acquired via
268 * reset_control_acquire() before they can be used and should be released
269 * via reset_control_release() afterwards.
271 * Use of id names is optional.
273 static inline struct reset_control *
274 __must_check reset_control_get_exclusive_released(struct device *dev,
277 return __reset_control_get(dev, id, 0, false, false, false);
281 * reset_control_bulk_get_exclusive_released - Lookup and obtain temporarily
282 * exclusive references to multiple reset
284 * @dev: device to be reset by the controller
285 * @num_rstcs: number of entries in rstcs array
286 * @rstcs: array of struct reset_control_bulk_data with reset line names set
288 * Fills the rstcs array with pointers to exclusive reset controls and
289 * returns 0, or an IS_ERR() condition containing errno.
290 * reset-controls returned by this function must be acquired via
291 * reset_control_bulk_acquire() before they can be used and should be released
292 * via reset_control_bulk_release() afterwards.
294 static inline int __must_check
295 reset_control_bulk_get_exclusive_released(struct device *dev, int num_rstcs,
296 struct reset_control_bulk_data *rstcs)
298 return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, false);
302 * reset_control_bulk_get_optional_exclusive_released - Lookup and obtain optional
303 * temporarily exclusive references to multiple
305 * @dev: device to be reset by the controller
306 * @num_rstcs: number of entries in rstcs array
307 * @rstcs: array of struct reset_control_bulk_data with reset line names set
309 * Optional variant of reset_control_bulk_get_exclusive_released(). If the
310 * requested reset is not specified in the device tree, this function returns 0
311 * instead of an error and missing rtsc is set to NULL.
313 * See reset_control_bulk_get_exclusive_released() for more information.
315 static inline int __must_check
316 reset_control_bulk_get_optional_exclusive_released(struct device *dev, int num_rstcs,
317 struct reset_control_bulk_data *rstcs)
319 return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, false);
323 * reset_control_get_shared - Lookup and obtain a shared reference to a
325 * @dev: device to be reset by the controller
326 * @id: reset line name
328 * Returns a struct reset_control or IS_ERR() condition containing errno.
329 * This function is intended for use with reset-controls which are shared
330 * between hardware blocks.
332 * When a reset-control is shared, the behavior of reset_control_assert /
333 * deassert is changed, the reset-core will keep track of a deassert_count
334 * and only (re-)assert the reset after reset_control_assert has been called
335 * as many times as reset_control_deassert was called. Also see the remark
336 * about shared reset-controls in the reset_control_assert docs.
338 * Calling reset_control_assert without first calling reset_control_deassert
339 * is not allowed on a shared reset control. Calling reset_control_reset is
340 * also not allowed on a shared reset control.
342 * Use of id names is optional.
344 static inline struct reset_control *reset_control_get_shared(
345 struct device *dev, const char *id)
347 return __reset_control_get(dev, id, 0, true, false, false);
351 * reset_control_bulk_get_shared - Lookup and obtain shared references to
352 * multiple reset controllers.
353 * @dev: device to be reset by the controller
354 * @num_rstcs: number of entries in rstcs array
355 * @rstcs: array of struct reset_control_bulk_data with reset line names set
357 * Fills the rstcs array with pointers to shared reset controls and
358 * returns 0, or an IS_ERR() condition containing errno.
360 static inline int __must_check
361 reset_control_bulk_get_shared(struct device *dev, int num_rstcs,
362 struct reset_control_bulk_data *rstcs)
364 return __reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, false);
368 * reset_control_get_optional_exclusive - optional reset_control_get_exclusive()
369 * @dev: device to be reset by the controller
370 * @id: reset line name
372 * Optional variant of reset_control_get_exclusive(). If the requested reset
373 * is not specified in the device tree, this function returns NULL instead of
376 * See reset_control_get_exclusive() for more information.
378 static inline struct reset_control *reset_control_get_optional_exclusive(
379 struct device *dev, const char *id)
381 return __reset_control_get(dev, id, 0, false, true, true);
385 * reset_control_bulk_get_optional_exclusive - optional
386 * reset_control_bulk_get_exclusive()
387 * @dev: device to be reset by the controller
388 * @num_rstcs: number of entries in rstcs array
389 * @rstcs: array of struct reset_control_bulk_data with reset line names set
391 * Optional variant of reset_control_bulk_get_exclusive(). If any of the
392 * requested resets are not specified in the device tree, this function sets
393 * them to NULL instead of returning an error.
395 * See reset_control_bulk_get_exclusive() for more information.
397 static inline int __must_check
398 reset_control_bulk_get_optional_exclusive(struct device *dev, int num_rstcs,
399 struct reset_control_bulk_data *rstcs)
401 return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, true);
405 * reset_control_get_optional_shared - optional reset_control_get_shared()
406 * @dev: device to be reset by the controller
407 * @id: reset line name
409 * Optional variant of reset_control_get_shared(). If the requested reset
410 * is not specified in the device tree, this function returns NULL instead of
413 * See reset_control_get_shared() for more information.
415 static inline struct reset_control *reset_control_get_optional_shared(
416 struct device *dev, const char *id)
418 return __reset_control_get(dev, id, 0, true, true, false);
422 * reset_control_bulk_get_optional_shared - optional
423 * reset_control_bulk_get_shared()
424 * @dev: device to be reset by the controller
425 * @num_rstcs: number of entries in rstcs array
426 * @rstcs: array of struct reset_control_bulk_data with reset line names set
428 * Optional variant of reset_control_bulk_get_shared(). If the requested resets
429 * are not specified in the device tree, this function sets them to NULL
430 * instead of returning an error.
432 * See reset_control_bulk_get_shared() for more information.
434 static inline int __must_check
435 reset_control_bulk_get_optional_shared(struct device *dev, int num_rstcs,
436 struct reset_control_bulk_data *rstcs)
438 return __reset_control_bulk_get(dev, num_rstcs, rstcs, true, true, false);
442 * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference
443 * to a reset controller.
444 * @node: device to be reset by the controller
445 * @id: reset line name
447 * Returns a struct reset_control or IS_ERR() condition containing errno.
449 * Use of id names is optional.
451 static inline struct reset_control *of_reset_control_get_exclusive(
452 struct device_node *node, const char *id)
454 return __of_reset_control_get(node, id, 0, false, false, true);
458 * of_reset_control_get_optional_exclusive - Lookup and obtain an optional exclusive
459 * reference to a reset controller.
460 * @node: device to be reset by the controller
461 * @id: reset line name
463 * Optional variant of of_reset_control_get_exclusive(). If the requested reset
464 * is not specified in the device tree, this function returns NULL instead of
467 * Returns a struct reset_control or IS_ERR() condition containing errno.
469 * Use of id names is optional.
471 static inline struct reset_control *of_reset_control_get_optional_exclusive(
472 struct device_node *node, const char *id)
474 return __of_reset_control_get(node, id, 0, false, true, true);
478 * of_reset_control_get_shared - Lookup and obtain a shared reference
479 * to a reset controller.
480 * @node: device to be reset by the controller
481 * @id: reset line name
483 * When a reset-control is shared, the behavior of reset_control_assert /
484 * deassert is changed, the reset-core will keep track of a deassert_count
485 * and only (re-)assert the reset after reset_control_assert has been called
486 * as many times as reset_control_deassert was called. Also see the remark
487 * about shared reset-controls in the reset_control_assert docs.
489 * Calling reset_control_assert without first calling reset_control_deassert
490 * is not allowed on a shared reset control. Calling reset_control_reset is
491 * also not allowed on a shared reset control.
492 * Returns a struct reset_control or IS_ERR() condition containing errno.
494 * Use of id names is optional.
496 static inline struct reset_control *of_reset_control_get_shared(
497 struct device_node *node, const char *id)
499 return __of_reset_control_get(node, id, 0, true, false, false);
503 * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive
504 * reference to a reset controller
506 * @node: device to be reset by the controller
507 * @index: index of the reset controller
509 * This is to be used to perform a list of resets for a device or power domain
510 * in whatever order. Returns a struct reset_control or IS_ERR() condition
513 static inline struct reset_control *of_reset_control_get_exclusive_by_index(
514 struct device_node *node, int index)
516 return __of_reset_control_get(node, NULL, index, false, false, true);
520 * of_reset_control_get_shared_by_index - Lookup and obtain a shared
521 * reference to a reset controller
523 * @node: device to be reset by the controller
524 * @index: index of the reset controller
526 * When a reset-control is shared, the behavior of reset_control_assert /
527 * deassert is changed, the reset-core will keep track of a deassert_count
528 * and only (re-)assert the reset after reset_control_assert has been called
529 * as many times as reset_control_deassert was called. Also see the remark
530 * about shared reset-controls in the reset_control_assert docs.
532 * Calling reset_control_assert without first calling reset_control_deassert
533 * is not allowed on a shared reset control. Calling reset_control_reset is
534 * also not allowed on a shared reset control.
535 * Returns a struct reset_control or IS_ERR() condition containing errno.
537 * This is to be used to perform a list of resets for a device or power domain
538 * in whatever order. Returns a struct reset_control or IS_ERR() condition
541 static inline struct reset_control *of_reset_control_get_shared_by_index(
542 struct device_node *node, int index)
544 return __of_reset_control_get(node, NULL, index, true, false, false);
548 * devm_reset_control_get_exclusive - resource managed
549 * reset_control_get_exclusive()
550 * @dev: device to be reset by the controller
551 * @id: reset line name
553 * Managed reset_control_get_exclusive(). For reset controllers returned
554 * from this function, reset_control_put() is called automatically on driver
557 * See reset_control_get_exclusive() for more information.
559 static inline struct reset_control *
560 __must_check devm_reset_control_get_exclusive(struct device *dev,
563 return __devm_reset_control_get(dev, id, 0, false, false, true);
567 * devm_reset_control_bulk_get_exclusive - resource managed
568 * reset_control_bulk_get_exclusive()
569 * @dev: device to be reset by the controller
570 * @num_rstcs: number of entries in rstcs array
571 * @rstcs: array of struct reset_control_bulk_data with reset line names set
573 * Managed reset_control_bulk_get_exclusive(). For reset controllers returned
574 * from this function, reset_control_put() is called automatically on driver
577 * See reset_control_bulk_get_exclusive() for more information.
579 static inline int __must_check
580 devm_reset_control_bulk_get_exclusive(struct device *dev, int num_rstcs,
581 struct reset_control_bulk_data *rstcs)
583 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, true);
587 * devm_reset_control_get_exclusive_released - resource managed
588 * reset_control_get_exclusive_released()
589 * @dev: device to be reset by the controller
590 * @id: reset line name
592 * Managed reset_control_get_exclusive_released(). For reset controllers
593 * returned from this function, reset_control_put() is called automatically on
596 * See reset_control_get_exclusive_released() for more information.
598 static inline struct reset_control *
599 __must_check devm_reset_control_get_exclusive_released(struct device *dev,
602 return __devm_reset_control_get(dev, id, 0, false, false, false);
606 * devm_reset_control_bulk_get_exclusive_released - resource managed
607 * reset_control_bulk_get_exclusive_released()
608 * @dev: device to be reset by the controller
609 * @num_rstcs: number of entries in rstcs array
610 * @rstcs: array of struct reset_control_bulk_data with reset line names set
612 * Managed reset_control_bulk_get_exclusive_released(). For reset controllers
613 * returned from this function, reset_control_put() is called automatically on
616 * See reset_control_bulk_get_exclusive_released() for more information.
618 static inline int __must_check
619 devm_reset_control_bulk_get_exclusive_released(struct device *dev, int num_rstcs,
620 struct reset_control_bulk_data *rstcs)
622 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, false);
626 * devm_reset_control_get_optional_exclusive_released - resource managed
627 * reset_control_get_optional_exclusive_released()
628 * @dev: device to be reset by the controller
629 * @id: reset line name
631 * Managed-and-optional variant of reset_control_get_exclusive_released(). For
632 * reset controllers returned from this function, reset_control_put() is called
633 * automatically on driver detach.
635 * See reset_control_get_exclusive_released() for more information.
637 static inline struct reset_control *
638 __must_check devm_reset_control_get_optional_exclusive_released(struct device *dev,
641 return __devm_reset_control_get(dev, id, 0, false, true, false);
645 * devm_reset_control_bulk_get_optional_exclusive_released - resource managed
646 * reset_control_bulk_optional_get_exclusive_released()
647 * @dev: device to be reset by the controller
648 * @num_rstcs: number of entries in rstcs array
649 * @rstcs: array of struct reset_control_bulk_data with reset line names set
651 * Managed reset_control_bulk_optional_get_exclusive_released(). For reset
652 * controllers returned from this function, reset_control_put() is called
653 * automatically on driver detach.
655 * See reset_control_bulk_optional_get_exclusive_released() for more information.
657 static inline int __must_check
658 devm_reset_control_bulk_get_optional_exclusive_released(struct device *dev, int num_rstcs,
659 struct reset_control_bulk_data *rstcs)
661 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, false);
665 * devm_reset_control_get_shared - resource managed reset_control_get_shared()
666 * @dev: device to be reset by the controller
667 * @id: reset line name
669 * Managed reset_control_get_shared(). For reset controllers returned from
670 * this function, reset_control_put() is called automatically on driver detach.
671 * See reset_control_get_shared() for more information.
673 static inline struct reset_control *devm_reset_control_get_shared(
674 struct device *dev, const char *id)
676 return __devm_reset_control_get(dev, id, 0, true, false, false);
680 * devm_reset_control_bulk_get_shared - resource managed
681 * reset_control_bulk_get_shared()
682 * @dev: device to be reset by the controller
683 * @num_rstcs: number of entries in rstcs array
684 * @rstcs: array of struct reset_control_bulk_data with reset line names set
686 * Managed reset_control_bulk_get_shared(). For reset controllers returned
687 * from this function, reset_control_put() is called automatically on driver
690 * See reset_control_bulk_get_shared() for more information.
692 static inline int __must_check
693 devm_reset_control_bulk_get_shared(struct device *dev, int num_rstcs,
694 struct reset_control_bulk_data *rstcs)
696 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, false);
700 * devm_reset_control_get_optional_exclusive - resource managed
701 * reset_control_get_optional_exclusive()
702 * @dev: device to be reset by the controller
703 * @id: reset line name
705 * Managed reset_control_get_optional_exclusive(). For reset controllers
706 * returned from this function, reset_control_put() is called automatically on
709 * See reset_control_get_optional_exclusive() for more information.
711 static inline struct reset_control *devm_reset_control_get_optional_exclusive(
712 struct device *dev, const char *id)
714 return __devm_reset_control_get(dev, id, 0, false, true, true);
718 * devm_reset_control_bulk_get_optional_exclusive - resource managed
719 * reset_control_bulk_get_optional_exclusive()
720 * @dev: device to be reset by the controller
721 * @num_rstcs: number of entries in rstcs array
722 * @rstcs: array of struct reset_control_bulk_data with reset line names set
724 * Managed reset_control_bulk_get_optional_exclusive(). For reset controllers
725 * returned from this function, reset_control_put() is called automatically on
728 * See reset_control_bulk_get_optional_exclusive() for more information.
730 static inline int __must_check
731 devm_reset_control_bulk_get_optional_exclusive(struct device *dev, int num_rstcs,
732 struct reset_control_bulk_data *rstcs)
734 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, true);
738 * devm_reset_control_get_optional_shared - resource managed
739 * reset_control_get_optional_shared()
740 * @dev: device to be reset by the controller
741 * @id: reset line name
743 * Managed reset_control_get_optional_shared(). For reset controllers returned
744 * from this function, reset_control_put() is called automatically on driver
747 * See reset_control_get_optional_shared() for more information.
749 static inline struct reset_control *devm_reset_control_get_optional_shared(
750 struct device *dev, const char *id)
752 return __devm_reset_control_get(dev, id, 0, true, true, false);
756 * devm_reset_control_bulk_get_optional_shared - resource managed
757 * reset_control_bulk_get_optional_shared()
758 * @dev: device to be reset by the controller
759 * @num_rstcs: number of entries in rstcs array
760 * @rstcs: array of struct reset_control_bulk_data with reset line names set
762 * Managed reset_control_bulk_get_optional_shared(). For reset controllers
763 * returned from this function, reset_control_put() is called automatically on
766 * See reset_control_bulk_get_optional_shared() for more information.
768 static inline int __must_check
769 devm_reset_control_bulk_get_optional_shared(struct device *dev, int num_rstcs,
770 struct reset_control_bulk_data *rstcs)
772 return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, true, false);
776 * devm_reset_control_get_exclusive_by_index - resource managed
777 * reset_control_get_exclusive()
778 * @dev: device to be reset by the controller
779 * @index: index of the reset controller
781 * Managed reset_control_get_exclusive(). For reset controllers returned from
782 * this function, reset_control_put() is called automatically on driver
785 * See reset_control_get_exclusive() for more information.
787 static inline struct reset_control *
788 devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
790 return __devm_reset_control_get(dev, NULL, index, false, false, true);
794 * devm_reset_control_get_shared_by_index - resource managed
795 * reset_control_get_shared
796 * @dev: device to be reset by the controller
797 * @index: index of the reset controller
799 * Managed reset_control_get_shared(). For reset controllers returned from
800 * this function, reset_control_put() is called automatically on driver detach.
801 * See reset_control_get_shared() for more information.
803 static inline struct reset_control *
804 devm_reset_control_get_shared_by_index(struct device *dev, int index)
806 return __devm_reset_control_get(dev, NULL, index, true, false, false);
810 * TEMPORARY calls to use during transition:
812 * of_reset_control_get() => of_reset_control_get_exclusive()
814 * These inline function calls will be removed once all consumers
815 * have been moved over to the new explicit API.
817 static inline struct reset_control *of_reset_control_get(
818 struct device_node *node, const char *id)
820 return of_reset_control_get_exclusive(node, id);
823 static inline struct reset_control *of_reset_control_get_by_index(
824 struct device_node *node, int index)
826 return of_reset_control_get_exclusive_by_index(node, index);
829 static inline struct reset_control *devm_reset_control_get(
830 struct device *dev, const char *id)
832 return devm_reset_control_get_exclusive(dev, id);
835 static inline struct reset_control *devm_reset_control_get_optional(
836 struct device *dev, const char *id)
838 return devm_reset_control_get_optional_exclusive(dev, id);
842 static inline struct reset_control *devm_reset_control_get_by_index(
843 struct device *dev, int index)
845 return devm_reset_control_get_exclusive_by_index(dev, index);
849 * APIs to manage a list of reset controllers
851 static inline struct reset_control *
852 devm_reset_control_array_get_exclusive(struct device *dev)
854 return devm_reset_control_array_get(dev, false, false);
857 static inline struct reset_control *
858 devm_reset_control_array_get_shared(struct device *dev)
860 return devm_reset_control_array_get(dev, true, false);
863 static inline struct reset_control *
864 devm_reset_control_array_get_optional_exclusive(struct device *dev)
866 return devm_reset_control_array_get(dev, false, true);
869 static inline struct reset_control *
870 devm_reset_control_array_get_optional_shared(struct device *dev)
872 return devm_reset_control_array_get(dev, true, true);
875 static inline struct reset_control *
876 of_reset_control_array_get_exclusive(struct device_node *node)
878 return of_reset_control_array_get(node, false, false, true);
881 static inline struct reset_control *
882 of_reset_control_array_get_exclusive_released(struct device_node *node)
884 return of_reset_control_array_get(node, false, false, false);
887 static inline struct reset_control *
888 of_reset_control_array_get_shared(struct device_node *node)
890 return of_reset_control_array_get(node, true, false, true);
893 static inline struct reset_control *
894 of_reset_control_array_get_optional_exclusive(struct device_node *node)
896 return of_reset_control_array_get(node, false, true, true);
899 static inline struct reset_control *
900 of_reset_control_array_get_optional_shared(struct device_node *node)
902 return of_reset_control_array_get(node, true, true, true);