blob: c4c097de0ba9e042c3a357e06c6b3f6d5dc5e58e [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
Vince Hsuc0a13aa2015-07-13 13:39:39 +010041struct reset_control *of_reset_control_get_by_index(
42 struct device_node *node, int index);
43
Philipp Zabelb4240802014-03-07 15:18:47 +010044#else
45
46static inline int reset_control_reset(struct reset_control *rstc)
47{
48 WARN_ON(1);
49 return 0;
50}
51
52static inline int reset_control_assert(struct reset_control *rstc)
53{
54 WARN_ON(1);
55 return 0;
56}
57
58static inline int reset_control_deassert(struct reset_control *rstc)
59{
60 WARN_ON(1);
61 return 0;
62}
63
Dinh Nguyen729de412014-10-10 10:21:14 -050064static inline int reset_control_status(struct reset_control *rstc)
65{
66 WARN_ON(1);
67 return 0;
68}
69
Philipp Zabelb4240802014-03-07 15:18:47 +010070static inline void reset_control_put(struct reset_control *rstc)
71{
72 WARN_ON(1);
73}
74
75static inline int device_reset_optional(struct device *dev)
76{
Philipp Zabel39b4da72015-10-29 09:55:00 +010077 return -ENOTSUPP;
Philipp Zabelb4240802014-03-07 15:18:47 +010078}
79
Axel Lin5bcd0b72015-09-01 07:56:38 +080080static inline struct reset_control *__must_check reset_control_get(
81 struct device *dev, const char *id)
82{
83 WARN_ON(1);
84 return ERR_PTR(-EINVAL);
85}
86
87static inline struct reset_control *__must_check devm_reset_control_get(
88 struct device *dev, const char *id)
89{
90 WARN_ON(1);
91 return ERR_PTR(-EINVAL);
92}
93
Philipp Zabelb4240802014-03-07 15:18:47 +010094static inline struct reset_control *reset_control_get_optional(
95 struct device *dev, const char *id)
96{
Philipp Zabel39b4da72015-10-29 09:55:00 +010097 return ERR_PTR(-ENOTSUPP);
Philipp Zabelb4240802014-03-07 15:18:47 +010098}
99
100static inline struct reset_control *devm_reset_control_get_optional(
101 struct device *dev, const char *id)
102{
Philipp Zabel39b4da72015-10-29 09:55:00 +0100103 return ERR_PTR(-ENOTSUPP);
Philipp Zabelb4240802014-03-07 15:18:47 +0100104}
105
Hans de Goedee3ec0a82014-04-13 14:09:15 +0200106static inline struct reset_control *of_reset_control_get(
107 struct device_node *node, const char *id)
108{
Philipp Zabel39b4da72015-10-29 09:55:00 +0100109 return ERR_PTR(-ENOTSUPP);
Hans de Goedee3ec0a82014-04-13 14:09:15 +0200110}
111
Vince Hsuc0a13aa2015-07-13 13:39:39 +0100112static inline struct reset_control *of_reset_control_get_by_index(
113 struct device_node *node, int index)
114{
115 return ERR_PTR(-ENOTSUPP);
116}
117
Philipp Zabelb4240802014-03-07 15:18:47 +0100118#endif /* CONFIG_RESET_CONTROLLER */
Philipp Zabel61fc4132012-11-19 17:23:13 +0100119
120#endif