1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Common header-file of the Linux driver for the TwinhanDTV Alpha/MagicBoxII
3  * USB2.0 DVB-T receiver.
4  *
5  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
6  *
7  * Thanks to Twinhan who kindly provided hardware and information.
8  *
9  * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
10  */
11 #ifndef _DVB_USB_VP7045_H_
12 #define _DVB_USB_VP7045_H_
13 
14 #define DVB_USB_LOG_PREFIX "vp7045"
15 #include "dvb-usb.h"
16 
17 /* vp7045 commands */
18 
19 /* Twinhan Vendor requests */
20 #define TH_COMMAND_IN                     0xC0
21 #define TH_COMMAND_OUT                    0xC1
22 
23 /* command bytes */
24 #define TUNER_REG_READ                    0x03
25 #define TUNER_REG_WRITE                   0x04
26 
27 #define RC_VAL_READ                       0x05
28  #define RC_NO_KEY                        0x44
29 
30 #define SET_TUNER_POWER                   0x06
31 #define CHECK_TUNER_POWER                 0x12
32  #define Tuner_Power_ON                   1
33  #define Tuner_Power_OFF                  0
34 
35 #define GET_USB_SPEED                     0x07
36 
37 #define LOCK_TUNER_COMMAND                0x09
38 
39 #define TUNER_SIGNAL_READ                 0x0A
40 
41 /* FX2 eeprom */
42 #define SET_EE_VALUE                      0x10
43 #define GET_EE_VALUE                      0x11
44  #define FX2_ID_ADDR                      0x00
45  #define VID_MSB_ADDR                     0x02
46  #define VID_LSB_ADDR                     0x01
47  #define PID_MSB_ADDR                     0x04
48  #define PID_LSB_ADDR                     0x03
49  #define MAC_0_ADDR                       0x07
50  #define MAC_1_ADDR                       0x08
51  #define MAC_2_ADDR                       0x09
52  #define MAC_3_ADDR                       0x0a
53  #define MAC_4_ADDR                       0x0b
54  #define MAC_5_ADDR                       0x0c
55 
56 #define RESET_FX2                         0x13
57 
58 #define FW_VERSION_READ                   0x0B
59 #define VENDOR_STRING_READ                0x0C
60 #define PRODUCT_STRING_READ               0x0D
61 #define FW_BCD_VERSION_READ               0x14
62 
63 extern struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d);
64 extern int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen,int msec);
65 extern u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg);
66 
67 #endif
68