Commit bb4cec96 authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8)

This enables MaxS4/S8 and Octopus Max card support in ddbridge by adding
glue code into ddbridge-core, having another PCI ID, and have the LNB IC
control code (and all other MaxS4/8 related code) in ddbridge-maxs8.c
(rather than another ~400 LoC in ddbridge-core.c like it's done in the
original vendor driver package).
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 3c4e0415
...@@ -12,6 +12,7 @@ config DVB_DDBRIDGE ...@@ -12,6 +12,7 @@ config DVB_DDBRIDGE
select DVB_STV6111 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV6111 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT
---help--- ---help---
Support for cards with the Digital Devices PCI express bridge: Support for cards with the Digital Devices PCI express bridge:
- Octopus PCIe Bridge - Octopus PCIe Bridge
...@@ -24,6 +25,7 @@ config DVB_DDBRIDGE ...@@ -24,6 +25,7 @@ config DVB_DDBRIDGE
- CineCTv7 and DuoFlex CT2/C2T2/C2T2I (Sony CXD28xx-based) - CineCTv7 and DuoFlex CT2/C2T2/C2T2I (Sony CXD28xx-based)
- MaxA8 series - MaxA8 series
- CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based) - CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based)
- Max S4/8
Say Y if you own such a card and want to use it. Say Y if you own such a card and want to use it.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-hw.o \ ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-hw.o \
ddbridge-i2c.o ddbridge-i2c.o ddbridge-maxs8.o
obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "ddbridge.h" #include "ddbridge.h"
#include "ddbridge-i2c.h" #include "ddbridge-i2c.h"
#include "ddbridge-regs.h" #include "ddbridge-regs.h"
#include "ddbridge-maxs8.h"
#include "ddbridge-io.h" #include "ddbridge-io.h"
#include "tda18271c2dd.h" #include "tda18271c2dd.h"
...@@ -1424,8 +1425,9 @@ static int dvb_input_attach(struct ddb_input *input) ...@@ -1424,8 +1425,9 @@ static int dvb_input_attach(struct ddb_input *input)
dvb->fe = dvb->fe2 = NULL; dvb->fe = dvb->fe2 = NULL;
switch (port->type) { switch (port->type) {
case DDB_TUNER_MXL5XX: case DDB_TUNER_MXL5XX:
dev_notice(port->dev->dev, "MaxLinear MxL5xx not supported\n"); if (fe_attach_mxl5xx(input) < 0)
return -ENODEV; return -ENODEV;
break;
case DDB_TUNER_DVBS_ST: case DDB_TUNER_DVBS_ST:
if (demod_attach_stv0900(input, 0) < 0) if (demod_attach_stv0900(input, 0) < 0)
return -ENODEV; return -ENODEV;
...@@ -1770,6 +1772,17 @@ static void ddb_port_probe(struct ddb_port *port) ...@@ -1770,6 +1772,17 @@ static void ddb_port_probe(struct ddb_port *port)
return; return;
} }
if (dev->link[l].info->type == DDB_OCTOPUS_MAX) {
port->name = "DUAL DVB-S2 MAX";
port->type_name = "MXL5XX";
port->class = DDB_PORT_TUNER;
port->type = DDB_TUNER_MXL5XX;
if (port->i2c)
ddbwritel(dev, I2C_SPEED_400,
port->i2c->regs + I2C_TIMING);
return;
}
if (port->nr > 1 && dev->link[l].info->type == DDB_OCTOPUS_CI) { if (port->nr > 1 && dev->link[l].info->type == DDB_OCTOPUS_CI) {
port->name = "CI internal"; port->name = "CI internal";
port->type_name = "INTERNAL"; port->type_name = "INTERNAL";
...@@ -2531,6 +2544,20 @@ static int ddb_port_match_i2c(struct ddb_port *port) ...@@ -2531,6 +2544,20 @@ static int ddb_port_match_i2c(struct ddb_port *port)
return 0; return 0;
} }
static int ddb_port_match_link_i2c(struct ddb_port *port)
{
struct ddb *dev = port->dev;
u32 i;
for (i = 0; i < dev->i2c_num; i++) {
if (dev->i2c[i].link == port->lnr) {
port->i2c = &dev->i2c[i];
return 1;
}
}
return 0;
}
void ddb_ports_init(struct ddb *dev) void ddb_ports_init(struct ddb *dev)
{ {
u32 i, l, p; u32 i, l, p;
...@@ -2555,7 +2582,11 @@ void ddb_ports_init(struct ddb *dev) ...@@ -2555,7 +2582,11 @@ void ddb_ports_init(struct ddb *dev)
port->obr = ci_bitrate; port->obr = ci_bitrate;
mutex_init(&port->i2c_gate_lock); mutex_init(&port->i2c_gate_lock);
ddb_port_match_i2c(port); if (!ddb_port_match_i2c(port)) {
if (info->type == DDB_OCTOPUS_MAX)
ddb_port_match_link_i2c(port);
}
ddb_port_probe(port); ddb_port_probe(port);
port->dvb[0].adap = &dev->adap[2 * p]; port->dvb[0].adap = &dev->adap[2 * p];
...@@ -2603,6 +2634,7 @@ void ddb_ports_init(struct ddb *dev) ...@@ -2603,6 +2634,7 @@ void ddb_ports_init(struct ddb *dev)
ddb_input_init(port, 2 * i + 1, 1, 2 * i + 1); ddb_input_init(port, 2 * i + 1, 1, 2 * i + 1);
ddb_output_init(port, i); ddb_output_init(port, i);
break; break;
case DDB_OCTOPUS_MAX:
case DDB_OCTOPUS_MAX_CT: case DDB_OCTOPUS_MAX_CT:
ddb_input_init(port, 2 * i, 0, 2 * p); ddb_input_init(port, 2 * i, 0, 2 * p);
ddb_input_init(port, 2 * i + 1, 1, 2 * p + 1); ddb_input_init(port, 2 * i + 1, 1, 2 * p + 1);
...@@ -3202,6 +3234,15 @@ static ssize_t regmap_show(struct device *device, ...@@ -3202,6 +3234,15 @@ static ssize_t regmap_show(struct device *device,
return sprintf(buf, "0x%08X\n", dev->link[0].ids.regmapid); return sprintf(buf, "0x%08X\n", dev->link[0].ids.regmapid);
} }
static ssize_t fmode_show(struct device *device,
struct device_attribute *attr, char *buf)
{
int num = attr->attr.name[5] - 0x30;
struct ddb *dev = dev_get_drvdata(device);
return sprintf(buf, "%u\n", dev->link[num].lnb.fmode);
}
static ssize_t devid_show(struct device *device, static ssize_t devid_show(struct device *device,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
...@@ -3211,6 +3252,21 @@ static ssize_t devid_show(struct device *device, ...@@ -3211,6 +3252,21 @@ static ssize_t devid_show(struct device *device,
return sprintf(buf, "%08x\n", dev->link[num].ids.devid); return sprintf(buf, "%08x\n", dev->link[num].ids.devid);
} }
static ssize_t fmode_store(struct device *device, struct device_attribute *attr,
const char *buf, size_t count)
{
struct ddb *dev = dev_get_drvdata(device);
int num = attr->attr.name[5] - 0x30;
unsigned int val;
if (sscanf(buf, "%u\n", &val) != 1)
return -EINVAL;
if (val > 3)
return -EINVAL;
lnb_init_fmode(dev, &dev->link[num], val);
return count;
}
static struct device_attribute ddb_attrs[] = { static struct device_attribute ddb_attrs[] = {
__ATTR_RO(version), __ATTR_RO(version),
__ATTR_RO(ports), __ATTR_RO(ports),
...@@ -3220,6 +3276,10 @@ static struct device_attribute ddb_attrs[] = { ...@@ -3220,6 +3276,10 @@ static struct device_attribute ddb_attrs[] = {
__ATTR(gap1, 0664, gap_show, gap_store), __ATTR(gap1, 0664, gap_show, gap_store),
__ATTR(gap2, 0664, gap_show, gap_store), __ATTR(gap2, 0664, gap_show, gap_store),
__ATTR(gap3, 0664, gap_show, gap_store), __ATTR(gap3, 0664, gap_show, gap_store),
__ATTR(fmode0, 0664, fmode_show, fmode_store),
__ATTR(fmode1, 0664, fmode_show, fmode_store),
__ATTR(fmode2, 0664, fmode_show, fmode_store),
__ATTR(fmode3, 0664, fmode_show, fmode_store),
__ATTR_MRO(devid0, devid_show), __ATTR_MRO(devid0, devid_show),
__ATTR_MRO(devid1, devid_show), __ATTR_MRO(devid1, devid_show),
__ATTR_MRO(devid2, devid_show), __ATTR_MRO(devid2, devid_show),
...@@ -3509,6 +3569,7 @@ static int ddb_init_boards(struct ddb *dev) ...@@ -3509,6 +3569,7 @@ static int ddb_init_boards(struct ddb *dev)
int ddb_init(struct ddb *dev) int ddb_init(struct ddb *dev)
{ {
mutex_init(&dev->link[0].lnb.lock);
mutex_init(&dev->link[0].flash_mutex); mutex_init(&dev->link[0].flash_mutex);
if (no_init) { if (no_init) {
ddb_device_create(dev); ddb_device_create(dev);
......
...@@ -297,3 +297,15 @@ const struct ddb_info ddb_c2t2i_8 = { ...@@ -297,3 +297,15 @@ const struct ddb_info ddb_c2t2i_8 = {
.ts_quirks = TS_QUIRK_SERIAL, .ts_quirks = TS_QUIRK_SERIAL,
.tempmon_irq = 24, .tempmon_irq = 24,
}; };
/****************************************************************************/
const struct ddb_info ddb_s2_48 = {
.type = DDB_OCTOPUS_MAX,
.name = "Digital Devices MAX S8 4/8",
.regmap = &octopus_map,
.port_num = 4,
.i2c_mask = 0x01,
.board_control = 1,
.tempmon_irq = 24,
};
...@@ -49,4 +49,8 @@ extern const struct ddb_info ddb_isdbt_8; ...@@ -49,4 +49,8 @@ extern const struct ddb_info ddb_isdbt_8;
extern const struct ddb_info ddb_c2t2i_v0_8; extern const struct ddb_info ddb_c2t2i_v0_8;
extern const struct ddb_info ddb_c2t2i_8; extern const struct ddb_info ddb_c2t2i_8;
/****************************************************************************/
extern const struct ddb_info ddb_s2_48;
#endif /* _DDBRIDGE_HW_H */ #endif /* _DDBRIDGE_HW_H */
...@@ -313,6 +313,7 @@ static const struct pci_device_id ddb_id_table[] = { ...@@ -313,6 +313,7 @@ static const struct pci_device_id ddb_id_table[] = {
DDB_DEVICE(0x0006, 0x0031, ddb_ctv7), DDB_DEVICE(0x0006, 0x0031, ddb_ctv7),
DDB_DEVICE(0x0006, 0x0032, ddb_ctv7), DDB_DEVICE(0x0006, 0x0032, ddb_ctv7),
DDB_DEVICE(0x0006, 0x0033, ddb_ctv7), DDB_DEVICE(0x0006, 0x0033, ddb_ctv7),
DDB_DEVICE(0x0007, 0x0023, ddb_s2_48),
DDB_DEVICE(0x0008, 0x0034, ddb_ct2_8), DDB_DEVICE(0x0008, 0x0034, ddb_ct2_8),
DDB_DEVICE(0x0008, 0x0035, ddb_c2t2_8), DDB_DEVICE(0x0008, 0x0035, ddb_c2t2_8),
DDB_DEVICE(0x0008, 0x0036, ddb_isdbt_8), DDB_DEVICE(0x0008, 0x0036, ddb_isdbt_8),
......
This diff is collapsed.
/*
* ddbridge-maxs8.h: Digital Devices bridge MaxS4/8 support
*
* Copyright (C) 2010-2017 Digital Devices GmbH
* Ralph Metzler <rjkm@metzlerbros.de>
* Marcus Metzler <mocm@metzlerbros.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _DDBRIDGE_MAXS8_H_
#define _DDBRIDGE_MAXS8_H_
#include "ddbridge.h"
/******************************************************************************/
int lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm);
int fe_attach_mxl5xx(struct ddb_input *input);
#endif /* _DDBRIDGE_MAXS8_H */
...@@ -133,3 +133,24 @@ ...@@ -133,3 +133,24 @@
#define CI_BUFFER_SIZE (0x0800) #define CI_BUFFER_SIZE (0x0800)
#define CI_BUFFER(i) (CI_BUFFER_BASE + (i) * CI_BUFFER_SIZE) #define CI_BUFFER(i) (CI_BUFFER_BASE + (i) * CI_BUFFER_SIZE)
/* ------------------------------------------------------------------------- */
/* LNB commands (mxl5xx / Max S8) */
#define LNB_BASE (0x400)
#define LNB_CONTROL(i) (LNB_BASE + (i) * 0x20 + 0x00)
#define LNB_CMD (7ULL << 0)
#define LNB_CMD_NOP 0
#define LNB_CMD_INIT 1
#define LNB_CMD_LOW 3
#define LNB_CMD_HIGH 4
#define LNB_CMD_OFF 5
#define LNB_CMD_DISEQC 6
#define LNB_BUSY (1ULL << 4)
#define LNB_TONE (1ULL << 15)
#define LNB_BUF_LEVEL(i) (LNB_BASE + (i) * 0x20 + 0x10)
#define LNB_BUF_WRITE(i) (LNB_BASE + (i) * 0x20 + 0x14)
...@@ -115,6 +115,7 @@ struct ddb_info { ...@@ -115,6 +115,7 @@ struct ddb_info {
#define DDB_NONE 0 #define DDB_NONE 0
#define DDB_OCTOPUS 1 #define DDB_OCTOPUS 1
#define DDB_OCTOPUS_CI 2 #define DDB_OCTOPUS_CI 2
#define DDB_OCTOPUS_MAX 5
#define DDB_OCTOPUS_MAX_CT 6 #define DDB_OCTOPUS_MAX_CT 6
char *name; char *name;
u32 i2c_mask; u32 i2c_mask;
...@@ -295,6 +296,15 @@ struct ddb_port { ...@@ -295,6 +296,15 @@ struct ddb_port {
#define TS_CAPTURE_LEN (4096) #define TS_CAPTURE_LEN (4096)
struct ddb_lnb {
struct mutex lock;
u32 tone;
enum fe_sec_voltage oldvoltage[4];
u32 voltage[4];
u32 voltages;
u32 fmode;
};
struct ddb_link { struct ddb_link {
struct ddb *dev; struct ddb *dev;
struct ddb_info *info; struct ddb_info *info;
...@@ -302,6 +312,7 @@ struct ddb_link { ...@@ -302,6 +312,7 @@ struct ddb_link {
u32 regs; u32 regs;
spinlock_t lock; spinlock_t lock;
struct mutex flash_mutex; struct mutex flash_mutex;
struct ddb_lnb lnb;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
struct ddb_ids ids; struct ddb_ids ids;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment