Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
3706a4da PB |
2 | #ifndef _DVB_USB_VP7021_H_ |
3 | #define _DVB_USB_VP7021_H_ | |
4 | ||
5 | #define DVB_USB_LOG_PREFIX "vp702x" | |
6 | #include "dvb-usb.h" | |
7 | ||
8 | extern int dvb_usb_vp702x_debug; | |
9 | #define deb_info(args...) dprintk(dvb_usb_vp702x_debug,0x01,args) | |
10 | #define deb_xfer(args...) dprintk(dvb_usb_vp702x_debug,0x02,args) | |
11 | #define deb_rc(args...) dprintk(dvb_usb_vp702x_debug,0x04,args) | |
12 | #define deb_fe(args...) dprintk(dvb_usb_vp702x_debug,0x08,args) | |
13 | ||
14 | /* commands are read and written with USB control messages */ | |
15 | ||
16 | /* consecutive read/write operation */ | |
4e5910e6 MK |
17 | #define REQUEST_OUT 0xB2 |
18 | #define REQUEST_IN 0xB3 | |
3706a4da PB |
19 | |
20 | /* the out-buffer of these consecutive operations contain sub-commands when b[0] = 0 | |
21 | * request: 0xB2; i: 0; v: 0; b[0] = 0, b[1] = subcmd, additional buffer | |
22 | * the returning buffer looks as follows | |
23 | * request: 0xB3; i: 0; v: 0; b[0] = 0xB3, additional buffer */ | |
24 | ||
4e5910e6 | 25 | #define GET_TUNER_STATUS 0x05 |
3706a4da PB |
26 | /* additional in buffer: |
27 | * 0 1 2 3 4 5 6 7 8 | |
28 | * N/A N/A 0x05 signal-quality N/A N/A signal-strength lock==0 N/A */ | |
29 | ||
4e5910e6 | 30 | #define GET_SYSTEM_STRING 0x06 |
3706a4da PB |
31 | /* additional in buffer: |
32 | * 0 1 2 3 4 5 6 7 8 | |
33 | * N/A 'U' 'S' 'B' '7' '0' '2' 'X' N/A */ | |
34 | ||
4e5910e6 | 35 | #define SET_DISEQC_CMD 0x08 |
3706a4da PB |
36 | /* additional out buffer: |
37 | * 0 1 2 3 4 | |
38 | * len X1 X2 X3 X4 | |
39 | * additional in buffer: | |
40 | * 0 1 2 | |
4e5910e6 | 41 | * N/A 0 0 b[1] == b[2] == 0 -> success, failure otherwise */ |
3706a4da | 42 | |
4e5910e6 | 43 | #define SET_LNB_POWER 0x09 |
3706a4da PB |
44 | /* additional out buffer: |
45 | * 0 1 2 | |
46 | * 0x00 0xff 1 = on, 0 = off | |
47 | * additional in buffer: | |
48 | * 0 1 2 | |
4e5910e6 | 49 | * N/A 0 0 b[1] == b[2] == 0 -> success failure otherwise */ |
3706a4da | 50 | |
4e5910e6 | 51 | #define GET_MAC_ADDRESS 0x0A |
3706a4da PB |
52 | /* #define GET_MAC_ADDRESS 0x0B */ |
53 | /* additional in buffer: | |
54 | * 0 1 2 3 4 5 6 7 8 | |
55 | * N/A N/A 0x0A or 0x0B MAC0 MAC1 MAC2 MAC3 MAC4 MAC5 */ | |
56 | ||
4e5910e6 | 57 | #define SET_PID_FILTER 0x11 |
3706a4da PB |
58 | /* additional in buffer: |
59 | * 0 1 ... 14 15 16 | |
60 | * PID0_MSB PID0_LSB ... PID7_MSB PID7_LSB PID_active (bits) */ | |
61 | ||
62 | /* request: 0xB2; i: 0; v: 0; | |
63 | * b[0] != 0 -> tune and lock a channel | |
64 | * 0 1 2 3 4 5 6 7 | |
65 | * freq0 freq1 divstep srate0 srate1 srate2 flag chksum | |
66 | */ | |
67 | ||
3706a4da | 68 | /* one direction requests */ |
4e5910e6 | 69 | #define READ_REMOTE_REQ 0xB4 |
3706a4da PB |
70 | /* IN i: 0; v: 0; b[0] == request, b[1] == key */ |
71 | ||
4e5910e6 | 72 | #define READ_PID_NUMBER_REQ 0xB5 |
3706a4da PB |
73 | /* IN i: 0; v: 0; b[0] == request, b[1] == 0, b[2] = pid number */ |
74 | ||
4e5910e6 | 75 | #define WRITE_EEPROM_REQ 0xB6 |
3706a4da PB |
76 | /* OUT i: offset; v: value to write; no extra buffer */ |
77 | ||
4e5910e6 | 78 | #define READ_EEPROM_REQ 0xB7 |
3706a4da PB |
79 | /* IN i: bufferlen; v: offset; buffer with bufferlen bytes */ |
80 | ||
4e5910e6 | 81 | #define READ_STATUS 0xB8 |
3706a4da PB |
82 | /* IN i: 0; v: 0; bufferlen 10 */ |
83 | ||
4e5910e6 | 84 | #define READ_TUNER_REG_REQ 0xB9 |
3706a4da PB |
85 | /* IN i: 0; v: register; b[0] = value */ |
86 | ||
4e5910e6 | 87 | #define READ_FX2_REG_REQ 0xBA |
3706a4da PB |
88 | /* IN i: offset; v: 0; b[0] = value */ |
89 | ||
4e5910e6 | 90 | #define WRITE_FX2_REG_REQ 0xBB |
3706a4da PB |
91 | /* OUT i: offset; v: value to write; 1 byte extra buffer */ |
92 | ||
4e5910e6 | 93 | #define SET_TUNER_POWER_REQ 0xBC |
3706a4da PB |
94 | /* IN i: 0 = power off, 1 = power on */ |
95 | ||
4e5910e6 | 96 | #define WRITE_TUNER_REG_REQ 0xBD |
3706a4da PB |
97 | /* IN i: register, v: value to write, no extra buffer */ |
98 | ||
4e5910e6 | 99 | #define RESET_TUNER 0xBE |
3706a4da PB |
100 | /* IN i: 0, v: 0, no extra buffer */ |
101 | ||
1c6410f3 | 102 | struct vp702x_device_state { |
1c6410f3 FM |
103 | struct mutex buf_mutex; |
104 | int buf_len; | |
105 | u8 *buf; | |
106 | }; | |
107 | ||
108 | ||
3706a4da PB |
109 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); |
110 | ||
111 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); | |
3706a4da | 112 | extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); |
3706a4da PB |
113 | |
114 | #endif |