1786baecfSMauro Carvalho Chehab /* Header file for all dibusb-based-receivers. 2786baecfSMauro Carvalho Chehab * 3786baecfSMauro Carvalho Chehab * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 4786baecfSMauro Carvalho Chehab * 5786baecfSMauro Carvalho Chehab * This program is free software; you can redistribute it and/or modify it 6786baecfSMauro Carvalho Chehab * under the terms of the GNU General Public License as published by the Free 7786baecfSMauro Carvalho Chehab * Software Foundation, version 2. 8786baecfSMauro Carvalho Chehab * 9786baecfSMauro Carvalho Chehab * see Documentation/dvb/README.dvb-usb for more information 10786baecfSMauro Carvalho Chehab */ 11786baecfSMauro Carvalho Chehab #ifndef _DVB_USB_DIBUSB_H_ 12786baecfSMauro Carvalho Chehab #define _DVB_USB_DIBUSB_H_ 13786baecfSMauro Carvalho Chehab 14786baecfSMauro Carvalho Chehab #ifndef DVB_USB_LOG_PREFIX 15786baecfSMauro Carvalho Chehab #define DVB_USB_LOG_PREFIX "dibusb" 16786baecfSMauro Carvalho Chehab #endif 17786baecfSMauro Carvalho Chehab #include "dvb-usb.h" 18786baecfSMauro Carvalho Chehab 19786baecfSMauro Carvalho Chehab #include "dib3000.h" 20786baecfSMauro Carvalho Chehab #include "dib3000mc.h" 21786baecfSMauro Carvalho Chehab #include "mt2060.h" 22786baecfSMauro Carvalho Chehab 23786baecfSMauro Carvalho Chehab /* 24786baecfSMauro Carvalho Chehab * protocol of all dibusb related devices 25786baecfSMauro Carvalho Chehab */ 26786baecfSMauro Carvalho Chehab 27786baecfSMauro Carvalho Chehab /* 28786baecfSMauro Carvalho Chehab * bulk msg to/from endpoint 0x01 29786baecfSMauro Carvalho Chehab * 30786baecfSMauro Carvalho Chehab * general structure: 31786baecfSMauro Carvalho Chehab * request_byte parameter_bytes 32786baecfSMauro Carvalho Chehab */ 33786baecfSMauro Carvalho Chehab 34786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_START_READ 0x00 35786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_START_DEMOD 0x01 36786baecfSMauro Carvalho Chehab 37786baecfSMauro Carvalho Chehab /* 38786baecfSMauro Carvalho Chehab * i2c read 39*ad86faadSRaimonds Cicans * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word 40786baecfSMauro Carvalho Chehab * bulk read: byte_buffer (length_word bytes) 41786baecfSMauro Carvalho Chehab */ 42786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_I2C_READ 0x02 43786baecfSMauro Carvalho Chehab 44786baecfSMauro Carvalho Chehab /* 45786baecfSMauro Carvalho Chehab * i2c write 46786baecfSMauro Carvalho Chehab * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes 47786baecfSMauro Carvalho Chehab */ 48786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_I2C_WRITE 0x03 49786baecfSMauro Carvalho Chehab 50786baecfSMauro Carvalho Chehab /* 51786baecfSMauro Carvalho Chehab * polling the value of the remote control 52786baecfSMauro Carvalho Chehab * bulk write: 0x04 53786baecfSMauro Carvalho Chehab * bulk read: byte_buffer (5 bytes) 54786baecfSMauro Carvalho Chehab */ 55786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_POLL_REMOTE 0x04 56786baecfSMauro Carvalho Chehab 57786baecfSMauro Carvalho Chehab /* additional status values for Hauppauge Remote Control Protocol */ 58786baecfSMauro Carvalho Chehab #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01 59786baecfSMauro Carvalho Chehab #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 60786baecfSMauro Carvalho Chehab 61786baecfSMauro Carvalho Chehab /* streaming mode: 62786baecfSMauro Carvalho Chehab * bulk write: 0x05 mode_byte 63786baecfSMauro Carvalho Chehab * 64786baecfSMauro Carvalho Chehab * mode_byte is mostly 0x00 65786baecfSMauro Carvalho Chehab */ 66786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 67786baecfSMauro Carvalho Chehab 68786baecfSMauro Carvalho Chehab /* interrupt the internal read loop, when blocking */ 69786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_INTR_READ 0x06 70786baecfSMauro Carvalho Chehab 71786baecfSMauro Carvalho Chehab /* io control 72786baecfSMauro Carvalho Chehab * 0x07 cmd_byte param_bytes 73786baecfSMauro Carvalho Chehab * 74786baecfSMauro Carvalho Chehab * param_bytes can be up to 32 bytes 75786baecfSMauro Carvalho Chehab * 76786baecfSMauro Carvalho Chehab * cmd_byte function parameter name 77786baecfSMauro Carvalho Chehab * 0x00 power mode 78786baecfSMauro Carvalho Chehab * 0x00 sleep 79786baecfSMauro Carvalho Chehab * 0x01 wakeup 80786baecfSMauro Carvalho Chehab * 81786baecfSMauro Carvalho Chehab * 0x01 enable streaming 82786baecfSMauro Carvalho Chehab * 0x02 disable streaming 83786baecfSMauro Carvalho Chehab * 84786baecfSMauro Carvalho Chehab * 85786baecfSMauro Carvalho Chehab */ 86786baecfSMauro Carvalho Chehab #define DIBUSB_REQ_SET_IOCTL 0x07 87786baecfSMauro Carvalho Chehab 88786baecfSMauro Carvalho Chehab /* IOCTL commands */ 89786baecfSMauro Carvalho Chehab 90786baecfSMauro Carvalho Chehab /* change the power mode in firmware */ 91786baecfSMauro Carvalho Chehab #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 92786baecfSMauro Carvalho Chehab #define DIBUSB_IOCTL_POWER_SLEEP 0x00 93786baecfSMauro Carvalho Chehab #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 94786baecfSMauro Carvalho Chehab 95786baecfSMauro Carvalho Chehab /* modify streaming of the FX2 */ 96786baecfSMauro Carvalho Chehab #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 97786baecfSMauro Carvalho Chehab #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 98786baecfSMauro Carvalho Chehab 99786baecfSMauro Carvalho Chehab struct dibusb_state { 100786baecfSMauro Carvalho Chehab struct dib_fe_xfer_ops ops; 101786baecfSMauro Carvalho Chehab int mt2060_present; 102786baecfSMauro Carvalho Chehab u8 tuner_addr; 103786baecfSMauro Carvalho Chehab }; 104786baecfSMauro Carvalho Chehab 105786baecfSMauro Carvalho Chehab struct dibusb_device_state { 106786baecfSMauro Carvalho Chehab /* for RC5 remote control */ 107786baecfSMauro Carvalho Chehab int old_toggle; 108786baecfSMauro Carvalho Chehab int last_repeat_count; 109786baecfSMauro Carvalho Chehab }; 110786baecfSMauro Carvalho Chehab 111786baecfSMauro Carvalho Chehab extern struct i2c_algorithm dibusb_i2c_algo; 112786baecfSMauro Carvalho Chehab 113786baecfSMauro Carvalho Chehab extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *); 114786baecfSMauro Carvalho Chehab extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *); 115786baecfSMauro Carvalho Chehab 116786baecfSMauro Carvalho Chehab extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int); 117786baecfSMauro Carvalho Chehab extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int); 118786baecfSMauro Carvalho Chehab extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int); 119786baecfSMauro Carvalho Chehab extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int); 120786baecfSMauro Carvalho Chehab 121786baecfSMauro Carvalho Chehab extern int dibusb_power_ctrl(struct dvb_usb_device *, int); 122786baecfSMauro Carvalho Chehab extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); 123786baecfSMauro Carvalho Chehab 124786baecfSMauro Carvalho Chehab #define DEFAULT_RC_INTERVAL 150 125786baecfSMauro Carvalho Chehab //#define DEFAULT_RC_INTERVAL 100000 126786baecfSMauro Carvalho Chehab 127786baecfSMauro Carvalho Chehab extern struct rc_map_table rc_map_dibusb_table[]; 128786baecfSMauro Carvalho Chehab extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); 129786baecfSMauro Carvalho Chehab extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); 130786baecfSMauro Carvalho Chehab 131786baecfSMauro Carvalho Chehab #endif 132