18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * ADV7393 encoder related structure and register definitions 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2010-2012 ADVANSEE - http://www.advansee.com/ 58c2ecf20Sopenharmony_ci * Benoît Thébaudeau <benoit.thebaudeau@advansee.com> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Based on ADV7343 driver, 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 128c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License as 138c2ecf20Sopenharmony_ci * published by the Free Software Foundation version 2. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * This program is distributed .as is. WITHOUT ANY WARRANTY of any 168c2ecf20Sopenharmony_ci * kind, whether express or implied; without even the implied warranty 178c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 188c2ecf20Sopenharmony_ci * GNU General Public License for more details. 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#ifndef ADV7393_REGS_H 228c2ecf20Sopenharmony_ci#define ADV7393_REGS_H 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistruct adv7393_std_info { 258c2ecf20Sopenharmony_ci u32 standard_val3; 268c2ecf20Sopenharmony_ci u32 fsc_val; 278c2ecf20Sopenharmony_ci v4l2_std_id stdid; 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* Register offset macros */ 318c2ecf20Sopenharmony_ci#define ADV7393_POWER_MODE_REG (0x00) 328c2ecf20Sopenharmony_ci#define ADV7393_MODE_SELECT_REG (0x01) 338c2ecf20Sopenharmony_ci#define ADV7393_MODE_REG0 (0x02) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define ADV7393_DAC123_OUTPUT_LEVEL (0x0B) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define ADV7393_SOFT_RESET (0x17) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG1 (0x30) 408c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG2 (0x31) 418c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG3 (0x32) 428c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG4 (0x33) 438c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG5 (0x34) 448c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG6 (0x35) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG7 (0x39) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG1 (0x80) 498c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG2 (0x82) 508c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG3 (0x83) 518c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG4 (0x84) 528c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG5 (0x86) 538c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG6 (0x87) 548c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG7 (0x88) 558c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG8 (0x89) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define ADV7393_SD_TIMING_REG0 (0x8A) 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define ADV7393_FSC_REG0 (0x8C) 608c2ecf20Sopenharmony_ci#define ADV7393_FSC_REG1 (0x8D) 618c2ecf20Sopenharmony_ci#define ADV7393_FSC_REG2 (0x8E) 628c2ecf20Sopenharmony_ci#define ADV7393_FSC_REG3 (0x8F) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define ADV7393_SD_CGMS_WSS0 (0x99) 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define ADV7393_SD_HUE_ADJUST (0xA0) 678c2ecf20Sopenharmony_ci#define ADV7393_SD_BRIGHTNESS_WSS (0xA1) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* Default values for the registers */ 708c2ecf20Sopenharmony_ci#define ADV7393_POWER_MODE_REG_DEFAULT (0x10) 718c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG1_DEFAULT (0x3C) /* Changed Default 728c2ecf20Sopenharmony_ci 720p EAV/SAV code*/ 738c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG2_DEFAULT (0x01) /* Changed Pixel data 748c2ecf20Sopenharmony_ci valid */ 758c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG3_DEFAULT (0x00) /* Color delay 0 clks */ 768c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG4_DEFAULT (0xEC) /* Changed */ 778c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG5_DEFAULT (0x08) 788c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG6_DEFAULT (0x00) 798c2ecf20Sopenharmony_ci#define ADV7393_HD_MODE_REG7_DEFAULT (0x00) 808c2ecf20Sopenharmony_ci#define ADV7393_SOFT_RESET_DEFAULT (0x02) 818c2ecf20Sopenharmony_ci#define ADV7393_COMPOSITE_POWER_VALUE (0x10) 828c2ecf20Sopenharmony_ci#define ADV7393_COMPONENT_POWER_VALUE (0x1C) 838c2ecf20Sopenharmony_ci#define ADV7393_SVIDEO_POWER_VALUE (0x0C) 848c2ecf20Sopenharmony_ci#define ADV7393_SD_HUE_ADJUST_DEFAULT (0x80) 858c2ecf20Sopenharmony_ci#define ADV7393_SD_BRIGHTNESS_WSS_DEFAULT (0x00) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define ADV7393_SD_CGMS_WSS0_DEFAULT (0x10) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG1_DEFAULT (0x10) 908c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG2_DEFAULT (0xC9) 918c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG3_DEFAULT (0x00) 928c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG4_DEFAULT (0x00) 938c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG5_DEFAULT (0x02) 948c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG6_DEFAULT (0x8C) 958c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG7_DEFAULT (0x14) 968c2ecf20Sopenharmony_ci#define ADV7393_SD_MODE_REG8_DEFAULT (0x00) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define ADV7393_SD_TIMING_REG0_DEFAULT (0x0C) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* Bit masks for Mode Select Register */ 1018c2ecf20Sopenharmony_ci#define INPUT_MODE_MASK (0x70) 1028c2ecf20Sopenharmony_ci#define SD_INPUT_MODE (0x00) 1038c2ecf20Sopenharmony_ci#define HD_720P_INPUT_MODE (0x10) 1048c2ecf20Sopenharmony_ci#define HD_1080I_INPUT_MODE (0x10) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* Bit masks for Mode Register 0 */ 1078c2ecf20Sopenharmony_ci#define TEST_PATTERN_BLACK_BAR_EN (0x04) 1088c2ecf20Sopenharmony_ci#define YUV_OUTPUT_SELECT (0x20) 1098c2ecf20Sopenharmony_ci#define RGB_OUTPUT_SELECT (0xDF) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* Bit masks for SD brightness/WSS */ 1128c2ecf20Sopenharmony_ci#define SD_BRIGHTNESS_VALUE_MASK (0x7F) 1138c2ecf20Sopenharmony_ci#define SD_BLANK_WSS_DATA_MASK (0x80) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* Bit masks for soft reset register */ 1168c2ecf20Sopenharmony_ci#define SOFT_RESET (0x02) 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* Bit masks for HD Mode Register 1 */ 1198c2ecf20Sopenharmony_ci#define OUTPUT_STD_MASK (0x03) 1208c2ecf20Sopenharmony_ci#define OUTPUT_STD_SHIFT (0) 1218c2ecf20Sopenharmony_ci#define OUTPUT_STD_EIA0_2 (0x00) 1228c2ecf20Sopenharmony_ci#define OUTPUT_STD_EIA0_1 (0x01) 1238c2ecf20Sopenharmony_ci#define OUTPUT_STD_FULL (0x02) 1248c2ecf20Sopenharmony_ci#define EMBEDDED_SYNC (0x04) 1258c2ecf20Sopenharmony_ci#define EXTERNAL_SYNC (0xFB) 1268c2ecf20Sopenharmony_ci#define STD_MODE_MASK (0x1F) 1278c2ecf20Sopenharmony_ci#define STD_MODE_SHIFT (3) 1288c2ecf20Sopenharmony_ci#define STD_MODE_720P (0x05) 1298c2ecf20Sopenharmony_ci#define STD_MODE_720P_25 (0x08) 1308c2ecf20Sopenharmony_ci#define STD_MODE_720P_30 (0x07) 1318c2ecf20Sopenharmony_ci#define STD_MODE_720P_50 (0x06) 1328c2ecf20Sopenharmony_ci#define STD_MODE_1080I (0x0D) 1338c2ecf20Sopenharmony_ci#define STD_MODE_1080I_25 (0x0E) 1348c2ecf20Sopenharmony_ci#define STD_MODE_1080P_24 (0x11) 1358c2ecf20Sopenharmony_ci#define STD_MODE_1080P_25 (0x10) 1368c2ecf20Sopenharmony_ci#define STD_MODE_1080P_30 (0x0F) 1378c2ecf20Sopenharmony_ci#define STD_MODE_525P (0x00) 1388c2ecf20Sopenharmony_ci#define STD_MODE_625P (0x03) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/* Bit masks for SD Mode Register 1 */ 1418c2ecf20Sopenharmony_ci#define SD_STD_MASK (0x03) 1428c2ecf20Sopenharmony_ci#define SD_STD_NTSC (0x00) 1438c2ecf20Sopenharmony_ci#define SD_STD_PAL_BDGHI (0x01) 1448c2ecf20Sopenharmony_ci#define SD_STD_PAL_M (0x02) 1458c2ecf20Sopenharmony_ci#define SD_STD_PAL_N (0x03) 1468c2ecf20Sopenharmony_ci#define SD_LUMA_FLTR_MASK (0x07) 1478c2ecf20Sopenharmony_ci#define SD_LUMA_FLTR_SHIFT (2) 1488c2ecf20Sopenharmony_ci#define SD_CHROMA_FLTR_MASK (0x07) 1498c2ecf20Sopenharmony_ci#define SD_CHROMA_FLTR_SHIFT (5) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci/* Bit masks for SD Mode Register 2 */ 1528c2ecf20Sopenharmony_ci#define SD_PRPB_SSAF_EN (0x01) 1538c2ecf20Sopenharmony_ci#define SD_PRPB_SSAF_DI (0xFE) 1548c2ecf20Sopenharmony_ci#define SD_DAC_OUT1_EN (0x02) 1558c2ecf20Sopenharmony_ci#define SD_DAC_OUT1_DI (0xFD) 1568c2ecf20Sopenharmony_ci#define SD_PEDESTAL_EN (0x08) 1578c2ecf20Sopenharmony_ci#define SD_PEDESTAL_DI (0xF7) 1588c2ecf20Sopenharmony_ci#define SD_SQUARE_PIXEL_EN (0x10) 1598c2ecf20Sopenharmony_ci#define SD_SQUARE_PIXEL_DI (0xEF) 1608c2ecf20Sopenharmony_ci#define SD_PIXEL_DATA_VALID (0x40) 1618c2ecf20Sopenharmony_ci#define SD_ACTIVE_EDGE_EN (0x80) 1628c2ecf20Sopenharmony_ci#define SD_ACTIVE_EDGE_DI (0x7F) 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* Bit masks for HD Mode Register 6 */ 1658c2ecf20Sopenharmony_ci#define HD_PRPB_SYNC_EN (0x04) 1668c2ecf20Sopenharmony_ci#define HD_PRPB_SYNC_DI (0xFB) 1678c2ecf20Sopenharmony_ci#define HD_DAC_SWAP_EN (0x08) 1688c2ecf20Sopenharmony_ci#define HD_DAC_SWAP_DI (0xF7) 1698c2ecf20Sopenharmony_ci#define HD_GAMMA_CURVE_A (0xEF) 1708c2ecf20Sopenharmony_ci#define HD_GAMMA_CURVE_B (0x10) 1718c2ecf20Sopenharmony_ci#define HD_GAMMA_EN (0x20) 1728c2ecf20Sopenharmony_ci#define HD_GAMMA_DI (0xDF) 1738c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_MODEA (0xBF) 1748c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_MODEB (0x40) 1758c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_EN (0x80) 1768c2ecf20Sopenharmony_ci#define HD_ADPT_FLTR_DI (0x7F) 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci#define ADV7393_BRIGHTNESS_MAX (63) 1798c2ecf20Sopenharmony_ci#define ADV7393_BRIGHTNESS_MIN (-64) 1808c2ecf20Sopenharmony_ci#define ADV7393_BRIGHTNESS_DEF (0) 1818c2ecf20Sopenharmony_ci#define ADV7393_HUE_MAX (127) 1828c2ecf20Sopenharmony_ci#define ADV7393_HUE_MIN (-128) 1838c2ecf20Sopenharmony_ci#define ADV7393_HUE_DEF (0) 1848c2ecf20Sopenharmony_ci#define ADV7393_GAIN_MAX (64) 1858c2ecf20Sopenharmony_ci#define ADV7393_GAIN_MIN (-64) 1868c2ecf20Sopenharmony_ci#define ADV7393_GAIN_DEF (0) 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#endif 189