1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2786baecfSMauro Carvalho Chehab #ifndef _DVB_USB_VP7021_H_ 3786baecfSMauro Carvalho Chehab #define _DVB_USB_VP7021_H_ 4786baecfSMauro Carvalho Chehab 5786baecfSMauro Carvalho Chehab #define DVB_USB_LOG_PREFIX "vp702x" 6786baecfSMauro Carvalho Chehab #include "dvb-usb.h" 7786baecfSMauro Carvalho Chehab 8786baecfSMauro Carvalho Chehab extern int dvb_usb_vp702x_debug; 9786baecfSMauro Carvalho Chehab #define deb_info(args...) dprintk(dvb_usb_vp702x_debug,0x01,args) 10786baecfSMauro Carvalho Chehab #define deb_xfer(args...) dprintk(dvb_usb_vp702x_debug,0x02,args) 11786baecfSMauro Carvalho Chehab #define deb_rc(args...) dprintk(dvb_usb_vp702x_debug,0x04,args) 12786baecfSMauro Carvalho Chehab #define deb_fe(args...) dprintk(dvb_usb_vp702x_debug,0x08,args) 13786baecfSMauro Carvalho Chehab 14786baecfSMauro Carvalho Chehab /* commands are read and written with USB control messages */ 15786baecfSMauro Carvalho Chehab 16786baecfSMauro Carvalho Chehab /* consecutive read/write operation */ 17786baecfSMauro Carvalho Chehab #define REQUEST_OUT 0xB2 18786baecfSMauro Carvalho Chehab #define REQUEST_IN 0xB3 19786baecfSMauro Carvalho Chehab 20786baecfSMauro Carvalho Chehab /* the out-buffer of these consecutive operations contain sub-commands when b[0] = 0 21786baecfSMauro Carvalho Chehab * request: 0xB2; i: 0; v: 0; b[0] = 0, b[1] = subcmd, additional buffer 22786baecfSMauro Carvalho Chehab * the returning buffer looks as follows 23786baecfSMauro Carvalho Chehab * request: 0xB3; i: 0; v: 0; b[0] = 0xB3, additional buffer */ 24786baecfSMauro Carvalho Chehab 25786baecfSMauro Carvalho Chehab #define GET_TUNER_STATUS 0x05 26786baecfSMauro Carvalho Chehab /* additional in buffer: 27786baecfSMauro Carvalho Chehab * 0 1 2 3 4 5 6 7 8 28786baecfSMauro Carvalho Chehab * N/A N/A 0x05 signal-quality N/A N/A signal-strength lock==0 N/A */ 29786baecfSMauro Carvalho Chehab 30786baecfSMauro Carvalho Chehab #define GET_SYSTEM_STRING 0x06 31786baecfSMauro Carvalho Chehab /* additional in buffer: 32786baecfSMauro Carvalho Chehab * 0 1 2 3 4 5 6 7 8 33786baecfSMauro Carvalho Chehab * N/A 'U' 'S' 'B' '7' '0' '2' 'X' N/A */ 34786baecfSMauro Carvalho Chehab 35786baecfSMauro Carvalho Chehab #define SET_DISEQC_CMD 0x08 36786baecfSMauro Carvalho Chehab /* additional out buffer: 37786baecfSMauro Carvalho Chehab * 0 1 2 3 4 38786baecfSMauro Carvalho Chehab * len X1 X2 X3 X4 39786baecfSMauro Carvalho Chehab * additional in buffer: 40786baecfSMauro Carvalho Chehab * 0 1 2 41786baecfSMauro Carvalho Chehab * N/A 0 0 b[1] == b[2] == 0 -> success, failure otherwise */ 42786baecfSMauro Carvalho Chehab 43786baecfSMauro Carvalho Chehab #define SET_LNB_POWER 0x09 44786baecfSMauro Carvalho Chehab /* additional out buffer: 45786baecfSMauro Carvalho Chehab * 0 1 2 46786baecfSMauro Carvalho Chehab * 0x00 0xff 1 = on, 0 = off 47786baecfSMauro Carvalho Chehab * additional in buffer: 48786baecfSMauro Carvalho Chehab * 0 1 2 49786baecfSMauro Carvalho Chehab * N/A 0 0 b[1] == b[2] == 0 -> success failure otherwise */ 50786baecfSMauro Carvalho Chehab 51786baecfSMauro Carvalho Chehab #define GET_MAC_ADDRESS 0x0A 52786baecfSMauro Carvalho Chehab /* #define GET_MAC_ADDRESS 0x0B */ 53786baecfSMauro Carvalho Chehab /* additional in buffer: 54786baecfSMauro Carvalho Chehab * 0 1 2 3 4 5 6 7 8 55786baecfSMauro Carvalho Chehab * N/A N/A 0x0A or 0x0B MAC0 MAC1 MAC2 MAC3 MAC4 MAC5 */ 56786baecfSMauro Carvalho Chehab 57786baecfSMauro Carvalho Chehab #define SET_PID_FILTER 0x11 58786baecfSMauro Carvalho Chehab /* additional in buffer: 59786baecfSMauro Carvalho Chehab * 0 1 ... 14 15 16 60786baecfSMauro Carvalho Chehab * PID0_MSB PID0_LSB ... PID7_MSB PID7_LSB PID_active (bits) */ 61786baecfSMauro Carvalho Chehab 62786baecfSMauro Carvalho Chehab /* request: 0xB2; i: 0; v: 0; 63786baecfSMauro Carvalho Chehab * b[0] != 0 -> tune and lock a channel 64786baecfSMauro Carvalho Chehab * 0 1 2 3 4 5 6 7 65786baecfSMauro Carvalho Chehab * freq0 freq1 divstep srate0 srate1 srate2 flag chksum 66786baecfSMauro Carvalho Chehab */ 67786baecfSMauro Carvalho Chehab 68786baecfSMauro Carvalho Chehab /* one direction requests */ 69786baecfSMauro Carvalho Chehab #define READ_REMOTE_REQ 0xB4 70786baecfSMauro Carvalho Chehab /* IN i: 0; v: 0; b[0] == request, b[1] == key */ 71786baecfSMauro Carvalho Chehab 72786baecfSMauro Carvalho Chehab #define READ_PID_NUMBER_REQ 0xB5 73786baecfSMauro Carvalho Chehab /* IN i: 0; v: 0; b[0] == request, b[1] == 0, b[2] = pid number */ 74786baecfSMauro Carvalho Chehab 75786baecfSMauro Carvalho Chehab #define WRITE_EEPROM_REQ 0xB6 76786baecfSMauro Carvalho Chehab /* OUT i: offset; v: value to write; no extra buffer */ 77786baecfSMauro Carvalho Chehab 78786baecfSMauro Carvalho Chehab #define READ_EEPROM_REQ 0xB7 79786baecfSMauro Carvalho Chehab /* IN i: bufferlen; v: offset; buffer with bufferlen bytes */ 80786baecfSMauro Carvalho Chehab 81786baecfSMauro Carvalho Chehab #define READ_STATUS 0xB8 82786baecfSMauro Carvalho Chehab /* IN i: 0; v: 0; bufferlen 10 */ 83786baecfSMauro Carvalho Chehab 84786baecfSMauro Carvalho Chehab #define READ_TUNER_REG_REQ 0xB9 85786baecfSMauro Carvalho Chehab /* IN i: 0; v: register; b[0] = value */ 86786baecfSMauro Carvalho Chehab 87786baecfSMauro Carvalho Chehab #define READ_FX2_REG_REQ 0xBA 88786baecfSMauro Carvalho Chehab /* IN i: offset; v: 0; b[0] = value */ 89786baecfSMauro Carvalho Chehab 90786baecfSMauro Carvalho Chehab #define WRITE_FX2_REG_REQ 0xBB 91786baecfSMauro Carvalho Chehab /* OUT i: offset; v: value to write; 1 byte extra buffer */ 92786baecfSMauro Carvalho Chehab 93786baecfSMauro Carvalho Chehab #define SET_TUNER_POWER_REQ 0xBC 94786baecfSMauro Carvalho Chehab /* IN i: 0 = power off, 1 = power on */ 95786baecfSMauro Carvalho Chehab 96786baecfSMauro Carvalho Chehab #define WRITE_TUNER_REG_REQ 0xBD 97786baecfSMauro Carvalho Chehab /* IN i: register, v: value to write, no extra buffer */ 98786baecfSMauro Carvalho Chehab 99786baecfSMauro Carvalho Chehab #define RESET_TUNER 0xBE 100786baecfSMauro Carvalho Chehab /* IN i: 0, v: 0, no extra buffer */ 101786baecfSMauro Carvalho Chehab 102786baecfSMauro Carvalho Chehab struct vp702x_device_state { 103786baecfSMauro Carvalho Chehab struct mutex buf_mutex; 104786baecfSMauro Carvalho Chehab int buf_len; 105786baecfSMauro Carvalho Chehab u8 *buf; 106786baecfSMauro Carvalho Chehab }; 107786baecfSMauro Carvalho Chehab 108786baecfSMauro Carvalho Chehab 109786baecfSMauro Carvalho Chehab extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); 110786baecfSMauro Carvalho Chehab 111786baecfSMauro Carvalho Chehab extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); 112786baecfSMauro Carvalho Chehab extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); 113786baecfSMauro Carvalho Chehab 114786baecfSMauro Carvalho Chehab #endif 115