linux/drivers/media/pci/intel/ipu3/ipu3-cio2.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2017 Intel Corporation */

#ifndef __IPU3_CIO2_H
#define __IPU3_CIO2_H

#include <linux/bits.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/types.h>

#include <asm/page.h>

#include <media/media-device.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-device.h>
#include <media/v4l2-subdev.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-v4l2.h>

struct cio2_fbpt_entry;		/* defined here, after the first usage */
struct pci_dev;

#define CIO2_NAME
#define CIO2_DEVICE_NAME
#define CIO2_ENTITY_NAME
#define CIO2_PCI_ID
#define CIO2_PCI_BAR
#define CIO2_DMA_MASK

#define CIO2_IMAGE_MAX_WIDTH
#define CIO2_IMAGE_MAX_HEIGHT

/* 32MB = 8xFBPT_entry */
#define CIO2_MAX_LOPS
#define CIO2_MAX_BUFFERS
#define CIO2_LOP_ENTRIES

#define CIO2_PAD_SINK
#define CIO2_PAD_SOURCE
#define CIO2_PADS

#define CIO2_NUM_DMA_CHAN
#define CIO2_NUM_PORTS

/* 1 for each sensor */
#define CIO2_QUEUES

/* Register and bit field definitions */
#define CIO2_REG_PIPE_BASE(n)
#define CIO2_REG_CSIRX_BASE
#define CIO2_REG_MIPIBE_BASE
#define CIO2_REG_PIXELGEN_BAS
#define CIO2_REG_IRQCTRL_BASE
#define CIO2_REG_GPREG_BASE

/* base register: CIO2_REG_PIPE_BASE(pipe) * CIO2_REG_CSIRX_BASE */
#define CIO2_REG_CSIRX_ENABLE
#define CIO2_REG_CSIRX_NOF_ENABLED_LANES
#define CIO2_REG_CSIRX_SP_IF_CONFIG
#define CIO2_REG_CSIRX_LP_IF_CONFIG
#define CIO2_CSIRX_IF_CONFIG_FILTEROUT
#define CIO2_CSIRX_IF_CONFIG_FILTEROUT_VC_INACTIVE
#define CIO2_CSIRX_IF_CONFIG_PASS
#define CIO2_CSIRX_IF_CONFIG_FLAG_ERROR
#define CIO2_REG_CSIRX_STATUS
#define CIO2_REG_CSIRX_STATUS_DLANE_HS
#define CIO2_CSIRX_STATUS_DLANE_HS_MASK
#define CIO2_REG_CSIRX_STATUS_DLANE_LP
#define CIO2_CSIRX_STATUS_DLANE_LP_MASK
/* Termination enable and settle in 0.0625ns units, lane=0..3 or -1 for clock */
#define CIO2_REG_CSIRX_DLY_CNT_TERMEN(lane)
#define CIO2_REG_CSIRX_DLY_CNT_SETTLE(lane)
/* base register: CIO2_REG_PIPE_BASE(pipe) * CIO2_REG_MIPIBE_BASE */
#define CIO2_REG_MIPIBE_ENABLE
#define CIO2_REG_MIPIBE_STATUS
#define CIO2_REG_MIPIBE_COMP_FORMAT(vc)
#define CIO2_REG_MIPIBE_FORCE_RAW8
#define CIO2_REG_MIPIBE_FORCE_RAW8_ENABLE
#define CIO2_REG_MIPIBE_FORCE_RAW8_USE_TYPEID
#define CIO2_REG_MIPIBE_FORCE_RAW8_TYPEID_SHIFT

#define CIO2_REG_MIPIBE_IRQ_STATUS
#define CIO2_REG_MIPIBE_IRQ_CLEAR
#define CIO2_REG_MIPIBE_GLOBAL_LUT_DISREGARD
#define CIO2_MIPIBE_GLOBAL_LUT_DISREGARD
#define CIO2_REG_MIPIBE_PKT_STALL_STATUS
#define CIO2_REG_MIPIBE_PARSE_GSP_THROUGH_LP_LUT_REG_IDX
#define CIO2_REG_MIPIBE_SP_LUT_ENTRY(vc)
#define CIO2_REG_MIPIBE_LP_LUT_ENTRY(m)
#define CIO2_MIPIBE_LP_LUT_ENTRY_DISREGARD
#define CIO2_MIPIBE_LP_LUT_ENTRY_SID_SHIFT
#define CIO2_MIPIBE_LP_LUT_ENTRY_VC_SHIFT
#define CIO2_MIPIBE_LP_LUT_ENTRY_FORMAT_TYPE_SHIFT

