Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* Header file for all dibusb-based-receivers.
0003  *
0004  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
0005  *
0006  * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
0007  */
0008 #ifndef _DVB_USB_DIBUSB_H_
0009 #define _DVB_USB_DIBUSB_H_
0010 
0011 #ifndef DVB_USB_LOG_PREFIX
0012  #define DVB_USB_LOG_PREFIX "dibusb"
0013 #endif
0014 #include "dvb-usb.h"
0015 
0016 #include "dib3000.h"
0017 #include "dib3000mc.h"
0018 #include "mt2060.h"
0019 
0020 /*
0021  * protocol of all dibusb related devices
0022  */
0023 
0024 /*
0025  * bulk msg to/from endpoint 0x01
0026  *
0027  * general structure:
0028  * request_byte parameter_bytes
0029  */
0030 
0031 #define DIBUSB_REQ_START_READ           0x00
0032 #define DIBUSB_REQ_START_DEMOD          0x01
0033 
0034 /*
0035  * i2c read
0036  * bulk write: 0x02 ((7bit i2c_addr << 1) | 0x01) register_bytes length_word
0037  * bulk read:  byte_buffer (length_word bytes)
0038  */
0039 #define DIBUSB_REQ_I2C_READ         0x02
0040 
0041 /*
0042  * i2c write
0043  * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes
0044  */
0045 #define DIBUSB_REQ_I2C_WRITE            0x03
0046 
0047 /*
0048  * polling the value of the remote control
0049  * bulk write: 0x04
0050  * bulk read:  byte_buffer (5 bytes)
0051  */
0052 #define DIBUSB_REQ_POLL_REMOTE       0x04
0053 
0054 /* additional status values for Hauppauge Remote Control Protocol */
0055 #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01
0056 #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY   0x03
0057 
0058 /* streaming mode:
0059  * bulk write: 0x05 mode_byte
0060  *
0061  * mode_byte is mostly 0x00
0062  */
0063 #define DIBUSB_REQ_SET_STREAMING_MODE   0x05
0064 
0065 /* interrupt the internal read loop, when blocking */
0066 #define DIBUSB_REQ_INTR_READ            0x06
0067 
0068 /* io control
0069  * 0x07 cmd_byte param_bytes
0070  *
0071  * param_bytes can be up to 32 bytes
0072  *
0073  * cmd_byte function    parameter name
0074  * 0x00     power mode
0075  *                      0x00      sleep
0076  *                      0x01      wakeup
0077  *
0078  * 0x01     enable streaming
0079  * 0x02     disable streaming
0080  *
0081  *
0082  */
0083 #define DIBUSB_REQ_SET_IOCTL            0x07
0084 
0085 /* IOCTL commands */
0086 
0087 /* change the power mode in firmware */
0088 #define DIBUSB_IOCTL_CMD_POWER_MODE     0x00
0089 #define DIBUSB_IOCTL_POWER_SLEEP            0x00
0090 #define DIBUSB_IOCTL_POWER_WAKEUP           0x01
0091 
0092 /* modify streaming of the FX2 */
0093 #define DIBUSB_IOCTL_CMD_ENABLE_STREAM  0x01
0094 #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
0095 
0096 /* Max transfer size done by I2C transfer functions */
0097 #define MAX_XFER_SIZE  64
0098 
0099 struct dibusb_state {
0100     struct dib_fe_xfer_ops ops;
0101     int mt2060_present;
0102     u8 tuner_addr;
0103 };
0104 
0105 struct dibusb_device_state {
0106     /* for RC5 remote control */
0107     int old_toggle;
0108     int last_repeat_count;
0109 };
0110 
0111 extern struct i2c_algorithm dibusb_i2c_algo;
0112 
0113 extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
0114 extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
0115 
0116 extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
0117 extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
0118 extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
0119 extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
0120 
0121 extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
0122 extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
0123 
0124 #define DEFAULT_RC_INTERVAL 150
0125 //#define DEFAULT_RC_INTERVAL 100000
0126 
0127 extern struct rc_map_table rc_map_dibusb_table[];
0128 extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *);
0129 extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *);
0130 
0131 #endif