2019-05-31 01:09:32 -07:00
/* SPDX-License-Identifier: GPL-2.0-only */
2006-09-19 12:51:37 -03:00
/* Linux driver for devices based on the DiBcom DiB0700 USB bridge
*
* Copyright ( C ) 2005 - 6 DiBcom , SA
*/
# ifndef _DIB0700_H_
# define _DIB0700_H_
# define DVB_USB_LOG_PREFIX "dib0700"
# include "dvb-usb.h"
# include "dib07x0.h"
extern int dvb_usb_dib0700_debug ;
# define deb_info(args...) dprintk(dvb_usb_dib0700_debug,0x01,args)
# define deb_fw(args...) dprintk(dvb_usb_dib0700_debug,0x02,args)
# define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args)
# define deb_data(args...) dprintk(dvb_usb_dib0700_debug,0x08,args)
2009-12-07 08:22:53 -03:00
# define REQUEST_SET_USB_XFER_LEN 0x0 /* valid only for firmware version */
/* higher than 1.21 */
# define REQUEST_I2C_READ 0x2
# define REQUEST_I2C_WRITE 0x3
# define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */
# define REQUEST_JUMPRAM 0x8
# define REQUEST_SET_CLOCK 0xB
# define REQUEST_SET_GPIO 0xC
# define REQUEST_ENABLE_VIDEO 0xF
2006-09-19 12:51:37 -03:00
// 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog)
// 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1)
// 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " )
2011-01-03 15:30:14 -03:00
# define REQUEST_SET_I2C_PARAM 0x10
2009-12-07 08:22:53 -03:00
# define REQUEST_SET_RC 0x11
# define REQUEST_NEW_I2C_READ 0x12
# define REQUEST_NEW_I2C_WRITE 0x13
# define REQUEST_GET_VERSION 0x15
2006-09-19 12:51:37 -03:00
struct dib0700_state {
u8 channel_state ;
2006-09-19 12:51:40 -03:00
u16 mt2060_if1 [ 2 ] ;
2007-07-25 14:42:54 -03:00
u8 rc_toggle ;
2008-03-29 21:37:01 -03:00
u8 rc_counter ;
2006-10-18 08:34:16 -03:00
u8 is_dib7000pc ;
2008-09-06 13:45:27 -03:00
u8 fw_use_new_i2c_api ;
2008-09-08 05:42:42 -03:00
u8 disable_streaming_master_mode ;
2011-03-24 09:32:26 -03:00
u32 fw_version ;
u32 nb_packet_buffer_size ;
2015-06-07 14:53:52 -03:00
int ( * read_status ) ( struct dvb_frontend * , enum fe_status * ) ;
2012-01-10 14:11:25 -03:00
int ( * sleep ) ( struct dvb_frontend * fe ) ;
2011-03-24 09:32:26 -03:00
u8 buf [ 255 ] ;
2017-11-23 03:24:46 -05:00
struct i2c_client * i2c_client_demod ;
struct i2c_client * i2c_client_tuner ;
2006-09-19 12:51:37 -03:00
} ;
2020-04-14 12:10:43 +02:00
int dib0700_get_version ( struct dvb_usb_device * d , u32 * hwversion ,
u32 * romversion , u32 * ramversion , u32 * fwtype ) ;
int dib0700_set_gpio ( struct dvb_usb_device * d , enum dib07x0_gpios gpio ,
u8 gpio_dir , u8 gpio_val ) ;
int dib0700_ctrl_clock ( struct dvb_usb_device * d , u32 clk_MHz , u8 clock_out_gp3 ) ;
int dib0700_ctrl_rd ( struct dvb_usb_device * d , u8 * tx , u8 txlen , u8 * rx ,
u8 rxlen ) ;
int dib0700_download_firmware ( struct usb_device * d ,
const struct firmware * fw ) ;
int dib0700_rc_setup ( struct dvb_usb_device * d , struct usb_interface * intf ) ;
int dib0700_streaming_ctrl ( struct dvb_usb_adapter * adap , int onoff ) ;
int dib0700_identify_state ( struct usb_device * d ,
const struct dvb_usb_device_properties * props ,
const struct dvb_usb_device_description * * desc ,
int * cold ) ;
int dib0700_change_protocol ( struct rc_dev * dev , u64 * rc_proto ) ;
int dib0700_set_i2c_speed ( struct dvb_usb_device * d , u16 scl_kHz ) ;
2006-09-19 12:51:37 -03:00
2020-04-14 12:10:43 +02:00
extern struct i2c_algorithm dib0700_i2c_algo ;
2006-09-19 12:51:37 -03:00
extern int dib0700_device_count ;
2008-03-29 21:37:01 -03:00
extern int dvb_usb_dib0700_ir_proto ;
2006-09-19 12:51:37 -03:00
extern struct dvb_usb_device_properties dib0700_devices [ ] ;
extern struct usb_device_id dib0700_usb_id_table [ ] ;
2008-03-29 21:37:01 -03:00
2006-09-19 12:51:37 -03:00
# endif