1 #ifndef _LINUX_MEI_CL_BUS_H 2 #define _LINUX_MEI_CL_BUS_H 3 4 #include <linux/device.h> 5 #include <linux/uuid.h> 6 #include <linux/mod_devicetable.h> 7 8 struct mei_cl_device; 9 struct mei_device; 10 11 typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device, 12 u32 events, void *context); 13 14 /** 15 * struct mei_cl_device - MEI device handle 16 * An mei_cl_device pointer is returned from mei_add_device() 17 * and links MEI bus clients to their actual ME host client pointer. 18 * Drivers for MEI devices will get an mei_cl_device pointer 19 * when being probed and shall use it for doing ME bus I/O. 20 * 21 * @bus_list: device on the bus list 22 * @bus: parent mei device 23 * @dev: linux driver model device pointer 24 * @me_cl: me client 25 * @cl: mei client 26 * @name: device name 27 * @event_work: async work to execute event callback 28 * @event_cb: Drivers register this callback to get asynchronous ME 29 * events (e.g. Rx buffer pending) notifications. 30 * @event_context: event callback run context 31 * @events: Events bitmask sent to the driver. 32 * @is_added: device is already scanned 33 * @priv_data: client private data 34 */ 35 struct mei_cl_device { 36 struct list_head bus_list; 37 struct mei_device *bus; 38 struct device dev; 39 40 struct mei_me_client *me_cl; 41 struct mei_cl *cl; 42 char name[MEI_CL_NAME_SIZE]; 43 44 struct work_struct event_work; 45 mei_cl_event_cb_t event_cb; 46 void *event_context; 47 unsigned long events; 48 unsigned int is_added:1; 49 50 void *priv_data; 51 }; 52 53 struct mei_cl_driver { 54 struct device_driver driver; 55 const char *name; 56 57 const struct mei_cl_device_id *id_table; 58 59 int (*probe)(struct mei_cl_device *dev, 60 const struct mei_cl_device_id *id); 61 int (*remove)(struct mei_cl_device *dev); 62 }; 63 64 int __mei_cl_driver_register(struct mei_cl_driver *driver, 65 struct module *owner); 66 #define mei_cl_driver_register(driver) \ 67 __mei_cl_driver_register(driver, THIS_MODULE) 68 69 void mei_cl_driver_unregister(struct mei_cl_driver *driver); 70 71 ssize_t mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length); 72 ssize_t mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length); 73 74 int mei_cl_register_event_cb(struct mei_cl_device *device, 75 mei_cl_event_cb_t read_cb, void *context); 76 77 #define MEI_CL_EVENT_RX 0 78 #define MEI_CL_EVENT_TX 1 79 80 void *mei_cl_get_drvdata(const struct mei_cl_device *device); 81 void mei_cl_set_drvdata(struct mei_cl_device *device, void *data); 82 83 int mei_cl_enable_device(struct mei_cl_device *device); 84 int mei_cl_disable_device(struct mei_cl_device *device); 85 86 #endif /* _LINUX_MEI_CL_BUS_H */ 87