]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/linux/soc/qcom/smd.h
Merge branch 'bugfixes'
[karo-tx-linux.git] / include / linux / soc / qcom / smd.h
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
11 /**
12  * struct qcom_smd_device - smd device struct
13  * @dev:        the device struct
14  * @channel:    handle to the smd channel for this device
15  */
16 struct qcom_smd_device {
17         struct device dev;
18         struct qcom_smd_channel *channel;
19 };
20
21 /**
22  * struct qcom_smd_driver - smd driver struct
23  * @driver:     underlying device driver
24  * @probe:      invoked when the smd channel is found
25  * @remove:     invoked when the smd channel is closed
26  * @callback:   invoked when an inbound message is received on the channel,
27  *              should return 0 on success or -EBUSY if the data cannot be
28  *              consumed at this time
29  */
30 struct qcom_smd_driver {
31         struct device_driver driver;
32         int (*probe)(struct qcom_smd_device *dev);
33         void (*remove)(struct qcom_smd_device *dev);
34         int (*callback)(struct qcom_smd_device *, const void *, size_t);
35 };
36
37 int qcom_smd_driver_register(struct qcom_smd_driver *drv);
38 void qcom_smd_driver_unregister(struct qcom_smd_driver *drv);
39
40 #define module_qcom_smd_driver(__smd_driver) \
41         module_driver(__smd_driver, qcom_smd_driver_register, \
42                       qcom_smd_driver_unregister)
43
44 int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len);
45
46 #endif