Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1 | /* Linux driver for devices based on the DiBcom DiB0700 USB bridge |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify it |
| 4 | * under the terms of the GNU General Public License as published by the Free |
| 5 | * Software Foundation, version 2. |
| 6 | * |
| 7 | * Copyright (C) 2005-6 DiBcom, SA |
| 8 | */ |
| 9 | #ifndef _DIB0700_H_ |
| 10 | #define _DIB0700_H_ |
| 11 | |
| 12 | #define DVB_USB_LOG_PREFIX "dib0700" |
| 13 | #include "dvb-usb.h" |
| 14 | |
| 15 | #include "dib07x0.h" |
| 16 | |
| 17 | extern int dvb_usb_dib0700_debug; |
| 18 | #define deb_info(args...) dprintk(dvb_usb_dib0700_debug,0x01,args) |
| 19 | #define deb_fw(args...) dprintk(dvb_usb_dib0700_debug,0x02,args) |
| 20 | #define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args) |
| 21 | #define deb_data(args...) dprintk(dvb_usb_dib0700_debug,0x08,args) |
| 22 | |
Olivier Grenie | acc5c9e | 2009-12-07 08:22:53 -0300 | [diff] [blame] | 23 | #define REQUEST_SET_USB_XFER_LEN 0x0 /* valid only for firmware version */ |
| 24 | /* higher than 1.21 */ |
| 25 | #define REQUEST_I2C_READ 0x2 |
| 26 | #define REQUEST_I2C_WRITE 0x3 |
| 27 | #define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */ |
| 28 | #define REQUEST_JUMPRAM 0x8 |
| 29 | #define REQUEST_SET_CLOCK 0xB |
| 30 | #define REQUEST_SET_GPIO 0xC |
| 31 | #define REQUEST_ENABLE_VIDEO 0xF |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 32 | // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog) |
| 33 | // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1) |
| 34 | // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " ) |
Olivier Grenie | 7757ddd | 2011-01-03 15:30:14 -0300 | [diff] [blame] | 35 | #define REQUEST_SET_I2C_PARAM 0x10 |
Olivier Grenie | acc5c9e | 2009-12-07 08:22:53 -0300 | [diff] [blame] | 36 | #define REQUEST_SET_RC 0x11 |
| 37 | #define REQUEST_NEW_I2C_READ 0x12 |
| 38 | #define REQUEST_NEW_I2C_WRITE 0x13 |
| 39 | #define REQUEST_GET_VERSION 0x15 |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 40 | |
| 41 | struct dib0700_state { |
| 42 | u8 channel_state; |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 43 | u16 mt2060_if1[2]; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 44 | u8 rc_toggle; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 45 | u8 rc_counter; |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 46 | u8 is_dib7000pc; |
Devin Heitmueller | bdc203e | 2008-09-06 13:45:27 -0300 | [diff] [blame] | 47 | u8 fw_use_new_i2c_api; |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 48 | u8 disable_streaming_master_mode; |
Olivier Grenie | ffa5899 | 2011-03-24 09:32:26 -0300 | [diff] [blame] | 49 | u32 fw_version; |
| 50 | u32 nb_packet_buffer_size; |
Jiri Slaby | d43272a | 2012-01-10 14:11:25 -0300 | [diff] [blame] | 51 | int (*read_status)(struct dvb_frontend *, fe_status_t *); |
| 52 | int (*sleep)(struct dvb_frontend* fe); |
Olivier Grenie | ffa5899 | 2011-03-24 09:32:26 -0300 | [diff] [blame] | 53 | u8 buf[255]; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 54 | }; |
| 55 | |
Devin Heitmueller | 99afb98 | 2008-11-15 07:13:07 -0300 | [diff] [blame] | 56 | extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion, |
| 57 | u32 *romversion, u32 *ramversion, u32 *fwtype); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 58 | extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 59 | extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3); |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 60 | extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 61 | extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw); |
Mauro Carvalho Chehab | c4018fa | 2014-05-21 17:40:25 -0300 | [diff] [blame] | 62 | extern int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 63 | extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); |
| 64 | extern struct i2c_algorithm dib0700_i2c_algo; |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 65 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
| 66 | struct dvb_usb_device_description **desc, int *cold); |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 67 | extern int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_type); |
Olivier Grenie | 7757ddd | 2011-01-03 15:30:14 -0300 | [diff] [blame] | 68 | extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 69 | |
| 70 | extern int dib0700_device_count; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 71 | extern int dvb_usb_dib0700_ir_proto; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 72 | extern struct dvb_usb_device_properties dib0700_devices[]; |
| 73 | extern struct usb_device_id dib0700_usb_id_table[]; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 74 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 75 | #endif |