xref: /openbmc/linux/include/media/drv-intf/cx25840.h (revision 22d55f02)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3     cx25840.h - definition for cx25840/1/2/3 inputs
4 
5     Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
6 
7 */
8 
9 #ifndef _CX25840_H_
10 #define _CX25840_H_
11 
12 /* Note that the cx25840 driver requires that the bridge driver calls the
13    v4l2_subdev's init operation in order to load the driver's firmware.
14    Without this the audio standard detection will fail and you will
15    only get mono.
16 
17    Since loading the firmware is often problematic when the driver is
18    compiled into the kernel I recommend postponing calling this function
19    until the first open of the video device. Another reason for
20    postponing it is that loading this firmware takes a long time (seconds)
21    due to the slow i2c bus speed. So it will speed up the boot process if
22    you can avoid loading the fw as long as the video device isn't used. */
23 
24 enum cx25840_video_input {
25 	/* Composite video inputs In1-In8 */
26 	CX25840_COMPOSITE1 = 1,
27 	CX25840_COMPOSITE2,
28 	CX25840_COMPOSITE3,
29 	CX25840_COMPOSITE4,
30 	CX25840_COMPOSITE5,
31 	CX25840_COMPOSITE6,
32 	CX25840_COMPOSITE7,
33 	CX25840_COMPOSITE8,
34 
35 	/* S-Video inputs consist of one luma input (In1-In8) ORed with one
36 	   chroma input (In5-In8) */
37 	CX25840_SVIDEO_LUMA1 = 0x10,
38 	CX25840_SVIDEO_LUMA2 = 0x20,
39 	CX25840_SVIDEO_LUMA3 = 0x30,
40 	CX25840_SVIDEO_LUMA4 = 0x40,
41 	CX25840_SVIDEO_LUMA5 = 0x50,
42 	CX25840_SVIDEO_LUMA6 = 0x60,
43 	CX25840_SVIDEO_LUMA7 = 0x70,
44 	CX25840_SVIDEO_LUMA8 = 0x80,
45 	CX25840_SVIDEO_CHROMA4 = 0x400,
46 	CX25840_SVIDEO_CHROMA5 = 0x500,
47 	CX25840_SVIDEO_CHROMA6 = 0x600,
48 	CX25840_SVIDEO_CHROMA7 = 0x700,
49 	CX25840_SVIDEO_CHROMA8 = 0x800,
50 
51 	/* S-Video aliases for common luma/chroma combinations */
52 	CX25840_SVIDEO1 = 0x510,
53 	CX25840_SVIDEO2 = 0x620,
54 	CX25840_SVIDEO3 = 0x730,
55 	CX25840_SVIDEO4 = 0x840,
56 
57 	/* Allow frames to specify specific input configurations */
58 	CX25840_VIN1_CH1  = 0x80000000,
59 	CX25840_VIN2_CH1  = 0x80000001,
60 	CX25840_VIN3_CH1  = 0x80000002,
61 	CX25840_VIN4_CH1  = 0x80000003,
62 	CX25840_VIN5_CH1  = 0x80000004,
63 	CX25840_VIN6_CH1  = 0x80000005,
64 	CX25840_VIN7_CH1  = 0x80000006,
65 	CX25840_VIN8_CH1  = 0x80000007,
66 	CX25840_VIN4_CH2  = 0x80000000,
67 	CX25840_VIN5_CH2  = 0x80000010,
68 	CX25840_VIN6_CH2  = 0x80000020,
69 	CX25840_NONE_CH2  = 0x80000030,
70 	CX25840_VIN7_CH3  = 0x80000000,
71 	CX25840_VIN8_CH3  = 0x80000040,
72 	CX25840_NONE0_CH3 = 0x80000080,
73 	CX25840_NONE1_CH3 = 0x800000c0,
74 	CX25840_SVIDEO_ON = 0x80000100,
75 	CX25840_COMPONENT_ON = 0x80000200,
76 	CX25840_DIF_ON = 0x80000400,
77 };
78 
79 enum cx25840_audio_input {
80 	/* Audio inputs: serial or In4-In8 */
81 	CX25840_AUDIO_SERIAL,
82 	CX25840_AUDIO4 = 4,
83 	CX25840_AUDIO5,
84 	CX25840_AUDIO6,
85 	CX25840_AUDIO7,
86 	CX25840_AUDIO8,
87 };
88 
89 enum cx25840_io_pin {
90 	CX25840_PIN_DVALID_PRGM0 = 0,
91 	CX25840_PIN_FIELD_PRGM1,
92 	CX25840_PIN_HRESET_PRGM2,
93 	CX25840_PIN_VRESET_HCTL_PRGM3,
94 	CX25840_PIN_IRQ_N_PRGM4,
95 	CX25840_PIN_IR_TX_PRGM6,
96 	CX25840_PIN_IR_RX_PRGM5,
97 	CX25840_PIN_GPIO0_PRGM8,
98 	CX25840_PIN_GPIO1_PRGM9,
99 	CX25840_PIN_SA_SDIN,		/* Alternate GP Input only */
100 	CX25840_PIN_SA_SDOUT,		/* Alternate GP Input only */
101 	CX25840_PIN_PLL_CLK_PRGM7,
102 	CX25840_PIN_CHIP_SEL_VIPCLK,	/* Output only */
103 };
104 
105 enum cx25840_io_pad {
106 	/* Output pads */
107 	CX25840_PAD_DEFAULT = 0,
108 	CX25840_PAD_ACTIVE,
109 	CX25840_PAD_VACTIVE,
110 	CX25840_PAD_CBFLAG,
111 	CX25840_PAD_VID_DATA_EXT0,
112 	CX25840_PAD_VID_DATA_EXT1,
113 	CX25840_PAD_GPO0,
114 	CX25840_PAD_GPO1,
115 	CX25840_PAD_GPO2,
116 	CX25840_PAD_GPO3,
117 	CX25840_PAD_IRQ_N,
118 	CX25840_PAD_AC_SYNC,
119 	CX25840_PAD_AC_SDOUT,
120 	CX25840_PAD_PLL_CLK,
121 	CX25840_PAD_VRESET,
122 	CX25840_PAD_RESERVED,
123 	/* Pads for PLL_CLK output only */
124 	CX25840_PAD_XTI_X5_DLL,
125 	CX25840_PAD_AUX_PLL,
126 	CX25840_PAD_VID_PLL,
127 	CX25840_PAD_XTI,
128 	/* Input Pads */
129 	CX25840_PAD_GPI0,
130 	CX25840_PAD_GPI1,
131 	CX25840_PAD_GPI2,
132 	CX25840_PAD_GPI3,
133 };
134 
135 enum cx25840_io_pin_strength {
136 	CX25840_PIN_DRIVE_MEDIUM = 0,
137 	CX25840_PIN_DRIVE_SLOW,
138 	CX25840_PIN_DRIVE_FAST,
139 };
140 
141 enum cx23885_io_pin {
142 	CX23885_PIN_IR_RX_GPIO19,
143 	CX23885_PIN_IR_TX_GPIO20,
144 	CX23885_PIN_I2S_SDAT_GPIO21,
145 	CX23885_PIN_I2S_WCLK_GPIO22,
146 	CX23885_PIN_I2S_BCLK_GPIO23,
147 	CX23885_PIN_IRQ_N_GPIO16,
148 };
149 
150 enum cx23885_io_pad {
151 	CX23885_PAD_IR_RX,
152 	CX23885_PAD_GPIO19,
153 	CX23885_PAD_IR_TX,
154 	CX23885_PAD_GPIO20,
155 	CX23885_PAD_I2S_SDAT,
156 	CX23885_PAD_GPIO21,
157 	CX23885_PAD_I2S_WCLK,
158 	CX23885_PAD_GPIO22,
159 	CX23885_PAD_I2S_BCLK,
160 	CX23885_PAD_GPIO23,
161 	CX23885_PAD_IRQ_N,
162 	CX23885_PAD_GPIO16,
163 };
164 
165 /* pvr150_workaround activates a workaround for a hardware bug that is
166    present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
167    certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
168    audio autodetect fails on some channels for these models and the workaround
169    is to select the audio standard explicitly. Many thanks to Hauppauge for
170    providing this information.
171    This platform data only needs to be supplied by the ivtv driver. */
172 struct cx25840_platform_data {
173 	int pvr150_workaround;
174 };
175 
176 #endif
177