1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * ISHTP bus definitions
5 * Copyright (c) 2014-2016, Intel Corporation.
7 #ifndef _LINUX_ISHTP_CL_BUS_H
8 #define _LINUX_ISHTP_CL_BUS_H
10 #include <linux/device.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/intel-ish-client-if.h>
15 struct ishtp_cl_device
;
20 * struct ishtp_cl_device - ISHTP device handle
21 * @dev: device pointer
22 * @ishtp_dev: pointer to ishtp device structure to primarily to access
23 * hw device operation callbacks and properties
24 * @fw_client: fw_client pointer to get fw information like protocol name
25 * max message length etc.
26 * @device_link: Link to next client in the list on a bus
27 * @event_work: Used to schedule rx event for client
28 * @driver_data: Storage driver private data
29 * @reference_count: Used for get/put device
30 * @event_cb: Callback to driver to send events
32 * An ishtp_cl_device pointer is returned from ishtp_add_device()
33 * and links ISHTP bus clients to their actual host client pointer.
34 * Drivers for ISHTP devices will get an ishtp_cl_device pointer
35 * when being probed and shall use it for doing bus I/O.
37 struct ishtp_cl_device
{
39 struct ishtp_device
*ishtp_dev
;
40 struct ishtp_fw_client
*fw_client
;
41 struct list_head device_link
;
42 struct work_struct event_work
;
45 void (*event_cb
)(struct ishtp_cl_device
*device
);
48 int ishtp_bus_new_client(struct ishtp_device
*dev
);
49 void ishtp_remove_all_clients(struct ishtp_device
*dev
);
50 int ishtp_cl_device_bind(struct ishtp_cl
*cl
);
51 void ishtp_cl_bus_rx_event(struct ishtp_cl_device
*device
);
53 /* Write a multi-fragment message */
54 int ishtp_send_msg(struct ishtp_device
*dev
,
55 struct ishtp_msg_hdr
*hdr
, void *msg
,
56 void (*ipc_send_compl
)(void *),
57 void *ipc_send_compl_prm
);
59 /* Write a single-fragment message */
60 int ishtp_write_message(struct ishtp_device
*dev
,
61 struct ishtp_msg_hdr
*hdr
,
64 /* Use DMA to send/receive messages */
65 int ishtp_use_dma_transfer(void);
67 /* Exported functions */
68 void ishtp_bus_remove_all_clients(struct ishtp_device
*ishtp_dev
,
71 void ishtp_recv(struct ishtp_device
*dev
);
72 void ishtp_reset_handler(struct ishtp_device
*dev
);
73 void ishtp_reset_compl_handler(struct ishtp_device
*dev
);
75 int ishtp_fw_cl_by_uuid(struct ishtp_device
*dev
, const guid_t
*cuuid
);
76 #endif /* _LINUX_ISHTP_CL_BUS_H */