linux/drivers/media/pci/ddbridge/ddbridge-hw.c
<<
>>
Prefs
   1/*
   2 * ddbridge-hw.c: Digital Devices bridge hardware maps
   3 *
   4 * Copyright (C) 2010-2017 Digital Devices GmbH
   5 *                         Ralph Metzler <rjkm@metzlerbros.de>
   6 *                         Marcus Metzler <mocm@metzlerbros.de>
   7 *
   8 * This program is free software; you can redistribute it and/or
   9 * modify it under the terms of the GNU General Public License
  10 * version 2 only, as published by the Free Software Foundation.
  11 *
  12 * This program is distributed in the hope that it will be useful,
  13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15 * GNU General Public License for more details.
  16 *
  17 */
  18
  19#include "ddbridge.h"
  20#include "ddbridge-hw.h"
  21
  22/******************************************************************************/
  23
  24static const struct ddb_regset octopus_input = {
  25        .base = 0x200,
  26        .num  = 0x08,
  27        .size = 0x10,
  28};
  29
  30static const struct ddb_regset octopus_output = {
  31        .base = 0x280,
  32        .num  = 0x08,
  33        .size = 0x10,
  34};
  35
  36static const struct ddb_regset octopus_idma = {
  37        .base = 0x300,
  38        .num  = 0x08,
  39        .size = 0x10,
  40};
  41
  42static const struct ddb_regset octopus_idma_buf = {
  43        .base = 0x2000,
  44        .num  = 0x08,
  45        .size = 0x100,
  46};
  47
  48static const struct ddb_regset octopus_odma = {
  49        .base = 0x380,
  50        .num  = 0x04,
  51        .size = 0x10,
  52};
  53
  54static const struct ddb_regset octopus_odma_buf = {
  55        .base = 0x2800,
  56        .num  = 0x04,
  57        .size = 0x100,
  58};
  59
  60static const struct ddb_regset octopus_i2c = {
  61        .base = 0x80,
  62        .num  = 0x04,
  63        .size = 0x20,
  64};
  65
  66static const struct ddb_regset octopus_i2c_buf = {
  67        .base = 0x1000,
  68        .num  = 0x04,
  69        .size = 0x200,
  70};
  71
  72/****************************************************************************/
  73
  74static const struct ddb_regmap octopus_map = {
  75        .irq_base_i2c = 0,
  76        .irq_base_idma = 8,
  77        .irq_base_odma = 16,
  78        .i2c = &octopus_i2c,
  79        .i2c_buf = &octopus_i2c_buf,
  80        .idma = &octopus_idma,
  81        .idma_buf = &octopus_idma_buf,
  82        .odma = &octopus_odma,
  83        .odma_buf = &octopus_odma_buf,
  84        .input = &octopus_input,
  85        .output = &octopus_output,
  86};
  87
  88/****************************************************************************/
  89
  90static const struct ddb_info ddb_none = {
  91        .type     = DDB_NONE,
  92        .name     = "unknown Digital Devices PCIe card, install newer driver",
  93        .regmap   = &octopus_map,
  94};
  95
  96static const struct ddb_info ddb_octopus = {
  97        .type     = DDB_OCTOPUS,
  98        .name     = "Digital Devices Octopus DVB adapter",
  99        .regmap   = &octopus_map,
 100        .port_num = 4,
 101        .i2c_mask = 0x0f,
 102};
 103
 104static const struct ddb_info ddb_octopusv3 = {
 105        .type     = DDB_OCTOPUS,
 106        .name     = "Digital Devices Octopus V3 DVB adapter",
 107        .regmap   = &octopus_map,
 108        .port_num = 4,
 109        .i2c_mask = 0x0f,
 110};
 111
 112static const struct ddb_info ddb_octopus_le = {
 113        .type     = DDB_OCTOPUS,
 114        .name     = "Digital Devices Octopus LE DVB adapter",
 115        .regmap   = &octopus_map,
 116        .port_num = 2,
 117        .i2c_mask = 0x03,
 118};
 119
 120static const struct ddb_info ddb_octopus_oem = {
 121        .type     = DDB_OCTOPUS,
 122        .name     = "Digital Devices Octopus OEM",
 123        .regmap   = &octopus_map,
 124        .port_num = 4,
 125        .i2c_mask = 0x0f,
 126        .led_num  = 1,
 127        .fan_num  = 1,
 128        .temp_num = 1,
 129        .temp_bus = 0,
 130};
 131
 132static const struct ddb_info ddb_octopus_mini = {
 133        .type     = DDB_OCTOPUS,
 134        .name     = "Digital Devices Octopus Mini",
 135        .regmap   = &octopus_map,
 136        .port_num = 4,
 137        .i2c_mask = 0x0f,
 138};
 139
 140static const struct ddb_info ddb_v6 = {
 141        .type     = DDB_OCTOPUS,
 142        .name     = "Digital Devices Cine S2 V6 DVB adapter",
 143        .regmap   = &octopus_map,
 144        .port_num = 3,
 145        .i2c_mask = 0x07,
 146};
 147
 148static const struct ddb_info ddb_v6_5 = {
 149        .type     = DDB_OCTOPUS,
 150        .name     = "Digital Devices Cine S2 V6.5 DVB adapter",
 151        .regmap   = &octopus_map,
 152        .port_num = 4,
 153        .i2c_mask = 0x0f,
 154};
 155
 156static const struct ddb_info ddb_v7 = {
 157        .type     = DDB_OCTOPUS,
 158        .name     = "Digital Devices Cine S2 V7 DVB adapter",
 159        .regmap   = &octopus_map,
 160        .port_num = 4,
 161        .i2c_mask = 0x0f,
 162        .board_control   = 2,
 163        .board_control_2 = 4,
 164        .ts_quirks = TS_QUIRK_REVERSED,
 165};
 166
 167static const struct ddb_info ddb_v7a = {
 168        .type     = DDB_OCTOPUS,
 169        .name     = "Digital Devices Cine S2 V7 Advanced DVB adapter",
 170        .regmap   = &octopus_map,
 171        .port_num = 4,
 172        .i2c_mask = 0x0f,
 173        .board_control   = 2,
 174        .board_control_2 = 4,
 175        .ts_quirks = TS_QUIRK_REVERSED,
 176};
 177
 178static const struct ddb_info ddb_ctv7 = {
 179        .type     = DDB_OCTOPUS,
 180        .name     = "Digital Devices Cine CT V7 DVB adapter",
 181        .regmap   = &octopus_map,
 182        .port_num = 4,
 183        .i2c_mask = 0x0f,
 184        .board_control   = 3,
 185        .board_control_2 = 4,
 186};
 187
 188static const struct ddb_info ddb_satixs2v3 = {
 189        .type     = DDB_OCTOPUS,
 190        .name     = "Mystique SaTiX-S2 V3 DVB adapter",
 191        .regmap   = &octopus_map,
 192        .port_num = 3,
 193        .i2c_mask = 0x07,
 194};
 195
 196static const struct ddb_info ddb_ci = {
 197        .type     = DDB_OCTOPUS_CI,
 198        .name     = "Digital Devices Octopus CI",
 199        .regmap   = &octopus_map,
 200        .port_num = 4,
 201        .i2c_mask = 0x03,
 202};
 203
 204static const struct ddb_info ddb_cis = {
 205        .type     = DDB_OCTOPUS_CI,
 206        .name     = "Digital Devices Octopus CI single",
 207        .regmap   = &octopus_map,
 208        .port_num = 3,
 209        .i2c_mask = 0x03,
 210};
 211
 212static const struct ddb_info ddb_ci_s2_pro = {
 213        .type     = DDB_OCTOPUS_CI,
 214        .name     = "Digital Devices Octopus CI S2 Pro",
 215        .regmap   = &octopus_map,
 216        .port_num = 4,
 217        .i2c_mask = 0x01,
 218        .board_control   = 2,
 219        .board_control_2 = 4,
 220};
 221
 222static const struct ddb_info ddb_ci_s2_pro_a = {
 223        .type     = DDB_OCTOPUS_CI,
 224        .name     = "Digital Devices Octopus CI S2 Pro Advanced",
 225        .regmap   = &octopus_map,
 226        .port_num = 4,
 227        .i2c_mask = 0x01,
 228        .board_control   = 2,
 229        .board_control_2 = 4,
 230};
 231
 232static const struct ddb_info ddb_dvbct = {
 233        .type     = DDB_OCTOPUS,
 234        .name     = "Digital Devices DVBCT V6.1 DVB adapter",
 235        .regmap   = &octopus_map,
 236        .port_num = 3,
 237        .i2c_mask = 0x07,
 238};
 239
 240/****************************************************************************/
 241
 242static const struct ddb_info ddb_ct2_8 = {
 243        .type     = DDB_OCTOPUS_MAX_CT,
 244        .name     = "Digital Devices MAX A8 CT2",
 245        .regmap   = &octopus_map,
 246        .port_num = 4,
 247        .i2c_mask = 0x0f,
 248        .board_control   = 0x0ff,
 249        .board_control_2 = 0xf00,
 250        .ts_quirks = TS_QUIRK_SERIAL,
 251        .tempmon_irq = 24,
 252};
 253
 254static const struct ddb_info ddb_c2t2_8 = {
 255        .type     = DDB_OCTOPUS_MAX_CT,
 256        .name     = "Digital Devices MAX A8 C2T2",
 257        .regmap   = &octopus_map,
 258        .port_num = 4,
 259        .i2c_mask = 0x0f,
 260        .board_control   = 0x0ff,
 261        .board_control_2 = 0xf00,
 262        .ts_quirks = TS_QUIRK_SERIAL,
 263        .tempmon_irq = 24,
 264};
 265
 266static const struct ddb_info ddb_isdbt_8 = {
 267        .type     = DDB_OCTOPUS_MAX_CT,
 268        .name     = "Digital Devices MAX A8 ISDBT",
 269        .regmap   = &octopus_map,
 270        .port_num = 4,
 271        .i2c_mask = 0x0f,
 272        .board_control   = 0x0ff,
 273        .board_control_2 = 0xf00,
 274        .ts_quirks = TS_QUIRK_SERIAL,
 275        .tempmon_irq = 24,
 276};
 277
 278static const struct ddb_info ddb_c2t2i_v0_8 = {
 279        .type     = DDB_OCTOPUS_MAX_CT,
 280        .name     = "Digital Devices MAX A8 C2T2I V0",
 281        .regmap   = &octopus_map,
 282        .port_num = 4,
 283        .i2c_mask = 0x0f,
 284        .board_control   = 0x0ff,
 285        .board_control_2 = 0xf00,
 286        .ts_quirks = TS_QUIRK_SERIAL | TS_QUIRK_ALT_OSC,
 287        .tempmon_irq = 24,
 288};
 289
 290static const struct ddb_info ddb_c2t2i_8 = {
 291        .type     = DDB_OCTOPUS_MAX_CT,
 292        .name     = "Digital Devices MAX A8 C2T2I",
 293        .regmap   = &octopus_map,
 294        .port_num = 4,
 295        .i2c_mask = 0x0f,
 296        .board_control   = 0x0ff,
 297        .board_control_2 = 0xf00,
 298        .ts_quirks = TS_QUIRK_SERIAL,
 299        .tempmon_irq = 24,
 300};
 301
 302/****************************************************************************/
 303
 304static const struct ddb_info ddb_s2_48 = {
 305        .type     = DDB_OCTOPUS_MAX,
 306        .name     = "Digital Devices MAX S8 4/8",
 307        .regmap   = &octopus_map,
 308        .port_num = 4,
 309        .i2c_mask = 0x01,
 310        .board_control = 1,
 311        .tempmon_irq = 24,
 312};
 313
 314/****************************************************************************/
 315/****************************************************************************/
 316/****************************************************************************/
 317
 318#define DDB_DEVID(_device, _subdevice, _info) { \
 319        .vendor = DDVID, \
 320        .device = _device, \
 321        .subvendor = DDVID, \
 322        .subdevice = _subdevice, \
 323        .info = &_info }
 324
 325static const struct ddb_device_id ddb_device_ids[] = {
 326        /* PCIe devices */
 327        DDB_DEVID(0x0002, 0x0001, ddb_octopus),
 328        DDB_DEVID(0x0003, 0x0001, ddb_octopus),
 329        DDB_DEVID(0x0005, 0x0004, ddb_octopusv3),
 330        DDB_DEVID(0x0003, 0x0002, ddb_octopus_le),
 331        DDB_DEVID(0x0003, 0x0003, ddb_octopus_oem),
 332        DDB_DEVID(0x0003, 0x0010, ddb_octopus_mini),
 333        DDB_DEVID(0x0005, 0x0011, ddb_octopus_mini),
 334        DDB_DEVID(0x0003, 0x0020, ddb_v6),
 335        DDB_DEVID(0x0003, 0x0021, ddb_v6_5),
 336        DDB_DEVID(0x0006, 0x0022, ddb_v7),
 337        DDB_DEVID(0x0006, 0x0024, ddb_v7a),
 338        DDB_DEVID(0x0003, 0x0030, ddb_dvbct),
 339        DDB_DEVID(0x0003, 0xdb03, ddb_satixs2v3),
 340        DDB_DEVID(0x0006, 0x0031, ddb_ctv7),
 341        DDB_DEVID(0x0006, 0x0032, ddb_ctv7),
 342        DDB_DEVID(0x0006, 0x0033, ddb_ctv7),
 343        DDB_DEVID(0x0007, 0x0023, ddb_s2_48),
 344        DDB_DEVID(0x0008, 0x0034, ddb_ct2_8),
 345        DDB_DEVID(0x0008, 0x0035, ddb_c2t2_8),
 346        DDB_DEVID(0x0008, 0x0036, ddb_isdbt_8),
 347        DDB_DEVID(0x0008, 0x0037, ddb_c2t2i_v0_8),
 348        DDB_DEVID(0x0008, 0x0038, ddb_c2t2i_8),
 349        DDB_DEVID(0x0006, 0x0039, ddb_ctv7),
 350        DDB_DEVID(0x0011, 0x0040, ddb_ci),
 351        DDB_DEVID(0x0011, 0x0041, ddb_cis),
 352        DDB_DEVID(0x0012, 0x0042, ddb_ci),
 353        DDB_DEVID(0x0013, 0x0043, ddb_ci_s2_pro),
 354        DDB_DEVID(0x0013, 0x0044, ddb_ci_s2_pro_a),
 355};
 356
 357/****************************************************************************/
 358
 359const struct ddb_info *get_ddb_info(u16 vendor, u16 device,
 360                                    u16 subvendor, u16 subdevice)
 361{
 362        int i;
 363
 364        for (i = 0; i < ARRAY_SIZE(ddb_device_ids); i++) {
 365                const struct ddb_device_id *id = &ddb_device_ids[i];
 366
 367                if (vendor == id->vendor &&
 368                    device == id->device &&
 369                    subvendor == id->subvendor &&
 370                    (subdevice == id->subdevice ||
 371                     id->subdevice == 0xffff))
 372                        return id->info;
 373        }
 374
 375        return &ddb_none;
 376}
 377