linux-bk/drivers/media/dvb/dibusb/dvb-dibusb.h
<<
>>
Prefs
   1/*
   2 * dvb-dibusb.h
   3 *
   4 * Copyright (C) 2004 Patrick Boettcher (patrick.boettcher@desy.de)
   5 *
   6 *      This program is free software; you can redistribute it and/or
   7 *      modify it under the terms of the GNU General Public License as
   8 *      published by the Free Software Foundation, version 2.
   9 *
  10 * for more information see dvb-dibusb.c .
  11 */
  12
  13#ifndef __DVB_DIBUSB_H__
  14#define __DVB_DIBUSB_H__
  15
  16#include "dib3000.h"
  17
  18typedef enum {
  19        DIBUSB1_1 = 0,
  20        DIBUSB2_0,
  21        DIBUSB1_1_AN2235,
  22} dibusb_type;
  23
  24static const char * dibusb_fw_filenames1_1[] = {
  25        "dvb-dibusb-5.0.0.11.fw"
  26};
  27
  28static const char * dibusb_fw_filenames1_1_an2235[] = {
  29        "dvb-dibusb-an2235-1.fw"
  30};
  31
  32static const char * dibusb_fw_filenames2_0[] = {
  33        "dvb-dibusb-6.0.0.5.fw"
  34};
  35
  36struct dibusb_device_parameter {
  37        dibusb_type type;
  38        u8 demod_addr;
  39        const char **fw_filenames;
  40        const char *usb_controller;
  41        u16 usb_cpu_csreg;
  42
  43        int num_urbs;
  44        int urb_buf_size;
  45        int default_size;
  46        int firmware_bug;
  47
  48        int cmd_pipe;
  49        int result_pipe;
  50        int data_pipe;
  51};
  52
  53static struct dibusb_device_parameter dibusb_dev_parm[3] = {
  54        {       .type = DIBUSB1_1,
  55                .demod_addr = 0x10,
  56                .fw_filenames = dibusb_fw_filenames1_1,
  57                .usb_controller = "Cypress AN2135",
  58                .usb_cpu_csreg = 0x7f92,
  59
  60                .num_urbs = 3,
  61                .urb_buf_size = 4096,
  62                .default_size = 188*21,
  63                .firmware_bug = 1,
  64
  65                .cmd_pipe = 0x01,
  66                .result_pipe = 0x81,
  67                .data_pipe = 0x82,
  68        },
  69        {       .type = DIBUSB2_0,
  70                .demod_addr = 0x18,
  71                .fw_filenames = dibusb_fw_filenames2_0,
  72                .usb_controller = "Cypress FX2",
  73                .usb_cpu_csreg = 0xe600,
  74
  75                .num_urbs = 3,
  76                .urb_buf_size = 40960,
  77                .default_size = 188*210,
  78                .firmware_bug = 0,
  79
  80                .cmd_pipe = 0x01,
  81                .result_pipe = 0x81,
  82                .data_pipe = 0x86,
  83        },
  84        {       .type = DIBUSB1_1_AN2235,
  85                .demod_addr = 0x10,
  86                .fw_filenames = dibusb_fw_filenames1_1_an2235,
  87                .usb_controller = "Cypress CY7C64613 (AN2235)",
  88                .usb_cpu_csreg = 0x7f92,
  89
  90                .num_urbs = 3,
  91                .urb_buf_size = 4096,
  92                .default_size = 188*21,
  93                .firmware_bug = 1,
  94
  95                .cmd_pipe = 0x01,
  96                .result_pipe = 0x81,
  97                .data_pipe = 0x82,
  98        }
  99};
 100
 101struct dibusb_device {
 102        const char *name;
 103        u16 cold_product_id;
 104        u16 warm_product_id;
 105        struct dibusb_device_parameter *parm;
 106};
 107
 108/* Vendor IDs */
 109#define USB_VID_ANCHOR                                          0x0547
 110#define USB_VID_AVERMEDIA                                       0x14aa
 111#define USB_VID_COMPRO                                          0x185b
 112#define USB_VID_COMPRO_UNK                                      0x145f
 113#define USB_VID_CYPRESS                                         0x04b4
 114#define USB_VID_DIBCOM                                          0x10b8
 115#define USB_VID_EMPIA                                           0xeb1a
 116#define USB_VID_GRANDTEC                                        0x5032
 117#define USB_VID_HYPER_PALTEK                            0x1025
 118#define USB_VID_IMC_NETWORKS                            0x13d3
 119#define USB_VID_TWINHAN                                         0x1822
 120#define USB_VID_ULTIMA_ELECTRONIC                       0x05d8
 121
 122/* Product IDs */
 123#define USB_PID_AVERMEDIA_DVBT_USB_COLD         0x0001
 124#define USB_PID_AVERMEDIA_DVBT_USB_WARM         0x0002
 125#define USB_PID_COMPRO_DVBU2000_COLD            0xd000
 126#define USB_PID_COMPRO_DVBU2000_WARM            0xd001
 127#define USB_PID_COMPRO_DVBU2000_UNK_COLD        0x010c
 128#define USB_PID_COMPRO_DVBU2000_UNK_WARM        0x010d
 129#define USB_PID_DIBCOM_MOD3000_COLD                     0x0bb8
 130#define USB_PID_DIBCOM_MOD3000_WARM                     0x0bb9
 131#define USB_PID_DIBCOM_MOD3001_COLD                     0x0bc6
 132#define USB_PID_DIBCOM_MOD3001_WARM                     0x0bc7
 133#define USB_PID_GRANDTEC_DVBT_USB_COLD          0x0fa0
 134#define USB_PID_GRANDTEC_DVBT_USB_WARM          0x0fa1
 135#define USB_PID_KWORLD_VSTREAM_COLD                     0x17de
 136#define USB_PID_KWORLD_VSTREAM_WARM                     0x17df
 137#define USB_PID_TWINHAN_VP7041_COLD                     0x3201
 138#define USB_PID_TWINHAN_VP7041_WARM                     0x3202
 139#define USB_PID_ULTIMA_TVBOX_COLD                       0x8105
 140#define USB_PID_ULTIMA_TVBOX_WARM                       0x8106
 141#define USB_PID_ULTIMA_TVBOX_AN2235_COLD        0x8107
 142#define USB_PID_ULTIMA_TVBOX_AN2235_WARM        0x8108
 143#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD        0x2235
 144#define USB_PID_ULTIMA_TVBOX_USB2_COLD          0x8109
 145#define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD       0x8613
 146#define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM       0x1002
 147#define USB_PID_UNK_HYPER_PALTEK_COLD           0x005e
 148#define USB_PID_UNK_HYPER_PALTEK_WARM           0x005f
 149#define USB_PID_YAKUMO_DTT200U_COLD                     0x0201
 150#define USB_PID_YAKUMO_DTT200U_WARM                     0x0301
 151
 152#define DIBUSB_SUPPORTED_DEVICES        15
 153
 154/* USB Driver stuff */
 155static struct dibusb_device dibusb_devices[DIBUSB_SUPPORTED_DEVICES] = {
 156        {       .name = "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device",
 157                .cold_product_id = USB_PID_TWINHAN_VP7041_COLD,
 158                .warm_product_id = USB_PID_TWINHAN_VP7041_WARM,
 159                .parm = &dibusb_dev_parm[0],
 160        },
 161        {       .name = "KWorld V-Stream XPERT DTV - DVB-T USB1.1",
 162                .cold_product_id = USB_PID_KWORLD_VSTREAM_COLD,
 163                .warm_product_id = USB_PID_KWORLD_VSTREAM_WARM,
 164                .parm = &dibusb_dev_parm[0],
 165        },
 166        {       .name = "Grandtec USB1.1 DVB-T/DiBcom USB1.1 DVB-T reference design (MOD3000)",
 167                .cold_product_id = USB_PID_DIBCOM_MOD3000_COLD,
 168                .warm_product_id = USB_PID_DIBCOM_MOD3000_WARM,
 169                .parm = &dibusb_dev_parm[0],
 170        },
 171        {       .name = "Artec T1 USB1.1 TVBOX with AN2135",
 172                .cold_product_id = USB_PID_ULTIMA_TVBOX_COLD,
 173                .warm_product_id = USB_PID_ULTIMA_TVBOX_WARM,
 174                .parm = &dibusb_dev_parm[0],
 175        },
 176        {       .name = "Artec T1 USB1.1 TVBOX with AN2235",
 177                .cold_product_id = USB_PID_ULTIMA_TVBOX_AN2235_COLD,
 178                .warm_product_id = USB_PID_ULTIMA_TVBOX_AN2235_WARM,
 179                .parm = &dibusb_dev_parm[2],
 180        },
 181        {       .name = "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)",
 182                .cold_product_id = USB_PID_ULTIMA_TVBOX_ANCHOR_COLD,
 183                .warm_product_id = 0, /* undefined, this design becomes USB_PID_DIBCOM_MOD3000_WARM in warm state */
 184                .parm = &dibusb_dev_parm[2],
 185        },
 186        {       .name = "Artec T1 USB2.0 TVBOX (please report the warm ID)",
 187                .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_COLD,
 188                .warm_product_id = 0, /* don't know, it is most likely that the device will get another USB ID in warm state */
 189                .parm = &dibusb_dev_parm[1],
 190        },
 191        {       .name = "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)",
 192                .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_COLD,
 193                .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 */
 194                .parm = &dibusb_dev_parm[1],
 195        },
 196        {       .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1",
 197                .cold_product_id = USB_PID_COMPRO_DVBU2000_COLD,
 198                .warm_product_id = USB_PID_COMPRO_DVBU2000_WARM,
 199                .parm = &dibusb_dev_parm[0],
 200        },
 201        {       .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1 (really ?? please report the name!)",
 202                .cold_product_id = USB_PID_COMPRO_DVBU2000_UNK_COLD,
 203                .warm_product_id = USB_PID_COMPRO_DVBU2000_UNK_WARM,
 204                .parm = &dibusb_dev_parm[0],
 205        },
 206        {       .name = "Unkown USB1.1 DVB-T device ???? please report the name to the author",
 207                .cold_product_id = USB_PID_UNK_HYPER_PALTEK_COLD,
 208                .warm_product_id = USB_PID_UNK_HYPER_PALTEK_WARM,
 209                .parm = &dibusb_dev_parm[0],
 210        },
 211        {       .name = "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
 212                .cold_product_id = USB_PID_DIBCOM_MOD3001_COLD,
 213                .warm_product_id = USB_PID_DIBCOM_MOD3001_WARM,
 214                .parm = &dibusb_dev_parm[1],
 215        },
 216        {       .name = "Grandtec DVB-T USB1.1",
 217                .cold_product_id = USB_PID_GRANDTEC_DVBT_USB_COLD,
 218                .warm_product_id = USB_PID_GRANDTEC_DVBT_USB_WARM,
 219                .parm = &dibusb_dev_parm[0],
 220        },
 221        {       .name = "Avermedia AverTV DVBT USB1.1",
 222                .cold_product_id = USB_PID_AVERMEDIA_DVBT_USB_COLD,
 223                .warm_product_id = USB_PID_AVERMEDIA_DVBT_USB_WARM,
 224                .parm = &dibusb_dev_parm[0],
 225        },
 226        {       .name = "Yakumo DVB-T mobile USB2.0",
 227                .cold_product_id = USB_PID_YAKUMO_DTT200U_COLD,
 228                .warm_product_id = USB_PID_YAKUMO_DTT200U_WARM,
 229                .parm = &dibusb_dev_parm[1],
 230        }
 231};
 232
 233/* USB Driver stuff */
 234/* table of devices that work with this driver */
 235static struct usb_device_id dibusb_table [] = {
 236        { USB_DEVICE(USB_VID_AVERMEDIA,         USB_PID_AVERMEDIA_DVBT_USB_COLD)},
 237        { USB_DEVICE(USB_VID_AVERMEDIA,         USB_PID_AVERMEDIA_DVBT_USB_WARM)},
 238        { USB_DEVICE(USB_VID_COMPRO,            USB_PID_COMPRO_DVBU2000_COLD) },
 239        { USB_DEVICE(USB_VID_COMPRO,            USB_PID_COMPRO_DVBU2000_WARM) },
 240        { USB_DEVICE(USB_VID_DIBCOM,            USB_PID_DIBCOM_MOD3000_COLD) },
 241        { USB_DEVICE(USB_VID_DIBCOM,            USB_PID_DIBCOM_MOD3000_WARM) },
 242        { USB_DEVICE(USB_VID_DIBCOM,            USB_PID_DIBCOM_MOD3001_COLD) },
 243        { USB_DEVICE(USB_VID_DIBCOM,            USB_PID_DIBCOM_MOD3001_WARM) },
 244        { USB_DEVICE(USB_VID_EMPIA,                     USB_PID_KWORLD_VSTREAM_COLD) },
 245        { USB_DEVICE(USB_VID_EMPIA,                     USB_PID_KWORLD_VSTREAM_WARM) },
 246        { USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_GRANDTEC_DVBT_USB_COLD) },
 247        { USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_GRANDTEC_DVBT_USB_WARM) },
 248        { USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_DIBCOM_MOD3000_COLD) },
 249        { USB_DEVICE(USB_VID_GRANDTEC,          USB_PID_DIBCOM_MOD3000_WARM) },
 250        { USB_DEVICE(USB_VID_HYPER_PALTEK,      USB_PID_UNK_HYPER_PALTEK_COLD) },
 251        { USB_DEVICE(USB_VID_HYPER_PALTEK,      USB_PID_UNK_HYPER_PALTEK_WARM) },
 252        { USB_DEVICE(USB_VID_IMC_NETWORKS,      USB_PID_TWINHAN_VP7041_COLD) },
 253        { USB_DEVICE(USB_VID_IMC_NETWORKS,      USB_PID_TWINHAN_VP7041_WARM) },
 254        { USB_DEVICE(USB_VID_TWINHAN,           USB_PID_TWINHAN_VP7041_COLD) },
 255        { USB_DEVICE(USB_VID_TWINHAN,           USB_PID_TWINHAN_VP7041_WARM) },
 256        { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) },
 257        { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) },
 258        { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) },
 259        { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) },
 260        { USB_DEVICE(USB_VID_AVERMEDIA,         USB_PID_YAKUMO_DTT200U_COLD) },
 261        { USB_DEVICE(USB_VID_AVERMEDIA,         USB_PID_YAKUMO_DTT200U_WARM) },
 262        { USB_DEVICE(USB_PID_COMPRO_DVBU2000_UNK_COLD, USB_VID_COMPRO_UNK) },
 263        { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) },
 264
 265/*
 266 * activate the following define when you have one of the devices and want to
 267 * build it from build-2.6 in dvb-kernel
 268 */
 269// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 270#ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 271        { USB_DEVICE(USB_VID_ANCHOR,            USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
 272        { USB_DEVICE(USB_VID_CYPRESS,           USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
 273        { USB_DEVICE(USB_VID_ANCHOR,            USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
 274#endif
 275        { }                 /* Terminating entry */
 276};
 277
 278MODULE_DEVICE_TABLE (usb, dibusb_table);
 279
 280#define DIBUSB_I2C_TIMEOUT                              HZ*5
 281
 282struct usb_dibusb {
 283        /* usb */
 284        struct usb_device * udev;
 285
 286        struct dibusb_device * dibdev;
 287
 288        int feedcount;
 289        int pid_parse;
 290        struct dib3000_xfer_ops xfer_ops;
 291
 292        struct urb **urb_list;
 293        u8 *buffer;
 294        dma_addr_t dma_handle;
 295
 296        /* I2C */
 297        struct i2c_adapter i2c_adap;
 298        struct i2c_client i2c_client;
 299
 300        /* locking */
 301        struct semaphore usb_sem;
 302        struct semaphore i2c_sem;
 303
 304        /* dvb */
 305        int dvb_is_ready;
 306        struct dvb_adapter *adapter;
 307        struct dmxdev dmxdev;
 308        struct dvb_demux demux;
 309        struct dvb_net dvb_net;
 310        struct dvb_frontend* fe;
 311
 312        /* remote control */
 313        struct input_dev rc_input_dev;
 314        struct work_struct rc_query_work;
 315        int rc_input_event;
 316};
 317
 318
 319/* types of first byte of each buffer */
 320
 321#define DIBUSB_REQ_START_READ                   0x00
 322#define DIBUSB_REQ_START_DEMOD                  0x01
 323#define DIBUSB_REQ_I2C_READ                     0x02
 324#define DIBUSB_REQ_I2C_WRITE                    0x03
 325
 326/* prefix for reading the current RC key */
 327#define DIBUSB_REQ_POLL_REMOTE                  0x04
 328
 329#define DIBUSB_RC_NEC_EMPTY                             0x00
 330#define DIBUSB_RC_NEC_KEY_PRESSED               0x01
 331#define DIBUSB_RC_NEC_KEY_REPEATED              0x02
 332
 333/* 0x05 0xXX */
 334#define DIBUSB_REQ_SET_STREAMING_MODE   0x05
 335
 336/* interrupt the internal read loop, when blocking */
 337#define DIBUSB_REQ_INTR_READ                    0x06
 338
 339/* IO control
 340 * 0x07 <cmd 1 byte> <param 32 bytes>
 341 */
 342#define DIBUSB_REQ_SET_IOCTL                    0x07
 343
 344/* IOCTL commands */
 345
 346/* change the power mode in firmware */
 347#define DIBUSB_IOCTL_CMD_POWER_MODE             0x00
 348#define DIBUSB_IOCTL_POWER_SLEEP                        0x00
 349#define DIBUSB_IOCTL_POWER_WAKEUP                       0x01
 350
 351#endif
 352
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.