1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Driver for the NXP SAA7164 PCIe bridge
5 * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com>
8 /* TODO: Cleanup and shorten the namespace */
10 /* Some structures are passed directly to/from the firmware and
11 * have strict alignment requirements. This is one of them.
13 struct tmComResHWDescr {
16 u8 bDescriptorSubtype;
21 u32 dwDeviceRegistersLocation;
22 u32 dwHostMemoryRegion;
23 u32 dwHostMemoryRegionSize;
24 u32 dwHostHibernatMemRegion;
25 u32 dwHostHibernatMemRegionSize;
26 } __attribute__((packed));
28 /* This is DWORD aligned on windows but I can't find the right
29 * gcc syntax to match the binary data from the device.
30 * I've manually padded with Reserved[3] bytes to match the hardware,
31 * but this could break if GCC decides to pack in a different way.
33 struct tmComResInterfaceDescr {
36 u8 bDescriptorSubtype;
47 struct tmComResBusDescr {
64 struct tmComResBusInfo {
67 u8 __iomem *m_pdwSetRing;
69 u8 __iomem *m_pdwGetRing;
76 /* All access is protected */
88 } __attribute__((packed));
107 wait_queue_head_t wait;
110 struct tmDescriptor {
116 struct tmComResDescrHeader {
121 } __attribute__((packed));
123 struct tmComResExtDevDescrHeader {
133 } __attribute__((packed));
135 struct tmComResGPIO {
138 } __attribute__((packed));
140 struct tmComResPathDescrHeader {
145 } __attribute__((packed));
148 enum tmComResTermType {
149 ITT_ANTENNA = 0x0203,
150 LINE_CONNECTOR = 0x0603,
151 SPDIF_CONNECTOR = 0x0605,
152 COMPOSITE_CONNECTOR = 0x0401,
153 SVIDEO_CONNECTOR = 0x0402,
154 COMPONENT_CONNECTOR = 0x0403,
155 STANDARD_DMA = 0xF101
158 struct tmComResAntTermDescrHeader {
167 } __attribute__((packed));
169 struct tmComResTunerDescrHeader {
179 } __attribute__((packed));
182 /* the buffer does not contain any valid data */
183 TM_BUFFER_FLAG_EMPTY,
185 /* the buffer is filled with valid data */
188 /* the buffer is the dummy buffer - TODO??? */
189 TM_BUFFER_FLAG_DUMMY_BUFFER
198 enum tmBufferFlag BufferFlag;
206 struct tmHWStreamParameters {
212 u64 **pagetablelistvirt;
213 u64 *pagetablelistphys;
215 u32 numpagetableentries;
218 struct tmStreamParameters {
219 struct tmHWStreamParameters HWStreamParameters;
220 u64 qwDummyPageTablePhys;
221 u64 *pDummyPageTableVirt;
224 struct tmComResDMATermDescrHeader {
240 } __attribute__((packed));
245 * This is the transport stream format header.
248 * bLength - The size of this descriptor in bytes.
249 * bDescriptorType - CS_INTERFACE.
250 * bDescriptorSubtype - VS_FORMAT_MPEG2TS descriptor subtype.
251 * bFormatIndex - A non-zero constant that uniquely identifies the
253 * bDataOffset - Offset to TSP packet within MPEG-2 TS transport
255 * bPacketLength - Length of TSP packet, in bytes (typically 188).
256 * bStrideLength - Length of MPEG-2 TS transport stride.
257 * guidStrideFormat - A Globally Unique Identifier indicating the
258 * format of the stride data (if any). Set to zeros
259 * if there is no Stride Data, or if the Stride
260 * Data is to be ignored by the application.
263 struct tmComResTSFormatDescrHeader {
271 u8 guidStrideFormat[16];
272 } __attribute__((packed));
274 /* Encoder related structures */
276 /* A/V Mux Selector */
277 struct tmComResSelDescrHeader {
284 } __attribute__((packed));
286 /* A/V Audio processor definitions */
287 struct tmComResProcDescrHeader {
295 } __attribute__((packed));
297 /* Video bitrate control message */
298 #define EU_VIDEO_BIT_RATE_MODE_CONSTANT (0)
299 #define EU_VIDEO_BIT_RATE_MODE_VARIABLE_AVERAGE (1)
300 #define EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK (2)
301 struct tmComResEncVideoBitRate {
302 u8 ucVideoBitRateMode;
304 u32 dwVideoBitRatePeak;
305 } __attribute__((packed));
307 /* Video Encoder Aspect Ratio message */
308 struct tmComResEncVideoInputAspectRatio {
311 } __attribute__((packed));
313 /* Video Encoder GOP IBP message */
314 /* 1. IPPPPPPPPPPPPPP */
315 /* 2. IBPBPBPBPBPBPBP */
316 /* 3. IBBPBBPBBPBBP */
317 #define SAA7164_ENCODER_DEFAULT_GOP_DIST (1)
318 #define SAA7164_ENCODER_DEFAULT_GOP_SIZE (15)
319 struct tmComResEncVideoGopStructure {
320 u8 ucGOPSize; /* GOP Size 12, 15 */
321 u8 ucRefFrameDist; /* Reference Frame Distance */
322 } __attribute__((packed));
324 /* Encoder processor definition */
325 struct tmComResEncoderDescrHeader {
337 u16 wmVidResolutionsCap;
341 } __attribute__((packed));
343 /* Audio processor definition */
344 struct tmComResAFeatureDescrHeader {
351 } __attribute__((packed));
353 /* Audio control messages */
354 struct tmComResAudioDefaults {
356 u8 ucDecoderFM_Level;
361 } __attribute__((packed));
363 /* Audio bitrate control message */
364 struct tmComResEncAudioBitRate {
365 u8 ucAudioBitRateMode;
367 u32 dwAudioBitRatePeak;
368 } __attribute__((packed));
370 /* Tuner / AV Decoder messages */
371 struct tmComResTunerStandard {
374 } __attribute__((packed));
376 struct tmComResTunerStandardAuto {
378 } __attribute__((packed));
380 /* EEPROM definition for PS stream types */
381 struct tmComResPSFormatDescrHeader {
389 } __attribute__((packed));
391 /* VBI control structure */
392 struct tmComResVBIFormatDescrHeader {
395 u8 subtype; /* VS_FORMAT_VBI */
397 u32 VideoStandard; /* See KS_AnalogVideoStandard, NTSC = 1 */
398 u8 StartLine; /* NTSC Start = 10 */
399 u8 EndLine; /* NTSC = 21 */
400 u8 FieldRate; /* 60 for NTSC */
401 u8 bNumLines; /* Unused - scheduled for removal */
402 } __attribute__((packed));
404 struct tmComResProbeCommit {
408 } __attribute__((packed));
410 struct tmComResDebugSetLevel {
412 } __attribute__((packed));
414 struct tmComResDebugGetData {
417 } __attribute__((packed));
419 struct tmFwInfoStruct {
428 } __attribute__((packed));