18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* Linux driver for devices based on the DiBcom DiB0700 USB bridge 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2005-6 DiBcom, SA 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef _DIB0700_H_ 78c2ecf20Sopenharmony_ci#define _DIB0700_H_ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define DVB_USB_LOG_PREFIX "dib0700" 108c2ecf20Sopenharmony_ci#include "dvb-usb.h" 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "dib07x0.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciextern int dvb_usb_dib0700_debug; 158c2ecf20Sopenharmony_ci#define deb_info(args...) dprintk(dvb_usb_dib0700_debug,0x01,args) 168c2ecf20Sopenharmony_ci#define deb_fw(args...) dprintk(dvb_usb_dib0700_debug,0x02,args) 178c2ecf20Sopenharmony_ci#define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args) 188c2ecf20Sopenharmony_ci#define deb_data(args...) dprintk(dvb_usb_dib0700_debug,0x08,args) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define REQUEST_SET_USB_XFER_LEN 0x0 /* valid only for firmware version */ 218c2ecf20Sopenharmony_ci /* higher than 1.21 */ 228c2ecf20Sopenharmony_ci#define REQUEST_I2C_READ 0x2 238c2ecf20Sopenharmony_ci#define REQUEST_I2C_WRITE 0x3 248c2ecf20Sopenharmony_ci#define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */ 258c2ecf20Sopenharmony_ci#define REQUEST_JUMPRAM 0x8 268c2ecf20Sopenharmony_ci#define REQUEST_SET_CLOCK 0xB 278c2ecf20Sopenharmony_ci#define REQUEST_SET_GPIO 0xC 288c2ecf20Sopenharmony_ci#define REQUEST_ENABLE_VIDEO 0xF 298c2ecf20Sopenharmony_ci // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog) 308c2ecf20Sopenharmony_ci // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1) 318c2ecf20Sopenharmony_ci // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " ) 328c2ecf20Sopenharmony_ci#define REQUEST_SET_I2C_PARAM 0x10 338c2ecf20Sopenharmony_ci#define REQUEST_SET_RC 0x11 348c2ecf20Sopenharmony_ci#define REQUEST_NEW_I2C_READ 0x12 358c2ecf20Sopenharmony_ci#define REQUEST_NEW_I2C_WRITE 0x13 368c2ecf20Sopenharmony_ci#define REQUEST_GET_VERSION 0x15 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistruct dib0700_state { 398c2ecf20Sopenharmony_ci u8 channel_state; 408c2ecf20Sopenharmony_ci u16 mt2060_if1[2]; 418c2ecf20Sopenharmony_ci u8 rc_toggle; 428c2ecf20Sopenharmony_ci u8 rc_counter; 438c2ecf20Sopenharmony_ci u8 is_dib7000pc; 448c2ecf20Sopenharmony_ci u8 fw_use_new_i2c_api; 458c2ecf20Sopenharmony_ci u8 disable_streaming_master_mode; 468c2ecf20Sopenharmony_ci u32 fw_version; 478c2ecf20Sopenharmony_ci u32 nb_packet_buffer_size; 488c2ecf20Sopenharmony_ci int (*read_status)(struct dvb_frontend *, enum fe_status *); 498c2ecf20Sopenharmony_ci int (*sleep)(struct dvb_frontend* fe); 508c2ecf20Sopenharmony_ci u8 buf[255]; 518c2ecf20Sopenharmony_ci struct i2c_client *i2c_client_demod; 528c2ecf20Sopenharmony_ci struct i2c_client *i2c_client_tuner; 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciint dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, 568c2ecf20Sopenharmony_ci u32 *romversion, u32 *ramversion, u32 *fwtype); 578c2ecf20Sopenharmony_ciint dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, 588c2ecf20Sopenharmony_ci u8 gpio_dir, u8 gpio_val); 598c2ecf20Sopenharmony_ciint dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); 608c2ecf20Sopenharmony_ciint dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, 618c2ecf20Sopenharmony_ci u8 rxlen); 628c2ecf20Sopenharmony_ciint dib0700_download_firmware(struct usb_device *d, 638c2ecf20Sopenharmony_ci const struct firmware *fw); 648c2ecf20Sopenharmony_ciint dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf); 658c2ecf20Sopenharmony_ciint dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); 668c2ecf20Sopenharmony_ciint dib0700_identify_state(struct usb_device *d, 678c2ecf20Sopenharmony_ci const struct dvb_usb_device_properties *props, 688c2ecf20Sopenharmony_ci const struct dvb_usb_device_description **desc, 698c2ecf20Sopenharmony_ci int *cold); 708c2ecf20Sopenharmony_ciint dib0700_change_protocol(struct rc_dev *dev, u64 *rc_proto); 718c2ecf20Sopenharmony_ciint dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciextern struct i2c_algorithm dib0700_i2c_algo; 748c2ecf20Sopenharmony_ciextern int dib0700_device_count; 758c2ecf20Sopenharmony_ciextern int dvb_usb_dib0700_ir_proto; 768c2ecf20Sopenharmony_ciextern struct dvb_usb_device_properties dib0700_devices[]; 778c2ecf20Sopenharmony_ciextern struct usb_device_id dib0700_usb_id_table[]; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#endif 80