File Index
Files and directories
Sign in
FILE

ipu7-isys.h

File preview with syntax highlighting.

linux-6.19.14/drivers/staging/media/ipu7/ipu7-isys.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright (C) 2013 - 2025 Intel Corporation
  4 */
  5
  6#ifndef IPU7_ISYS_H
  7#define IPU7_ISYS_H
  8
  9#include <linux/irqreturn.h>
 10#include <linux/list.h>
 11#include <linux/mutex.h>
 12#include <linux/pm_qos.h>
 13#include <linux/spinlock_types.h>
 14#include <linux/types.h>
 15
 16#include <media/media-device.h>
 17#include <media/v4l2-async.h>
 18#include <media/v4l2-device.h>
 19#include <media/v4l2-mediabus.h>
 20
 21#include "abi/ipu7_fw_msg_abi.h"
 22#include "abi/ipu7_fw_isys_abi.h"
 23
 24#include "ipu7.h"
 25#include "ipu7-isys-csi2.h"
 26#include "ipu7-isys-video.h"
 27
 28#define IPU_ISYS_ENTITY_PREFIX		"Intel IPU7"
 29
 30/* FW support max 16 streams */
 31#define IPU_ISYS_MAX_STREAMS		16U
 32
 33/*
 34 * Current message queue configuration. These must be big enough
 35 * so that they never gets full. Queues are located in system memory
 36 */
 37#define IPU_ISYS_SIZE_RECV_QUEUE	40U
 38#define IPU_ISYS_SIZE_LOG_QUEUE		256U
 39#define IPU_ISYS_SIZE_SEND_QUEUE	40U
 40#define IPU_ISYS_NUM_RECV_QUEUE		1U
 41
 42#define IPU_ISYS_MIN_WIDTH		2U
 43#define IPU_ISYS_MIN_HEIGHT		2U
 44#define IPU_ISYS_MAX_WIDTH		8160U
 45#define IPU_ISYS_MAX_HEIGHT		8190U
 46
 47#define FW_CALL_TIMEOUT_JIFFIES		\
 48	msecs_to_jiffies(IPU_LIB_CALL_TIMEOUT_MS)
 49
 50struct isys_fw_log {
 51	struct mutex mutex; /* protect whole struct */
 52	void *head;
 53	void *addr;
 54	u32 count; /* running counter of log */
 55	u32 size; /* actual size of log content, in bits */
 56};
 57
 58/*
 59 * struct ipu7_isys
 60 *
 61 * @media_dev: Media device
 62 * @v4l2_dev: V4L2 device
 63 * @adev: ISYS bus device
 64 * @power: Is ISYS powered on or not?
 65 * @isr_bits: Which bits does the ISR handle?
 66 * @power_lock: Serialise access to power (power state in general)
 67 * @csi2_rx_ctrl_cached: cached shared value between all CSI2 receivers
 68 * @streams_lock: serialise access to streams
 69 * @streams: streams per firmware stream ID
 70 * @syscom: fw communication layer context
 71 * @ref_count: total number of callers fw open
 72 * @mutex: serialise access isys video open/release related operations
 73 * @stream_mutex: serialise stream start and stop, queueing requests
 74 * @pdata: platform data pointer
 75 * @csi2: CSI-2 receivers
 76 */
 77struct ipu7_isys {
 78	struct media_device media_dev;
 79	struct v4l2_device v4l2_dev;
 80	struct ipu7_bus_device *adev;
 81
 82	int power;
 83	spinlock_t power_lock;	/* Serialise access to power */
 84	u32 isr_csi2_mask;
 85	u32 csi2_rx_ctrl_cached;
 86	spinlock_t streams_lock;
 87	struct ipu7_isys_stream streams[IPU_ISYS_MAX_STREAMS];
 88	int streams_ref_count[IPU_ISYS_MAX_STREAMS];
 89	u32 phy_rext_cal;
 90	bool icache_prefetch;
 91	bool csi2_cse_ipc_not_supported;
 92	unsigned int ref_count;
 93	unsigned int stream_opened;
 94
 95	struct mutex mutex;	/* Serialise isys video open/release related */
 96	struct mutex stream_mutex;	/* Stream start, stop, queueing reqs */
 97
 98	struct ipu7_isys_pdata *pdata;
 99
100	struct ipu7_isys_csi2 *csi2;
101	struct isys_fw_log *fw_log;
102
103	struct list_head requests;
104	struct pm_qos_request pm_qos;
105	spinlock_t listlock;	/* Protect framebuflist */
106	struct list_head framebuflist;
107	struct list_head framebuflist_fw;
108	struct v4l2_async_notifier notifier;
109
110	struct ipu7_insys_config *subsys_config;
111	dma_addr_t subsys_config_dma_addr;
112};
113
114struct isys_fw_msgs {
115	union {
116		u64 dummy;
117		struct ipu7_insys_buffset frame;
118		struct ipu7_insys_stream_cfg stream;
119	} fw_msg;
120	struct list_head head;
121	dma_addr_t dma_addr;
122};
123
124struct ipu7_isys_csi2_config {
125	unsigned int nlanes;
126	unsigned int port;
127	enum v4l2_mbus_type bus_type;
128};
129
130struct sensor_async_sd {
131	struct v4l2_async_connection asc;
132	struct ipu7_isys_csi2_config csi2;
133};
134
135struct isys_fw_msgs *ipu7_get_fw_msg_buf(struct ipu7_isys_stream *stream);
136void ipu7_put_fw_msg_buf(struct ipu7_isys *isys, uintptr_t data);
137void ipu7_cleanup_fw_msg_bufs(struct ipu7_isys *isys);
138int isys_isr_one(struct ipu7_bus_device *adev);
139void ipu7_isys_setup_hw(struct ipu7_isys *isys);
140#endif /* IPU7_ISYS_H */
~/ Read-only file preview.