| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 2 | + |
|---|
| 1 | 3 | /* |
|---|
| 2 | | - cx25840.h - definition for cx25840/1/2/3 inputs |
|---|
| 3 | | - |
|---|
| 4 | | - Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) |
|---|
| 5 | | - |
|---|
| 6 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - (at your option) any later version. |
|---|
| 10 | | - |
|---|
| 11 | | - This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - GNU General Public License for more details. |
|---|
| 15 | | - |
|---|
| 16 | | - You should have received a copy of the GNU General Public License |
|---|
| 17 | | - along with this program; if not, write to the Free Software |
|---|
| 18 | | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 19 | | -*/ |
|---|
| 4 | + * cx25840.h - definition for cx25840/1/2/3 inputs |
|---|
| 5 | + * |
|---|
| 6 | + * Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) |
|---|
| 7 | + */ |
|---|
| 20 | 8 | |
|---|
| 21 | 9 | #ifndef _CX25840_H_ |
|---|
| 22 | 10 | #define _CX25840_H_ |
|---|
| 23 | 11 | |
|---|
| 24 | | -/* Note that the cx25840 driver requires that the bridge driver calls the |
|---|
| 25 | | - v4l2_subdev's init operation in order to load the driver's firmware. |
|---|
| 26 | | - Without this the audio standard detection will fail and you will |
|---|
| 27 | | - only get mono. |
|---|
| 28 | | - |
|---|
| 29 | | - Since loading the firmware is often problematic when the driver is |
|---|
| 30 | | - compiled into the kernel I recommend postponing calling this function |
|---|
| 31 | | - until the first open of the video device. Another reason for |
|---|
| 32 | | - postponing it is that loading this firmware takes a long time (seconds) |
|---|
| 33 | | - due to the slow i2c bus speed. So it will speed up the boot process if |
|---|
| 34 | | - you can avoid loading the fw as long as the video device isn't used. */ |
|---|
| 12 | +/* |
|---|
| 13 | + * Note that the cx25840 driver requires that the bridge driver calls the |
|---|
| 14 | + * v4l2_subdev's load_fw operation in order to load the driver's firmware. |
|---|
| 15 | + * This will load the firmware on the first invocation (further ones are NOP). |
|---|
| 16 | + * Without this the audio standard detection will fail and you will |
|---|
| 17 | + * only get mono. |
|---|
| 18 | + * Alternatively, you can call the reset operation (this can be done |
|---|
| 19 | + * multiple times if needed, each invocation will fully reinitialize |
|---|
| 20 | + * the device). |
|---|
| 21 | + * |
|---|
| 22 | + * Since loading the firmware is often problematic when the driver is |
|---|
| 23 | + * compiled into the kernel I recommend postponing calling this function |
|---|
| 24 | + * until the first open of the video device. Another reason for |
|---|
| 25 | + * postponing it is that loading this firmware takes a long time (seconds) |
|---|
| 26 | + * due to the slow i2c bus speed. So it will speed up the boot process if |
|---|
| 27 | + * you can avoid loading the fw as long as the video device isn't used. |
|---|
| 28 | + */ |
|---|
| 35 | 29 | |
|---|
| 36 | 30 | enum cx25840_video_input { |
|---|
| 37 | 31 | /* Composite video inputs In1-In8 */ |
|---|
| .. | .. |
|---|
| 44 | 38 | CX25840_COMPOSITE7, |
|---|
| 45 | 39 | CX25840_COMPOSITE8, |
|---|
| 46 | 40 | |
|---|
| 47 | | - /* S-Video inputs consist of one luma input (In1-In8) ORed with one |
|---|
| 48 | | - chroma input (In5-In8) */ |
|---|
| 41 | + /* |
|---|
| 42 | + * S-Video inputs consist of one luma input (In1-In8) ORed with one |
|---|
| 43 | + * chroma input (In5-In8) |
|---|
| 44 | + */ |
|---|
| 49 | 45 | CX25840_SVIDEO_LUMA1 = 0x10, |
|---|
| 50 | 46 | CX25840_SVIDEO_LUMA2 = 0x20, |
|---|
| 51 | 47 | CX25840_SVIDEO_LUMA3 = 0x30, |
|---|
| .. | .. |
|---|
| 88 | 84 | CX25840_DIF_ON = 0x80000400, |
|---|
| 89 | 85 | }; |
|---|
| 90 | 86 | |
|---|
| 87 | +/* |
|---|
| 88 | + * The defines below are used to set the chip video output settings |
|---|
| 89 | + * in the generic mode that can be enabled by calling the subdevice |
|---|
| 90 | + * init core op. |
|---|
| 91 | + * |
|---|
| 92 | + * The requested settings can be passed to the init core op as |
|---|
| 93 | + * @val parameter and to the s_routing video op as @config parameter. |
|---|
| 94 | + * |
|---|
| 95 | + * For details please refer to the section 3.7 Video Output Formatting and |
|---|
| 96 | + * to Video Out Control 1 to 4 registers in the section 5.6 Video Decoder Core |
|---|
| 97 | + * of the chip datasheet. |
|---|
| 98 | + */ |
|---|
| 99 | +#define CX25840_VCONFIG_FMT_SHIFT 0 |
|---|
| 100 | +#define CX25840_VCONFIG_FMT_MASK GENMASK(2, 0) |
|---|
| 101 | +#define CX25840_VCONFIG_FMT_BT601 BIT(0) |
|---|
| 102 | +#define CX25840_VCONFIG_FMT_BT656 BIT(1) |
|---|
| 103 | +#define CX25840_VCONFIG_FMT_VIP11 GENMASK(1, 0) |
|---|
| 104 | +#define CX25840_VCONFIG_FMT_VIP2 BIT(2) |
|---|
| 105 | + |
|---|
| 106 | +#define CX25840_VCONFIG_RES_SHIFT 3 |
|---|
| 107 | +#define CX25840_VCONFIG_RES_MASK GENMASK(4, 3) |
|---|
| 108 | +#define CX25840_VCONFIG_RES_8BIT BIT(3) |
|---|
| 109 | +#define CX25840_VCONFIG_RES_10BIT BIT(4) |
|---|
| 110 | + |
|---|
| 111 | +#define CX25840_VCONFIG_VBIRAW_SHIFT 5 |
|---|
| 112 | +#define CX25840_VCONFIG_VBIRAW_MASK GENMASK(6, 5) |
|---|
| 113 | +#define CX25840_VCONFIG_VBIRAW_DISABLED BIT(5) |
|---|
| 114 | +#define CX25840_VCONFIG_VBIRAW_ENABLED BIT(6) |
|---|
| 115 | + |
|---|
| 116 | +#define CX25840_VCONFIG_ANCDATA_SHIFT 7 |
|---|
| 117 | +#define CX25840_VCONFIG_ANCDATA_MASK GENMASK(8, 7) |
|---|
| 118 | +#define CX25840_VCONFIG_ANCDATA_DISABLED BIT(7) |
|---|
| 119 | +#define CX25840_VCONFIG_ANCDATA_ENABLED BIT(8) |
|---|
| 120 | + |
|---|
| 121 | +#define CX25840_VCONFIG_TASKBIT_SHIFT 9 |
|---|
| 122 | +#define CX25840_VCONFIG_TASKBIT_MASK GENMASK(10, 9) |
|---|
| 123 | +#define CX25840_VCONFIG_TASKBIT_ZERO BIT(9) |
|---|
| 124 | +#define CX25840_VCONFIG_TASKBIT_ONE BIT(10) |
|---|
| 125 | + |
|---|
| 126 | +#define CX25840_VCONFIG_ACTIVE_SHIFT 11 |
|---|
| 127 | +#define CX25840_VCONFIG_ACTIVE_MASK GENMASK(12, 11) |
|---|
| 128 | +#define CX25840_VCONFIG_ACTIVE_COMPOSITE BIT(11) |
|---|
| 129 | +#define CX25840_VCONFIG_ACTIVE_HORIZONTAL BIT(12) |
|---|
| 130 | + |
|---|
| 131 | +#define CX25840_VCONFIG_VALID_SHIFT 13 |
|---|
| 132 | +#define CX25840_VCONFIG_VALID_MASK GENMASK(14, 13) |
|---|
| 133 | +#define CX25840_VCONFIG_VALID_NORMAL BIT(13) |
|---|
| 134 | +#define CX25840_VCONFIG_VALID_ANDACTIVE BIT(14) |
|---|
| 135 | + |
|---|
| 136 | +#define CX25840_VCONFIG_HRESETW_SHIFT 15 |
|---|
| 137 | +#define CX25840_VCONFIG_HRESETW_MASK GENMASK(16, 15) |
|---|
| 138 | +#define CX25840_VCONFIG_HRESETW_NORMAL BIT(15) |
|---|
| 139 | +#define CX25840_VCONFIG_HRESETW_PIXCLK BIT(16) |
|---|
| 140 | + |
|---|
| 141 | +#define CX25840_VCONFIG_CLKGATE_SHIFT 17 |
|---|
| 142 | +#define CX25840_VCONFIG_CLKGATE_MASK GENMASK(18, 17) |
|---|
| 143 | +#define CX25840_VCONFIG_CLKGATE_NONE BIT(17) |
|---|
| 144 | +#define CX25840_VCONFIG_CLKGATE_VALID BIT(18) |
|---|
| 145 | +#define CX25840_VCONFIG_CLKGATE_VALIDACTIVE GENMASK(18, 17) |
|---|
| 146 | + |
|---|
| 147 | +#define CX25840_VCONFIG_DCMODE_SHIFT 19 |
|---|
| 148 | +#define CX25840_VCONFIG_DCMODE_MASK GENMASK(20, 19) |
|---|
| 149 | +#define CX25840_VCONFIG_DCMODE_DWORDS BIT(19) |
|---|
| 150 | +#define CX25840_VCONFIG_DCMODE_BYTES BIT(20) |
|---|
| 151 | + |
|---|
| 152 | +#define CX25840_VCONFIG_IDID0S_SHIFT 21 |
|---|
| 153 | +#define CX25840_VCONFIG_IDID0S_MASK GENMASK(22, 21) |
|---|
| 154 | +#define CX25840_VCONFIG_IDID0S_NORMAL BIT(21) |
|---|
| 155 | +#define CX25840_VCONFIG_IDID0S_LINECNT BIT(22) |
|---|
| 156 | + |
|---|
| 157 | +#define CX25840_VCONFIG_VIPCLAMP_SHIFT 23 |
|---|
| 158 | +#define CX25840_VCONFIG_VIPCLAMP_MASK GENMASK(24, 23) |
|---|
| 159 | +#define CX25840_VCONFIG_VIPCLAMP_ENABLED BIT(23) |
|---|
| 160 | +#define CX25840_VCONFIG_VIPCLAMP_DISABLED BIT(24) |
|---|
| 161 | + |
|---|
| 91 | 162 | enum cx25840_audio_input { |
|---|
| 92 | 163 | /* Audio inputs: serial or In4-In8 */ |
|---|
| 93 | 164 | CX25840_AUDIO_SERIAL, |
|---|
| .. | .. |
|---|
| 115 | 186 | }; |
|---|
| 116 | 187 | |
|---|
| 117 | 188 | enum cx25840_io_pad { |
|---|
| 118 | | - /* Output pads */ |
|---|
| 189 | + /* Output pads, these must match the actual chip register values */ |
|---|
| 119 | 190 | CX25840_PAD_DEFAULT = 0, |
|---|
| 120 | 191 | CX25840_PAD_ACTIVE, |
|---|
| 121 | 192 | CX25840_PAD_VACTIVE, |
|---|
| .. | .. |
|---|
| 174 | 245 | CX23885_PAD_GPIO16, |
|---|
| 175 | 246 | }; |
|---|
| 176 | 247 | |
|---|
| 177 | | -/* pvr150_workaround activates a workaround for a hardware bug that is |
|---|
| 178 | | - present in Hauppauge PVR-150 (and possibly PVR-500) cards that have |
|---|
| 179 | | - certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The |
|---|
| 180 | | - audio autodetect fails on some channels for these models and the workaround |
|---|
| 181 | | - is to select the audio standard explicitly. Many thanks to Hauppauge for |
|---|
| 182 | | - providing this information. |
|---|
| 183 | | - This platform data only needs to be supplied by the ivtv driver. */ |
|---|
| 248 | +/* |
|---|
| 249 | + * pvr150_workaround activates a workaround for a hardware bug that is |
|---|
| 250 | + * present in Hauppauge PVR-150 (and possibly PVR-500) cards that have |
|---|
| 251 | + * certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The |
|---|
| 252 | + * audio autodetect fails on some channels for these models and the workaround |
|---|
| 253 | + * is to select the audio standard explicitly. Many thanks to Hauppauge for |
|---|
| 254 | + * providing this information. |
|---|
| 255 | + * |
|---|
| 256 | + * This platform data only needs to be supplied by the ivtv driver. |
|---|
| 257 | + */ |
|---|
| 184 | 258 | struct cx25840_platform_data { |
|---|
| 185 | 259 | int pvr150_workaround; |
|---|
| 186 | 260 | }; |
|---|