treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / usb / dvb-usb / dibusb.h
bloba83326c36ca7d93ee45bed4537d98fbccc80d16b
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Header file for all dibusb-based-receivers.
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
6 * see Documentation/media/dvb-drivers/dvb-usb.rst for more information
7 */
8 #ifndef _DVB_USB_DIBUSB_H_
9 #define _DVB_USB_DIBUSB_H_
11 #ifndef DVB_USB_LOG_PREFIX
12 #define DVB_USB_LOG_PREFIX "dibusb"
13 #endif
14 #include "dvb-usb.h"
16 #include "dib3000.h"
17 #include "dib3000mc.h"
18 #include "mt2060.h"
21 * protocol of all dibusb related devices
25 * bulk msg to/from endpoint 0x01
27 * general structure:
28 * request_byte parameter_bytes
31 #define DIBUSB_REQ_START_READ 0x00
32 #define DIBUSB_REQ_START_DEMOD 0x01
35 * i2c read
36 * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word
37 * bulk read: byte_buffer (length_word bytes)
39 #define DIBUSB_REQ_I2C_READ 0x02
42 * i2c write
43 * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
45 #define DIBUSB_REQ_I2C_WRITE 0x03
48 * polling the value of the remote control
49 * bulk write: 0x04
50 * bulk read: byte_buffer (5 bytes)
52 #define DIBUSB_REQ_POLL_REMOTE 0x04
54 /* additional status values for Hauppauge Remote Control Protocol */
55 #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
56 #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03
58 /* streaming mode:
59 * bulk write: 0x05 mode_byte
61 * mode_byte is mostly 0x00
63 #define DIBUSB_REQ_SET_STREAMING_MODE 0x05
65 /* interrupt the internal read loop, when blocking */
66 #define DIBUSB_REQ_INTR_READ 0x06
68 /* io control
69 * 0x07 cmd_byte param_bytes
71 * param_bytes can be up to 32 bytes
73 * cmd_byte function parameter name
74 * 0x00 power mode
75 * 0x00 sleep
76 * 0x01 wakeup
78 * 0x01 enable streaming
79 * 0x02 disable streaming
83 #define DIBUSB_REQ_SET_IOCTL 0x07
85 /* IOCTL commands */
87 /* change the power mode in firmware */
88 #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00
89 #define DIBUSB_IOCTL_POWER_SLEEP 0x00
90 #define DIBUSB_IOCTL_POWER_WAKEUP 0x01
92 /* modify streaming of the FX2 */
93 #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
94 #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
96 /* Max transfer size done by I2C transfer functions */
97 #define MAX_XFER_SIZE 64
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 rc_map_table rc_map_dibusb_table[];
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