2013-03-27 22:29:53 +07:00
|
|
|
#ifndef _LINUX_MEI_CL_BUS_H
|
|
|
|
#define _LINUX_MEI_CL_BUS_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/uuid.h>
|
2014-09-29 20:31:46 +07:00
|
|
|
#include <linux/mod_devicetable.h>
|
2013-03-27 22:29:53 +07:00
|
|
|
|
|
|
|
struct mei_cl_device;
|
2015-07-23 19:08:41 +07:00
|
|
|
struct mei_device;
|
2013-03-27 22:29:53 +07:00
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
typedef void (*mei_cldev_event_cb_t)(struct mei_cl_device *cldev,
|
|
|
|
u32 events, void *context);
|
2015-05-07 19:54:07 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct mei_cl_device - MEI device handle
|
|
|
|
* An mei_cl_device pointer is returned from mei_add_device()
|
|
|
|
* and links MEI bus clients to their actual ME host client pointer.
|
|
|
|
* Drivers for MEI devices will get an mei_cl_device pointer
|
|
|
|
* when being probed and shall use it for doing ME bus I/O.
|
|
|
|
*
|
2015-07-23 19:08:42 +07:00
|
|
|
* @bus_list: device on the bus list
|
2015-07-23 19:08:41 +07:00
|
|
|
* @bus: parent mei device
|
2015-05-07 19:54:07 +07:00
|
|
|
* @dev: linux driver model device pointer
|
|
|
|
* @me_cl: me client
|
|
|
|
* @cl: mei client
|
|
|
|
* @name: device name
|
|
|
|
* @event_work: async work to execute event callback
|
|
|
|
* @event_cb: Drivers register this callback to get asynchronous ME
|
|
|
|
* events (e.g. Rx buffer pending) notifications.
|
|
|
|
* @event_context: event callback run context
|
2015-07-26 13:54:23 +07:00
|
|
|
* @events_mask: Events bit mask requested by driver.
|
2015-05-07 19:54:07 +07:00
|
|
|
* @events: Events bitmask sent to the driver.
|
2015-07-23 19:08:43 +07:00
|
|
|
*
|
|
|
|
* @do_match: wheather device can be matched with a driver
|
2015-07-23 19:08:42 +07:00
|
|
|
* @is_added: device is already scanned
|
2015-05-07 19:54:07 +07:00
|
|
|
* @priv_data: client private data
|
|
|
|
*/
|
|
|
|
struct mei_cl_device {
|
2015-07-23 19:08:42 +07:00
|
|
|
struct list_head bus_list;
|
2015-07-23 19:08:41 +07:00
|
|
|
struct mei_device *bus;
|
2015-05-07 19:54:07 +07:00
|
|
|
struct device dev;
|
|
|
|
|
|
|
|
struct mei_me_client *me_cl;
|
|
|
|
struct mei_cl *cl;
|
|
|
|
char name[MEI_CL_NAME_SIZE];
|
|
|
|
|
|
|
|
struct work_struct event_work;
|
2015-09-10 14:18:05 +07:00
|
|
|
mei_cldev_event_cb_t event_cb;
|
2015-05-07 19:54:07 +07:00
|
|
|
void *event_context;
|
2015-07-26 13:54:23 +07:00
|
|
|
unsigned long events_mask;
|
2015-05-07 19:54:07 +07:00
|
|
|
unsigned long events;
|
2015-07-23 19:08:43 +07:00
|
|
|
|
|
|
|
unsigned int do_match:1;
|
2015-07-23 19:08:42 +07:00
|
|
|
unsigned int is_added:1;
|
2015-05-07 19:54:07 +07:00
|
|
|
|
|
|
|
void *priv_data;
|
|
|
|
};
|
|
|
|
|
2013-03-27 22:29:53 +07:00
|
|
|
struct mei_cl_driver {
|
|
|
|
struct device_driver driver;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
const struct mei_cl_device_id *id_table;
|
|
|
|
|
2015-09-10 14:18:04 +07:00
|
|
|
int (*probe)(struct mei_cl_device *cldev,
|
2013-03-27 22:29:53 +07:00
|
|
|
const struct mei_cl_device_id *id);
|
2015-09-10 14:18:04 +07:00
|
|
|
int (*remove)(struct mei_cl_device *cldev);
|
2013-03-27 22:29:53 +07:00
|
|
|
};
|
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
|
|
|
|
struct module *owner);
|
|
|
|
#define mei_cldev_driver_register(cldrv) \
|
|
|
|
__mei_cldev_driver_register(cldrv, THIS_MODULE)
|
2013-03-27 22:29:54 +07:00
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
|
2013-03-27 22:29:54 +07:00
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
|
|
|
|
ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
|
2013-03-27 22:29:55 +07:00
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
int mei_cldev_register_event_cb(struct mei_cl_device *cldev,
|
|
|
|
unsigned long event_mask,
|
|
|
|
mei_cldev_event_cb_t read_cb, void *context);
|
2013-03-27 22:29:55 +07:00
|
|
|
|
|
|
|
#define MEI_CL_EVENT_RX 0
|
|
|
|
#define MEI_CL_EVENT_TX 1
|
2015-07-26 13:54:23 +07:00
|
|
|
#define MEI_CL_EVENT_NOTIF 2
|
2013-03-27 22:29:55 +07:00
|
|
|
|
2015-09-10 14:18:02 +07:00
|
|
|
const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
|
|
|
|
u8 mei_cldev_ver(const struct mei_cl_device *cldev);
|
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
|
|
|
|
void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
|
2013-03-27 22:29:59 +07:00
|
|
|
|
2015-09-10 14:18:05 +07:00
|
|
|
int mei_cldev_enable(struct mei_cl_device *cldev);
|
|
|
|
int mei_cldev_disable(struct mei_cl_device *cldev);
|
2015-09-10 14:18:03 +07:00
|
|
|
bool mei_cldev_enabled(struct mei_cl_device *cldev);
|
2013-04-09 05:51:38 +07:00
|
|
|
|
2013-03-27 22:29:53 +07:00
|
|
|
#endif /* _LINUX_MEI_CL_BUS_H */
|