blob: 7f65f9cff951033607b0beba1c1ab0df70ee60e9 [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);
Dinh Nguyen729de412014-10-10 10:21:14 -050013int reset_control_status(struct reset_control *rstc);
Philipp Zabel61fc4132012-11-19 17:23:13 +010014
Philipp Zabel61fc4132012-11-19 17:23:13 +010015struct reset_control *reset_control_get(struct device *dev, const char *id);
16void reset_control_put(struct reset_control *rstc);
17struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
18
Philipp Zabelb4240802014-03-07 15:18:47 +010019int __must_check device_reset(struct device *dev);
20
21static inline int device_reset_optional(struct device *dev)
22{
23 return device_reset(dev);
24}
25
26static inline struct reset_control *reset_control_get_optional(
27 struct device *dev, const char *id)
28{
29 return reset_control_get(dev, id);
30}
31
32static inline struct reset_control *devm_reset_control_get_optional(
33 struct device *dev, const char *id)
34{
35 return devm_reset_control_get(dev, id);
36}
37
Hans de Goedee3ec0a82014-04-13 14:09:15 +020038struct reset_control *of_reset_control_get(struct device_node *node,
39 const char *id);
40
Philipp Zabelb4240802014-03-07 15:18:47 +010041#else
42
43static inline int reset_control_reset(struct reset_control *rstc)
44{
45 WARN_ON(1);
46 return 0;
47}
48
49static inline int reset_control_assert(struct reset_control *rstc)
50{
51 WARN_ON(1);
52 return 0;
53}
54
55static inline int reset_control_deassert(struct reset_control *rstc)
56{
57 WARN_ON(1);
58 return 0;
59}
60
Dinh Nguyen729de412014-10-10 10:21:14 -050061static inline int reset_control_status(struct reset_control *rstc)
62{
63 WARN_ON(1);
64 return 0;
65}
66
Philipp Zabelb4240802014-03-07 15:18:47 +010067static inline void reset_control_put(struct reset_control *rstc)
68{
69 WARN_ON(1);
70}
71
72static inline int device_reset_optional(struct device *dev)
73{
74 return -ENOSYS;
75}
76
Axel Lin5bcd0b72015-09-01 07:56:38 +080077static inline struct reset_control *__must_check reset_control_get(
78 struct device *dev, const char *id)
79{
80 WARN_ON(1);
81 return ERR_PTR(-EINVAL);
82}
83
84static inline struct reset_control *__must_check devm_reset_control_get(
85 struct device *dev, const char *id)
86{
87 WARN_ON(1);
88 return ERR_PTR(-EINVAL);
89}
90
Philipp Zabelb4240802014-03-07 15:18:47 +010091static inline struct reset_control *reset_control_get_optional(
92 struct device *dev, const char *id)
93{
94 return ERR_PTR(-ENOSYS);
95}
96
97static inline struct reset_control *devm_reset_control_get_optional(
98 struct device *dev, const char *id)
99{
100 return ERR_PTR(-ENOSYS);
101}
102
Hans de Goedee3ec0a82014-04-13 14:09:15 +0200103static inline struct reset_control *of_reset_control_get(
104 struct device_node *node, const char *id)
105{
106 return ERR_PTR(-ENOSYS);
107}
108
Philipp Zabelb4240802014-03-07 15:18:47 +0100109#endif /* CONFIG_RESET_CONTROLLER */
Philipp Zabel61fc4132012-11-19 17:23:13 +0100110
111#endif