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

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ config DVB_DDBRIDGE
	select DVB_STV6111 if MEDIA_SUBDRV_AUTOSELECT
	select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT
	select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT
	select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT
	---help---
	  Support for cards with the Digital Devices PCI express bridge:
	  - Octopus PCIe Bridge
@@ -24,6 +25,7 @@ config DVB_DDBRIDGE
	  - CineCTv7 and DuoFlex CT2/C2T2/C2T2I (Sony CXD28xx-based)
	  - MaxA8 series
	  - 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.

+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#

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

+64 −3
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "ddbridge.h"
#include "ddbridge-i2c.h"
#include "ddbridge-regs.h"
#include "ddbridge-maxs8.h"
#include "ddbridge-io.h"

#include "tda18271c2dd.h"
@@ -1424,8 +1425,9 @@ static int dvb_input_attach(struct ddb_input *input)
	dvb->fe = dvb->fe2 = NULL;
	switch (port->type) {
	case DDB_TUNER_MXL5XX:
		dev_notice(port->dev->dev, "MaxLinear MxL5xx not supported\n");
		if (fe_attach_mxl5xx(input) < 0)
			return -ENODEV;
		break;
	case DDB_TUNER_DVBS_ST:
		if (demod_attach_stv0900(input, 0) < 0)
			return -ENODEV;
@@ -1770,6 +1772,17 @@ static void ddb_port_probe(struct ddb_port *port)
		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) {
		port->name = "CI internal";
		port->type_name = "INTERNAL";
@@ -2531,6 +2544,20 @@ static int ddb_port_match_i2c(struct ddb_port *port)
	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)
{
	u32 i, l, p;
@@ -2555,7 +2582,11 @@ void ddb_ports_init(struct ddb *dev)
			port->obr = ci_bitrate;
			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);

			port->dvb[0].adap = &dev->adap[2 * p];
@@ -2603,6 +2634,7 @@ void ddb_ports_init(struct ddb *dev)
				ddb_input_init(port, 2 * i + 1, 1, 2 * i + 1);
				ddb_output_init(port, i);
				break;
			case DDB_OCTOPUS_MAX:
			case DDB_OCTOPUS_MAX_CT:
				ddb_input_init(port, 2 * i, 0, 2 * p);
				ddb_input_init(port, 2 * i + 1, 1, 2 * p + 1);
@@ -3202,6 +3234,15 @@ static ssize_t regmap_show(struct device *device,
	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,
			  struct device_attribute *attr, char *buf)
{
@@ -3211,6 +3252,21 @@ static ssize_t devid_show(struct device *device,
	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[] = {
	__ATTR_RO(version),
	__ATTR_RO(ports),
@@ -3220,6 +3276,10 @@ static struct device_attribute ddb_attrs[] = {
	__ATTR(gap1, 0664, gap_show, gap_store),
	__ATTR(gap2, 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(devid1, devid_show),
	__ATTR_MRO(devid2, devid_show),
@@ -3509,6 +3569,7 @@ static int ddb_init_boards(struct ddb *dev)

int ddb_init(struct ddb *dev)
{
	mutex_init(&dev->link[0].lnb.lock);
	mutex_init(&dev->link[0].flash_mutex);
	if (no_init) {
		ddb_device_create(dev);
+12 −0
Original line number Diff line number Diff line
@@ -297,3 +297,15 @@ const struct ddb_info ddb_c2t2i_8 = {
	.ts_quirks = TS_QUIRK_SERIAL,
	.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,
};
+4 −0
Original line number Diff line number Diff line
@@ -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_8;

/****************************************************************************/

extern const struct ddb_info ddb_s2_48;

#endif /* _DDBRIDGE_HW_H */
Loading