blob: 349f150ae12cb4f896eea2aafc73cfcb3fcfd26c [file] [log] [blame]
Philipp Zabel61fc4132012-11-19 17:23:13 +01001#ifndef _LINUX_RESET_H_
2#define _LINUX_RESET_H_
3
4struct device;
Hans de Goedee3ec0a82014-04-13 14:09:15 +02005struct device_node;
Philipp Zabel61fc4132012-11-19 17:23:13 +01006struct reset_control;
7
Philipp Zabelb4240802014-03-07 15:18:47 +01008#ifdef CONFIG_RESET_CONTROLLER
9
Philipp Zabel61fc4132012-11-19 17:23:13 +010010int reset_control_reset(struct reset_control *rstc);
11int reset_control_assert(struct reset_control *rstc);
12int reset_control_deassert(struct reset_control *rstc);
13
Philipp Zabel61fc4132012-11-19 17:23:13 +010014struct reset_control *reset_control_get(struct device *dev, const char *id);
15void reset_control_put(struct reset_control *rstc);
16struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
17
Philipp Zabelb4240802014-03-07 15:18:47 +010018int __must_check device_reset(struct device *dev);
19
20static inline int device_reset_optional(struct device *dev)
21{
22 return device_reset(dev);
23}
24
25static 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
31static 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 Goedee3ec0a82014-04-13 14:09:15 +020037struct reset_control *of_reset_control_get(struct device_node *node,
38 const char *id);
39
Philipp Zabelb4240802014-03-07 15:18:47 +010040#else
41
42static inline int reset_control_reset(struct reset_control *rstc)
43{
44 WARN_ON(1);
45 return 0;
46}
47
48static inline int reset_control_assert(struct reset_control *rstc)
49{
50 WARN_ON(1);
51 return 0;
52}
53
54static inline int reset_control_deassert(struct reset_control *rstc)
55{
56 WARN_ON(1);
57 return 0;
58}
59
60static inline void reset_control_put(struct reset_control *rstc)
61{
62 WARN_ON(1);
63}
64
65static inline int device_reset_optional(struct device *dev)
66{
67 return -ENOSYS;
68}
69
70static inline struct reset_control *reset_control_get_optional(
71 struct device *dev, const char *id)
72{
73 return ERR_PTR(-ENOSYS);
74}
75
76static 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 Goedee3ec0a82014-04-13 14:09:15 +020082static 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 Zabelb4240802014-03-07 15:18:47 +010088#endif /* CONFIG_RESET_CONTROLLER */
Philipp Zabel61fc4132012-11-19 17:23:13 +010089
90#endif