/* base register: CIO2_REG_PIPE_BASE(pipe) * CIO2_REG_IRQCTRL_BASE */
/* IRQ registers are 18-bit wide, see cio2_irq_error for bit definitions */
#define CIO2_REG_IRQCTRL_EDGE
#define CIO2_REG_IRQCTRL_MASK
#define CIO2_REG_IRQCTRL_STATUS
#define CIO2_REG_IRQCTRL_CLEAR
#define CIO2_REG_IRQCTRL_ENABLE
#define CIO2_REG_IRQCTRL_LEVEL_NOT_PULSE

#define CIO2_REG_GPREG_SRST
#define CIO2_GPREG_SRST_ALL
#define CIO2_REG_FB_HPLL_FREQ
#define CIO2_REG_ISCLK_RATIO

#define CIO2_REG_CGC
#define CIO2_CGC_CSI2_TGE
#define CIO2_CGC_PRIM_TGE
#define CIO2_CGC_SIDE_TGE
#define CIO2_CGC_XOSC_TGE
#define CIO2_CGC_MPLL_SHUTDOWN_EN
#define CIO2_CGC_D3I3_TGE
#define CIO2_CGC_CSI2_INTERFRAME_TGE
#define CIO2_CGC_CSI2_PORT_DCGE
#define CIO2_CGC_CSI2_DCGE
#define CIO2_CGC_SIDE_DCGE
#define CIO2_CGC_PRIM_DCGE
#define CIO2_CGC_ROSC_DCGE
#define CIO2_CGC_XOSC_DCGE
#define CIO2_CGC_FLIS_DCGE
#define CIO2_CGC_CLKGATE_HOLDOFF_SHIFT
#define CIO2_CGC_CSI_CLKGATE_HOLDOFF_SHIFT
#define CIO2_REG_D0I3C
#define CIO2_D0I3C_I3
#define CIO2_D0I3C_RR
#define CIO2_REG_SWRESET
#define CIO2_SWRESET_SWRESET
#define CIO2_REG_SENSOR_ACTIVE
#define CIO2_REG_INT_STS
#define CIO2_REG_INT_STS_EXT_OE
#define CIO2_INT_EXT_OE_DMAOE_SHIFT
#define CIO2_INT_EXT_OE_DMAOE_MASK
#define CIO2_INT_EXT_OE_OES_SHIFT
#define CIO2_INT_EXT_OE_OES_MASK
#define CIO2_REG_INT_EN
#define CIO2_REG_INT_EN_IRQ
#define CIO2_REG_INT_EN_IOS(dma)
/*
 * Interrupt on completion bit, Eg. DMA 0-3 maps to bit 0-3,
 * DMA4 & DMA5 map to bit 4 ... DMA18 & DMA19 map to bit 11 Et cetera
 */
#define CIO2_INT_IOC(dma)
#define CIO2_INT_IOC_SHIFT
#define CIO2_INT_IOC_MASK
#define CIO2_INT_IOS_IOLN(dma)
#define CIO2_INT_IOS_IOLN_SHIFT
#define CIO2_INT_IOS_IOLN_MASK
#define CIO2_INT_IOIE
#define CIO2_INT_IOOE
#define CIO2_INT_IOIRQ
#define CIO2_REG_INT_EN_EXT_OE
#define CIO2_REG_DMA_DBG
#define CIO2_REG_DMA_DBG_DMA_INDEX_SHIFT
#define CIO2_REG_PBM_ARB_CTRL
#define CIO2_PBM_ARB_CTRL_LANES_DIV
#define CIO2_PBM_ARB_CTRL_LANES_DIV_SHIFT
#define CIO2_PBM_ARB_CTRL_LE_EN
#define CIO2_PBM_ARB_CTRL_PLL_POST_SHTDN
#define CIO2_PBM_ARB_CTRL_PLL_POST_SHTDN_SHIFT
#define CIO2_PBM_ARB_CTRL_PLL_AHD_WK_UP
#define CIO2_PBM_ARB_CTRL_PLL_AHD_WK_UP_SHIFT
#define CIO2_REG_PBM_WMCTRL1
#define CIO2_PBM_WMCTRL1_MIN_2CK_SHIFT
#define CIO2_PBM_WMCTRL1_MID1_2CK_SHIFT
#define CIO2_PBM_WMCTRL1_MID2_2CK_SHIFT
#define CIO2_PBM_WMCTRL1_TS_COUNT_DISABLE
#define CIO2_PBM_WMCTRL1_MIN_2CK
#define CIO2_PBM_WMCTRL1_MID1_2CK
#define CIO2_PBM_WMCTRL1_MID2_2CK
#define CIO2_REG_PBM_WMCTRL2
#define CIO2_PBM_WMCTRL2_HWM_2CK
#define CIO2_PBM_WMCTRL2_HWM_2CK_SHIFT
#define CIO2_PBM_WMCTRL2_LWM_2CK
#define CIO2_PBM_WMCTRL2_LWM_2CK_SHIFT
#define CIO2_PBM_WMCTRL2_OBFFWM_2CK
#define CIO2_PBM_WMCTRL2_OBFFWM_2CK_SHIFT
#define CIO2_PBM_WMCTRL2_TRANSDYN
#define CIO2_PBM_WMCTRL2_TRANSDYN_SHIFT
#define CIO2_PBM_WMCTRL2_DYNWMEN
#define CIO2_PBM_WMCTRL2_OBFF_MEM_EN
#define CIO2_PBM_WMCTRL2_OBFF_CPU_EN
#define CIO2_PBM_WMCTRL2_DRAINNOW
#define CIO2_REG_PBM_TS_COUNT
#define CIO2_REG_PBM_FOPN_ABORT
/* below n = 0..3 */
#define CIO2_PBM_FOPN_ABORT(n)
#define CIO2_PBM_FOPN_FORCE_ABORT(n)
#define CIO2_PBM_FOPN_FRAMEOPEN(n)
#define CIO2_REG_LTRCTRL
#define CIO2_LTRCTRL_LTRDYNEN
#define CIO2_LTRCTRL_LTRSTABLETIME_SHIFT
#define CIO2_LTRCTRL_LTRSTABLETIME_MASK
#define CIO2_LTRCTRL_LTRSEL1S3
#define CIO2_LTRCTRL_LTRSEL1S2
#define CIO2_LTRCTRL_LTRSEL1S1
#define CIO2_LTRCTRL_LTRSEL1S0
#define CIO2_LTRCTRL_LTRSEL2S3
#define CIO2_LTRCTRL_LTRSEL2S2
#define CIO2_LTRCTRL_LTRSEL2S1
#define CIO2_LTRCTRL_LTRSEL2S0
#define CIO2_REG_LTRVAL23
#define CIO2_REG_LTRVAL01
#define CIO2_LTRVAL02_VAL_SHIFT
#define CIO2_LTRVAL02_SCALE_SHIFT
#define CIO2_LTRVAL13_VAL_SHIFT
#define CIO2_LTRVAL13_SCALE_SHIFT

