76 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * ISHTP bus definitions4 *5 * Copyright (c) 2014-2016, Intel Corporation.6 */7#ifndef _LINUX_ISHTP_CL_BUS_H8#define _LINUX_ISHTP_CL_BUS_H9 10#include <linux/device.h>11#include <linux/mod_devicetable.h>12#include <linux/intel-ish-client-if.h>13 14struct ishtp_cl;15struct ishtp_cl_device;16struct ishtp_device;17struct ishtp_msg_hdr;18 19/**20 * struct ishtp_cl_device - ISHTP device handle21 * @dev: device pointer22 * @ishtp_dev: pointer to ishtp device structure to primarily to access23 * hw device operation callbacks and properties24 * @fw_client: fw_client pointer to get fw information like protocol name25 * max message length etc.26 * @device_link: Link to next client in the list on a bus27 * @event_work: Used to schedule rx event for client28 * @driver_data: Storage driver private data29 * @reference_count: Used for get/put device30 * @event_cb: Callback to driver to send events31 *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 pointer35 * when being probed and shall use it for doing bus I/O.36 */37struct ishtp_cl_device {38 struct device dev;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;43 void *driver_data;44 int reference_count;45 void (*event_cb)(struct ishtp_cl_device *device);46};47 48int ishtp_bus_new_client(struct ishtp_device *dev);49int ishtp_cl_device_bind(struct ishtp_cl *cl);50void ishtp_cl_bus_rx_event(struct ishtp_cl_device *device);51 52/* Write a multi-fragment message */53int ishtp_send_msg(struct ishtp_device *dev,54 struct ishtp_msg_hdr *hdr, void *msg,55 void (*ipc_send_compl)(void *),56 void *ipc_send_compl_prm);57 58/* Write a single-fragment message */59int ishtp_write_message(struct ishtp_device *dev,60 struct ishtp_msg_hdr *hdr,61 void *buf);62 63/* Use DMA to send/receive messages */64int ishtp_use_dma_transfer(void);65 66/* Exported functions */67void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,68 bool warm_reset);69 70void ishtp_recv(struct ishtp_device *dev);71void ishtp_reset_handler(struct ishtp_device *dev);72void ishtp_reset_compl_handler(struct ishtp_device *dev);73 74int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid);75#endif /* _LINUX_ISHTP_CL_BUS_H */76