summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dibusb/dvb-dibusb.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/dibusb/dvb-dibusb.h')
-rw-r--r--linux/drivers/media/dvb/dibusb/dvb-dibusb.h345
1 files changed, 100 insertions, 245 deletions
diff --git a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h
index b6f106019..bac7d0921 100644
--- a/linux/drivers/media/dvb/dibusb/dvb-dibusb.h
+++ b/linux/drivers/media/dvb/dibusb/dvb-dibusb.h
@@ -7,35 +7,71 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2.
*
- * for more information see dvb-dibusb.c .
+ * for more information see dvb-dibusb-core.c .
*/
-
#ifndef __DVB_DIBUSB_H__
#define __DVB_DIBUSB_H__
+#include <linux/input.h>
+#include <linux/config.h>
+#include <linux/usb.h>
+
+#include "dvb_frontend.h"
+#include "dvb_demux.h"
+#include "dvb_net.h"
+#include "dmxdev.h"
+
#include "dib3000.h"
+/* debug */
+#ifdef CONFIG_DVB_DIBCOM_DEBUG
+#define dprintk(level,args...) \
+ do { if ((debug & level)) { printk(args); } } while (0)
+
+#define debug_dump(b,l) if (debug) {\
+ int i; deb_xfer("%s: %d > ",__FUNCTION__,l); \
+ for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \
+ deb_xfer("\n");\
+}
+
+/* module parameters - declared in -core.c */
+extern int debug;
+
+#else
+#define dprintk(args...)
+#define debug_dump(b,l)
+#endif
+
+/* module parameters - declared in -core.c */
+extern int pid_parse;
+extern int rc_query_interval;
+
+#define deb_info(args...) dprintk(0x01,args)
+#define deb_xfer(args...) dprintk(0x02,args)
+#define deb_alot(args...) dprintk(0x04,args)
+#define deb_ts(args...) dprintk(0x08,args)
+#define deb_err(args...) dprintk(0x10,args)
+#define deb_rc(args...) dprintk(0x20,args)
+
+/* generic log methods - taken from usb.h */
+#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg)
+#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg)
+
+/* Version information */
+#define DRIVER_VERSION "0.1"
+#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device"
+#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
+
typedef enum {
DIBUSB1_1 = 0,
DIBUSB2_0,
DIBUSB1_1_AN2235,
} dibusb_type;
-static const char * dibusb_fw_filenames1_1[] = {
- "dvb-dibusb-5.0.0.11.fw"
-};
-
-static const char * dibusb_fw_filenames1_1_an2235[] = {
- "dvb-dibusb-an2235-1.fw"
-};
-
-static const char * dibusb_fw_filenames2_0[] = {
- "dvb-dibusb-6.0.0.5.fw"
-};
-
+/* struct for holding properties of the different dibusb device models */
struct dibusb_device_parameter {
dibusb_type type;
- u8 demod_addr;
const char **fw_filenames;
const char *usb_controller;
u16 usb_cpu_csreg;
@@ -48,56 +84,17 @@ struct dibusb_device_parameter {
int cmd_pipe;
int result_pipe;
int data_pipe;
-};
-static struct dibusb_device_parameter dibusb_dev_parm[3] = {
- { .type = DIBUSB1_1,
- .demod_addr = 0x10,
- .fw_filenames = dibusb_fw_filenames1_1,
- .usb_controller = "Cypress AN2135",
- .usb_cpu_csreg = 0x7f92,
-
- .num_urbs = 3,
- .urb_buf_size = 4096,
- .default_size = 188*21,
- .firmware_bug = 1,
-
- .cmd_pipe = 0x01,
- .result_pipe = 0x81,
- .data_pipe = 0x82,
- },
- { .type = DIBUSB2_0,
- .demod_addr = 0x18,
- .fw_filenames = dibusb_fw_filenames2_0,
- .usb_controller = "Cypress FX2",
- .usb_cpu_csreg = 0xe600,
-
- .num_urbs = 3,
- .urb_buf_size = 40960,
- .default_size = 188*210,
- .firmware_bug = 0,
-
- .cmd_pipe = 0x01,
- .result_pipe = 0x81,
- .data_pipe = 0x86,
- },
- { .type = DIBUSB1_1_AN2235,
- .demod_addr = 0x10,
- .fw_filenames = dibusb_fw_filenames1_1_an2235,
- .usb_controller = "Cypress CY7C64613 (AN2235)",
- .usb_cpu_csreg = 0x7f92,
-
- .num_urbs = 3,
- .urb_buf_size = 4096,
- .default_size = 188*21,
- .firmware_bug = 1,
-
- .cmd_pipe = 0x01,
- .result_pipe = 0x81,
- .data_pipe = 0x82,
- }
+ int (*pll_set) (struct dvb_frontend *,struct dvb_frontend_parameters *);
+ unsigned char pll_addr;
+ unsigned char demod_i2c_addrs[4];
};
+/*
+ * for each warm/cold product id a name is stored, this is just beautification,
+ * it could easily done by an PID-array, but then the real names of the devices
+ * would get lost.
+ */
struct dibusb_device {
const char *name;
u16 cold_product_id;
@@ -105,187 +102,6 @@ struct dibusb_device {
struct dibusb_device_parameter *parm;
};
-/* Vendor IDs */
-#define USB_VID_ANCHOR 0x0547
-#define USB_VID_AVERMEDIA 0x14aa
-#define USB_VID_COMPRO 0x185b
-#define USB_VID_COMPRO_UNK 0x145f
-#define USB_VID_CYPRESS 0x04b4
-#define USB_VID_DIBCOM 0x10b8
-#define USB_VID_EMPIA 0xeb1a
-#define USB_VID_GRANDTEC 0x5032
-#define USB_VID_HYPER_PALTEK 0x1025
-#define USB_VID_IMC_NETWORKS 0x13d3
-#define USB_VID_TWINHAN 0x1822
-#define USB_VID_ULTIMA_ELECTRONIC 0x05d8
-
-/* Product IDs */
-#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
-#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
-#define USB_PID_COMPRO_DVBU2000_COLD 0xd000
-#define USB_PID_COMPRO_DVBU2000_WARM 0xd001
-#define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c
-#define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d
-#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8
-#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9
-#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6
-#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
-#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131
-#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
-#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
-#define USB_PID_KWORLD_VSTREAM_COLD 0x17de
-#define USB_PID_KWORLD_VSTREAM_WARM 0x17df
-#define USB_PID_TWINHAN_VP7041_COLD 0x3201
-#define USB_PID_TWINHAN_VP7041_WARM 0x3202
-#define USB_PID_ULTIMA_TVBOX_COLD 0x8105
-#define USB_PID_ULTIMA_TVBOX_WARM 0x8106
-#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107
-#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108
-#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235
-#define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109
-#define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613
-#define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002
-#define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e
-#define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f
-#define USB_PID_YAKUMO_DTT200U_COLD 0x0201
-#define USB_PID_YAKUMO_DTT200U_WARM 0x0301
-
-#define DIBUSB_SUPPORTED_DEVICES 16
-
-/* USB Driver stuff */
-static struct dibusb_device dibusb_devices[DIBUSB_SUPPORTED_DEVICES] = {
- { .name = "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device",
- .cold_product_id = USB_PID_TWINHAN_VP7041_COLD,
- .warm_product_id = USB_PID_TWINHAN_VP7041_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "KWorld V-Stream XPERT DTV - DVB-T USB1.1",
- .cold_product_id = USB_PID_KWORLD_VSTREAM_COLD,
- .warm_product_id = USB_PID_KWORLD_VSTREAM_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Grandtec USB1.1 DVB-T/DiBcom USB1.1 DVB-T reference design (MOD3000)",
- .cold_product_id = USB_PID_DIBCOM_MOD3000_COLD,
- .warm_product_id = USB_PID_DIBCOM_MOD3000_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs",
- .cold_product_id = USB_PID_DIBCOM_ANCHOR_2135_COLD,
- .warm_product_id = 0, /* undefined, let's see what comes out */
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Artec T1 USB1.1 TVBOX with AN2135",
- .cold_product_id = USB_PID_ULTIMA_TVBOX_COLD,
- .warm_product_id = USB_PID_ULTIMA_TVBOX_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Artec T1 USB1.1 TVBOX with AN2235",
- .cold_product_id = USB_PID_ULTIMA_TVBOX_AN2235_COLD,
- .warm_product_id = USB_PID_ULTIMA_TVBOX_AN2235_WARM,
- .parm = &dibusb_dev_parm[2],
- },
- { .name = "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)",
- .cold_product_id = USB_PID_ULTIMA_TVBOX_ANCHOR_COLD,
- .warm_product_id = 0, /* undefined, this design becomes USB_PID_DIBCOM_MOD3000_WARM in warm state */
- .parm = &dibusb_dev_parm[2],
- },
- { .name = "Artec T1 USB2.0 TVBOX (please report the warm ID)",
- .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_COLD,
- .warm_product_id = 0, /* don't know, it is most likely that the device will get another USB ID in warm state */
- .parm = &dibusb_dev_parm[1],
- },
- { .name = "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)",
- .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_COLD,
- .warm_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_WARM, /* undefined, it could be that the device will get another USB ID in warm state */
- .parm = &dibusb_dev_parm[1],
- },
- { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1",
- .cold_product_id = USB_PID_COMPRO_DVBU2000_COLD,
- .warm_product_id = USB_PID_COMPRO_DVBU2000_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1 (really ?? please report the name!)",
- .cold_product_id = USB_PID_COMPRO_DVBU2000_UNK_COLD,
- .warm_product_id = USB_PID_COMPRO_DVBU2000_UNK_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Unkown USB1.1 DVB-T device ???? please report the name to the author",
- .cold_product_id = USB_PID_UNK_HYPER_PALTEK_COLD,
- .warm_product_id = USB_PID_UNK_HYPER_PALTEK_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
- .cold_product_id = USB_PID_DIBCOM_MOD3001_COLD,
- .warm_product_id = USB_PID_DIBCOM_MOD3001_WARM,
- .parm = &dibusb_dev_parm[1],
- },
- { .name = "Grandtec DVB-T USB1.1",
- .cold_product_id = USB_PID_GRANDTEC_DVBT_USB_COLD,
- .warm_product_id = USB_PID_GRANDTEC_DVBT_USB_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Avermedia AverTV DVBT USB1.1",
- .cold_product_id = USB_PID_AVERMEDIA_DVBT_USB_COLD,
- .warm_product_id = USB_PID_AVERMEDIA_DVBT_USB_WARM,
- .parm = &dibusb_dev_parm[0],
- },
- { .name = "Yakumo DVB-T mobile USB2.0",
- .cold_product_id = USB_PID_YAKUMO_DTT200U_COLD,
- .warm_product_id = USB_PID_YAKUMO_DTT200U_WARM,
- .parm = &dibusb_dev_parm[1],
- }
-};
-
-/* USB Driver stuff */
-/* table of devices that work with this driver */
-static struct usb_device_id dibusb_table [] = {
- { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)},
- { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)},
- { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) },
- { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) },
- { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) },
- { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) },
- { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) },
- { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) },
- { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) },
- { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) },
- { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) },
- { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) },
- { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) },
- { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) },
- { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) },
- { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) },
- { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) },
- { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) },
- { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) },
- { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) },
- { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) },
- { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) },
- { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) },
- { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) },
- { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) },
- { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) },
- { USB_DEVICE(USB_PID_COMPRO_DVBU2000_UNK_COLD, USB_VID_COMPRO_UNK) },
- { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) },
-
-/*
- * activate the following define when you have one of the devices and want to
- * build it from build-2.6 in dvb-kernel
- */
-// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
-#ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
- { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
- { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
- { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
- { USB_DEVICE(USB_VID_ANCHOR, USB_PID_DIBCOM_ANCHOR_2135_COLD) },
-#endif
- { } /* Terminating entry */
-};
-
-MODULE_DEVICE_TABLE (usb, dibusb_table);
-
-#define DIBUSB_I2C_TIMEOUT HZ*5
-
struct usb_dibusb {
/* usb */
struct usb_device * udev;
@@ -302,7 +118,6 @@ struct usb_dibusb {
/* I2C */
struct i2c_adapter i2c_adap;
- struct i2c_client i2c_client;
/* locking */
struct semaphore usb_sem;
@@ -322,8 +137,44 @@ struct usb_dibusb {
int rc_input_event;
};
+/* commonly used functions in the separated files */
+
+/* dvb-dibusb-firmware.c */
+int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_device *dibdev);
-/* types of first byte of each buffer */
+/* dvb-dibusb-remote.c */
+int dibusb_remote_exit(struct usb_dibusb *dib);
+int dibusb_remote_init(struct usb_dibusb *dib);
+
+/* dvb-dibusb-fe-i2c.c */
+int dibusb_fe_init(struct usb_dibusb* dib);
+int dibusb_fe_exit(struct usb_dibusb *dib);
+int dibusb_i2c_init(struct usb_dibusb *dib);
+int dibusb_i2c_exit(struct usb_dibusb *dib);
+
+/* dvb-dibusb-dvb.c */
+void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs);
+int dibusb_dvb_init(struct usb_dibusb *dib);
+int dibusb_dvb_exit(struct usb_dibusb *dib);
+
+/* dvb-dibusb-usb.c */
+int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf,
+ u16 rlen);
+
+int dibusb_hw_wakeup(struct usb_dibusb *dib);
+int dibusb_set_streaming_mode(struct usb_dibusb *dib,u8 mode);
+int dibusb_streaming(struct usb_dibusb *dib,int onoff);
+
+int dibusb_usb_init(struct usb_dibusb *dib);
+int dibusb_usb_exit(struct usb_dibusb *dib);
+
+/* i2c and transfer stuff */
+#define DIBUSB_I2C_TIMEOUT HZ*5
+
+/*
+ * types of first byte of each buffer send to USB, applying for
+ * USB1.1 and USB2.0
+ */
#define DIBUSB_REQ_START_READ 0x00
#define DIBUSB_REQ_START_DEMOD 0x01
@@ -355,4 +206,8 @@ struct usb_dibusb {
#define DIBUSB_IOCTL_POWER_SLEEP 0x00
#define DIBUSB_IOCTL_POWER_WAKEUP 0x01
+/* modify streaming of the FX2 */
+#define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01
+#define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
+
#endif