diff options
Diffstat (limited to 'linux/drivers/media/dvb/dibusb/dvb-dibusb.h')
-rw-r--r-- | linux/drivers/media/dvb/dibusb/dvb-dibusb.h | 138 |
1 files changed, 94 insertions, 44 deletions
diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h index 4e5acaf2b..9b54f5d4c 100644 --- a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h +++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h @@ -22,6 +22,7 @@ #include "dmxdev.h" #include "dib3000.h" +#include "mt352.h" /* debug */ #ifdef CONFIG_DVB_DIBCOM_DEBUG @@ -42,6 +43,11 @@ extern int debug; #define debug_dump(b,l) #endif +/* Version information */ +#define DRIVER_VERSION "0.3" +#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device" +#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" + /* module parameters - declared in -core.c */ extern int pid_parse; extern int rc_query_interval; @@ -58,55 +64,60 @@ extern int rc_query_interval; #define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg) -/* Version information */ -#define DRIVER_VERSION "0.1" -#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device" -#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" +struct dibusb_usb_controller { + const char *name; /* name of the usb controller */ + u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ +}; typedef enum { DIBUSB1_1 = 0, - DIBUSB2_0, DIBUSB1_1_AN2235, -} dibusb_type; - -/* struct for holding properties of the different dibusb device models */ -struct dibusb_device_parameter { - dibusb_type type; - const char **fw_filenames; - const char *usb_controller; - u16 usb_cpu_csreg; + DIBUSB2_0, + UMT2_0, +} dibusb_class_t; + +#define DIBUSB_POSSIBLE_I2C_ADDR_NUM 4 +struct dibusb_frontend_tuner_combi { + int (*pll_set) (struct dvb_frontend *,struct dvb_frontend_parameters *, u8 + pll_buf[5]); /* pll_set function callback */ + unsigned char pll_addr; /* tuner i2c address */ + unsigned char demod_i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ +}; + +struct dibusb_device_class { + dibusb_class_t id; + const struct dibusb_usb_controller *usb_ctrl; /* usb controller */ + + const char *firmware; /* valid firmware filenames */ + + int pipe_cmd; /* command pipe (read/write) */ + int pipe_data; /* data pipe */ + + int urb_count; /* number of data URBs to be submitted */ + int urb_buffer_size; /* the size of the buffer for each URB */ + +// struct dibusb_frontend_tuner_combi *fe_tuner; /* appropriate frontend and tuner combination */ - int num_urbs; - int urb_buf_size; - int default_size; - int firmware_bug; - - int cmd_pipe; - int result_pipe; - int data_pipe; - - int (*pll_set) (struct dvb_frontend *,struct dvb_frontend_parameters *); - unsigned char pll_addr; - unsigned char demod_i2c_addrs[4]; + int (*pll_set) (struct dvb_frontend *,struct dvb_frontend_parameters *); + u8 pll_addr; /* tuner i2c address */ + u8 demod_i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ }; -/* - * for each warm/cold product id a name is stored, this is just beautification, - * it could easily done by an PID-array, but then the real names of the devices - * would get lost. - */ -struct dibusb_device { - const char *name; - u16 cold_product_id; - u16 warm_product_id; - struct dibusb_device_parameter *parm; +#define DIBUSB_ID_MAX_NUM 15 +struct dibusb_usb_device { + const char *name; /* real name of the box */ + struct dibusb_device_class *dev_cl; /* which dibusb_device_class is this device part of */ + + struct usb_device_id *cold_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at pre firmware state */ + struct usb_device_id *warm_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */ }; + struct usb_dibusb { /* usb */ struct usb_device * udev; - struct dibusb_device * dibdev; + struct dibusb_usb_device * dibdev; #define DIBUSB_STATE_INIT 0x000 #define DIBUSB_STATE_URB_LIST 0x001 @@ -148,7 +159,7 @@ struct usb_dibusb { /* commonly used functions in the separated files */ /* dvb-dibusb-firmware.c */ -int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_device *dibdev); +int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev); /* dvb-dibusb-remote.c */ int dibusb_remote_exit(struct usb_dibusb *dib); @@ -179,31 +190,70 @@ int dibusb_urb_exit(struct usb_dibusb *dib); /* i2c and transfer stuff */ #define DIBUSB_I2C_TIMEOUT HZ*5 -/* - * types of first byte of each buffer send to USB, applying for - * USB1.1 and USB2.0 +/* + * protocol of all dibusb related devices + */ + +/* + * bulk msg to/from endpoint 0x01 + * + * general structure: + * request_byte parameter_bytes */ #define DIBUSB_REQ_START_READ 0x00 #define DIBUSB_REQ_START_DEMOD 0x01 + +/* + * i2c read + * bulk write: 0x02 (i2c_addr & 0x01) register_bytes length_word + * bulk read: byte_buffer (length_word bytes) + */ #define DIBUSB_REQ_I2C_READ 0x02 + +/* + * i2c write + * bulk write: 0x03 i2c_addr register_bytes value_bytes + */ #define DIBUSB_REQ_I2C_WRITE 0x03 -/* prefix for reading the current RC key */ +/* + * polling the value of the remote control + * bulk write: 0x04 + * bulk read: byte_buffer (5 bytes) + * + * first byte of byte_buffer shows the status (0x00, 0x01, 0x02) + */ #define DIBUSB_REQ_POLL_REMOTE 0x04 #define DIBUSB_RC_NEC_EMPTY 0x00 #define DIBUSB_RC_NEC_KEY_PRESSED 0x01 #define DIBUSB_RC_NEC_KEY_REPEATED 0x02 -/* 0x05 0xXX */ +/* streaming mode: + * bulk write: 0x05 mode_byte + * + * mode_byte is mostly 0x00 + */ #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 /* interrupt the internal read loop, when blocking */ #define DIBUSB_REQ_INTR_READ 0x06 -/* IO control - * 0x07 <cmd 1 byte> <param 32 bytes> +/* io control + * 0x07 cmd_byte param_bytes + * + * param_bytes can be up to 32 bytes + * + * cmd_byte function parameter name + * 0x00 power mode + * 0x00 sleep + * 0x01 wakeup + * + * 0x01 enable streaming + * 0x02 disable streaming + * + * */ #define DIBUSB_REQ_SET_IOCTL 0x07 |