/* SPDX-License-Identifier: GPL-2.0-only */ /* * Most ISHTP provider device and ISHTP logic declarations * * Copyright (c) 2003-2016, Intel Corporation. */ #ifndef _ISHTP_DEV_H_ #define _ISHTP_DEV_H_ #include <linux/types.h> #include <linux/spinlock.h> #include <linux/intel-ish-client-if.h> #include "bus.h" #include "hbm.h" #define IPC_PAYLOAD_SIZE … #define ISHTP_RD_MSG_BUF_SIZE … #define IPC_FULL_MSG_SIZE … /* Number of messages to be held in ISR->BH FIFO */ #define RD_INT_FIFO_SIZE … /* * Number of IPC messages to be held in Tx FIFO, to be sent by ISR - * Tx complete interrupt or RX_COMPLETE handler */ #define IPC_TX_FIFO_SIZE … /* * Number of Maximum ISHTP Clients */ #define ISHTP_CLIENTS_MAX … /* * Number of File descriptors/handles * that can be opened to the driver. * * Limit to 255: 256 Total Clients * minus internal client for ISHTP Bus Messages */ #define ISHTP_MAX_OPEN_HANDLE_COUNT … /* Internal Clients Number */ #define ISHTP_HOST_CLIENT_ID_ANY … #define ISHTP_HBM_HOST_CLIENT_ID … #define MAX_DMA_DELAY … /* ISHTP device states */ enum ishtp_dev_state { … }; const char *ishtp_dev_state_str(int state); struct ishtp_cl; /** * struct ishtp_fw_client - representation of fw client * * @props - client properties * @client_id - fw client id */ struct ishtp_fw_client { … }; /* * Control info for IPC messages ISHTP/IPC sending FIFO - * list with inline data buffer * This structure will be filled with parameters submitted * by the caller glue layer * 'buf' may be pointing to the external buffer or to 'inline_data' * 'offset' will be initialized to 0 by submitting * * 'ipc_send_compl' is intended for use by clients that send fragmented * messages. When a fragment is sent down to IPC msg regs, * it will be called. * If it has more fragments to send, it will do it. With last fragment * it will send appropriate ISHTP "message-complete" flag. * It will remove the outstanding message * (mark outstanding buffer as available). * If counting flow control is in work and there are more flow control * credits, it can put the next client message queued in cl. * structure for IPC processing. * */ struct wr_msg_ctl_info { … }; /* * The ISHTP layer talks to hardware IPC message using the following * callbacks */ struct ishtp_hw_ops { … }; /** * struct ishtp_driver_data - Driver-specific data for ISHTP devices * * This structure holds driver-specific data that can be associated with each * ISHTP device instance. It allows for the storage of data that is unique to * a particular driver or hardware variant. * * @fw_filename: The firmware filename associated with a specific hardware * variant of the Intel Integrated Sensor Hub (ISH). This allows * the driver to load the correct firmware based on the device's * hardware variant. */ struct ishtp_driver_data { … }; /** * struct ishtp_device - ISHTP private device struct */ struct ishtp_device { … }; static inline unsigned long ishtp_secs_to_jiffies(unsigned long sec) { … } /* * Register Access Function */ static inline int ish_ipc_reset(struct ishtp_device *dev) { … } /* Exported function */ void ishtp_device_init(struct ishtp_device *dev); int ishtp_start(struct ishtp_device *dev); #endif /*_ISHTP_DEV_H_*/