Skip to contentSkip to conversation

dddvb/ddbridge updates as of 2018-06-23

PATCH In review Daniel Scheller 2 participants 21 messages Jun 23, 2018 – Jul 30, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover dddvb/ddbridge updates as of 2018-06-23

From: Daniel Scheller <[email protected]>

A bunch of commits as they appeared in the dddvb upstream GIT as of 2018-06-23, mainly cleanups, cosmetics and code move in preparation for new MCI card types, plus improvements to the existing SX8 code, ie. DVBv5 signal statistics.

Also fixes one sparse warning as being reported by Hans' daily media_tree build in the mxl5xx driver.

Daniel Scheller (19):
[media] dvb-frontends/mxl5xx: add break to case DVBS2 in
get_frontend()
[media] dvb-frontends/stv0910: cast the BER denominator shift exp to
ULL
[media] ddbridge: probe for LNBH25 chips before attaching [media] ddbridge: evaluate the actual link when setting up the dummy
tuner
[media] ddbridge: report I2C bus errors
[media] ddbridge: remove unused MDIO defines and hwinfo member [media] ddbridge: link structure access cosmetics in ddb_port_probe() [media] ddbridge: change MCI base ID and define a SX8 ID [media] ddbridge/mci: update copyright year in headers [media] ddbridge/mci: read and report signal strength and SNR [media] ddbridge/mci: rename defines and fix i/q var types [media] ddbridge/mci: extend mci_command and mci_result structs [media] ddbridge/mci: store mci type and number of ports in the hwinfo [media] ddbridge/mci: make ddb_mci_cmd() and ddb_mci_config() public [media] ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.c [media] ddbridge/mci: add more MCI status codes, improve MCI_SUCCESS
macro
[media] ddbridge/sx8: disable automatic PLS code search [media] ddbridge/sx8: enable modulation selection in set_parameters() [media] ddbridge/mci: add SX8 I/Q mode remark and remove DIAG CMD
defines

 drivers/media/dvb-frontends/mxl5xx.c       |   1 +
 drivers/media/dvb-frontends/stv0910.c      |   4 +-
 drivers/media/pci/ddbridge/Makefile        |   3 +-
 drivers/media/pci/ddbridge/ddbridge-core.c |  45 +--
 drivers/media/pci/ddbridge/ddbridge-hw.c   |   3 +-
 drivers/media/pci/ddbridge/ddbridge-i2c.c  |   5 +-
 drivers/media/pci/ddbridge/ddbridge-max.c  |  18 +-
 drivers/media/pci/ddbridge/ddbridge-max.h  |   2 +-
 drivers/media/pci/ddbridge/ddbridge-mci.c  | 409 ++----------------------
 drivers/media/pci/ddbridge/ddbridge-mci.h  | 192 ++++++++---
 drivers/media/pci/ddbridge/ddbridge-regs.h |   8 -
 drivers/media/pci/ddbridge/ddbridge-sx8.c  | 490 +++++++++++++++++++++++++++++
 drivers/media/pci/ddbridge/ddbridge.h      |  14 +-
 13 files changed, 718 insertions(+), 476 deletions(-)
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-sx8.c
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/19 dvb-frontends/mxl5xx: add break to case DVBS2 in get_frontend()

From: Daniel Scheller <[email protected]>

Fix one sparse warning:

drivers/media/dvb-frontends/mxl5xx.c:731:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

as seen in Hans' daily media_tree builds.

---
 drivers/media/dvb-frontends/mxl5xx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/dvb-frontends/mxl5xx.c +1 -0
index 274d8fca0763..a7d08ace11ba 100644
@@ -739,6 +739,7 @@ static int get_frontend(struct dvb_frontend *fe,
 		default:
 			break;
 		}
