18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * drivers/media/i2c/tvp514x_regs.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2008 Texas Instruments Inc
68c2ecf20Sopenharmony_ci * Author: Vaibhav Hiremath <hvaibhav@ti.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Contributors:
98c2ecf20Sopenharmony_ci *     Sivaraj R <sivaraj@ti.com>
108c2ecf20Sopenharmony_ci *     Brijesh R Jadav <brijesh.j@ti.com>
118c2ecf20Sopenharmony_ci *     Hardik Shah <hardik.shah@ti.com>
128c2ecf20Sopenharmony_ci *     Manjunath Hadli <mrh@ti.com>
138c2ecf20Sopenharmony_ci *     Karicheri Muralidharan <m-karicheri2@ti.com>
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef _TVP514X_REGS_H
178c2ecf20Sopenharmony_ci#define _TVP514X_REGS_H
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * TVP5146/47 registers
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#define REG_INPUT_SEL			(0x00)
238c2ecf20Sopenharmony_ci#define REG_AFE_GAIN_CTRL		(0x01)
248c2ecf20Sopenharmony_ci#define REG_VIDEO_STD			(0x02)
258c2ecf20Sopenharmony_ci#define REG_OPERATION_MODE		(0x03)
268c2ecf20Sopenharmony_ci#define REG_AUTOSWITCH_MASK		(0x04)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define REG_COLOR_KILLER		(0x05)
298c2ecf20Sopenharmony_ci#define REG_LUMA_CONTROL1		(0x06)
308c2ecf20Sopenharmony_ci#define REG_LUMA_CONTROL2		(0x07)
318c2ecf20Sopenharmony_ci#define REG_LUMA_CONTROL3		(0x08)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define REG_BRIGHTNESS			(0x09)
348c2ecf20Sopenharmony_ci#define REG_CONTRAST			(0x0A)
358c2ecf20Sopenharmony_ci#define REG_SATURATION			(0x0B)
368c2ecf20Sopenharmony_ci#define REG_HUE				(0x0C)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define REG_CHROMA_CONTROL1		(0x0D)
398c2ecf20Sopenharmony_ci#define REG_CHROMA_CONTROL2		(0x0E)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* 0x0F Reserved */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define REG_COMP_PR_SATURATION		(0x10)
448c2ecf20Sopenharmony_ci#define REG_COMP_Y_CONTRAST		(0x11)
458c2ecf20Sopenharmony_ci#define REG_COMP_PB_SATURATION		(0x12)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* 0x13 Reserved */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define REG_COMP_Y_BRIGHTNESS		(0x14)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* 0x15 Reserved */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define REG_AVID_START_PIXEL_LSB	(0x16)
548c2ecf20Sopenharmony_ci#define REG_AVID_START_PIXEL_MSB	(0x17)
558c2ecf20Sopenharmony_ci#define REG_AVID_STOP_PIXEL_LSB		(0x18)
568c2ecf20Sopenharmony_ci#define REG_AVID_STOP_PIXEL_MSB		(0x19)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define REG_HSYNC_START_PIXEL_LSB	(0x1A)
598c2ecf20Sopenharmony_ci#define REG_HSYNC_START_PIXEL_MSB	(0x1B)
608c2ecf20Sopenharmony_ci#define REG_HSYNC_STOP_PIXEL_LSB	(0x1C)
618c2ecf20Sopenharmony_ci#define REG_HSYNC_STOP_PIXEL_MSB	(0x1D)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define REG_VSYNC_START_LINE_LSB	(0x1E)
648c2ecf20Sopenharmony_ci#define REG_VSYNC_START_LINE_MSB	(0x1F)
658c2ecf20Sopenharmony_ci#define REG_VSYNC_STOP_LINE_LSB		(0x20)
668c2ecf20Sopenharmony_ci#define REG_VSYNC_STOP_LINE_MSB		(0x21)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define REG_VBLK_START_LINE_LSB		(0x22)
698c2ecf20Sopenharmony_ci#define REG_VBLK_START_LINE_MSB		(0x23)
708c2ecf20Sopenharmony_ci#define REG_VBLK_STOP_LINE_LSB		(0x24)
718c2ecf20Sopenharmony_ci#define REG_VBLK_STOP_LINE_MSB		(0x25)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* 0x26 - 0x27 Reserved */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define REG_FAST_SWTICH_CONTROL		(0x28)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* 0x29 Reserved */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define REG_FAST_SWTICH_SCART_DELAY	(0x2A)
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* 0x2B Reserved */
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define REG_SCART_DELAY			(0x2C)
848c2ecf20Sopenharmony_ci#define REG_CTI_DELAY			(0x2D)
858c2ecf20Sopenharmony_ci#define REG_CTI_CONTROL			(0x2E)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* 0x2F - 0x31 Reserved */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define REG_SYNC_CONTROL		(0x32)
908c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER1		(0x33)
918c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER2		(0x34)
928c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER3		(0x35)
938c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER4		(0x36)
948c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER5		(0x37)
958c2ecf20Sopenharmony_ci#define REG_OUTPUT_FORMATTER6		(0x38)
968c2ecf20Sopenharmony_ci#define REG_CLEAR_LOST_LOCK		(0x39)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define REG_STATUS1			(0x3A)
998c2ecf20Sopenharmony_ci#define REG_STATUS2			(0x3B)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define REG_AGC_GAIN_STATUS_LSB		(0x3C)
1028c2ecf20Sopenharmony_ci#define REG_AGC_GAIN_STATUS_MSB		(0x3D)
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* 0x3E Reserved */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define REG_VIDEO_STD_STATUS		(0x3F)
1078c2ecf20Sopenharmony_ci#define REG_GPIO_INPUT1			(0x40)
1088c2ecf20Sopenharmony_ci#define REG_GPIO_INPUT2			(0x41)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* 0x42 - 0x45 Reserved */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define REG_AFE_COARSE_GAIN_CH1		(0x46)
1138c2ecf20Sopenharmony_ci#define REG_AFE_COARSE_GAIN_CH2		(0x47)
1148c2ecf20Sopenharmony_ci#define REG_AFE_COARSE_GAIN_CH3		(0x48)
1158c2ecf20Sopenharmony_ci#define REG_AFE_COARSE_GAIN_CH4		(0x49)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_PB_B_LSB	(0x4A)
1188c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_PB_B_MSB	(0x4B)
1198c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_Y_G_CHROMA_LSB	(0x4C)
1208c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_Y_G_CHROMA_MSB	(0x4D)
1218c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_PR_R_LSB	(0x4E)
1228c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_PR_R_MSB	(0x4F)
1238c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_CVBS_LUMA_LSB	(0x50)
1248c2ecf20Sopenharmony_ci#define REG_AFE_FINE_GAIN_CVBS_LUMA_MSB	(0x51)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* 0x52 - 0x68 Reserved */
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#define REG_FBIT_VBIT_CONTROL1		(0x69)
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/* 0x6A - 0x6B Reserved */
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define REG_BACKEND_AGC_CONTROL		(0x6C)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* 0x6D - 0x6E Reserved */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define REG_AGC_DECREMENT_SPEED_CONTROL	(0x6F)
1378c2ecf20Sopenharmony_ci#define REG_ROM_VERSION			(0x70)
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* 0x71 - 0x73 Reserved */
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define REG_AGC_WHITE_PEAK_PROCESSING	(0x74)
1428c2ecf20Sopenharmony_ci#define REG_FBIT_VBIT_CONTROL2		(0x75)
1438c2ecf20Sopenharmony_ci#define REG_VCR_TRICK_MODE_CONTROL	(0x76)
1448c2ecf20Sopenharmony_ci#define REG_HORIZONTAL_SHAKE_INCREMENT	(0x77)
1458c2ecf20Sopenharmony_ci#define REG_AGC_INCREMENT_SPEED		(0x78)
1468c2ecf20Sopenharmony_ci#define REG_AGC_INCREMENT_DELAY		(0x79)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* 0x7A - 0x7F Reserved */
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define REG_CHIP_ID_MSB			(0x80)
1518c2ecf20Sopenharmony_ci#define REG_CHIP_ID_LSB			(0x81)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/* 0x82 Reserved */
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define REG_CPLL_SPEED_CONTROL		(0x83)
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* 0x84 - 0x96 Reserved */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define REG_STATUS_REQUEST		(0x97)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* 0x98 - 0x99 Reserved */
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define REG_VERTICAL_LINE_COUNT_LSB	(0x9A)
1648c2ecf20Sopenharmony_ci#define REG_VERTICAL_LINE_COUNT_MSB	(0x9B)
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* 0x9C - 0x9D Reserved */
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define REG_AGC_DECREMENT_DELAY		(0x9E)
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci/* 0x9F - 0xB0 Reserved */
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_1_MASK1	(0xB1)
1738c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_1_MASK2	(0xB2)
1748c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_1_MASK3	(0xB3)
1758c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_1_MASK4	(0xB4)
1768c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_1_MASK5	(0xB5)
1778c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_2_MASK1	(0xB6)
1788c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_2_MASK2	(0xB7)
1798c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_2_MASK3	(0xB8)
1808c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_2_MASK4	(0xB9)
1818c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_2_MASK5	(0xBA)
1828c2ecf20Sopenharmony_ci#define REG_VDP_TTX_FILTER_CONTROL	(0xBB)
1838c2ecf20Sopenharmony_ci#define REG_VDP_FIFO_WORD_COUNT		(0xBC)
1848c2ecf20Sopenharmony_ci#define REG_VDP_FIFO_INTERRUPT_THRLD	(0xBD)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* 0xBE Reserved */
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci#define REG_VDP_FIFO_RESET		(0xBF)
1898c2ecf20Sopenharmony_ci#define REG_VDP_FIFO_OUTPUT_CONTROL	(0xC0)
1908c2ecf20Sopenharmony_ci#define REG_VDP_LINE_NUMBER_INTERRUPT	(0xC1)
1918c2ecf20Sopenharmony_ci#define REG_VDP_PIXEL_ALIGNMENT_LSB	(0xC2)
1928c2ecf20Sopenharmony_ci#define REG_VDP_PIXEL_ALIGNMENT_MSB	(0xC3)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* 0xC4 - 0xD5 Reserved */
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define REG_VDP_LINE_START		(0xD6)
1978c2ecf20Sopenharmony_ci#define REG_VDP_LINE_STOP		(0xD7)
1988c2ecf20Sopenharmony_ci#define REG_VDP_GLOBAL_LINE_MODE	(0xD8)
1998c2ecf20Sopenharmony_ci#define REG_VDP_FULL_FIELD_ENABLE	(0xD9)
2008c2ecf20Sopenharmony_ci#define REG_VDP_FULL_FIELD_MODE		(0xDA)
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci/* 0xDB - 0xDF Reserved */
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define REG_VBUS_DATA_ACCESS_NO_VBUS_ADDR_INCR	(0xE0)
2058c2ecf20Sopenharmony_ci#define REG_VBUS_DATA_ACCESS_VBUS_ADDR_INCR	(0xE1)
2068c2ecf20Sopenharmony_ci#define REG_FIFO_READ_DATA			(0xE2)
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/* 0xE3 - 0xE7 Reserved */
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci#define REG_VBUS_ADDRESS_ACCESS1	(0xE8)
2118c2ecf20Sopenharmony_ci#define REG_VBUS_ADDRESS_ACCESS2	(0xE9)
2128c2ecf20Sopenharmony_ci#define REG_VBUS_ADDRESS_ACCESS3	(0xEA)
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci/* 0xEB - 0xEF Reserved */
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#define REG_INTERRUPT_RAW_STATUS0	(0xF0)
2178c2ecf20Sopenharmony_ci#define REG_INTERRUPT_RAW_STATUS1	(0xF1)
2188c2ecf20Sopenharmony_ci#define REG_INTERRUPT_STATUS0		(0xF2)
2198c2ecf20Sopenharmony_ci#define REG_INTERRUPT_STATUS1		(0xF3)
2208c2ecf20Sopenharmony_ci#define REG_INTERRUPT_MASK0		(0xF4)
2218c2ecf20Sopenharmony_ci#define REG_INTERRUPT_MASK1		(0xF5)
2228c2ecf20Sopenharmony_ci#define REG_INTERRUPT_CLEAR0		(0xF6)
2238c2ecf20Sopenharmony_ci#define REG_INTERRUPT_CLEAR1		(0xF7)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* 0xF8 - 0xFF Reserved */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/*
2288c2ecf20Sopenharmony_ci * Mask and bit definitions of TVP5146/47 registers
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_ci/* The ID values we are looking for */
2318c2ecf20Sopenharmony_ci#define TVP514X_CHIP_ID_MSB		(0x51)
2328c2ecf20Sopenharmony_ci#define TVP5146_CHIP_ID_LSB		(0x46)
2338c2ecf20Sopenharmony_ci#define TVP5147_CHIP_ID_LSB		(0x47)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define VIDEO_STD_MASK			(0x07)
2368c2ecf20Sopenharmony_ci#define VIDEO_STD_AUTO_SWITCH_BIT	(0x00)
2378c2ecf20Sopenharmony_ci#define VIDEO_STD_NTSC_MJ_BIT		(0x01)
2388c2ecf20Sopenharmony_ci#define VIDEO_STD_PAL_BDGHIN_BIT	(0x02)
2398c2ecf20Sopenharmony_ci#define VIDEO_STD_PAL_M_BIT		(0x03)
2408c2ecf20Sopenharmony_ci#define VIDEO_STD_PAL_COMBINATION_N_BIT	(0x04)
2418c2ecf20Sopenharmony_ci#define VIDEO_STD_NTSC_4_43_BIT		(0x05)
2428c2ecf20Sopenharmony_ci#define VIDEO_STD_SECAM_BIT		(0x06)
2438c2ecf20Sopenharmony_ci#define VIDEO_STD_PAL_60_BIT		(0x07)
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/*
2468c2ecf20Sopenharmony_ci * Status bit
2478c2ecf20Sopenharmony_ci */
2488c2ecf20Sopenharmony_ci#define STATUS_TV_VCR_BIT		(1<<0)
2498c2ecf20Sopenharmony_ci#define STATUS_HORZ_SYNC_LOCK_BIT	(1<<1)
2508c2ecf20Sopenharmony_ci#define STATUS_VIRT_SYNC_LOCK_BIT	(1<<2)
2518c2ecf20Sopenharmony_ci#define STATUS_CLR_SUBCAR_LOCK_BIT	(1<<3)
2528c2ecf20Sopenharmony_ci#define STATUS_LOST_LOCK_DETECT_BIT	(1<<4)
2538c2ecf20Sopenharmony_ci#define STATUS_FEILD_RATE_BIT		(1<<5)
2548c2ecf20Sopenharmony_ci#define STATUS_LINE_ALTERNATING_BIT	(1<<6)
2558c2ecf20Sopenharmony_ci#define STATUS_PEAK_WHITE_DETECT_BIT	(1<<7)
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci/* Tokens for register write */
2588c2ecf20Sopenharmony_ci#define TOK_WRITE                       (0)     /* token for write operation */
2598c2ecf20Sopenharmony_ci#define TOK_TERM                        (1)     /* terminating token */
2608c2ecf20Sopenharmony_ci#define TOK_DELAY                       (2)     /* delay token for reg list */
2618c2ecf20Sopenharmony_ci#define TOK_SKIP                        (3)     /* token to skip a register */
2628c2ecf20Sopenharmony_ci/**
2638c2ecf20Sopenharmony_ci * struct tvp514x_reg - Structure for TVP5146/47 register initialization values
2648c2ecf20Sopenharmony_ci * @token - Token: TOK_WRITE, TOK_TERM etc..
2658c2ecf20Sopenharmony_ci * @reg - Register offset
2668c2ecf20Sopenharmony_ci * @val - Register Value for TOK_WRITE or delay in ms for TOK_DELAY
2678c2ecf20Sopenharmony_ci */
2688c2ecf20Sopenharmony_cistruct tvp514x_reg {
2698c2ecf20Sopenharmony_ci	u8 token;
2708c2ecf20Sopenharmony_ci	u8 reg;
2718c2ecf20Sopenharmony_ci	u32 val;
2728c2ecf20Sopenharmony_ci};
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci#endif				/* ifndef _TVP514X_REGS_H */
275