1
2
3
4
5 #ifndef _LINUX_MEI_CL_BUS_H
6 #define _LINUX_MEI_CL_BUS_H
7
8 #include <linux/device.h>
9 #include <linux/uuid.h>
10 #include <linux/mod_devicetable.h>
11
12 struct mei_cl_device;
13 struct mei_device;
14
15 typedef void (*mei_cldev_cb_t)(struct mei_cl_device *cldev);
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 struct mei_cl_device {
42 struct list_head bus_list;
43 struct mei_device *bus;
44 struct device dev;
45
46 struct mei_me_client *me_cl;
47 struct mei_cl *cl;
48 char name[MEI_CL_NAME_SIZE];
49
50 struct work_struct rx_work;
51 mei_cldev_cb_t rx_cb;
52 struct work_struct notif_work;
53 mei_cldev_cb_t notif_cb;
54
55 unsigned int do_match:1;
56 unsigned int is_added:1;
57
58 void *priv_data;
59 };
60
61 #define to_mei_cl_device(d) container_of(d, struct mei_cl_device, dev)
62
63 struct mei_cl_driver {
64 struct device_driver driver;
65 const char *name;
66
67 const struct mei_cl_device_id *id_table;
68
69 int (*probe)(struct mei_cl_device *cldev,
70 const struct mei_cl_device_id *id);
71 int (*remove)(struct mei_cl_device *cldev);
72 };
73
74 int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
75 struct module *owner);
76 #define mei_cldev_driver_register(cldrv) \
77 __mei_cldev_driver_register(cldrv, THIS_MODULE)
78
79 void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
80
81
82
83
84
85
86
87
88
89 #define module_mei_cl_driver(__mei_cldrv) \
90 module_driver(__mei_cldrv, \
91 mei_cldev_driver_register,\
92 mei_cldev_driver_unregister)
93
94 ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
95 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
96 ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf,
97 size_t length);
98
99 int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb);
100 int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
101 mei_cldev_cb_t notif_cb);
102
103 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
104 u8 mei_cldev_ver(const struct mei_cl_device *cldev);
105
106 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
107 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
108
109 int mei_cldev_enable(struct mei_cl_device *cldev);
110 int mei_cldev_disable(struct mei_cl_device *cldev);
111 bool mei_cldev_enabled(struct mei_cl_device *cldev);
112
113 #endif