Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
0003  *
0004  *  Copyright (C) 2005-6 DiBcom, SA
0005  */
0006 #ifndef _DIB0700_H_
0007 #define _DIB0700_H_
0008 
0009 #define DVB_USB_LOG_PREFIX "dib0700"
0010 #include "dvb-usb.h"
0011 
0012 #include "dib07x0.h"
0013 
0014 extern int dvb_usb_dib0700_debug;
0015 #define deb_info(args...)   dprintk(dvb_usb_dib0700_debug,0x01,args)
0016 #define deb_fw(args...)     dprintk(dvb_usb_dib0700_debug,0x02,args)
0017 #define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args)
0018 #define deb_data(args...)   dprintk(dvb_usb_dib0700_debug,0x08,args)
0019 
0020 #define REQUEST_SET_USB_XFER_LEN    0x0 /* valid only for firmware version */
0021                     /* higher than 1.21 */
0022 #define REQUEST_I2C_READ            0x2
0023 #define REQUEST_I2C_WRITE           0x3
0024 #define REQUEST_POLL_RC             0x4 /* deprecated in firmware v1.20 */
0025 #define REQUEST_JUMPRAM             0x8
0026 #define REQUEST_SET_CLOCK           0xB
0027 #define REQUEST_SET_GPIO            0xC
0028 #define REQUEST_ENABLE_VIDEO        0xF
0029     // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog)
0030     // 2 Byte: MPEG2 mode:  4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1)
0031     // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines)    4LSB(     "                "           )
0032 #define REQUEST_SET_I2C_PARAM       0x10
0033 #define REQUEST_SET_RC              0x11
0034 #define REQUEST_NEW_I2C_READ        0x12
0035 #define REQUEST_NEW_I2C_WRITE       0x13
0036 #define REQUEST_GET_VERSION         0x15
0037 
0038 struct dib0700_state {
0039     u8 channel_state;
0040     u16 mt2060_if1[2];
0041     u8 rc_toggle;
0042     u8 rc_counter;
0043     u8 is_dib7000pc;
0044     u8 fw_use_new_i2c_api;
0045     u8 disable_streaming_master_mode;
0046     u32 fw_version;
0047     u32 nb_packet_buffer_size;
0048     int (*read_status)(struct dvb_frontend *, enum fe_status *);
0049     int (*sleep)(struct dvb_frontend* fe);
0050     u8 buf[255];
0051     struct i2c_client *i2c_client_demod;
0052     struct i2c_client *i2c_client_tuner;
0053 };
0054 
0055 int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
0056             u32 *romversion, u32 *ramversion, u32 *fwtype);
0057 int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio,
0058              u8 gpio_dir, u8 gpio_val);
0059 int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
0060 int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx,
0061             u8 rxlen);
0062 int dib0700_download_firmware(struct usb_device *d,
0063                   const struct firmware *fw);
0064 int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf);
0065 int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
0066 int dib0700_identify_state(struct usb_device *d,
0067                const struct dvb_usb_device_properties *props,
0068                const struct dvb_usb_device_description **desc,
0069                int *cold);
0070 int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_proto);
0071 int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz);
0072 
0073 extern struct i2c_algorithm dib0700_i2c_algo;
0074 extern int dib0700_device_count;
0075 extern int dvb_usb_dib0700_ir_proto;
0076 extern struct dvb_usb_device_properties dib0700_devices[];
0077 extern struct usb_device_id dib0700_usb_id_table[];
0078 
0079 #endif