+		break;
 	case SYS_DVBS:
 		switch ((enum MXL_HYDRA_MODULATION_E)
 			reg_data[DMD_MODULATION_SCHEME_ADDR]) {
Signature · 1 line
2.16.4
#2 lore raw

Re: [PATCH 01/19] [media] dvb-frontends/mxl5xx: add break to case DVBS2 in get_frontend()

Em Sat, 23 Jun 2018 17:35:57 +0200
Daniel Scheller <[email protected]> escreveu:

Quoted 18 lines

From: Daniel Scheller <[email protected]>

Fix one sparse warning:

drivers/media/dvb-frontends/mxl5xx.c:731:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

as seen in Hans' daily media_tree builds.

---
 drivers/media/dvb-frontends/mxl5xx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/dvb-frontends/mxl5xx.c +0 -0
index 274d8fca0763..a7d08ace11ba 100644

drivers/media/dvb-frontends/mxl5xx.c static int get_frontend(struct dvb_frontend *fe, · line 745

Quoted 7 lines
drivers/media/dvb-frontends/mxl5xx.c +1 -0
@@ -739,6 +739,7 @@ static int get_frontend(struct dvb_frontend *fe,
 		default:
 			break;
 		}
+		break;
 	case SYS_DVBS:
 		switch ((enum MXL_HYDRA_MODULATION_E)
 			reg_data[DMD_MODULATION_SCHEME_ADDR]) {

Are you sure this is the right thing to do here? looking at the code, I suspect that it should, instead, just adding a comment, as the stuff below the SYS_DVBS case seem to be needed also for DVB-S2.

Thanks,
Mauro

#3 lore raw

PATCH 2/19 dvb-frontends/stv0910: cast the BER denominator shift exp to ULL

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

To avoid miscalculations related to the BER denominator, the shift expression needs to be casted as ULL.

Picked up from the upstream dddvb GIT.

---
 drivers/media/dvb-frontends/stv0910.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/stv0910.c +2 -2
index 41444fa1c0bb..91b21eb59531 100644
@@ -682,8 +682,8 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
 		return -EINVAL;
 
 	if ((regs[0] & 0x80) == 0) {
-		state->last_berdenominator = 1 << ((state->berscale * 2) +
-						  10 + 3);
+		state->last_berdenominator = 1ULL << ((state->berscale * 2) +
+						     10 + 3);
 		state->last_bernumerator = ((u32)(regs[0] & 0x7F) << 16) |
 			((u32)regs[1] << 8) | regs[2];
 		if (state->last_bernumerator < 256 && state->berscale < 6) {
Signature · 1 line
2.16.4
#4 lore raw

PATCH 3/19 ddbridge: probe for LNBH25 chips before attaching

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

In demod_attach_stv0910(), the LNBH25 IC is being blindly attached and, if the result is bad, blindly attached on another possible I2C address. The LNBH25 uses it's set_voltage function to test for the IC and will print an error to the kernel log on failure. Prevent this by probing the possible I2C address and use this (and only this) to attach the LNBH25 I2C driver. This also allows the stv0910 attach function to be a bit cleaner.

Picked up from the upstream dddvb GIT and adapted for the LNBH25 driver variant from the kernel tree.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/pci/ddbridge/ddbridge-core.c +15 -7
index d5b0d1eaf3ad..3f83415b06c7 100644
@@ -1191,6 +1191,13 @@ static const struct lnbh25_config lnbh25_cfg = {
 	.data2_config = LNBH25_TEN
 };
 
+static int has_lnbh25(struct i2c_adapter *i2c, u8 adr)
+{
+	u8 val;
+
+	return i2c_read_reg(i2c, adr, 0, &val) ? 0 : 1;
+}
+
 static int demod_attach_stv0910(struct ddb_input *input, int type, int tsfast)
 {
 	struct i2c_adapter *i2c = &input->port->i2c->adap;
@@ -1224,14 +1231,15 @@ static int demod_attach_stv0910(struct ddb_input *input, int type, int tsfast)
 	/* attach lnbh25 - leftshift by one as the lnbh25 driver expects 8bit
 	 * i2c addresses
 	 */
-	lnbcfg.i2c_address = (((input->nr & 1) ? 0x0d : 0x0c) << 1);
-	if (!dvb_attach(lnbh25_attach, dvb->fe, &lnbcfg, i2c)) {
+	if (has_lnbh25(i2c, 0x0d))
+		lnbcfg.i2c_address = (((input->nr & 1) ? 0x0d : 0x0c) << 1);
+	else
 		lnbcfg.i2c_address = (((input->nr & 1) ? 0x09 : 0x08) << 1);
-		if (!dvb_attach(lnbh25_attach, dvb->fe, &lnbcfg, i2c)) {
-			dev_err(dev, "No LNBH25 found!\n");
-			dvb_frontend_detach(dvb->fe);
-			return -ENODEV;
-		}
+
+	if (!dvb_attach(lnbh25_attach, dvb->fe, &lnbcfg, i2c)) {
+		dev_err(dev, "No LNBH25 found!\n");
+		dvb_frontend_detach(dvb->fe);
+		return -ENODEV;
 	}
 
 	return 0;
Signature · 1 line
2.16.4
#5 lore raw

PATCH 4/19 ddbridge: evaluate the actual link when setting up the dummy tuner

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Devices supporting dummy tuner operation can exist on any link, not only on link 0, so fix this accordingly.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-core.c +1 -1
index 3f83415b06c7..55eb151f329e 100644
@@ -1859,7 +1859,7 @@ static void ddb_port_probe(struct ddb_port *port)
 	/* Handle missing ports and ports without I2C */
 
 	if (dummy_tuner && !port->nr &&
-	    dev->link[0].ids.device == 0x0005) {
+	    dev->link[l].ids.device == 0x0005) {
 		port->name = "DUMMY";
 		port->class = DDB_PORT_TUNER;
 		port->type = DDB_TUNER_DUMMY;
Signature · 1 line
2.16.4
#6 lore raw

PATCH 5/19 ddbridge: report I2C bus errors

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

The I2C_COMMAND response reports an error in the I2C bus communication using bit 17. Evaluate the response more thoroughly and log an error if an I2C problem was detected.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-i2c.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-i2c.c +4 -1
index 667340c86ea7..5a28d7611713 100644
@@ -73,7 +73,10 @@ static int ddb_i2c_cmd(struct ddb_i2c *i2c, u32 adr, u32 cmd)
 		}
 		return -EIO;
 	}
-	if (val & 0x70000)
+	val &= 0x70000;
+	if (val == 0x20000)
+		dev_err(dev->dev, "I2C bus error\n");
+	if (val)
 		return -EIO;
 	return 0;
 }
Signature · 1 line
2.16.4
#7 lore raw

PATCH 6/19 ddbridge: remove unused MDIO defines and hwinfo member

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

ddbridge has a few MDIO related remainders (defines, hwinfo struct) which aren't of any use for the in-kernel driver at all (they're only used in conjunction with the OctoNet SAT>IP boxes which the kernel driver doesn't have any support for), so clean this up.

---
 drivers/media/pci/ddbridge/ddbridge-regs.h | 8 --------
 drivers/media/pci/ddbridge/ddbridge.h      | 1 -
 2 files changed, 9 deletions(-)
drivers/media/pci/ddbridge/ddbridge-regs.h +0 -8
index b978b5991940..f9e1cbb99b53 100644
@@ -33,14 +33,6 @@
 #define GPIO_INPUT       0x24
 #define GPIO_DIRECTION   0x28
 
-/* ------------------------------------------------------------------------- */
-/* MDIO */
-
-#define MDIO_CTRL        0x20
-#define MDIO_ADR         0x24
-#define MDIO_REG         0x28
-#define MDIO_VAL         0x2C
-
 /* ------------------------------------------------------------------------- */
 
 #define BOARD_CONTROL    0x30
drivers/media/pci/ddbridge/ddbridge.h +0 -1
index a66b1125cc74..9c645bee428a 100644
@@ -127,7 +127,6 @@ struct ddb_info {
 	u8    temp_bus;
 	u32   board_control;
 	u32   board_control_2;
-	u8    mdio_num;
 	u8    con_clock; /* use a continuous clock */
 	u8    ts_quirks;
 #define TS_QUIRK_SERIAL   1
Signature · 1 line
2.16.4
#8 lore raw

PATCH 7/19 ddbridge: link structure access cosmetics in ddb_port_probe()

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Throughout the function, dev->link[l] is used several times. Unclutter this a bit by declaring a ddb_link var at the top of the function, assign the address of dev->link[l] to it and use that var to access the link[] struct member.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/media/pci/ddbridge/ddbridge-core.c +9 -8
index 55eb151f329e..408460be00b7 100644
@@ -1850,6 +1850,7 @@ static void ddb_port_probe(struct ddb_port *port)
 {
 	struct ddb *dev = port->dev;
 	u32 l = port->lnr;
+	struct ddb_link *link = &dev->link[l];
 	u8 id, type;
 
 	port->name = "NO MODULE";
@@ -1859,7 +1860,7 @@ static void ddb_port_probe(struct ddb_port *port)
 	/* Handle missing ports and ports without I2C */
 
 	if (dummy_tuner && !port->nr &&
-	    dev->link[l].ids.device == 0x0005) {
+	    link->ids.device == 0x0005) {
 		port->name = "DUMMY";
 		port->class = DDB_PORT_TUNER;
 		port->type = DDB_TUNER_DUMMY;
@@ -1873,14 +1874,14 @@ static void ddb_port_probe(struct ddb_port *port)
 		return;
 	}
 
-	if (port->nr == 1 && dev->link[l].info->type == DDB_OCTOPUS_CI &&
-	    dev->link[l].info->i2c_mask == 1) {
+	if (port->nr == 1 && link->info->type == DDB_OCTOPUS_CI &&
+	    link->info->i2c_mask == 1) {
 		port->name = "NO TAB";
 		port->class = DDB_PORT_NONE;
 		return;
 	}
 
-	if (dev->link[l].info->type == DDB_OCTOPUS_MAX) {
+	if (link->info->type == DDB_OCTOPUS_MAX) {
 		port->name = "DUAL DVB-S2 MAX";
 		port->type_name = "MXL5XX";
 		port->class = DDB_PORT_TUNER;
@@ -1891,8 +1892,8 @@ static void ddb_port_probe(struct ddb_port *port)
 		return;
 	}
 
-	if (dev->link[l].info->type == DDB_OCTOPUS_MCI) {
-		if (port->nr >= dev->link[l].info->mci)
+	if (link->info->type == DDB_OCTOPUS_MCI) {
+		if (port->nr >= link->info->mci)
 			return;
 		port->name = "DUAL MCI";
 		port->type_name = "MCI";
@@ -1901,7 +1902,7 @@ static void ddb_port_probe(struct ddb_port *port)
 		return;
 	}
 
-	if (port->nr > 1 && dev->link[l].info->type == DDB_OCTOPUS_CI) {
+	if (port->nr > 1 && link->info->type == DDB_OCTOPUS_CI) {
 		port->name = "CI internal";
 		port->type_name = "INTERNAL";
 		port->class = DDB_PORT_CI;
@@ -1986,7 +1987,7 @@ static void ddb_port_probe(struct ddb_port *port)
 		port->class = DDB_PORT_TUNER;
 		if (id == 0x51) {
 			if (port->nr == 0 &&
-			    dev->link[l].info->ts_quirks & TS_QUIRK_REVERSED)
+			    link->info->ts_quirks & TS_QUIRK_REVERSED)
 				port->type = DDB_TUNER_DVBS_STV0910_PR;
 			else
 				port->type = DDB_TUNER_DVBS_STV0910_P;
Signature · 1 line
2.16.4
#9 lore raw

PATCH 8/19 ddbridge: change MCI base ID and define a SX8 ID

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Change the start of the MCI ID range (internally used only) to 48 and define an ID for the SX8 card type. Use this new ID to handle device attachment.

This change is done in preparation for support of more MCI based cards.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++--
 drivers/media/pci/ddbridge/ddbridge.h      | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/media/pci/ddbridge/ddbridge-core.c +2 -2
index 408460be00b7..68ea0ffdad2d 100644
@@ -1592,7 +1592,7 @@ static int dvb_input_attach(struct ddb_input *input)
 		if (demod_attach_dummy(input) < 0)
 			goto err_detach;
 		break;
-	case DDB_TUNER_MCI:
+	case DDB_TUNER_MCI_SX8:
 		if (ddb_fe_attach_mci(input) < 0)
 			goto err_detach;
 		break;
@@ -1898,7 +1898,7 @@ static void ddb_port_probe(struct ddb_port *port)
 		port->name = "DUAL MCI";
 		port->type_name = "MCI";
 		port->class = DDB_PORT_TUNER;
-		port->type = DDB_TUNER_MCI;
+		port->type = DDB_TUNER_MCI_SX8;
 		return;
 	}
 
drivers/media/pci/ddbridge/ddbridge.h +3 -1
index 9c645bee428a..65bd74d86ed5 100644
@@ -254,7 +254,6 @@ struct ddb_port {
 #define DDB_CI_EXTERNAL_XO2_B    13
 #define DDB_TUNER_DVBS_STV0910_PR 14
 #define DDB_TUNER_DVBC2T2I_SONY_P 15
-#define DDB_TUNER_MCI            16
 
 #define DDB_TUNER_XO2            32
 #define DDB_TUNER_DVBS_STV0910   (DDB_TUNER_XO2 + 0)
@@ -264,6 +263,9 @@ struct ddb_port {
 #define DDB_TUNER_ATSC_ST        (DDB_TUNER_XO2 + 4)
 #define DDB_TUNER_DVBC2T2I_SONY  (DDB_TUNER_XO2 + 5)
 
+#define DDB_TUNER_MCI            48
+#define DDB_TUNER_MCI_SX8        (DDB_TUNER_MCI + 0)
+
 	struct ddb_input      *input[2];
 	struct ddb_output     *output;
 	struct dvb_ca_en50221 *en;
Signature · 1 line
2.16.4
#10 lore raw

PATCH 9/19 ddbridge/mci: update copyright year in headers

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Update the copyright year information in the MCI headers to 2017-2018.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.c | 6 +++---
 drivers/media/pci/ddbridge/ddbridge-mci.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.c +3 -3
index 4ac634fc96e4..46b20b06e2a6 100644
@@ -2,9 +2,9 @@
 /*
  * ddbridge-mci.c: Digital Devices microcode interface
  *
- * Copyright (C) 2017 Digital Devices GmbH
- *                    Ralph Metzler <[email protected]>
- *                    Marcus Metzler <[email protected]>
+ * Copyright (C) 2017-2018 Digital Devices GmbH
+ *                         Ralph Metzler <[email protected]>
+ *                         Marcus Metzler <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
drivers/media/pci/ddbridge/ddbridge-mci.h +3 -3
index 209cc2b92dff..389f6376603b 100644
@@ -2,9 +2,9 @@
 /*
  * ddbridge-mci.h: Digital Devices micro code interface
  *
- * Copyright (C) 2017 Digital Devices GmbH
- *                    Marcus Metzler <[email protected]>
- *                    Ralph Metzler <[email protected]>
+ * Copyright (C) 2017-2018 Digital Devices GmbH
+ *                         Marcus Metzler <[email protected]>
+ *                         Ralph Metzler <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
Signature · 1 line
2.16.4
#11 lore raw

PATCH 10/19 ddbridge/mci: read and report signal strength and SNR

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Implement querying signal statistics from the MCI and report this data in read_status() as DVBv5 statistics.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.c | 47 ++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-mci.c +46 -1
index 46b20b06e2a6..7d402861fa9e 100644
@@ -155,6 +155,47 @@ static void release(struct dvb_frontend *fe)
 	kfree(state);
 }
 
+static int get_info(struct dvb_frontend *fe)
+{
+	int stat;
+	struct mci *state = fe->demodulator_priv;
+	struct mci_command cmd;
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.command = MCI_CMD_GETSIGNALINFO;
+	cmd.demod = state->demod;
+	stat = mci_cmd(state, &cmd, &state->signal_info);
+	return stat;
+}
+
+static int get_snr(struct dvb_frontend *fe)
+{
+	struct mci *state = fe->demodulator_priv;
+	struct dtv_frontend_properties *p = &fe->dtv_property_cache;
+
+	p->cnr.len = 1;
+	p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
+	p->cnr.stat[0].svalue =
+		(s64)state->signal_info.dvbs2_signal_info.signal_to_noise
+		     * 10;
+	return 0;
+}
+
+static int get_strength(struct dvb_frontend *fe)
+{
+	struct mci *state = fe->demodulator_priv;
+	struct dtv_frontend_properties *p = &fe->dtv_property_cache;
+	s32 str;
+
+	str = 100000 -
+	      (state->signal_info.dvbs2_signal_info.channel_power
+	       * 10 + 108750);
+	p->strength.len = 1;
+	p->strength.stat[0].scale = FE_SCALE_DECIBEL;
+	p->strength.stat[0].svalue = str;
+	return 0;
+}
+
 static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 {
 	int stat;
@@ -168,10 +209,14 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 	if (stat)
 		return stat;
 	*status = 0x00;
+	get_info(fe);
+	get_strength(fe);
 	if (res.status == SX8_DEMOD_WAIT_MATYPE)
 		*status = 0x0f;
-	if (res.status == SX8_DEMOD_LOCKED)
+	if (res.status == SX8_DEMOD_LOCKED) {
 		*status = 0x1f;
+		get_snr(fe);
+	}
 	return stat;
 }
 
Signature · 1 line
2.16.4
#12 lore raw

PATCH 11/19 ddbridge/mci: rename defines and fix i/q var types

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Adjustments to match the FPGA firmware, and the signal I/Q values are reported as s16 types from the card firmware.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.c |  2 +-
 drivers/media/pci/ddbridge/ddbridge-mci.h | 56 +++++++++++++++----------------
 2 files changed, 29 insertions(+), 29 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.c +1 -1
index 7d402861fa9e..fa0d7d0cc6f6 100644
@@ -342,7 +342,7 @@ static int start(struct dvb_frontend *fe, u32 flags, u32 modmask, u32 ts_config)
 	memset(&cmd, 0, sizeof(cmd));
 
 	if (state->base->iq_mode) {
-		cmd.command = SX8_CMD_SELECT_IQOUT;
+		cmd.command = SX8_CMD_ENABLE_IQOUTPUT;
 		cmd.demod = state->demod;
 		cmd.output = 0;
 		mci_cmd(state, &cmd, NULL);
drivers/media/pci/ddbridge/ddbridge-mci.h +28 -28

76 lines not on this page · raw message

Signature · 1 line
2.16.4
#13 lore raw

PATCH 12/19 ddbridge/mci: extend mci_command and mci_result structs

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Recent FPGA firmware reports more data and values in sent command responses. Adjust the mci_command and mci_result structs including it's unions to match these changes and add a few comments explaining things.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.h | 74 +++++++++++++++++++++++++++----
 1 file changed, 66 insertions(+), 8 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.h +66 -8
index 2e74f0544717..5e0c9e88b6fc 100644
@@ -90,16 +90,30 @@ struct mci_command {
 	union {
 		u32 command_word;
 		struct {
-			u8 command;
-			u8 tuner;
-			u8 demod;
-			u8 output;
+			u8  command;
+			u8  tuner;
+			u8  demod;
+			u8  output;
 		};
 	};
 	union {
 		u32 params[31];
 		struct {
+			/*
+			 * Bit 0: DVB-S Enabled
+			 * Bit 1: DVB-S2 Enabled
+			 * Bit 7: InputStreamID
+			 */
 			u8  flags;
+			/*
+			 * Bit 0: QPSK,
+			 * Bit 1: 8PSK/8APSK
+			 * Bit 2: 16APSK
+			 * Bit 3: 32APSK
+			 * Bit 4: 64APSK
+			 * Bit 5: 128APSK
+			 * Bit 6: 256APSK
+			 */
 			u8  s2_modulation_mask;
 			u8  rsvd1;
 			u8  retry;
@@ -108,7 +122,36 @@ struct mci_command {
 			u8  input_stream_id;
 			u8  rsvd2[3];
 			u32 scrambling_sequence_index;
+			u32 frequency_range;
 		} dvbs2_search;
+
+		struct {
+			u8  tap;
+			u8  rsvd;
+			u16 point;
+		} get_iq_symbol;
+
+		struct {
+			/*
+			 * Bit 0: 0=VTM/1=SCAN
+			 * Bit 1: Set Gain
+			 */
+			u8  flags;
+			u8  roll_off;
+			u8  rsvd1;
+			u8  rsvd2;
+			u32 frequency;
+			u32 symbol_rate; /* Only in VTM mode */
+			u16 gain;
+		} sx8_start_iq;
+
+		struct {
+			/*
+			 * Bit 1:0 = STVVGLNA Gain.
+			 *   0 = AGC, 1 = 0dB, 2 = Minimum, 3 = Maximum
+			 */
+			u8  flags;
+		} sx8_input_enable;
 	};
 };
 
@@ -116,34 +159,49 @@ struct mci_result {
 	union {
 		u32 status_word;
 		struct {
-			u8 status;
-			u8 rsvd;
+			u8  status;
+			u8  mode;
 			u16 time;
 		};
 	};
 	union {
 		u32 result[27];
 		struct {
+			/* 1 = DVB-S, 2 = DVB-S2X */
 			u8  standard;
 			/* puncture rate for DVB-S */
 			u8  pls_code;
-			/* 7-6: rolloff, 5-2: rsrvd, 1:short, 0:pilots */
+			/* 2-0: rolloff */
 			u8  roll_off;
 			u8  rsvd;
+			/* actual frequency in Hz */
 			u32 frequency;
+			/* actual symbolrate in Hz */
 			u32 symbol_rate;
+			/* channel power in dBm x 100 */
 			s16 channel_power;
+			/* band power in dBm x 100 */
 			s16 band_power;
+			/*
+			 * SNR in dB x 100
+			 * Note: negative values are valid in DVB-S2
+			 */
 			s16 signal_to_noise;
 			s16 rsvd2;
+			/*
+			 * Counter for packet errors
+			 * (set to 0 on start command)
+			 */
 			u32 packet_errors;
+			/* Bit error rate: PreRS in DVB-S, PreBCH in DVB-S2X */
 			u32 ber_numerator;
 			u32 ber_denominator;
 		} dvbs2_signal_info;
+
 		struct {
 			s16 i;
 			s16 q;
-		} dvbs2_signal_iq;
+		} iq_symbol;
 	};
 	u32 version[4];
 };
Signature · 1 line
2.16.4
#14 lore raw

PATCH 13/19 ddbridge/mci: store mci type and number of ports in the hwinfo

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

For better support for future MCI based cards, rename the mci struct member to mci_ports to carry the number of ports on the cards, and add a mci_type member to identify the card type to handle differing hardware.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++--
 drivers/media/pci/ddbridge/ddbridge-hw.c   | 3 ++-
 drivers/media/pci/ddbridge/ddbridge.h      | 9 ++++++---
 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/media/pci/ddbridge/ddbridge-core.c +2 -2
index 68ea0ffdad2d..67b60da12cf4 100644
@@ -1893,12 +1893,12 @@ static void ddb_port_probe(struct ddb_port *port)
 	}
 
 	if (link->info->type == DDB_OCTOPUS_MCI) {
-		if (port->nr >= link->info->mci)
+		if (port->nr >= link->info->mci_ports)
 			return;
 		port->name = "DUAL MCI";
 		port->type_name = "MCI";
 		port->class = DDB_PORT_TUNER;
-		port->type = DDB_TUNER_MCI_SX8;
+		port->type = DDB_TUNER_MCI + link->info->mci_type;
 		return;
 	}
 
drivers/media/pci/ddbridge/ddbridge-hw.c +2 -1
index 1d3ee6accdd5..f3cbac07b41f 100644
@@ -318,7 +318,8 @@ static const struct ddb_info ddb_s2x_48 = {
 	.port_num = 4,
 	.i2c_mask = 0x00,
 	.tempmon_irq = 24,
-	.mci      = 4
+	.mci_ports = 4,
+	.mci_type = 0,
 };
 
 /****************************************************************************/
drivers/media/pci/ddbridge/ddbridge.h +6 -3
index 65bd74d86ed5..8a354dfb6c22 100644
@@ -120,20 +120,23 @@ struct ddb_info {
 #define DDB_OCTOPUS_MCI     9
 	char *name;
 	u32   i2c_mask;
+	u32   board_control;
+	u32   board_control_2;
+
 	u8    port_num;
 	u8    led_num;
 	u8    fan_num;
 	u8    temp_num;
 	u8    temp_bus;
-	u32   board_control;
-	u32   board_control_2;
 	u8    con_clock; /* use a continuous clock */
 	u8    ts_quirks;
 #define TS_QUIRK_SERIAL   1
 #define TS_QUIRK_REVERSED 2
 #define TS_QUIRK_ALT_OSC  8
+	u8    mci_ports;
+	u8    mci_type;
+
 	u32   tempmon_irq;
-	u8    mci;
 	const struct ddb_regmap *regmap;
 };
 
Signature · 1 line
2.16.4
#15 lore raw

PATCH 14/19 ddbridge/mci: make ddb_mci_cmd() and ddb_mci_config() public

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

In preparation for splitting all MaxSX8 related code parts from the common MCI code, prefix both mci_cmd() and mci_config() functions with ddb_, remove the static marking and add matching function prototypes to ddbridge-mci.h so these functions can be reused from other files within the ddbridge driver. As this requires the mci-related structs to be defined in ddbridge-mci.h, move struct mci and struct mci_base there and clean them up.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.c | 62 ++++++++-----------------------
 drivers/media/pci/ddbridge/ddbridge-mci.h | 36 ++++++++++++++++++
 2 files changed, 51 insertions(+), 47 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.c +15 -47
index fa0d7d0cc6f6..a29ff25d9029 100644
@@ -26,38 +26,6 @@ static const u32 MCLK = (1550000000 / 12);
 static const u32 MAX_DEMOD_LDPC_BITRATE = (1550000000 / 6);
 static const u32 MAX_LDPC_BITRATE = (720000000);
 
-struct mci_base {
-	struct list_head     mci_list;
-	void                *key;
-	struct ddb_link     *link;
-	struct completion    completion;
-
-	struct device       *dev;
-	struct mutex         tuner_lock; /* concurrent tuner access lock */
-	u8                   adr;
-	struct mutex         mci_lock; /* concurrent MCI access lock */
-	int                  count;
-
-	u8                   tuner_use_count[MCI_TUNER_MAX];
-	u8                   assigned_demod[MCI_DEMOD_MAX];
-	u32                  used_ldpc_bitrate[MCI_DEMOD_MAX];
-	u8                   demod_in_use[MCI_DEMOD_MAX];
-	u32                  iq_mode;
-};
-
-struct mci {
-	struct mci_base     *base;
-	struct dvb_frontend  fe;
-	int                  nr;
-	int                  demod;
-	int                  tuner;
-	int                  first_time_lock;
-	int                  started;
-	struct mci_result    signal_info;
-
-	u32                  bb_mode;
-};
-
 static int mci_reset(struct mci *state)
 {
 	struct ddb_link *link = state->base->link;
@@ -84,7 +52,7 @@ static int mci_reset(struct mci *state)
 	return 0;
 }
 
-static int mci_config(struct mci *state, u32 config)
+int ddb_mci_config(struct mci *state, u32 config)
 {
 	struct ddb_link *link = state->base->link;
 
@@ -122,9 +90,9 @@ static int _mci_cmd_unlocked(struct mci *state,
 	return 0;
 }
 
-static int mci_cmd(struct mci *state,
-		   struct mci_command *command,
-		   struct mci_result *result)
+int ddb_mci_cmd(struct mci *state,
+		struct mci_command *command,
+		struct mci_result *result)
 {
 	int stat;
 
@@ -164,7 +132,7 @@ static int get_info(struct dvb_frontend *fe)
 	memset(&cmd, 0, sizeof(cmd));
 	cmd.command = MCI_CMD_GETSIGNALINFO;
 	cmd.demod = state->demod;
-	stat = mci_cmd(state, &cmd, &state->signal_info);
+	stat = ddb_mci_cmd(state, &cmd, &state->signal_info);
 	return stat;
 }
 
@@ -205,7 +173,7 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 
 	cmd.command = MCI_CMD_GETSTATUS;
 	cmd.demod = state->demod;
-	stat = mci_cmd(state, &cmd, &res);
+	stat = ddb_mci_cmd(state, &cmd, &res);
 	if (stat)
 		return stat;
 	*status = 0x00;
@@ -228,7 +196,7 @@ static int mci_set_tuner(struct dvb_frontend *fe, u32 tuner, u32 on)
 	memset(&cmd, 0, sizeof(cmd));
 	cmd.tuner = state->tuner;
 	cmd.command = on ? SX8_CMD_INPUT_ENABLE : SX8_CMD_INPUT_DISABLE;
-	return mci_cmd(state, &cmd, NULL);
+	return ddb_mci_cmd(state, &cmd, NULL);
 }
 
 static int stop(struct dvb_frontend *fe)
@@ -241,13 +209,13 @@ static int stop(struct dvb_frontend *fe)
 	if (state->demod != DEMOD_UNUSED) {
 		cmd.command = MCI_CMD_STOP;
 		cmd.demod = state->demod;
-		mci_cmd(state, &cmd, NULL);
+		ddb_mci_cmd(state, &cmd, NULL);
 		if (state->base->iq_mode) {
 			cmd.command = MCI_CMD_STOP;
 			cmd.demod = state->demod;
 			cmd.output = 0;
-			mci_cmd(state, &cmd, NULL);
-			mci_config(state, SX8_TSCONFIG_MODE_NORMAL);
+			ddb_mci_cmd(state, &cmd, NULL);
+			ddb_mci_config(state, SX8_TSCONFIG_MODE_NORMAL);
 		}
 	}
 	mutex_lock(&state->base->tuner_lock);
@@ -345,8 +313,8 @@ static int start(struct dvb_frontend *fe, u32 flags, u32 modmask, u32 ts_config)
 		cmd.command = SX8_CMD_ENABLE_IQOUTPUT;
 		cmd.demod = state->demod;
 		cmd.output = 0;
-		mci_cmd(state, &cmd, NULL);
-		mci_config(state, ts_config);
+		ddb_mci_cmd(state, &cmd, NULL);
+		ddb_mci_config(state, ts_config);
 	}
 	if (p->stream_id != NO_STREAM_ID_FILTER && p->stream_id != 0x80000000)
 		flags |= 0x80;
@@ -368,7 +336,7 @@ static int start(struct dvb_frontend *fe, u32 flags, u32 modmask, u32 ts_config)
 	cmd.output = state->nr;
 	if (p->stream_id == 0x80000000)
 		cmd.output |= 0x80;
-	stat = mci_cmd(state, &cmd, NULL);
+	stat = ddb_mci_cmd(state, &cmd, NULL);
 	if (stat)
 		stop(fe);
 	return stat;
@@ -413,8 +381,8 @@ static int start_iq(struct dvb_frontend *fe, u32 ts_config)
 	cmd.tuner = state->tuner;
 	cmd.demod = state->demod;
 	cmd.output = 7;
-	mci_config(state, ts_config);
-	stat = mci_cmd(state, &cmd, NULL);
+	ddb_mci_config(state, ts_config);
+	stat = ddb_mci_cmd(state, &cmd, NULL);
 	if (stat)
 		stop(fe);
 	return stat;
drivers/media/pci/ddbridge/ddbridge-mci.h +36 -0
index 5e0c9e88b6fc..14c8b1ee6358 100644
@@ -206,6 +206,42 @@ struct mci_result {
 	u32 version[4];
 };
 
+struct mci_base {
+	struct list_head     mci_list;
+	void                *key;
+	struct ddb_link     *link;
+	struct completion    completion;
+
+	struct device       *dev;
+	struct mutex         tuner_lock; /* concurrent tuner access lock */
+	u8                   adr;
+	struct mutex         mci_lock; /* concurrent MCI access lock */
+	int                  count;
+
+	u8                   tuner_use_count[MCI_TUNER_MAX];
+	u8                   assigned_demod[MCI_DEMOD_MAX];
+	u32                  used_ldpc_bitrate[MCI_DEMOD_MAX];
+	u8                   demod_in_use[MCI_DEMOD_MAX];
+	u32                  iq_mode;
+};
+
+struct mci {
+	struct mci_base     *base;
+	struct dvb_frontend  fe;
+	int                  nr;
+	int                  demod;
+	int                  tuner;
+	int                  first_time_lock;
+	int                  started;
+	struct mci_result    signal_info;
+
+	u32                  bb_mode;
+};
+
+int ddb_mci_cmd(struct mci *state, struct mci_command *command,
+		struct mci_result *result);
+int ddb_mci_config(struct mci *state, u32 config);
+
 struct dvb_frontend
 *ddb_mci_attach(struct ddb_input *input,
 		int mci_type, int nr,
Signature · 1 line
2.16.4
#16 lore raw

PATCH 15/19 ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.c

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Split off all code specific to the MaxSX8 cards to a separate ddbridge-sx8 module and hook it up in the Makefile. This also adds evaluation of the mci_type to allow for using different attach handling for different cards. As different cards can implement things differently (ie. support differing frontend_ops, and have different base structs being put ontop of the common mci_base struct), this introduces the mci_cfg struct which is initially used to hold a few specifics to the -sx8 submodule. While at it, the handling of the i/q mode is adjusted slightly. Besides this and handling mci_base and sx8_base struct pointers where needed, all code is copied unmodified from ddbridge-mci.c.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/Makefile        |   3 +-
 drivers/media/pci/ddbridge/ddbridge-core.c |   2 +-
 drivers/media/pci/ddbridge/ddbridge-max.c  |  18 +-
 drivers/media/pci/ddbridge/ddbridge-max.h  |   2 +-
 drivers/media/pci/ddbridge/ddbridge-mci.c  | 408 +------------------------
 drivers/media/pci/ddbridge/ddbridge-mci.h  |  28 +-
 drivers/media/pci/ddbridge/ddbridge-sx8.c  | 474 +++++++++++++++++++++++++++++
 7 files changed, 516 insertions(+), 419 deletions(-)
 create mode 100644 drivers/media/pci/ddbridge/ddbridge-sx8.c
drivers/media/pci/ddbridge/Makefile +2 -1
index 9b9e35f171b7..5b6d5bbc38af 100644
@@ -4,7 +4,8 @@
 #
 
 ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-ci.o \
-		ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o
+		ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o \
+		ddbridge-sx8.o
 
 obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
 
drivers/media/pci/ddbridge/ddbridge-core.c +1 -1
index 67b60da12cf4..c1b982e8e6c9 100644
@@ -1593,7 +1593,7 @@ static int dvb_input_attach(struct ddb_input *input)
 			goto err_detach;
 		break;
 	case DDB_TUNER_MCI_SX8:
-		if (ddb_fe_attach_mci(input) < 0)
+		if (ddb_fe_attach_mci(input, port->type) < 0)
 			goto err_detach;
 		break;
 	default:
drivers/media/pci/ddbridge/ddbridge-max.c +13 -5
index 739e4b444cf4..8da1c7b91577 100644
@@ -457,21 +457,29 @@ int ddb_fe_attach_mxl5xx(struct ddb_input *input)
 /******************************************************************************/
 /* MAX MCI related functions */
 
-int ddb_fe_attach_mci(struct ddb_input *input)
+int ddb_fe_attach_mci(struct ddb_input *input, u32 type)
 {
 	struct ddb *dev = input->port->dev;
 	struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
 	struct ddb_port *port = input->port;
 	struct ddb_link *link = &dev->link[port->lnr];
 	int demod, tuner;
+	struct mci_cfg cfg;
 
 	demod = input->nr;
 	tuner = demod & 3;
-	if (fmode == 3)
-		tuner = 0;
-	dvb->fe = ddb_mci_attach(input, 0, demod, &dvb->set_input);
+	switch (type) {
+	case DDB_TUNER_MCI_SX8:
+		cfg = ddb_max_sx8_cfg;
+		if (fmode == 3)
+			tuner = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+	dvb->fe = ddb_mci_attach(input, &cfg, demod, &dvb->set_input);
 	if (!dvb->fe) {
-		dev_err(dev->dev, "No MAXSX8 found!\n");
+		dev_err(dev->dev, "No MCI card found!\n");
 		return -ENODEV;
 	}
 	if (!dvb->set_input) {
drivers/media/pci/ddbridge/ddbridge-max.h +1 -1
index 82efc53baa94..9838c73973b6 100644
@@ -25,6 +25,6 @@
 
 int ddb_lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm);
 int ddb_fe_attach_mxl5xx(struct ddb_input *input);
-int ddb_fe_attach_mci(struct ddb_input *input);
+int ddb_fe_attach_mci(struct ddb_input *input, u32 type);
 
 #endif /* _DDBRIDGE_MAX_H */
drivers/media/pci/ddbridge/ddbridge-mci.c +11 -397

456 lines not on this page · raw message

drivers/media/pci/ddbridge/ddbridge-mci.h +14 -14
index 14c8b1ee6358..f02bc76e3c98 100644
@@ -211,18 +211,11 @@ struct mci_base {
 	void                *key;
 	struct ddb_link     *link;
 	struct completion    completion;
-
 	struct device       *dev;
 	struct mutex         tuner_lock; /* concurrent tuner access lock */
-	u8                   adr;
 	struct mutex         mci_lock; /* concurrent MCI access lock */
 	int                  count;
-
-	u8                   tuner_use_count[MCI_TUNER_MAX];
-	u8                   assigned_demod[MCI_DEMOD_MAX];
-	u32                  used_ldpc_bitrate[MCI_DEMOD_MAX];
-	u8                   demod_in_use[MCI_DEMOD_MAX];
-	u32                  iq_mode;
+	int                  type;
 };
 
 struct mci {
@@ -231,20 +224,27 @@ struct mci {
 	int                  nr;
 	int                  demod;
 	int                  tuner;
-	int                  first_time_lock;
-	int                  started;
-	struct mci_result    signal_info;
+};
 
-	u32                  bb_mode;
+struct mci_cfg {
+	int                  type;
+	struct dvb_frontend_ops *fe_ops;
+	u32                  base_size;
+	u32                  state_size;
+	int (*init)(struct mci *mci);
+	int (*base_init)(struct mci_base *mci_base);
+	int (*set_input)(struct dvb_frontend *fe, int input);
 };
 
+/* defined in ddbridge-sx8.c */
+extern const struct mci_cfg ddb_max_sx8_cfg;
+
 int ddb_mci_cmd(struct mci *state, struct mci_command *command,
 		struct mci_result *result);
 int ddb_mci_config(struct mci *state, u32 config);
 
 struct dvb_frontend
-*ddb_mci_attach(struct ddb_input *input,
-		int mci_type, int nr,
+*ddb_mci_attach(struct ddb_input *input, struct mci_cfg *cfg, int nr,
 		int (**fn_set_input)(struct dvb_frontend *fe, int input));
 
 #endif /* _DDBRIDGE_MCI_H_ */
drivers/media/pci/ddbridge/ddbridge-sx8.c new file +474 -0

474 lines not on this page · raw message

Signature · 1 line
2.16.4
#17 lore raw

PATCH 16/19 ddbridge/mci: add more MCI status codes, improve MCI_SUCCESS macro

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

The MCI can report the command status more finegrained, so, add more status code defines and update the MCI_SUCCESS macro.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.h +6 -2
index f02bc76e3c98..600a8bc642c4 100644
@@ -74,9 +74,13 @@
 #define SX8_CMD_ENABLE_IQOUTPUT  (0x44)
 #define SX8_CMD_DISABLE_IQOUTPUT (0x45)
 
-#define MCI_ERROR_UNSUPPORTED    (0x80)
+#define MCI_STATUS_OK            (0x00)
+#define MCI_STATUS_UNSUPPORTED   (0x80)
+#define MCI_STATUS_RETRY         (0xFD)
+#define MCI_STATUS_NOT_READY     (0xFE)
+#define MCI_STATUS_ERROR         (0xFF)
 
-#define MCI_SUCCESS(status)      (status < MCI_ERROR_UNSUPPORTED)
+#define MCI_SUCCESS(status)      ((status & MCI_STATUS_UNSUPPORTED) == 0)
 
 #define SX8_CMD_DIAG_READ8       (0xE0)
 #define SX8_CMD_DIAG_READ32      (0xE1)
Signature · 1 line
2.16.4
#18 lore raw

PATCH 17/19 ddbridge/sx8: disable automatic PLS code search

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

The SX8 cards by default do an automatic search for the PLS code. This is not necessarily wanted as this can eventually be detected wrong, so disable this.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-sx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ddbridge/ddbridge-sx8.c +1 -1
index 1a12f2105490..c87cefa10762 100644
@@ -292,7 +292,7 @@ static int start(struct dvb_frontend *fe, u32 flags, u32 modmask, u32 ts_config)
 	cmd.dvbs2_search.frequency = p->frequency * 1000;
 	cmd.dvbs2_search.symbol_rate = p->symbol_rate;
 	cmd.dvbs2_search.scrambling_sequence_index =
-		p->scrambling_sequence_index;
+		p->scrambling_sequence_index | 0x80000000;
 	cmd.dvbs2_search.input_stream_id =
 		(p->stream_id != NO_STREAM_ID_FILTER) ? p->stream_id : 0;
 	cmd.tuner = state->mci.tuner;
Signature · 1 line
2.16.4
#19 lore raw

PATCH 18/19 ddbridge/sx8: enable modulation selection in set_parameters()

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Allow for tuning to transponders with specific modulations in set_parameters(). Setting a specific modulation will also enable lower modulations.

Picked up from the upstream dddvb GIT. Upstream also has support for APSK64/128/256 modulations which aren't supported yet by the DVB API, so comment them out until support for them is added.

---
 drivers/media/pci/ddbridge/ddbridge-sx8.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/media/pci/ddbridge/ddbridge-sx8.c +23 -7
index c87cefa10762..4418604258d1 100644
@@ -372,15 +372,31 @@ static int set_parameters(struct dvb_frontend *fe)
 	if (iq_mode)
 		ts_config = (SX8_TSCONFIG_TSHEADER | SX8_TSCONFIG_MODE_IQ);
 	if (iq_mode < 3) {
-		u32 flags = 3;
-		u32 mask = 0x7f;
-
-		if (p->modulation == APSK_16 ||
-		    p->modulation == APSK_32) {
-			flags = 2;
+		u32 mask;
+
+		switch (p->modulation) {
+		/* uncomment whenever these modulations hit the DVB API
+		 *	case APSK_256:
+		 *		mask = 0x7f;
+		 *		break;
+		 *	case APSK_128:
+		 *		mask = 0x3f;
+		 *		break;
+		 *	case APSK_64:
+		 *		mask = 0x1f;
+		 *		break;
+		 */
+		case APSK_32:
 			mask = 0x0f;
+			break;
+		case APSK_16:
+			mask = 0x07;
+			break;
+		default:
+			mask = 0x03;
+			break;
 		}
-		stat = start(fe, flags, mask, ts_config);
+		stat = start(fe, 3, mask, ts_config);
 	} else {
 		u32 flags = (iq_mode == 2) ? 1 : 0;
 
Signature · 1 line
2.16.4
#20 lore raw

PATCH 19/19 ddbridge/mci: add SX8 I/Q mode remark and remove DIAG CMD defines

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Take note that the SX8 IQ mode is only available on a single tuner, and remove the MCI/SX8 DIAG CMD defines.

Picked up from the upstream dddvb GIT.

---
 drivers/media/pci/ddbridge/ddbridge-mci.h | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/media/pci/ddbridge/ddbridge-mci.h +16 -8
index 600a8bc642c4..24241111c634 100644
@@ -42,6 +42,22 @@
 #define SX8_TSCONFIG_MODE_NORMAL            (0x00000001)
 #define SX8_TSCONFIG_MODE_IQ                (0x00000003)
 
+/*
+ * IQMode is only available on MaxSX8 on a single tuner
+ *
+ * IQ_MODE_SAMPLES
+ *       sampling rate is 1550/24 MHz (64.583 MHz)
+ *       channel agc is frozen, to allow stitching the FFT results together
+ *
+ * IQ_MODE_VTM
+ *       sampling rate is the supplied symbolrate
+ *       channel agc is active
+ *
+ * in both cases down sampling is done with a RRC Filter (currently fixed to
+ * alpha = 0.05) which causes some (ca 5%) aliasing at the edges from
+ * outside the spectrum
+ */
+
 #define SX8_TSCONFIG_TSHEADER               (0x00000004)
 #define SX8_TSCONFIG_BURST                  (0x00000008)
 
@@ -82,14 +98,6 @@
 
 #define MCI_SUCCESS(status)      ((status & MCI_STATUS_UNSUPPORTED) == 0)
 
-#define SX8_CMD_DIAG_READ8       (0xE0)
-#define SX8_CMD_DIAG_READ32      (0xE1)
-#define SX8_CMD_DIAG_WRITE8      (0xE2)
-#define SX8_CMD_DIAG_WRITE32     (0xE3)
-
-#define SX8_CMD_DIAG_READRF      (0xE8)
-#define SX8_CMD_DIAG_WRITERF     (0xE9)
-
 struct mci_command {
 	union {
 		u32 command_word;
Signature · 1 line
2.16.4