blob: c0eda5023d74351fd951e8f434a94a609cb10f4d [file] [log] [blame]
Philipp Zabel61fc4132012-11-19 17:23:13 +01001#ifndef _LINUX_RESET_H_
2#define _LINUX_RESET_H_
3
4struct device;
5struct reset_control;
6
Philipp Zabelb4240802014-03-07 15:18:47 +01007#ifdef CONFIG_RESET_CONTROLLER
8
Philipp Zabel61fc4132012-11-19 17:23:13 +01009int reset_control_reset(struct reset_control *rstc);
10int reset_control_assert(struct reset_control *rstc);
11int reset_control_deassert(struct reset_control *rstc);
12
Philipp Zabel61fc4132012-11-19 17:23:13 +010013struct reset_control *reset_control_get(struct device *dev, const char *id);
14void reset_control_put(struct reset_control *rstc);
15struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
16
Philipp Zabelb4240802014-03-07 15:18:47 +010017int __must_check device_reset(struct device *dev);
18
19static inline int device_reset_optional(struct device *dev)
20{
21 return device_reset(dev);
22}
23
24static inline struct reset_control *reset_control_get_optional(
25 struct device *dev, const char *id)
26{
27 return reset_control_get(dev, id);
28}
29
30static inline struct reset_control *devm_reset_control_get_optional(
31 struct device *dev, const char *id)
32{
33 return devm_reset_control_get(dev, id);
34}
35
36#else
37
38static inline int reset_control_reset(struct reset_control *rstc)
39{
40 WARN_ON(1);
41 return 0;
42}
43
44static inline int reset_control_assert(struct reset_control *rstc)
45{
46 WARN_ON(1);
47 return 0;
48}
49
50static inline int reset_control_deassert(struct reset_control *rstc)
51{
52 WARN_ON(1);
53 return 0;
54}
55
56static inline void reset_control_put(struct reset_control *rstc)
57{
58 WARN_ON(1);
59}
60
61static inline int device_reset_optional(struct device *dev)
62{
63 return -ENOSYS;
64}
65
66static inline struct reset_control *reset_control_get_optional(
67 struct device *dev, const char *id)
68{
69 return ERR_PTR(-ENOSYS);
70}
71
72static inline struct reset_control *devm_reset_control_get_optional(
73 struct device *dev, const char *id)
74{
75 return ERR_PTR(-ENOSYS);
76}
77
78#endif /* CONFIG_RESET_CONTROLLER */
Philipp Zabel61fc4132012-11-19 17:23:13 +010079
80#endif