162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci saa7115.h - definition for saa7111/3/4/5 inputs and frequency flags 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci*/ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _SAA7115_H_ 1062306a36Sopenharmony_ci#define _SAA7115_H_ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* s_routing inputs, outputs, and config */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* SAA7111/3/4/5 HW inputs */ 1562306a36Sopenharmony_ci#define SAA7115_COMPOSITE0 0 1662306a36Sopenharmony_ci#define SAA7115_COMPOSITE1 1 1762306a36Sopenharmony_ci#define SAA7115_COMPOSITE2 2 1862306a36Sopenharmony_ci#define SAA7115_COMPOSITE3 3 1962306a36Sopenharmony_ci#define SAA7115_COMPOSITE4 4 /* not available for the saa7111/3 */ 2062306a36Sopenharmony_ci#define SAA7115_COMPOSITE5 5 /* not available for the saa7111/3 */ 2162306a36Sopenharmony_ci#define SAA7115_SVIDEO0 6 2262306a36Sopenharmony_ci#define SAA7115_SVIDEO1 7 2362306a36Sopenharmony_ci#define SAA7115_SVIDEO2 8 2462306a36Sopenharmony_ci#define SAA7115_SVIDEO3 9 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* outputs */ 2762306a36Sopenharmony_ci#define SAA7115_IPORT_ON 1 2862306a36Sopenharmony_ci#define SAA7115_IPORT_OFF 0 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* SAA7111 specific outputs. */ 3162306a36Sopenharmony_ci#define SAA7111_VBI_BYPASS 2 3262306a36Sopenharmony_ci#define SAA7111_FMT_YUV422 0x00 3362306a36Sopenharmony_ci#define SAA7111_FMT_RGB 0x40 3462306a36Sopenharmony_ci#define SAA7111_FMT_CCIR 0x80 3562306a36Sopenharmony_ci#define SAA7111_FMT_YUV411 0xc0 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* config flags */ 3862306a36Sopenharmony_ci/* 3962306a36Sopenharmony_ci * Register 0x85 should set bit 0 to 0 (it's 1 by default). This bit 4062306a36Sopenharmony_ci * controls the IDQ signal polarity which is set to 'inverted' if the bit 4162306a36Sopenharmony_ci * it 1 and to 'default' if it is 0. 4262306a36Sopenharmony_ci */ 4362306a36Sopenharmony_ci#define SAA7115_IDQ_IS_DEFAULT (1 << 0) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* s_crystal_freq values and flags */ 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* SAA7115 v4l2_crystal_freq frequency values */ 4862306a36Sopenharmony_ci#define SAA7115_FREQ_32_11_MHZ 32110000 /* 32.11 MHz crystal, SAA7114/5 only */ 4962306a36Sopenharmony_ci#define SAA7115_FREQ_24_576_MHZ 24576000 /* 24.576 MHz crystal */ 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* SAA7115 v4l2_crystal_freq audio clock control flags */ 5262306a36Sopenharmony_ci#define SAA7115_FREQ_FL_UCGC (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */ 5362306a36Sopenharmony_ci#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */ 5462306a36Sopenharmony_ci#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */ 5562306a36Sopenharmony_ci#define SAA7115_FREQ_FL_DOUBLE_ASCLK (1 << 3) /* SA 39, LRDIV, SAA7114/5 only */ 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* ===== SAA7113 Config enums ===== */ 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* Register 0x08 "Horizontal time constant" [Bit 3..4]: 6062306a36Sopenharmony_ci * Should be set to "Fast Locking Mode" according to the datasheet, 6162306a36Sopenharmony_ci * and that is the default setting in the gm7113c_init table. 6262306a36Sopenharmony_ci * saa7113_init sets this value to "VTR Mode". */ 6362306a36Sopenharmony_cienum saa7113_r08_htc { 6462306a36Sopenharmony_ci SAA7113_HTC_TV_MODE = 0x00, 6562306a36Sopenharmony_ci SAA7113_HTC_VTR_MODE, /* Default for saa7113_init */ 6662306a36Sopenharmony_ci SAA7113_HTC_FAST_LOCKING_MODE = 0x03 /* Default for gm7113c_init */ 6762306a36Sopenharmony_ci}; 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/* Register 0x10 "Output format selection" [Bit 6..7]: 7062306a36Sopenharmony_ci * Defaults to ITU_656 as specified in datasheet. */ 7162306a36Sopenharmony_cienum saa7113_r10_ofts { 7262306a36Sopenharmony_ci SAA7113_OFTS_ITU_656 = 0x0, /* Default */ 7362306a36Sopenharmony_ci SAA7113_OFTS_VFLAG_BY_VREF, 7462306a36Sopenharmony_ci SAA7113_OFTS_VFLAG_BY_DATA_TYPE 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci/* 7862306a36Sopenharmony_ci * Register 0x12 "Output control" [Bit 0..3 Or Bit 4..7]: 7962306a36Sopenharmony_ci * This is used to select what data is output on the RTS0 and RTS1 pins. 8062306a36Sopenharmony_ci * RTS1 [Bit 4..7] Defaults to DOT_IN. (This value can not be set for RTS0) 8162306a36Sopenharmony_ci * RTS0 [Bit 0..3] Defaults to VIPB in gm7113c_init as specified 8262306a36Sopenharmony_ci * in the datasheet, but is set to HREF_HS in the saa7113_init table. 8362306a36Sopenharmony_ci */ 8462306a36Sopenharmony_cienum saa7113_r12_rts { 8562306a36Sopenharmony_ci SAA7113_RTS_DOT_IN = 0, /* OBS: Only for RTS1 (Default RTS1) */ 8662306a36Sopenharmony_ci SAA7113_RTS_VIPB, /* Default RTS0 For gm7113c_init */ 8762306a36Sopenharmony_ci SAA7113_RTS_GPSW, 8862306a36Sopenharmony_ci SAA7115_RTS_HL, 8962306a36Sopenharmony_ci SAA7113_RTS_VL, 9062306a36Sopenharmony_ci SAA7113_RTS_DL, 9162306a36Sopenharmony_ci SAA7113_RTS_PLIN, 9262306a36Sopenharmony_ci SAA7113_RTS_HREF_HS, /* Default RTS0 For saa7113_init */ 9362306a36Sopenharmony_ci SAA7113_RTS_HS, 9462306a36Sopenharmony_ci SAA7113_RTS_HQ, 9562306a36Sopenharmony_ci SAA7113_RTS_ODD, 9662306a36Sopenharmony_ci SAA7113_RTS_VS, 9762306a36Sopenharmony_ci SAA7113_RTS_V123, 9862306a36Sopenharmony_ci SAA7113_RTS_VGATE, 9962306a36Sopenharmony_ci SAA7113_RTS_VREF, 10062306a36Sopenharmony_ci SAA7113_RTS_FID 10162306a36Sopenharmony_ci}; 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci/** 10462306a36Sopenharmony_ci * struct saa7115_platform_data - Allow overriding default initialization 10562306a36Sopenharmony_ci * 10662306a36Sopenharmony_ci * @saa7113_force_gm7113c_init: Force the use of the gm7113c_init table 10762306a36Sopenharmony_ci * instead of saa7113_init table 10862306a36Sopenharmony_ci * (saa7113 only) 10962306a36Sopenharmony_ci * @saa7113_r08_htc: [R_08 - Bit 3..4] 11062306a36Sopenharmony_ci * @saa7113_r10_vrln: [R_10 - Bit 3] 11162306a36Sopenharmony_ci * default: Disabled for gm7113c_init 11262306a36Sopenharmony_ci * Enabled for saa7113c_init 11362306a36Sopenharmony_ci * @saa7113_r10_ofts: [R_10 - Bit 6..7] 11462306a36Sopenharmony_ci * @saa7113_r12_rts0: [R_12 - Bit 0..3] 11562306a36Sopenharmony_ci * @saa7113_r12_rts1: [R_12 - Bit 4..7] 11662306a36Sopenharmony_ci * @saa7113_r13_adlsb: [R_13 - Bit 7] - default: disabled 11762306a36Sopenharmony_ci */ 11862306a36Sopenharmony_cistruct saa7115_platform_data { 11962306a36Sopenharmony_ci bool saa7113_force_gm7113c_init; 12062306a36Sopenharmony_ci enum saa7113_r08_htc *saa7113_r08_htc; 12162306a36Sopenharmony_ci bool *saa7113_r10_vrln; 12262306a36Sopenharmony_ci enum saa7113_r10_ofts *saa7113_r10_ofts; 12362306a36Sopenharmony_ci enum saa7113_r12_rts *saa7113_r12_rts0; 12462306a36Sopenharmony_ci enum saa7113_r12_rts *saa7113_r12_rts1; 12562306a36Sopenharmony_ci bool *saa7113_r13_adlsb; 12662306a36Sopenharmony_ci}; 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci#endif 129