162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * VIA Camera register definitions.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#define VCR_INTCTRL	0x300	/* Capture interrupt control */
662306a36Sopenharmony_ci#define   VCR_IC_EAV	  0x0001   /* End of active video status */
762306a36Sopenharmony_ci#define	  VCR_IC_EVBI	  0x0002   /* End of VBI status */
862306a36Sopenharmony_ci#define   VCR_IC_FBOTFLD  0x0004   /* "flipping" Bottom field is active */
962306a36Sopenharmony_ci#define   VCR_IC_ACTBUF	  0x0018   /* Active video buffer  */
1062306a36Sopenharmony_ci#define   VCR_IC_VSYNC	  0x0020   /* 0 = VB, 1 = active video */
1162306a36Sopenharmony_ci#define   VCR_IC_BOTFLD	  0x0040   /* Bottom field is active */
1262306a36Sopenharmony_ci#define   VCR_IC_FFULL	  0x0080   /* FIFO full */
1362306a36Sopenharmony_ci#define   VCR_IC_INTEN	  0x0100   /* End of active video int. enable */
1462306a36Sopenharmony_ci#define   VCR_IC_VBIINT	  0x0200   /* End of VBI int enable */
1562306a36Sopenharmony_ci#define   VCR_IC_VBIBUF	  0x0400   /* Current VBI buffer */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define VCR_TSC		0x308	/* Transport stream control */
1862306a36Sopenharmony_ci#define VCR_TSC_ENABLE    0x000001   /* Transport stream input enable */
1962306a36Sopenharmony_ci#define VCR_TSC_DROPERR   0x000002   /* Drop error packets */
2062306a36Sopenharmony_ci#define VCR_TSC_METHOD    0x00000c   /* DMA method (non-functional) */
2162306a36Sopenharmony_ci#define VCR_TSC_COUNT     0x07fff0   /* KByte or packet count */
2262306a36Sopenharmony_ci#define VCR_TSC_CBMODE	  0x080000   /* Change buffer by byte count */
2362306a36Sopenharmony_ci#define VCR_TSC_PSSIG	  0x100000   /* Packet starting signal disable */
2462306a36Sopenharmony_ci#define VCR_TSC_BE	  0x200000   /* MSB first (serial mode) */
2562306a36Sopenharmony_ci#define VCR_TSC_SERIAL	  0x400000   /* Serial input (0 = parallel) */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define VCR_CAPINTC	0x310	/* Capture interface control */
2862306a36Sopenharmony_ci#define   VCR_CI_ENABLE   0x00000001  /* Capture enable */
2962306a36Sopenharmony_ci#define   VCR_CI_BSS	  0x00000002  /* WTF "bit stream selection" */
3062306a36Sopenharmony_ci#define   VCR_CI_3BUFS	  0x00000004  /* 1 = 3 buffers, 0 = 2 buffers */
3162306a36Sopenharmony_ci#define   VCR_CI_VIPEN	  0x00000008  /* VIP enable */
3262306a36Sopenharmony_ci#define   VCR_CI_CCIR601_8  0		/* CCIR601 input stream, 8 bit */
3362306a36Sopenharmony_ci#define   VCR_CI_CCIR656_8  0x00000010  /* ... CCIR656, 8 bit */
3462306a36Sopenharmony_ci#define   VCR_CI_CCIR601_16 0x00000020  /* ... CCIR601, 16 bit */
3562306a36Sopenharmony_ci#define   VCR_CI_CCIR656_16 0x00000030  /* ... CCIR656, 16 bit */
3662306a36Sopenharmony_ci#define   VCR_CI_HDMODE   0x00000040  /* CCIR656-16 hdr decode mode; 1=16b */
3762306a36Sopenharmony_ci#define   VCR_CI_BSWAP    0x00000080  /* Swap bytes (16-bit) */
3862306a36Sopenharmony_ci#define   VCR_CI_YUYV	  0	      /* Byte order 0123 */
3962306a36Sopenharmony_ci#define   VCR_CI_UYVY	  0x00000100  /* Byte order 1032 */
4062306a36Sopenharmony_ci#define   VCR_CI_YVYU	  0x00000200  /* Byte order 0321 */
4162306a36Sopenharmony_ci#define   VCR_CI_VYUY	  0x00000300  /* Byte order 3012 */
4262306a36Sopenharmony_ci#define   VCR_CI_VIPTYPE  0x00000400  /* VIP type */
4362306a36Sopenharmony_ci#define   VCR_CI_IFSEN    0x00000800  /* Input field signal enable */
4462306a36Sopenharmony_ci#define   VCR_CI_DIODD	  0	      /* De-interlace odd, 30fps */
4562306a36Sopenharmony_ci#define   VCR_CI_DIEVEN   0x00001000  /*    ...even field, 30fps */
4662306a36Sopenharmony_ci#define   VCR_CI_DIBOTH   0x00002000  /*    ...both fields, 60fps */
4762306a36Sopenharmony_ci#define   VCR_CI_DIBOTH30 0x00003000  /*    ...both fields, 30fps interlace */
4862306a36Sopenharmony_ci#define   VCR_CI_CONVTYPE 0x00004000  /* 4:2:2 to 4:4:4; 1 = interpolate */
4962306a36Sopenharmony_ci#define   VCR_CI_CFC	  0x00008000  /* Capture flipping control */
5062306a36Sopenharmony_ci#define   VCR_CI_FILTER   0x00070000  /* Horiz filter mode select
5162306a36Sopenharmony_ci					 000 = none
5262306a36Sopenharmony_ci					 001 = 2 tap
5362306a36Sopenharmony_ci					 010 = 3 tap
5462306a36Sopenharmony_ci					 011 = 4 tap
5562306a36Sopenharmony_ci					 100 = 5 tap */
5662306a36Sopenharmony_ci#define   VCR_CI_CLKINV   0x00080000  /* Input CLK inverted */
5762306a36Sopenharmony_ci#define   VCR_CI_VREFINV  0x00100000  /* VREF inverted */
5862306a36Sopenharmony_ci#define   VCR_CI_HREFINV  0x00200000  /* HREF inverted */
5962306a36Sopenharmony_ci#define   VCR_CI_FLDINV   0x00400000  /* Field inverted */
6062306a36Sopenharmony_ci#define   VCR_CI_CLKPIN	  0x00800000  /* Capture clock pin */
6162306a36Sopenharmony_ci#define   VCR_CI_THRESH   0x0f000000  /* Capture fifo threshold */
6262306a36Sopenharmony_ci#define   VCR_CI_HRLE     0x10000000  /* Positive edge of HREF */
6362306a36Sopenharmony_ci#define   VCR_CI_VRLE     0x20000000  /* Positive edge of VREF */
6462306a36Sopenharmony_ci#define   VCR_CI_OFLDINV  0x40000000  /* Field output inverted */
6562306a36Sopenharmony_ci#define   VCR_CI_CLKEN    0x80000000  /* Capture clock enable */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define VCR_HORRANGE	0x314	/* Active video horizontal range */
6862306a36Sopenharmony_ci#define VCR_VERTRANGE	0x318	/* Active video vertical range */
6962306a36Sopenharmony_ci#define VCR_AVSCALE	0x31c	/* Active video scaling control */
7062306a36Sopenharmony_ci#define   VCR_AVS_HEN	  0x00000800   /* Horizontal scale enable */
7162306a36Sopenharmony_ci#define   VCR_AVS_VEN	  0x04000000   /* Vertical enable */
7262306a36Sopenharmony_ci#define VCR_VBIHOR	0x320	/* VBI Data horizontal range */
7362306a36Sopenharmony_ci#define VCR_VBIVERT	0x324	/* VBI data vertical range */
7462306a36Sopenharmony_ci#define VCR_VBIBUF1	0x328	/* First VBI buffer */
7562306a36Sopenharmony_ci#define VCR_VBISTRIDE	0x32c	/* VBI stride */
7662306a36Sopenharmony_ci#define VCR_ANCDATACNT	0x330	/* Ancillary data count setting */
7762306a36Sopenharmony_ci#define VCR_MAXDATA	0x334	/* Active data count of active video */
7862306a36Sopenharmony_ci#define VCR_MAXVBI	0x338	/* Maximum data count of VBI */
7962306a36Sopenharmony_ci#define VCR_CAPDATA	0x33c	/* Capture data count */
8062306a36Sopenharmony_ci#define VCR_VBUF1	0x340	/* First video buffer */
8162306a36Sopenharmony_ci#define VCR_VBUF2	0x344	/* Second video buffer */
8262306a36Sopenharmony_ci#define VCR_VBUF3	0x348	/* Third video buffer */
8362306a36Sopenharmony_ci#define VCR_VBUF_MASK	0x1ffffff0	/* Bits 28:4 */
8462306a36Sopenharmony_ci#define VCR_VBIBUF2	0x34c	/* Second VBI buffer */
8562306a36Sopenharmony_ci#define VCR_VSTRIDE	0x350	/* Stride of video + coring control */
8662306a36Sopenharmony_ci#define   VCR_VS_STRIDE_SHIFT 4
8762306a36Sopenharmony_ci#define   VCR_VS_STRIDE   0x00001ff0  /* Stride (8-byte units) */
8862306a36Sopenharmony_ci#define   VCR_VS_CCD	  0x007f0000  /* Coring compare data */
8962306a36Sopenharmony_ci#define   VCR_VS_COREEN   0x00800000  /* Coring enable */
9062306a36Sopenharmony_ci#define VCR_TS0ERR	0x354	/* TS buffer 0 error indicator */
9162306a36Sopenharmony_ci#define VCR_TS1ERR	0x358	/* TS buffer 0 error indicator */
9262306a36Sopenharmony_ci#define VCR_TS2ERR	0x35c	/* TS buffer 0 error indicator */
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/* Add 0x1000 for the second capture engine registers */
95