Commit | Line | Data |
---|---|---|
f2ab3298 BA |
1 | #ifndef __QCOM_SMD_H__ |
2 | #define __QCOM_SMD_H__ | |
3 | ||
4 | #include <linux/device.h> | |
5 | #include <linux/mod_devicetable.h> | |
6 | ||
7 | struct qcom_smd; | |
8 | struct qcom_smd_channel; | |
9 | struct qcom_smd_lookup; | |
10 | ||
1a7caca2 BA |
11 | /** |
12 | * struct qcom_smd_id - struct used for matching a smd device | |
13 | * @name: name of the channel | |
14 | */ | |
15 | struct qcom_smd_id { | |
16 | char name[20]; | |
17 | }; | |
18 | ||
f2ab3298 BA |
19 | /** |
20 | * struct qcom_smd_device - smd device struct | |
21 | * @dev: the device struct | |
22 | * @channel: handle to the smd channel for this device | |
23 | */ | |
24 | struct qcom_smd_device { | |
25 | struct device dev; | |
26 | struct qcom_smd_channel *channel; | |
27 | }; | |
28 | ||
29 | /** | |
30 | * struct qcom_smd_driver - smd driver struct | |
31 | * @driver: underlying device driver | |
1a7caca2 | 32 | * @smd_match_table: static channel match table |
f2ab3298 BA |
33 | * @probe: invoked when the smd channel is found |
34 | * @remove: invoked when the smd channel is closed | |
35 | * @callback: invoked when an inbound message is received on the channel, | |
36 | * should return 0 on success or -EBUSY if the data cannot be | |
37 | * consumed at this time | |
38 | */ | |
39 | struct qcom_smd_driver { | |
40 | struct device_driver driver; | |
1a7caca2 BA |
41 | const struct qcom_smd_id *smd_match_table; |
42 | ||
f2ab3298 BA |
43 | int (*probe)(struct qcom_smd_device *dev); |
44 | void (*remove)(struct qcom_smd_device *dev); | |
45 | int (*callback)(struct qcom_smd_device *, const void *, size_t); | |
46 | }; | |
47 | ||
48 | int qcom_smd_driver_register(struct qcom_smd_driver *drv); | |
49 | void qcom_smd_driver_unregister(struct qcom_smd_driver *drv); | |
50 | ||
51 | #define module_qcom_smd_driver(__smd_driver) \ | |
52 | module_driver(__smd_driver, qcom_smd_driver_register, \ | |
53 | qcom_smd_driver_unregister) | |
54 | ||
55 | int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len); | |
56 | ||
57 | #endif |