0001
0002
0003
0004
0005 #ifndef _LINUX_MEI_CL_BUS_H
0006 #define _LINUX_MEI_CL_BUS_H
0007
0008 #include <linux/device.h>
0009 #include <linux/uuid.h>
0010 #include <linux/mod_devicetable.h>
0011
0012 struct mei_cl_device;
0013 struct mei_device;
0014
0015 typedef void (*mei_cldev_cb_t)(struct mei_cl_device *cldev);
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 struct mei_cl_device {
0042 struct list_head bus_list;
0043 struct mei_device *bus;
0044 struct device dev;
0045
0046 struct mei_me_client *me_cl;
0047 struct mei_cl *cl;
0048 char name[MEI_CL_NAME_SIZE];
0049
0050 struct work_struct rx_work;
0051 mei_cldev_cb_t rx_cb;
0052 struct work_struct notif_work;
0053 mei_cldev_cb_t notif_cb;
0054
0055 unsigned int do_match:1;
0056 unsigned int is_added:1;
0057
0058 void *priv_data;
0059 };
0060
0061 #define to_mei_cl_device(d) container_of(d, struct mei_cl_device, dev)
0062
0063 struct mei_cl_driver {
0064 struct device_driver driver;
0065 const char *name;
0066
0067 const struct mei_cl_device_id *id_table;
0068
0069 int (*probe)(struct mei_cl_device *cldev,
0070 const struct mei_cl_device_id *id);
0071 void (*remove)(struct mei_cl_device *cldev);
0072 };
0073
0074 int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
0075 struct module *owner);
0076 #define mei_cldev_driver_register(cldrv) \
0077 __mei_cldev_driver_register(cldrv, THIS_MODULE)
0078
0079 void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 #define module_mei_cl_driver(__mei_cldrv) \
0090 module_driver(__mei_cldrv, \
0091 mei_cldev_driver_register,\
0092 mei_cldev_driver_unregister)
0093
0094 ssize_t mei_cldev_send(struct mei_cl_device *cldev, const u8 *buf,
0095 size_t length);
0096 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
0097 ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf,
0098 size_t length);
0099 ssize_t mei_cldev_send_vtag(struct mei_cl_device *cldev, const u8 *buf,
0100 size_t length, u8 vtag);
0101 ssize_t mei_cldev_recv_vtag(struct mei_cl_device *cldev, u8 *buf, size_t length,
0102 u8 *vtag);
0103 ssize_t mei_cldev_recv_nonblock_vtag(struct mei_cl_device *cldev, u8 *buf,
0104 size_t length, u8 *vtag);
0105
0106 int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb);
0107 int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
0108 mei_cldev_cb_t notif_cb);
0109
0110 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
0111 u8 mei_cldev_ver(const struct mei_cl_device *cldev);
0112
0113 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
0114 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
0115
0116 int mei_cldev_enable(struct mei_cl_device *cldev);
0117 int mei_cldev_disable(struct mei_cl_device *cldev);
0118 bool mei_cldev_enabled(const struct mei_cl_device *cldev);
0119
0120 void *mei_cldev_dma_map(struct mei_cl_device *cldev, u8 buffer_id, size_t size);
0121 int mei_cldev_dma_unmap(struct mei_cl_device *cldev);
0122
0123 #endif