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