Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / drivers / media / dvb / dvb-usb / dibusb.h
blob8e847aa73ba1af1e8db007c5f85d10abbf8a79a0
1 /* Header file for all dibusb-based-receivers.
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation, version 2.
9 * see Documentation/dvb/README.dvb-usb for more information
11 #ifndef _DVB_USB_DIBUSB_H_
12 #define _DVB_USB_DIBUSB_H_
14 #ifndef DVB_USB_LOG_PREFIX
15 #define DVB_USB_LOG_PREFIX "dibusb"
16 #endif
17 #include "dvb-usb.h"
19 #include "dib3000.h"
20 #include "dib3000mc.h"
21 #include "mt2060.h"
24 * protocol of all dibusb related devices
28 * bulk msg to/from endpoint 0x01
30 * general structure:
31 * request_byte parameter_bytes
34 #define DIBUSB_REQ_START_READ 0x00
35 #define DIBUSB_REQ_START_DEMOD 0x01
38 * i2c read
39 * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word
40 * bulk read: byte_buffer (length_word bytes)
42 #define DIBUSB_REQ_I2C_READ 0x02
45 * i2c write
46 * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
48 #define DIBUSB_REQ_I2C_WRITE 0x03
51 * polling the value of the remote control
52 * bulk write: 0x04
53 * bulk read: byte_buffer (5 bytes)
55 #define DIBUSB_REQ_POLL_REMOTE 0x04
57 /* additional status values for Hauppauge Remote Control Protocol */
58 #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
59 #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
61 /* streaming mode:
62 * bulk write: 0x05 mode_byte
64 * mode_byte is mostly 0x00
66 #define DIBUSB_REQ_SET_STREAMING_MODE 0x05
68 /* interrupt the internal read loop, when blocking */
69 #define DIBUSB_REQ_INTR_READ 0x06
71 /* io control
72 * 0x07 cmd_byte param_bytes
74 * param_bytes can be up to 32 bytes
76 * cmd_byte function parameter name
77 * 0x00 power mode
78 * 0x00 sleep
79 * 0x01 wakeup
81 * 0x01 enable streaming
82 * 0x02 disable streaming
86 #define DIBUSB_REQ_SET_IOCTL 0x07
88 /* IOCTL commands */
90 /* change the power mode in firmware */
91 #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
92 #define DIBUSB_IOCTL_POWER_SLEEP 0x00
93 #define DIBUSB_IOCTL_POWER_WAKEUP 0x01
95 /* modify streaming of the FX2 */
96 #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
97 #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
99 struct dibusb_state {
100 struct dib_fe_xfer_ops ops;
101 int mt2060_present;
102 u8 tuner_addr;
105 struct dibusb_device_state {
106 /* for RC5 remote control */
107 int old_toggle;
108 int last_repeat_count;
111 extern struct i2c_algorithm dibusb_i2c_algo;
113 extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
114 extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
116 extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
117 extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
118 extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
119 extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
121 extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
122 extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
124 #define DEFAULT_RC_INTERVAL 150
125 //#define DEFAULT_RC_INTERVAL 100000
127 extern struct dvb_usb_rc_key dibusb_rc_keys[];
128 extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
129 extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
131 #endif