18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * ADV7343 encoder related structure and register definitions
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or
78c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License as
88c2ecf20Sopenharmony_ci * published by the Free Software Foundation version 2.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * This program is distributed .as is. WITHOUT ANY WARRANTY of any
118c2ecf20Sopenharmony_ci * kind, whether express or implied; without even the implied warranty
128c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
138c2ecf20Sopenharmony_ci * GNU General Public License for more details.
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef ADV7343_REGS_H
178c2ecf20Sopenharmony_ci#define ADV7343_REGS_H
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct adv7343_std_info {
208c2ecf20Sopenharmony_ci	u32 standard_val3;
218c2ecf20Sopenharmony_ci	u32 fsc_val;
228c2ecf20Sopenharmony_ci	v4l2_std_id stdid;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Register offset macros */
268c2ecf20Sopenharmony_ci#define ADV7343_POWER_MODE_REG		(0x00)
278c2ecf20Sopenharmony_ci#define ADV7343_MODE_SELECT_REG		(0x01)
288c2ecf20Sopenharmony_ci#define ADV7343_MODE_REG0		(0x02)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define ADV7343_DAC2_OUTPUT_LEVEL	(0x0b)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define ADV7343_SOFT_RESET		(0x17)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG1		(0x30)
358c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG2		(0x31)
368c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG3		(0x32)
378c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG4		(0x33)
388c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG5		(0x34)
398c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG6		(0x35)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG7		(0x39)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG1		(0x80)
448c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG2		(0x82)
458c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG3		(0x83)
468c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG4		(0x84)
478c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG5		(0x86)
488c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG6		(0x87)
498c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG7		(0x88)
508c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG8		(0x89)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define ADV7343_FSC_REG0		(0x8C)
538c2ecf20Sopenharmony_ci#define ADV7343_FSC_REG1		(0x8D)
548c2ecf20Sopenharmony_ci#define ADV7343_FSC_REG2		(0x8E)
558c2ecf20Sopenharmony_ci#define ADV7343_FSC_REG3		(0x8F)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define ADV7343_SD_CGMS_WSS0		(0x99)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define ADV7343_SD_HUE_REG		(0xA0)
608c2ecf20Sopenharmony_ci#define ADV7343_SD_BRIGHTNESS_WSS	(0xA1)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* Default values for the registers */
638c2ecf20Sopenharmony_ci#define ADV7343_POWER_MODE_REG_DEFAULT		(0x10)
648c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG1_DEFAULT		(0x3C)	/* Changed Default
658c2ecf20Sopenharmony_ci							   720p EAVSAV code*/
668c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG2_DEFAULT		(0x01)	/* Changed Pixel data
678c2ecf20Sopenharmony_ci							   valid */
688c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG3_DEFAULT		(0x00)	/* Color delay 0 clks */
698c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG4_DEFAULT		(0xE8)	/* Changed */
708c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG5_DEFAULT		(0x08)
718c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG6_DEFAULT		(0x00)
728c2ecf20Sopenharmony_ci#define ADV7343_HD_MODE_REG7_DEFAULT		(0x00)
738c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG8_DEFAULT		(0x00)
748c2ecf20Sopenharmony_ci#define ADV7343_SOFT_RESET_DEFAULT		(0x02)
758c2ecf20Sopenharmony_ci#define ADV7343_COMPOSITE_POWER_VALUE		(0x80)
768c2ecf20Sopenharmony_ci#define ADV7343_COMPONENT_POWER_VALUE		(0x1C)
778c2ecf20Sopenharmony_ci#define ADV7343_SVIDEO_POWER_VALUE		(0x60)
788c2ecf20Sopenharmony_ci#define ADV7343_SD_HUE_REG_DEFAULT		(127)
798c2ecf20Sopenharmony_ci#define ADV7343_SD_BRIGHTNESS_WSS_DEFAULT	(0x03)
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define ADV7343_SD_CGMS_WSS0_DEFAULT		(0x10)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG1_DEFAULT		(0x00)
848c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG2_DEFAULT		(0xC9)
858c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG3_DEFAULT		(0x10)
868c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG4_DEFAULT		(0x01)
878c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG5_DEFAULT		(0x02)
888c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG6_DEFAULT		(0x0C)
898c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG7_DEFAULT		(0x04)
908c2ecf20Sopenharmony_ci#define ADV7343_SD_MODE_REG8_DEFAULT		(0x00)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* Bit masks for Mode Select Register */
938c2ecf20Sopenharmony_ci#define INPUT_MODE_MASK			(0x70)
948c2ecf20Sopenharmony_ci#define SD_INPUT_MODE			(0x00)
958c2ecf20Sopenharmony_ci#define HD_720P_INPUT_MODE		(0x10)
968c2ecf20Sopenharmony_ci#define HD_1080I_INPUT_MODE		(0x10)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Bit masks for Mode Register 0 */
998c2ecf20Sopenharmony_ci#define TEST_PATTERN_BLACK_BAR_EN	(0x04)
1008c2ecf20Sopenharmony_ci#define YUV_OUTPUT_SELECT		(0x20)
1018c2ecf20Sopenharmony_ci#define RGB_OUTPUT_SELECT		(0xDF)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* Bit masks for DAC output levels */
1048c2ecf20Sopenharmony_ci#define DAC_OUTPUT_LEVEL_MASK		(0xFF)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* Bit masks for soft reset register */
1078c2ecf20Sopenharmony_ci#define SOFT_RESET			(0x02)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* Bit masks for HD Mode Register 1 */
1108c2ecf20Sopenharmony_ci#define OUTPUT_STD_MASK		(0x03)
1118c2ecf20Sopenharmony_ci#define OUTPUT_STD_SHIFT	(0)
1128c2ecf20Sopenharmony_ci#define OUTPUT_STD_EIA0_2	(0x00)
1138c2ecf20Sopenharmony_ci#define OUTPUT_STD_EIA0_1	(0x01)
1148c2ecf20Sopenharmony_ci#define OUTPUT_STD_FULL		(0x02)
1158c2ecf20Sopenharmony_ci#define EMBEDDED_SYNC		(0x04)
1168c2ecf20Sopenharmony_ci#define EXTERNAL_SYNC		(0xFB)
1178c2ecf20Sopenharmony_ci#define STD_MODE_SHIFT		(3)
1188c2ecf20Sopenharmony_ci#define STD_MODE_MASK		(0x1F)
1198c2ecf20Sopenharmony_ci#define STD_MODE_720P		(0x05)
1208c2ecf20Sopenharmony_ci#define STD_MODE_720P_25	(0x08)
1218c2ecf20Sopenharmony_ci#define STD_MODE_720P_30	(0x07)
1228c2ecf20Sopenharmony_ci#define STD_MODE_720P_50	(0x06)
1238c2ecf20Sopenharmony_ci#define STD_MODE_1080I		(0x0D)
1248c2ecf20Sopenharmony_ci#define STD_MODE_1080I_25fps	(0x0E)
1258c2ecf20Sopenharmony_ci#define STD_MODE_1080P_24	(0x12)
1268c2ecf20Sopenharmony_ci#define STD_MODE_1080P_25	(0x10)
1278c2ecf20Sopenharmony_ci#define STD_MODE_1080P_30	(0x0F)
1288c2ecf20Sopenharmony_ci#define STD_MODE_525P		(0x00)
1298c2ecf20Sopenharmony_ci#define STD_MODE_625P		(0x03)
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* Bit masks for SD Mode Register 1 */
1328c2ecf20Sopenharmony_ci#define SD_STD_MASK		(0x03)
1338c2ecf20Sopenharmony_ci#define SD_STD_NTSC		(0x00)
1348c2ecf20Sopenharmony_ci#define SD_STD_PAL_BDGHI	(0x01)
1358c2ecf20Sopenharmony_ci#define SD_STD_PAL_M		(0x02)
1368c2ecf20Sopenharmony_ci#define SD_STD_PAL_N		(0x03)
1378c2ecf20Sopenharmony_ci#define SD_LUMA_FLTR_MASK	(0x7)
1388c2ecf20Sopenharmony_ci#define SD_LUMA_FLTR_SHIFT	(0x2)
1398c2ecf20Sopenharmony_ci#define SD_CHROMA_FLTR_MASK	(0x7)
1408c2ecf20Sopenharmony_ci#define SD_CHROMA_FLTR_SHIFT	(0x5)
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* Bit masks for SD Mode Register 2 */
1438c2ecf20Sopenharmony_ci#define SD_PBPR_SSAF_EN		(0x01)
1448c2ecf20Sopenharmony_ci#define SD_PBPR_SSAF_DI		(0xFE)
1458c2ecf20Sopenharmony_ci#define SD_DAC_1_DI		(0xFD)
1468c2ecf20Sopenharmony_ci#define SD_DAC_2_DI		(0xFB)
1478c2ecf20Sopenharmony_ci#define SD_PEDESTAL_EN		(0x08)
1488c2ecf20Sopenharmony_ci#define SD_PEDESTAL_DI		(0xF7)
1498c2ecf20Sopenharmony_ci#define SD_SQUARE_PIXEL_EN	(0x10)
1508c2ecf20Sopenharmony_ci#define SD_SQUARE_PIXEL_DI	(0xEF)
1518c2ecf20Sopenharmony_ci#define SD_PIXEL_DATA_VALID	(0x40)
1528c2ecf20Sopenharmony_ci#define SD_ACTIVE_EDGE_EN	(0x80)
1538c2ecf20Sopenharmony_ci#define SD_ACTIVE_EDGE_DI	(0x7F)
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci/* Bit masks for HD Mode Register 6 */
1568c2ecf20Sopenharmony_ci#define HD_RGB_INPUT_EN		(0x02)
1578c2ecf20Sopenharmony_ci#define HD_RGB_INPUT_DI		(0xFD)
1588c2ecf20Sopenharmony_ci#define HD_PBPR_SYNC_EN		(0x04)
1598c2ecf20Sopenharmony_ci#define HD_PBPR_SYNC_DI		(0xFB)
1608c2ecf20Sopenharmony_ci#define HD_DAC_SWAP_EN		(0x08)
1618c2ecf20Sopenharmony_ci#define HD_DAC_SWAP_DI		(0xF7)
1628c2ecf20Sopenharmony_ci#define HD_GAMMA_CURVE_A	(0xEF)
1638c2ecf20Sopenharmony_ci#define HD_GAMMA_CURVE_B	(0x10)
1648c2ecf20Sopenharmony_ci#define HD_GAMMA_EN		(0x20)
1658c2ecf20Sopenharmony_ci#define HD_GAMMA_DI		(0xDF)
1668c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_MODEB	(0x40)
1678c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_MODEA	(0xBF)
1688c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_EN		(0x80)
1698c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_DI		(0x7F)
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci#define ADV7343_BRIGHTNESS_MAX	(127)
1728c2ecf20Sopenharmony_ci#define ADV7343_BRIGHTNESS_MIN	(0)
1738c2ecf20Sopenharmony_ci#define ADV7343_BRIGHTNESS_DEF	(3)
1748c2ecf20Sopenharmony_ci#define ADV7343_HUE_MAX		(255)
1758c2ecf20Sopenharmony_ci#define ADV7343_HUE_MIN		(0)
1768c2ecf20Sopenharmony_ci#define ADV7343_HUE_DEF		(127)
1778c2ecf20Sopenharmony_ci#define ADV7343_GAIN_MAX	(64)
1788c2ecf20Sopenharmony_ci#define ADV7343_GAIN_MIN	(-64)
1798c2ecf20Sopenharmony_ci#define ADV7343_GAIN_DEF	(0)
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci#endif
182