#define CIO2_LTRVAL0_VAL
/* Value times 1024 ns */
#define CIO2_LTRVAL0_SCALE
#define CIO2_LTRVAL1_VAL
#define CIO2_LTRVAL1_SCALE
#define CIO2_LTRVAL2_VAL
#define CIO2_LTRVAL2_SCALE
#define CIO2_LTRVAL3_VAL
#define CIO2_LTRVAL3_SCALE

#define CIO2_REG_CDMABA(n)
#define CIO2_REG_CDMARI(n)
#define CIO2_CDMARI_FBPT_RP_SHIFT
#define CIO2_CDMARI_FBPT_RP_MASK
#define CIO2_REG_CDMAC0(n)
#define CIO2_CDMAC0_FBPT_LEN_SHIFT
#define CIO2_CDMAC0_FBPT_WIDTH_SHIFT
#define CIO2_CDMAC0_FBPT_NS
#define CIO2_CDMAC0_DMA_INTR_ON_FS
#define CIO2_CDMAC0_DMA_INTR_ON_FE
#define CIO2_CDMAC0_FBPT_UPDATE_FIFO_FULL
#define CIO2_CDMAC0_FBPT_FIFO_FULL_FIX_DIS
#define CIO2_CDMAC0_DMA_EN
#define CIO2_CDMAC0_DMA_HALTED
#define CIO2_REG_CDMAC1(n)
#define CIO2_CDMAC1_LINENUMINT_SHIFT
#define CIO2_CDMAC1_LINENUMUPDATE_SHIFT
/* n = 0..3 */
#define CIO2_REG_PXM_PXF_FMT_CFG0(n)
#define CIO2_PXM_PXF_FMT_CFG_SID0_SHIFT
#define CIO2_PXM_PXF_FMT_CFG_SID1_SHIFT
#define CIO2_PXM_PXF_FMT_CFG_PCK_64B
#define CIO2_PXM_PXF_FMT_CFG_PCK_32B
#define CIO2_PXM_PXF_FMT_CFG_BPP_08
#define CIO2_PXM_PXF_FMT_CFG_BPP_10
#define CIO2_PXM_PXF_FMT_CFG_BPP_12
#define CIO2_PXM_PXF_FMT_CFG_BPP_14
#define CIO2_PXM_PXF_FMT_CFG_SPEC_4PPC
#define CIO2_PXM_PXF_FMT_CFG_SPEC_3PPC_RGBA
#define CIO2_PXM_PXF_FMT_CFG_SPEC_3PPC_ARGB
#define CIO2_PXM_PXF_FMT_CFG_SPEC_PLANAR2
#define CIO2_PXM_PXF_FMT_CFG_SPEC_PLANAR3
#define CIO2_PXM_PXF_FMT_CFG_SPEC_NV16
#define CIO2_PXM_PXF_FMT_CFG_PSWAP4_1ST_AB
#define CIO2_PXM_PXF_FMT_CFG_PSWAP4_1ST_CD
#define CIO2_PXM_PXF_FMT_CFG_PSWAP4_2ND_AC
#define CIO2_PXM_PXF_FMT_CFG_PSWAP4_2ND_BD
#define CIO2_REG_INT_STS_EXT_IE
#define CIO2_REG_INT_EN_EXT_IE
#define CIO2_INT_EXT_IE_ECC_RE(n)
#define CIO2_INT_EXT_IE_DPHY_NR(n)
#define CIO2_INT_EXT_IE_ECC_NR(n)
#define CIO2_INT_EXT_IE_CRCERR(n)
#define CIO2_INT_EXT_IE_INTERFRAMEDATA(n)
#define CIO2_INT_EXT_IE_PKT2SHORT(n)
#define CIO2_INT_EXT_IE_PKT2LONG(n)
#define CIO2_INT_EXT_IE_IRQ(n)
#define CIO2_REG_PXM_FRF_CFG(n)
#define CIO2_PXM_FRF_CFG_FNSEL
#define CIO2_PXM_FRF_CFG_FN_RST
#define CIO2_PXM_FRF_CFG_ABORT
#define CIO2_PXM_FRF_CFG_CRC_TH_SHIFT
#define CIO2_PXM_FRF_CFG_MSK_ECC_DPHY_NR
#define CIO2_PXM_FRF_CFG_MSK_ECC_RE
#define CIO2_PXM_FRF_CFG_MSK_ECC_DPHY_NE
#define CIO2_PXM_FRF_CFG_EVEN_ODD_MODE_SHIFT
#define CIO2_PXM_FRF_CFG_MASK_CRC_THRES
#define CIO2_PXM_FRF_CFG_MASK_CSI_ACCEPT
#define CIO2_PXM_FRF_CFG_CIOHC_FS_MODE
#define CIO2_PXM_FRF_CFG_CIOHC_FRST_FRM_SHIFT
#define CIO2_REG_PXM_SID2BID0(n)
#define CIO2_FB_HPLL_FREQ
#define CIO2_ISCLK_RATIO

