Linux 4.6-rc6
[cris-mirror.git] / include / linux / soc / qcom / smd.h
blobd0cb6d189a0a02bd28459c7b143229563f23c4e4
1 #ifndef __QCOM_SMD_H__
2 #define __QCOM_SMD_H__
4 #include <linux/device.h>
5 #include <linux/mod_devicetable.h>
7 struct qcom_smd;
8 struct qcom_smd_channel;
9 struct qcom_smd_lookup;
11 /**
12 * struct qcom_smd_id - struct used for matching a smd device
13 * @name: name of the channel
15 struct qcom_smd_id {
16 char name[20];
19 /**
20 * struct qcom_smd_device - smd device struct
21 * @dev: the device struct
22 * @channel: handle to the smd channel for this device
24 struct qcom_smd_device {
25 struct device dev;
26 struct qcom_smd_channel *channel;
29 /**
30 * struct qcom_smd_driver - smd driver struct
31 * @driver: underlying device driver
32 * @smd_match_table: static channel match table
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
39 struct qcom_smd_driver {
40 struct device_driver driver;
41 const struct qcom_smd_id *smd_match_table;
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);
48 int qcom_smd_driver_register(struct qcom_smd_driver *drv);
49 void qcom_smd_driver_unregister(struct qcom_smd_driver *drv);
51 #define module_qcom_smd_driver(__smd_driver) \
52 module_driver(__smd_driver, qcom_smd_driver_register, \
53 qcom_smd_driver_unregister)
55 int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len);
57 #endif