xref: /openbmc/linux/drivers/media/usb/dvb-usb/cinergyT2.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2786baecfSMauro Carvalho Chehab /*
3786baecfSMauro Carvalho Chehab  * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
4786baecfSMauro Carvalho Chehab  *
5786baecfSMauro Carvalho Chehab  * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
6786baecfSMauro Carvalho Chehab  *
7786baecfSMauro Carvalho Chehab  * Based on the dvb-usb-framework code and the
8786baecfSMauro Carvalho Chehab  * original Terratec Cinergy T2 driver by:
9786baecfSMauro Carvalho Chehab  *
10786baecfSMauro Carvalho Chehab  * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
11786baecfSMauro Carvalho Chehab  *                  Holger Waechtler <holger@qanu.de>
12786baecfSMauro Carvalho Chehab  *
13786baecfSMauro Carvalho Chehab  *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
14786baecfSMauro Carvalho Chehab  */
15786baecfSMauro Carvalho Chehab 
16786baecfSMauro Carvalho Chehab #ifndef _DVB_USB_CINERGYT2_H_
17786baecfSMauro Carvalho Chehab #define _DVB_USB_CINERGYT2_H_
18786baecfSMauro Carvalho Chehab 
19786baecfSMauro Carvalho Chehab #include <linux/usb/input.h>
20786baecfSMauro Carvalho Chehab 
21786baecfSMauro Carvalho Chehab #define DVB_USB_LOG_PREFIX "cinergyT2"
22786baecfSMauro Carvalho Chehab #include "dvb-usb.h"
23786baecfSMauro Carvalho Chehab 
24786baecfSMauro Carvalho Chehab #define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
25786baecfSMauro Carvalho Chehab 
26786baecfSMauro Carvalho Chehab extern int dvb_usb_cinergyt2_debug;
27786baecfSMauro Carvalho Chehab 
28786baecfSMauro Carvalho Chehab #define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
29786baecfSMauro Carvalho Chehab #define deb_xfer(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x002, args)
30786baecfSMauro Carvalho Chehab #define deb_pll(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x004, args)
31786baecfSMauro Carvalho Chehab #define deb_ts(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x008, args)
32786baecfSMauro Carvalho Chehab #define deb_err(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x010, args)
33786baecfSMauro Carvalho Chehab #define deb_rc(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x020, args)
34786baecfSMauro Carvalho Chehab #define deb_fw(args...)    dprintk(dvb_usb_cinergyt2_debug,  0x040, args)
35786baecfSMauro Carvalho Chehab #define deb_mem(args...)   dprintk(dvb_usb_cinergyt2_debug,  0x080, args)
36786baecfSMauro Carvalho Chehab #define deb_uxfer(args...) dprintk(dvb_usb_cinergyt2_debug,  0x100, args)
37786baecfSMauro Carvalho Chehab 
38786baecfSMauro Carvalho Chehab 
39786baecfSMauro Carvalho Chehab 
40786baecfSMauro Carvalho Chehab enum cinergyt2_ep1_cmd {
41786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_PID_TABLE_RESET		= 0x01,
42786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_PID_SETUP			= 0x02,
43786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_CONTROL_STREAM_TRANSFER	= 0x03,
44786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_SET_TUNER_PARAMETERS	= 0x04,
45786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_GET_TUNER_STATUS		= 0x05,
46786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_START_SCAN		= 0x06,
47786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_CONTINUE_SCAN		= 0x07,
48786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_GET_RC_EVENTS		= 0x08,
49786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_SLEEP_MODE		= 0x09,
50786baecfSMauro Carvalho Chehab 	CINERGYT2_EP1_GET_FIRMWARE_VERSION	= 0x0A
51786baecfSMauro Carvalho Chehab };
52786baecfSMauro Carvalho Chehab 
53786baecfSMauro Carvalho Chehab 
54786baecfSMauro Carvalho Chehab struct dvbt_get_status_msg {
55786baecfSMauro Carvalho Chehab 	uint32_t freq;
56786baecfSMauro Carvalho Chehab 	uint8_t bandwidth;
57786baecfSMauro Carvalho Chehab 	uint16_t tps;
58786baecfSMauro Carvalho Chehab 	uint8_t flags;
59786baecfSMauro Carvalho Chehab 	__le16 gain;
60786baecfSMauro Carvalho Chehab 	uint8_t snr;
61786baecfSMauro Carvalho Chehab 	__le32 viterbi_error_rate;
62786baecfSMauro Carvalho Chehab 	uint32_t rs_error_rate;
63786baecfSMauro Carvalho Chehab 	__le32 uncorrected_block_count;
64786baecfSMauro Carvalho Chehab 	uint8_t lock_bits;
65786baecfSMauro Carvalho Chehab 	uint8_t prev_lock_bits;
66786baecfSMauro Carvalho Chehab } __attribute__((packed));
67786baecfSMauro Carvalho Chehab 
68786baecfSMauro Carvalho Chehab 
69786baecfSMauro Carvalho Chehab struct dvbt_set_parameters_msg {
70786baecfSMauro Carvalho Chehab 	uint8_t cmd;
71786baecfSMauro Carvalho Chehab 	__le32 freq;
72786baecfSMauro Carvalho Chehab 	uint8_t bandwidth;
73786baecfSMauro Carvalho Chehab 	__le16 tps;
74786baecfSMauro Carvalho Chehab 	uint8_t flags;
75786baecfSMauro Carvalho Chehab } __attribute__((packed));
76786baecfSMauro Carvalho Chehab 
77786baecfSMauro Carvalho Chehab 
78786baecfSMauro Carvalho Chehab extern struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d);
79786baecfSMauro Carvalho Chehab 
80786baecfSMauro Carvalho Chehab #endif /* _DVB_USB_CINERGYT2_H_ */
81786baecfSMauro Carvalho Chehab 
82