162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * ISHTP bus definitions 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (c) 2014-2016, Intel Corporation. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci#ifndef _LINUX_ISHTP_CL_BUS_H 862306a36Sopenharmony_ci#define _LINUX_ISHTP_CL_BUS_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/device.h> 1162306a36Sopenharmony_ci#include <linux/mod_devicetable.h> 1262306a36Sopenharmony_ci#include <linux/intel-ish-client-if.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cistruct ishtp_cl; 1562306a36Sopenharmony_cistruct ishtp_cl_device; 1662306a36Sopenharmony_cistruct ishtp_device; 1762306a36Sopenharmony_cistruct ishtp_msg_hdr; 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/** 2062306a36Sopenharmony_ci * struct ishtp_cl_device - ISHTP device handle 2162306a36Sopenharmony_ci * @dev: device pointer 2262306a36Sopenharmony_ci * @ishtp_dev: pointer to ishtp device structure to primarily to access 2362306a36Sopenharmony_ci * hw device operation callbacks and properties 2462306a36Sopenharmony_ci * @fw_client: fw_client pointer to get fw information like protocol name 2562306a36Sopenharmony_ci * max message length etc. 2662306a36Sopenharmony_ci * @device_link: Link to next client in the list on a bus 2762306a36Sopenharmony_ci * @event_work: Used to schedule rx event for client 2862306a36Sopenharmony_ci * @driver_data: Storage driver private data 2962306a36Sopenharmony_ci * @reference_count: Used for get/put device 3062306a36Sopenharmony_ci * @event_cb: Callback to driver to send events 3162306a36Sopenharmony_ci * 3262306a36Sopenharmony_ci * An ishtp_cl_device pointer is returned from ishtp_add_device() 3362306a36Sopenharmony_ci * and links ISHTP bus clients to their actual host client pointer. 3462306a36Sopenharmony_ci * Drivers for ISHTP devices will get an ishtp_cl_device pointer 3562306a36Sopenharmony_ci * when being probed and shall use it for doing bus I/O. 3662306a36Sopenharmony_ci */ 3762306a36Sopenharmony_cistruct ishtp_cl_device { 3862306a36Sopenharmony_ci struct device dev; 3962306a36Sopenharmony_ci struct ishtp_device *ishtp_dev; 4062306a36Sopenharmony_ci struct ishtp_fw_client *fw_client; 4162306a36Sopenharmony_ci struct list_head device_link; 4262306a36Sopenharmony_ci struct work_struct event_work; 4362306a36Sopenharmony_ci void *driver_data; 4462306a36Sopenharmony_ci int reference_count; 4562306a36Sopenharmony_ci void (*event_cb)(struct ishtp_cl_device *device); 4662306a36Sopenharmony_ci}; 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciint ishtp_bus_new_client(struct ishtp_device *dev); 4962306a36Sopenharmony_civoid ishtp_remove_all_clients(struct ishtp_device *dev); 5062306a36Sopenharmony_ciint ishtp_cl_device_bind(struct ishtp_cl *cl); 5162306a36Sopenharmony_civoid ishtp_cl_bus_rx_event(struct ishtp_cl_device *device); 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci/* Write a multi-fragment message */ 5462306a36Sopenharmony_ciint ishtp_send_msg(struct ishtp_device *dev, 5562306a36Sopenharmony_ci struct ishtp_msg_hdr *hdr, void *msg, 5662306a36Sopenharmony_ci void (*ipc_send_compl)(void *), 5762306a36Sopenharmony_ci void *ipc_send_compl_prm); 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Write a single-fragment message */ 6062306a36Sopenharmony_ciint ishtp_write_message(struct ishtp_device *dev, 6162306a36Sopenharmony_ci struct ishtp_msg_hdr *hdr, 6262306a36Sopenharmony_ci void *buf); 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* Use DMA to send/receive messages */ 6562306a36Sopenharmony_ciint ishtp_use_dma_transfer(void); 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/* Exported functions */ 6862306a36Sopenharmony_civoid ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev, 6962306a36Sopenharmony_ci bool warm_reset); 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_civoid ishtp_recv(struct ishtp_device *dev); 7262306a36Sopenharmony_civoid ishtp_reset_handler(struct ishtp_device *dev); 7362306a36Sopenharmony_civoid ishtp_reset_compl_handler(struct ishtp_device *dev); 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciint ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid); 7662306a36Sopenharmony_ci#endif /* _LINUX_ISHTP_CL_BUS_H */ 77