18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  tw68-reg.h - TW68xx register offsets
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Much of this code is derived from the cx88 and sa7134 drivers, which
68c2ecf20Sopenharmony_ci *  were in turn derived from the bt87x driver.  The original work was by
78c2ecf20Sopenharmony_ci *  Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
88c2ecf20Sopenharmony_ci *  Hans Verkuil, Andy Walls and many others.  Their work is gratefully
98c2ecf20Sopenharmony_ci *  acknowledged.  Full credit goes to them - any problems within this code
108c2ecf20Sopenharmony_ci *  are mine.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci *  Copyright (C) William M. Brack
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *  Refactored and updated to the latest v4l core frameworks:
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci *  Copyright (C) 2014 Hans Verkuil <hverkuil@xs4all.nl>
178c2ecf20Sopenharmony_ci*/
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#ifndef _TW68_REG_H_
208c2ecf20Sopenharmony_ci#define _TW68_REG_H_
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* ---------------------------------------------------------------------- */
238c2ecf20Sopenharmony_ci#define	TW68_DMAC		0x000
248c2ecf20Sopenharmony_ci#define	TW68_DMAP_SA		0x004
258c2ecf20Sopenharmony_ci#define	TW68_DMAP_EXE		0x008
268c2ecf20Sopenharmony_ci#define	TW68_DMAP_PP		0x00c
278c2ecf20Sopenharmony_ci#define	TW68_VBIC		0x010
288c2ecf20Sopenharmony_ci#define	TW68_SBUSC		0x014
298c2ecf20Sopenharmony_ci#define	TW68_SBUSSD		0x018
308c2ecf20Sopenharmony_ci#define	TW68_INTSTAT		0x01C
318c2ecf20Sopenharmony_ci#define	TW68_INTMASK		0x020
328c2ecf20Sopenharmony_ci#define	TW68_GPIOC		0x024
338c2ecf20Sopenharmony_ci#define	TW68_GPOE		0x028
348c2ecf20Sopenharmony_ci#define	TW68_TESTREG		0x02C
358c2ecf20Sopenharmony_ci#define	TW68_SBUSRD		0x030
368c2ecf20Sopenharmony_ci#define	TW68_SBUS_TRIG		0x034
378c2ecf20Sopenharmony_ci#define	TW68_CAP_CTL		0x040
388c2ecf20Sopenharmony_ci#define	TW68_SUBSYS		0x054
398c2ecf20Sopenharmony_ci#define	TW68_I2C_RST		0x064
408c2ecf20Sopenharmony_ci#define	TW68_VBIINST		0x06C
418c2ecf20Sopenharmony_ci/* define bits in FIFO and DMAP Control reg */
428c2ecf20Sopenharmony_ci#define	TW68_DMAP_EN		(1 << 0)
438c2ecf20Sopenharmony_ci#define	TW68_FIFO_EN		(1 << 1)
448c2ecf20Sopenharmony_ci/* define the Interrupt Status Register bits */
458c2ecf20Sopenharmony_ci#define	TW68_SBDONE		(1 << 0)
468c2ecf20Sopenharmony_ci#define	TW68_DMAPI		(1 << 1)
478c2ecf20Sopenharmony_ci#define	TW68_GPINT		(1 << 2)
488c2ecf20Sopenharmony_ci#define	TW68_FFOF		(1 << 3)
498c2ecf20Sopenharmony_ci#define	TW68_FDMIS		(1 << 4)
508c2ecf20Sopenharmony_ci#define	TW68_DMAPERR		(1 << 5)
518c2ecf20Sopenharmony_ci#define	TW68_PABORT		(1 << 6)
528c2ecf20Sopenharmony_ci#define	TW68_SBDONE2		(1 << 12)
538c2ecf20Sopenharmony_ci#define	TW68_SBERR2		(1 << 13)
548c2ecf20Sopenharmony_ci#define	TW68_PPERR		(1 << 14)
558c2ecf20Sopenharmony_ci#define	TW68_FFERR		(1 << 15)
568c2ecf20Sopenharmony_ci#define	TW68_DET50		(1 << 16)
578c2ecf20Sopenharmony_ci#define	TW68_FLOCK		(1 << 17)
588c2ecf20Sopenharmony_ci#define	TW68_CCVALID		(1 << 18)
598c2ecf20Sopenharmony_ci#define	TW68_VLOCK		(1 << 19)
608c2ecf20Sopenharmony_ci#define	TW68_FIELD		(1 << 20)
618c2ecf20Sopenharmony_ci#define	TW68_SLOCK		(1 << 21)
628c2ecf20Sopenharmony_ci#define	TW68_HLOCK		(1 << 22)
638c2ecf20Sopenharmony_ci#define	TW68_VDLOSS		(1 << 23)
648c2ecf20Sopenharmony_ci#define	TW68_SBERR		(1 << 24)
658c2ecf20Sopenharmony_ci/* define the i2c control register bits */
668c2ecf20Sopenharmony_ci#define	TW68_SBMODE		(0)
678c2ecf20Sopenharmony_ci#define	TW68_WREN		(1)
688c2ecf20Sopenharmony_ci#define	TW68_SSCLK		(6)
698c2ecf20Sopenharmony_ci#define	TW68_SSDAT		(7)
708c2ecf20Sopenharmony_ci#define	TW68_SBCLK		(8)
718c2ecf20Sopenharmony_ci#define	TW68_WDLEN		(16)
728c2ecf20Sopenharmony_ci#define	TW68_RDLEN		(20)
738c2ecf20Sopenharmony_ci#define	TW68_SBRW		(24)
748c2ecf20Sopenharmony_ci#define	TW68_SBDEV		(25)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define	TW68_SBMODE_B		(1 << TW68_SBMODE)
778c2ecf20Sopenharmony_ci#define	TW68_WREN_B		(1 << TW68_WREN)
788c2ecf20Sopenharmony_ci#define	TW68_SSCLK_B		(1 << TW68_SSCLK)
798c2ecf20Sopenharmony_ci#define	TW68_SSDAT_B		(1 << TW68_SSDAT)
808c2ecf20Sopenharmony_ci#define	TW68_SBRW_B		(1 << TW68_SBRW)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define	TW68_GPDATA		0x100
838c2ecf20Sopenharmony_ci#define	TW68_STATUS1		0x204
848c2ecf20Sopenharmony_ci#define	TW68_INFORM		0x208
858c2ecf20Sopenharmony_ci#define	TW68_OPFORM		0x20C
868c2ecf20Sopenharmony_ci#define	TW68_HSYNC		0x210
878c2ecf20Sopenharmony_ci#define	TW68_ACNTL		0x218
888c2ecf20Sopenharmony_ci#define	TW68_CROP_HI		0x21C
898c2ecf20Sopenharmony_ci#define	TW68_VDELAY_LO		0x220
908c2ecf20Sopenharmony_ci#define	TW68_VACTIVE_LO		0x224
918c2ecf20Sopenharmony_ci#define	TW68_HDELAY_LO		0x228
928c2ecf20Sopenharmony_ci#define	TW68_HACTIVE_LO		0x22C
938c2ecf20Sopenharmony_ci#define	TW68_CNTRL1		0x230
948c2ecf20Sopenharmony_ci#define	TW68_VSCALE_LO		0x234
958c2ecf20Sopenharmony_ci#define	TW68_SCALE_HI		0x238
968c2ecf20Sopenharmony_ci#define	TW68_HSCALE_LO		0x23C
978c2ecf20Sopenharmony_ci#define	TW68_BRIGHT		0x240
988c2ecf20Sopenharmony_ci#define	TW68_CONTRAST		0x244
998c2ecf20Sopenharmony_ci#define	TW68_SHARPNESS		0x248
1008c2ecf20Sopenharmony_ci#define	TW68_SAT_U		0x24C
1018c2ecf20Sopenharmony_ci#define	TW68_SAT_V		0x250
1028c2ecf20Sopenharmony_ci#define	TW68_HUE		0x254
1038c2ecf20Sopenharmony_ci#define	TW68_SHARP2		0x258
1048c2ecf20Sopenharmony_ci#define	TW68_VSHARP		0x25C
1058c2ecf20Sopenharmony_ci#define	TW68_CORING		0x260
1068c2ecf20Sopenharmony_ci#define	TW68_VBICNTL		0x264
1078c2ecf20Sopenharmony_ci#define	TW68_CNTRL2		0x268
1088c2ecf20Sopenharmony_ci#define	TW68_CC_DATA		0x26C
1098c2ecf20Sopenharmony_ci#define	TW68_SDT		0x270
1108c2ecf20Sopenharmony_ci#define	TW68_SDTR		0x274
1118c2ecf20Sopenharmony_ci#define	TW68_RESERV2		0x278
1128c2ecf20Sopenharmony_ci#define	TW68_RESERV3		0x27C
1138c2ecf20Sopenharmony_ci#define	TW68_CLMPG		0x280
1148c2ecf20Sopenharmony_ci#define	TW68_IAGC		0x284
1158c2ecf20Sopenharmony_ci#define	TW68_AGCGAIN		0x288
1168c2ecf20Sopenharmony_ci#define	TW68_PEAKWT		0x28C
1178c2ecf20Sopenharmony_ci#define	TW68_CLMPL		0x290
1188c2ecf20Sopenharmony_ci#define	TW68_SYNCT		0x294
1198c2ecf20Sopenharmony_ci#define	TW68_MISSCNT		0x298
1208c2ecf20Sopenharmony_ci#define	TW68_PCLAMP		0x29C
1218c2ecf20Sopenharmony_ci#define	TW68_VCNTL1		0x2A0
1228c2ecf20Sopenharmony_ci#define	TW68_VCNTL2		0x2A4
1238c2ecf20Sopenharmony_ci#define	TW68_CKILL		0x2A8
1248c2ecf20Sopenharmony_ci#define	TW68_COMB		0x2AC
1258c2ecf20Sopenharmony_ci#define	TW68_LDLY		0x2B0
1268c2ecf20Sopenharmony_ci#define	TW68_MISC1		0x2B4
1278c2ecf20Sopenharmony_ci#define	TW68_LOOP		0x2B8
1288c2ecf20Sopenharmony_ci#define	TW68_MISC2		0x2BC
1298c2ecf20Sopenharmony_ci#define	TW68_MVSN		0x2C0
1308c2ecf20Sopenharmony_ci#define	TW68_STATUS2		0x2C4
1318c2ecf20Sopenharmony_ci#define	TW68_HFREF		0x2C8
1328c2ecf20Sopenharmony_ci#define	TW68_CLMD		0x2CC
1338c2ecf20Sopenharmony_ci#define	TW68_IDCNTL		0x2D0
1348c2ecf20Sopenharmony_ci#define	TW68_CLCNTL1		0x2D4
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* Audio */
1378c2ecf20Sopenharmony_ci#define	TW68_ACKI1		0x300
1388c2ecf20Sopenharmony_ci#define	TW68_ACKI2		0x304
1398c2ecf20Sopenharmony_ci#define	TW68_ACKI3		0x308
1408c2ecf20Sopenharmony_ci#define	TW68_ACKN1		0x30C
1418c2ecf20Sopenharmony_ci#define	TW68_ACKN2		0x310
1428c2ecf20Sopenharmony_ci#define	TW68_ACKN3		0x314
1438c2ecf20Sopenharmony_ci#define	TW68_SDIV		0x318
1448c2ecf20Sopenharmony_ci#define	TW68_LRDIV		0x31C
1458c2ecf20Sopenharmony_ci#define	TW68_ACCNTL		0x320
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci#define	TW68_VSCTL		0x3B8
1488c2ecf20Sopenharmony_ci#define	TW68_CHROMAGVAL		0x3BC
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define	TW68_F2CROP_HI		0x3DC
1518c2ecf20Sopenharmony_ci#define	TW68_F2VDELAY_LO	0x3E0
1528c2ecf20Sopenharmony_ci#define	TW68_F2VACTIVE_LO	0x3E4
1538c2ecf20Sopenharmony_ci#define	TW68_F2HDELAY_LO	0x3E8
1548c2ecf20Sopenharmony_ci#define	TW68_F2HACTIVE_LO	0x3EC
1558c2ecf20Sopenharmony_ci#define	TW68_F2CNT		0x3F0
1568c2ecf20Sopenharmony_ci#define	TW68_F2VSCALE_LO	0x3F4
1578c2ecf20Sopenharmony_ci#define	TW68_F2SCALE_HI		0x3F8
1588c2ecf20Sopenharmony_ci#define	TW68_F2HSCALE_LO	0x3FC
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci#define	RISC_INT_BIT		0x08000000
1618c2ecf20Sopenharmony_ci#define	RISC_SYNCO		0xC0000000
1628c2ecf20Sopenharmony_ci#define	RISC_SYNCE		0xD0000000
1638c2ecf20Sopenharmony_ci#define	RISC_JUMP		0xB0000000
1648c2ecf20Sopenharmony_ci#define	RISC_LINESTART		0x90000000
1658c2ecf20Sopenharmony_ci#define	RISC_INLINE		0xA0000000
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define VideoFormatNTSC		 0
1688c2ecf20Sopenharmony_ci#define VideoFormatNTSCJapan	 0
1698c2ecf20Sopenharmony_ci#define VideoFormatPALBDGHI	 1
1708c2ecf20Sopenharmony_ci#define VideoFormatSECAM	 2
1718c2ecf20Sopenharmony_ci#define VideoFormatNTSC443	 3
1728c2ecf20Sopenharmony_ci#define VideoFormatPALM		 4
1738c2ecf20Sopenharmony_ci#define VideoFormatPALN		 5
1748c2ecf20Sopenharmony_ci#define VideoFormatPALNC	 5
1758c2ecf20Sopenharmony_ci#define VideoFormatPAL60	 6
1768c2ecf20Sopenharmony_ci#define VideoFormatAuto		 7
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define ColorFormatRGB32	 0x00
1798c2ecf20Sopenharmony_ci#define ColorFormatRGB24	 0x10
1808c2ecf20Sopenharmony_ci#define ColorFormatRGB16	 0x20
1818c2ecf20Sopenharmony_ci#define ColorFormatRGB15	 0x30
1828c2ecf20Sopenharmony_ci#define ColorFormatYUY2		 0x40
1838c2ecf20Sopenharmony_ci#define ColorFormatBSWAP         0x04
1848c2ecf20Sopenharmony_ci#define ColorFormatWSWAP         0x08
1858c2ecf20Sopenharmony_ci#define ColorFormatGamma         0x80
1868c2ecf20Sopenharmony_ci#endif
187