This source file includes following definitions.
- slim_get_devicedata
- slim_set_devicedata
1
2
3
4
5
6 #ifndef _LINUX_SLIMBUS_H
7 #define _LINUX_SLIMBUS_H
8 #include <linux/device.h>
9 #include <linux/module.h>
10 #include <linux/completion.h>
11 #include <linux/mod_devicetable.h>
12
13 extern struct bus_type slimbus_bus;
14
15
16
17
18
19
20
21
22 struct slim_eaddr {
23 u8 instance;
24 u8 dev_index;
25 u16 prod_code;
26 u16 manf_id;
27 } __packed;
28
29
30
31
32
33
34
35 enum slim_device_status {
36 SLIM_DEVICE_STATUS_DOWN = 0,
37 SLIM_DEVICE_STATUS_UP,
38 SLIM_DEVICE_STATUS_RESERVED,
39 };
40
41 struct slim_controller;
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 struct slim_device {
59 struct device dev;
60 struct slim_eaddr e_addr;
61 struct slim_controller *ctrl;
62 enum slim_device_status status;
63 u8 laddr;
64 bool is_laddr_valid;
65 struct list_head stream_list;
66 spinlock_t stream_list_lock;
67 };
68
69 #define to_slim_device(d) container_of(d, struct slim_device, dev)
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 struct slim_driver {
86 int (*probe)(struct slim_device *sl);
87 void (*remove)(struct slim_device *sl);
88 void (*shutdown)(struct slim_device *sl);
89 int (*device_status)(struct slim_device *sl,
90 enum slim_device_status s);
91 struct device_driver driver;
92 const struct slim_device_id *id_table;
93 };
94 #define to_slim_driver(d) container_of(d, struct slim_driver, driver)
95
96
97
98
99
100
101
102
103
104
105
106
107 struct slim_val_inf {
108 u16 start_offset;
109 u8 num_bytes;
110 u8 *rbuf;
111 const u8 *wbuf;
112 struct completion *comp;
113 };
114
115 #define SLIM_DEVICE_MAX_CHANNELS 256
116
117 #define SLIM_DEVICE_MAX_PORTS 32
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 struct slim_stream_config {
135 unsigned int rate;
136 unsigned int bps;
137
138 unsigned int ch_count;
139 unsigned int *chs;
140
141 unsigned long port_mask;
142 int direction;
143 };
144
145
146
147
148 #define slim_driver_register(drv) \
149 __slim_driver_register(drv, THIS_MODULE)
150 int __slim_driver_register(struct slim_driver *drv, struct module *owner);
151 void slim_driver_unregister(struct slim_driver *drv);
152
153
154
155
156
157
158
159
160
161 #define module_slim_driver(__slim_driver) \
162 module_driver(__slim_driver, slim_driver_register, \
163 slim_driver_unregister)
164
165 static inline void *slim_get_devicedata(const struct slim_device *dev)
166 {
167 return dev_get_drvdata(&dev->dev);
168 }
169
170 static inline void slim_set_devicedata(struct slim_device *dev, void *data)
171 {
172 dev_set_drvdata(&dev->dev, data);
173 }
174
175 struct slim_device *of_slim_get_device(struct slim_controller *ctrl,
176 struct device_node *np);
177 struct slim_device *slim_get_device(struct slim_controller *ctrl,
178 struct slim_eaddr *e_addr);
179 int slim_get_logical_addr(struct slim_device *sbdev);
180
181
182 #define SLIM_MSG_MC_REQUEST_INFORMATION 0x20
183 #define SLIM_MSG_MC_REQUEST_CLEAR_INFORMATION 0x21
184 #define SLIM_MSG_MC_REPLY_INFORMATION 0x24
185 #define SLIM_MSG_MC_CLEAR_INFORMATION 0x28
186 #define SLIM_MSG_MC_REPORT_INFORMATION 0x29
187
188
189 #define SLIM_MSG_MC_REQUEST_VALUE 0x60
190 #define SLIM_MSG_MC_REQUEST_CHANGE_VALUE 0x61
191 #define SLIM_MSG_MC_REPLY_VALUE 0x64
192 #define SLIM_MSG_MC_CHANGE_VALUE 0x68
193
194 int slim_xfer_msg(struct slim_device *sbdev, struct slim_val_inf *msg,
195 u8 mc);
196 int slim_readb(struct slim_device *sdev, u32 addr);
197 int slim_writeb(struct slim_device *sdev, u32 addr, u8 value);
198 int slim_read(struct slim_device *sdev, u32 addr, size_t count, u8 *val);
199 int slim_write(struct slim_device *sdev, u32 addr, size_t count, u8 *val);
200
201
202 struct slim_stream_runtime;
203 struct slim_stream_runtime *slim_stream_allocate(struct slim_device *dev,
204 const char *sname);
205 int slim_stream_prepare(struct slim_stream_runtime *stream,
206 struct slim_stream_config *c);
207 int slim_stream_enable(struct slim_stream_runtime *stream);
208 int slim_stream_disable(struct slim_stream_runtime *stream);
209 int slim_stream_unprepare(struct slim_stream_runtime *stream);
210 int slim_stream_free(struct slim_stream_runtime *stream);
211
212 #endif