#define CIO2_IRQCTRL_MASK

#define CIO2_INT_EN_EXT_OE_MASK

#define CIO2_CGC_CLKGATE_HOLDOFF
#define CIO2_CGC_CSI_CLKGATE_HOLDOFF

#define CIO2_PXM_FRF_CFG_CRC_TH

#define CIO2_INT_EN_EXT_IE_MASK

#define CIO2_DMA_CHAN

#define CIO2_CSIRX_DLY_CNT_CLANE_IDX

#define CIO2_CSIRX_DLY_CNT_TERMEN_CLANE_A
#define CIO2_CSIRX_DLY_CNT_TERMEN_CLANE_B
#define CIO2_CSIRX_DLY_CNT_SETTLE_CLANE_A
#define CIO2_CSIRX_DLY_CNT_SETTLE_CLANE_B

#define CIO2_CSIRX_DLY_CNT_TERMEN_DLANE_A
#define CIO2_CSIRX_DLY_CNT_TERMEN_DLANE_B
#define CIO2_CSIRX_DLY_CNT_SETTLE_DLANE_A
#define CIO2_CSIRX_DLY_CNT_SETTLE_DLANE_B

#define CIO2_CSIRX_DLY_CNT_TERMEN_DEFAULT
#define CIO2_CSIRX_DLY_CNT_SETTLE_DEFAULT

struct cio2_csi2_timing {};

struct cio2_buffer {};

#define to_cio2_buffer(vb)

struct csi2_bus_info {};

struct cio2_queue {};

struct cio2_device {};

#define to_cio2_device(n)

/**************** Virtual channel ****************/
/*
 * This should come from sensor driver. No
 * driver interface nor requirement yet.
 */
#define SENSOR_VIR_CH_DFLT

/**************** FBPT operations ****************/
#define CIO2_FBPT_SIZE

#define CIO2_FBPT_SUBENTRY_UNIT

/* cio2 fbpt first_entry ctrl status */
#define CIO2_FBPT_CTRL_VALID
#define CIO2_FBPT_CTRL_IOC
#define CIO2_FBPT_CTRL_IOS
#define CIO2_FBPT_CTRL_SUCCXFAIL
#define CIO2_FBPT_CTRL_CMPLCODE_SHIFT

/*
 * Frame Buffer Pointer Table(FBPT) entry
 * each entry describe an output buffer and consists of
 * several sub-entries
 */
struct __packed cio2_fbpt_entry {};

static inline struct cio2_queue *file_to_cio2_queue(struct file *file)
{}

static inline struct cio2_queue *vb2q_to_cio2_queue(struct vb2_queue *vq)
{}

#endif