Skip to contentSkip to conversation

STV0910/STV6111 drivers, ddbridge CineS2 V7 support

PATCH Superseded Daniel Scheller 4 participants 15 messages Jun 30, 2017 – Jul 8, 2017

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover STV0910/STV6111 drivers, ddbridge CineS2 V7 support

From: Daniel Scheller <[email protected]>

For Linux 4.14.

This series adds drivers for the ST STV0910 DVB-S/S2 demodulator ICs and the ST STV6111 DVB-S/S2 tuners, and utilises them to enable ddbridge to support the current line of Digital Devices DVB-S/S2 hardware (e.g. Cine S2 V7/V7A adapters, DuoFlex S2 V4 addon modules and maybe more, with similar components).

The two new drivers have been picked up from Digital Devices' vendor- provided dddvb driver package, as of release 0.9.29. Permission to reuse (and mainline) them was formally granted by Ralph Metzler <[email protected]>.

Drivers have been cleaned up alot (formatting fixes, dead code removal, features depending on not-yet-available API changes removed). Checkpatch complaints left:

WARNING: please write a paragraph that describes the config symbol fully #39: FILE: drivers/media/dvb-frontends/Kconfig:31:
+config DVB_STV0910

Not sure what checkpatch demands, since a module description exists in Kconfig... Applies to the stv6111 aswell.

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #64:
new file mode 100644

See below.

WARNING: 'VALIDE' may be misspelled - perhaps 'VALID'? #3314: FILE: drivers/media/dvb-frontends/stv0910_regs.h:1467:
+#define FSTV0910_P2_NOSRAM_VALIDE 0xf30e0004

Picked from upstream. Since I'm not sure if this really is a mistake (maybe the hardware vendor really wants to name the reg like this?) so kept as-is.

CamelCase and ALLCAPS are changed into kernel_kase. Patches have been proposed to the vendor driver package maintainers to keep things synced as much as possible.

Patch 2 is a fix for an issue found while preparing this series for posting, and was in parallel submitted to the vendor's GIT repository.

Adding myself to MAINTAINERS for stv0910 and stv6111 as I'll keep track of any upstream (vendor provided package) changes and propose them for mainline inclusion.

Mauro, I assume you're the one who reviews this (since these are new drivers). It'd be very great to have this in for 4.14 to tackle the ddbridge bump for 4.15. Of course awaiting review yet, this v2 should be a good candidate for merge.

Changes from v1 to v2:
- CamelCase and ALLCAPS changed to kernel_case
- Signal statistics acquisition refactored to comply with standards
- printk* and pr_* changed to dev_*
- Add myself to MAINTAINERS for stv0910 and stv6111

Daniel Scheller (10):
[media] dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend
driver
[media] dvb-frontends/stv0910: Fix possible buffer overflow [media] dvb-frontends/stv0910: add multistream (ISI) and PLS
capabilities
[media] dvb-frontends/stv0910: Add demod-only signal strength
reporting
[media] dvb-frontends/stv0910: Add missing set_frontend fe-op [media] dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver [media] ddbridge: return stv09xx id in port_has_stv0900_aa() [media] ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware [media] ddbridge: stv0910 single demod mode module option [media] MAINTAINERS: add entries for stv0910 and stv6111

 MAINTAINERS                                |   16 +
 drivers/media/dvb-frontends/Kconfig        |   18 +
 drivers/media/dvb-frontends/Makefile       |    2 +
 drivers/media/dvb-frontends/stv0910.c      | 1773 +++++++++++
 drivers/media/dvb-frontends/stv0910.h      |   32 +
 drivers/media/dvb-frontends/stv0910_regs.h | 4759 ++++++++++++++++++++++++++++
 drivers/media/dvb-frontends/stv6111.c      |  673 ++++
 drivers/media/dvb-frontends/stv6111.h      |   20 +
 drivers/media/pci/ddbridge/Kconfig         |    4 +
 drivers/media/pci/ddbridge/ddbridge-core.c |  151 +-
 drivers/media/pci/ddbridge/ddbridge.h      |    2 +
 11 files changed, 7442 insertions(+), 8 deletions(-)
 create mode 100644 drivers/media/dvb-frontends/stv0910.c
 create mode 100644 drivers/media/dvb-frontends/stv0910.h
 create mode 100644 drivers/media/dvb-frontends/stv0910_regs.h
 create mode 100644 drivers/media/dvb-frontends/stv6111.c
 create mode 100644 drivers/media/dvb-frontends/stv6111.h
Signature · 1 line
2.13.0
#1 lore raw

PATCH v2 1/10 dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver

From: Daniel Scheller <[email protected]>

This adds a multi frontend driver for the ST STV0910 DVB-S/S2 demodulator frontends. The driver code originates from the Digital Devices' dddvb vendor driver package as of version 0.9.29, and has been cleaned up from core API usage which isn't supported yet in the kernel, and additionally all obvious style issues have been resolved. All camel case and allcaps have been converted to kernel_case and lowercase. Patches have been sent to the vendor package maintainers to fix this aswell. Signal statistics acquisition has been refactored to comply with standards.

Permission to reuse and mainline the driver code was formally granted by Ralph Metzler <[email protected]>.

---
 drivers/media/dvb-frontends/Kconfig        |    9 +
 drivers/media/dvb-frontends/Makefile       |    1 +
 drivers/media/dvb-frontends/stv0910.c      | 1708 ++++++++++
 drivers/media/dvb-frontends/stv0910.h      |   32 +
 drivers/media/dvb-frontends/stv0910_regs.h | 4759 ++++++++++++++++++++++++++++
 5 files changed, 6509 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/stv0910.c
 create mode 100644 drivers/media/dvb-frontends/stv0910.h
 create mode 100644 drivers/media/dvb-frontends/stv0910_regs.h
drivers/media/dvb-frontends/Kconfig +9 -0
index 3a260b82b3e8..773de5e264e3 100644
@@ -28,6 +28,15 @@ config DVB_STV090x
 	  DVB-S/S2/DSS Multistandard Professional/Broadcast demodulators.
 	  Say Y when you want to support these frontends.
 
+config DVB_STV0910
+	tristate "STV0910 based"
+	depends on DVB_CORE && I2C
+	default m if !MEDIA_SUBDRV_AUTOSELECT
+	help
+	  ST STV0910 DVB-S/S2 demodulator driver.
+
+	  Say Y when you want to support these frontends.
+
 config DVB_STV6110x
 	tristate "STV6110/(A) based tuners"
 	depends on DVB_CORE && I2C
drivers/media/dvb-frontends/Makefile +1 -0
index 3fccaf34ef52..c302b2d07499 100644
@@ -110,6 +110,7 @@ obj-$(CONFIG_DVB_CXD2820R) += cxd2820r.o
 obj-$(CONFIG_DVB_CXD2841ER) += cxd2841er.o
 obj-$(CONFIG_DVB_DRXK) += drxk.o
 obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
+obj-$(CONFIG_DVB_STV0910) += stv0910.o
 obj-$(CONFIG_DVB_SI2165) += si2165.o
 obj-$(CONFIG_DVB_A8293) += a8293.o
 obj-$(CONFIG_DVB_SP2) += sp2.o
drivers/media/dvb-frontends/stv0910.c new file +1708 -0

1,708 lines not on this page · raw message

drivers/media/dvb-frontends/stv0910.h new file +32 -0
new file mode 100644
index 000000000000..e1ab6df7c805
@@ -0,0 +1,32 @@
+#ifndef _STV0910_H_
+#define _STV0910_H_
+
+#include <linux/types.h>
+#include <linux/i2c.h>
+
+struct stv0910_cfg {
+	u32 clk;
+	u8  adr;
+	u8  parallel;
+	u8  rptlvl;
+	u8  single;
+};
+
+#if IS_REACHABLE(CONFIG_DVB_STV0910)
+
+extern struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
+					   struct stv0910_cfg *cfg, int nr);
+
+#else
+
+static inline struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
+						  struct stv0910_cfg *cfg,
+						  int nr)
+{
+	pr_warn("%s: driver disabled by Kconfig\n", __func__);
+	return NULL;
+}
+
+#endif /* CONFIG_DVB_STV0910 */
+
+#endif /* _STV0910_H_ */
drivers/media/dvb-frontends/stv0910_regs.h new file +4759 -0

1,238 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.0

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [PATCH v2 01/10] [media] dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver

reproduce:

Hi Daniel,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.12 next-20170703]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Scheller/dvb-frontends-add-ST-STV0910-DVB-S-S2-demodulator-frontend-driver/20170703-211611
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-v0-07040424 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/Daniel-Scheller/dvb-frontends-add-ST-STV0910-DVB-S-S2-demodulator-frontend-driver/20170703-211611 HEAD dafb8a36ff9cb533c394de71f2282325ad4a460d builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

drivers/media/dvb-frontends/stv0910.c: In function 'read_signal_strength':

>> drivers/media/dvb-frontends/stv0910.c:1284: error: 'p' undeclared (first use in this function)

drivers/media/dvb-frontends/stv0910.c:1284: error: (Each undeclared identifier is reported only once drivers/media/dvb-frontends/stv0910.c:1284: error: for each function it appears in.)

vim +/p +1284 drivers/media/dvb-frontends/stv0910.c

1278 }
1279
1280 static void read_signal_strength(struct dvb_frontend *fe)
1281 {
1282 /* FIXME: add signal strength algo */
1283

> 1284		p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;

1285 }
1286
1287 static int read_status(struct dvb_frontend *fe, enum fe_status *status)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw

Re: [PATCH v2 01/10] [media] dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver

Am Tue, 4 Jul 2017 06:01:32 +0800
schrieb kbuild test robot <[email protected]>:

Quoted 10 lines

All errors (new ones prefixed by >>):

drivers/media/dvb-frontends/stv0910.c: In function
'read_signal_strength':

Quoted 2 lines
Quoted 2 lines

drivers/media/dvb-frontends/stv0910.c:1284: error: 'p' undeclared (first use in this function)

drivers/media/dvb-frontends/stv0910.c:1284: error: (Each
undeclared identifier is reported only once drivers/media/dvb-frontends/stv0910.c:1284: error: for each function it appears in.)

Fixed in v3 (by "Add required fe.dtv_propcache vars/references to the dummy STR function, fixes bisect" in v3-1/10).

Best regards,
Daniel Scheller

Signature · 1 line
https://github.com/herrnst
#4 lore raw

PATCH v2 2/10 dvb-frontends/stv0910: Fix possible buffer overflow

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Fixes smatch error:

drivers/media/dvb-frontends/stv0910.c:715 dvbs2_nbch() error: buffer overflow 'nbch[fectype]' 2 <= 28

Also, fixes the nbch array table by adding the DUMMY_PLF element at the top to match the enums (table element order was off by one before).

Patch sent upstream aswell.

---
 drivers/media/dvb-frontends/stv0910.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/stv0910.c +2 -1
index 2f25bad7f7b8..5a5d190298ea 100644
@@ -676,6 +676,7 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
 static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype)
 {
 	static u32 nbch[][2] = {
+		{    0,     0}, /* DUMMY_PLF */
 		{16200,  3240}, /* QPSK_1_4, */
 		{21600,  5400}, /* QPSK_1_3, */
 		{25920,  6480}, /* QPSK_2_5, */
@@ -708,7 +709,7 @@ static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype)
 
 	if (mod_cod >= DVBS2_QPSK_1_4 &&
 	    mod_cod <= DVBS2_32APSK_9_10 && fectype <= DVBS2_16K)
-		return nbch[fectype][mod_cod];
+		return nbch[mod_cod][fectype];
 	return 64800;
 }
 
Signature · 1 line
2.13.0
#5 lore raw

PATCH v2 3/10 dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Implements stream_id filter and scrambling code setup in start() and also sets FE_CAN_MULTISTREAM in frontend_ops. This enables the driver to properly receive and handle multistream transponders, functionality has been reported working fine by testers with access to such streams, in conjunction with VDR on the userspace side.

The code snippet originates from the original vendor's dddvb driver package and has been made working properly with the current in-kernel DVB core API.

---
 drivers/media/dvb-frontends/stv0910.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/stv0910.c +26 -6
index 5a5d190298ea..b9d6a61e6017 100644
@@ -120,9 +120,7 @@ struct stv {
 	int   is_vcm;
 
 	u32   cur_scrambling_code;
-	u32   force_scrambling_code;
 	u32   scrambling_code;
-	u32   default_input_stream_id;
 
 	u32   last_bernumerator;
 	u32   last_berdenominator;
@@ -970,6 +968,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 	s32 freq;
 	u8  reg_dmdcfgmd;
 	u16 symb;
+	u32 scrambling_code = 1;
 
 	if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
 		return -EINVAL;
@@ -983,6 +982,28 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 
 	init_search_param(state);
 
+	if (p->stream_id != NO_STREAM_ID_FILTER) {
+		/* Backwards compatibility to "crazy" API.
+		 * PRBS X root cannot be 0, so this should always work.
+		 */
+		if (p->stream_id & 0xffffff00)
+			scrambling_code = p->stream_id >> 8;
+		write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff,
+			  p->stream_id & 0xff);
+		write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff,
+			  0xff);
+	}
+
+	if (scrambling_code != state->cur_scrambling_code) {
+		write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
+			  scrambling_code & 0xff);
+		write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff,
+			  (scrambling_code >> 8) & 0xff);
+		write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff,
+			  (scrambling_code >> 16) & 0x07);
+		state->cur_scrambling_code = scrambling_code;
+	}
+
 	if (p->symbol_rate <= 1000000) {  /* SR <=1Msps */
 		state->demod_timeout = 3000;
 		state->fec_timeout = 2000;
@@ -1600,7 +1621,8 @@ static struct dvb_frontend_ops stv0910_ops = {
 		.caps			= FE_CAN_INVERSION_AUTO |
 					  FE_CAN_FEC_AUTO       |
 					  FE_CAN_QPSK           |
-					  FE_CAN_2G_MODULATION
+					  FE_CAN_2G_MODULATION  |
+					  FE_CAN_MULTISTREAM
 	},
 	.sleep				= sleep,
 	.release                        = release,
@@ -1658,9 +1680,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 	state->search_range = 16000000;
 	state->demod_bits = 0x10;     /* Inversion : Auto with reset to 0 */
 	state->receive_mode   = RCVMODE_NONE;
-	state->cur_scrambling_code = (u32) -1;
-	state->force_scrambling_code = (u32) -1;
-	state->default_input_stream_id = (u32) -1;
+	state->cur_scrambling_code = (~0U);
 	state->single = cfg->single ? 1 : 0;
 
 	base = match_base(i2c, cfg->adr);
Signature · 1 line
2.13.0
#6 lore raw

PATCH v2 4/10 dvb-frontends/stv0910: Add demod-only signal strength reporting

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Original code at least has some signed/unsigned issues, resulting in values like 32dBm. Implement signal strength readout to work without asking the attached tuner, and use a lookup table instead of log calc. Values reported appear plausible, gathered from feedback from several testers.

---
 drivers/media/dvb-frontends/stv0910.c | 51 ++++++++++++++++++++++++++++++++---
 1 file changed, 47 insertions(+), 4 deletions(-)
drivers/media/dvb-frontends/stv0910.c +47 -4
index b9d6a61e6017..045f8f5305ab 100644
@@ -136,7 +136,7 @@ struct sinit_table {
 
 struct slookup {
 	s16  value;
-	u16  reg_value;
+	u32  reg_value;
 };
 
 static inline int i2c_write(struct i2c_adapter *adap, u8 adr,
@@ -328,6 +328,25 @@ struct slookup s2_sn_lookup[] = {
 	{  510,    463  },  /*C/N=51.0dB*/
 };
 
+struct slookup padc_lookup[] = {
+	{    0,  118000 }, /* PADC=+0dBm  */
+	{ -100,  93600  }, /* PADC=-1dBm  */
+	{ -200,  74500  }, /* PADC=-2dBm  */
+	{ -300,  59100  }, /* PADC=-3dBm  */
+	{ -400,  47000  }, /* PADC=-4dBm  */
+	{ -500,  37300  }, /* PADC=-5dBm  */
+	{ -600,  29650  }, /* PADC=-6dBm  */
+	{ -700,  23520  }, /* PADC=-7dBm  */
+	{ -900,  14850  }, /* PADC=-9dBm  */
+	{ -1100, 9380   }, /* PADC=-11dBm */
+	{ -1300, 5910   }, /* PADC=-13dBm */
+	{ -1500, 3730   }, /* PADC=-15dBm */
+	{ -1700, 2354   }, /* PADC=-17dBm */
+	{ -1900, 1485   }, /* PADC=-19dBm */
+	{ -2000, 1179   }, /* PADC=-20dBm */
+	{ -2100, 1000   }, /* PADC=-21dBm */
+};
+
 /*********************************************************************
  * Tracking carrier loop carrier QPSK 1/4 to 8PSK 9/10 long Frame
  *********************************************************************/
@@ -568,7 +587,7 @@ static int tracking_optimization(struct stv *state)
 }
 
 static s32 table_lookup(struct slookup *table,
-		       int table_size, u16 reg_value)
+		       int table_size, u32 reg_value)
 {
 	s32 value;
 	int imin = 0;
@@ -1301,9 +1320,33 @@ static int read_ber(struct dvb_frontend *fe)
 
 static void read_signal_strength(struct dvb_frontend *fe)
 {
-	/* FIXME: add signal strength algo */
+	struct stv *state = fe->demodulator_priv;
+	struct dtv_frontend_properties *p = &state->fe.dtv_property_cache;
+	s64 strength;
+	u8 reg[2];
+	u16 agc;
+	s32 padc;
+	s32 power = 0;
+	int i;
 
-	p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+	read_regs(state, RSTV0910_P2_AGCIQIN1 + state->regoff, reg, 2);
+
+	agc = (((u32) reg[0]) << 8) | reg[1];
+
+	for (i = 0; i < 5; i += 1) {
+		read_regs(state, RSTV0910_P2_POWERI + state->regoff, reg, 2);
+		power += (u32) reg[0] * (u32) reg[0]
+			+ (u32) reg[1] * (u32) reg[1];
+		usleep_range(3000, 4000);
+	}
+	power /= 5;
+
+	padc = table_lookup(padc_lookup, ARRAY_SIZE(padc_lookup), power) + 352;
+
+	strength = (padc - agc);
+
+	p->strength.stat[0].scale = FE_SCALE_DECIBEL;
+	p->strength.stat[0].uvalue = strength;
 }
 
 static int read_status(struct dvb_frontend *fe, enum fe_status *status)
Signature · 1 line
2.13.0
#7 lore raw

PATCH v2 5/10 dvb-frontends/stv0910: Add missing set_frontend fe-op

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

This was missing from the frontend_ops.

---
 drivers/media/dvb-frontends/stv0910.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/dvb-frontends/stv0910.c +1 -0
index 045f8f5305ab..1f2d6f5ee58a 100644
@@ -1670,6 +1670,7 @@ static struct dvb_frontend_ops stv0910_ops = {
 	.sleep				= sleep,
 	.release                        = release,
 	.i2c_gate_ctrl                  = gate_ctrl,
+	.set_frontend			= set_parameters,
 	.get_frontend_algo              = get_algo,
 	.get_frontend                   = get_frontend,
 	.tune                           = tune,
Signature · 1 line
2.13.0
#8 lore raw

PATCH v2 6/10 dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

This adds a frontend driver for the ST STV6111 DVB-S/S2 tuners. Like the stv0910 demod frontend driver, this driver originates from the Digital Devices' dddvb vendor driver package as of version 0.9.29, and was cleaned up aswell. No functionality had to be removed though. Any camel case has been converted to kernel_case, fixup patch has been proposed upstream.

Permission to reuse and mainline the driver code was formally granted by Ralph Metzler <[email protected]>.

---
 drivers/media/dvb-frontends/Kconfig   |   9 +
 drivers/media/dvb-frontends/Makefile  |   1 +
 drivers/media/dvb-frontends/stv6111.c | 673 ++++++++++++++++++++++++++++++++++
 drivers/media/dvb-frontends/stv6111.h |  20 +
 4 files changed, 703 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/stv6111.c
 create mode 100644 drivers/media/dvb-frontends/stv6111.h
drivers/media/dvb-frontends/Kconfig +9 -0
index 773de5e264e3..d2d3160abdf7 100644
@@ -44,6 +44,15 @@ config DVB_STV6110x
 	help
 	  A Silicon tuner that supports DVB-S and DVB-S2 modes
 
+config DVB_STV6111
+	tristate "STV6111 based tuners"
+	depends on DVB_CORE && I2C
+	default m if !MEDIA_SUBDRV_AUTOSELECT
+	help
+	  A Silicon tuner that supports DVB-S and DVB-S2 modes
+
+	  Say Y when you want to support these frontends.
+
 config DVB_M88DS3103
 	tristate "Montage Technology M88DS3103"
 	depends on DVB_CORE && I2C && I2C_MUX
drivers/media/dvb-frontends/Makefile +1 -0
index c302b2d07499..e8bf1d873485 100644
@@ -111,6 +111,7 @@ obj-$(CONFIG_DVB_CXD2841ER) += cxd2841er.o
 obj-$(CONFIG_DVB_DRXK) += drxk.o
 obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
 obj-$(CONFIG_DVB_STV0910) += stv0910.o
+obj-$(CONFIG_DVB_STV6111) += stv6111.o
 obj-$(CONFIG_DVB_SI2165) += si2165.o
 obj-$(CONFIG_DVB_A8293) += a8293.o
 obj-$(CONFIG_DVB_SP2) += sp2.o
drivers/media/dvb-frontends/stv6111.c new file +673 -0

673 lines not on this page · raw message

drivers/media/dvb-frontends/stv6111.h new file +20 -0
new file mode 100644
index 000000000000..066dd70c9426
@@ -0,0 +1,20 @@
+#ifndef _STV6111_H_
+#define _STV6111_H_
+
+#if IS_REACHABLE(CONFIG_DVB_STV6111)
+
+extern struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
+				struct i2c_adapter *i2c, u8 adr);
+
+#else
+
+static inline struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
+				struct i2c_adapter *i2c, u8 adr)
+{
+	pr_warn("%s: Driver disabled by Kconfig\n", __func__);
+	return NULL;
+}
+
+#endif /* CONFIG_DVB_STV6111 */
+
+#endif /* _STV6111_H_ */
Signature · 1 line
2.13.0
#9 lore raw

PATCH v2 7/10 ddbridge: return stv09xx id in port_has_stv0900_aa()

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

The returned value is required for further evaluation of the exact demodulator chip (stv090x or stv0910).

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/media/pci/ddbridge/ddbridge-core.c +4 -5
index cd1723e79a07..3fbac7bee2d4 100644
@@ -1480,10 +1480,9 @@ static int port_has_stv0900(struct ddb_port *port)
 	return 1;
 }
 
-static int port_has_stv0900_aa(struct ddb_port *port)
+static int port_has_stv0900_aa(struct ddb_port *port, u8 *id)
 {
-	u8 val;
-	if (i2c_read_reg16(&port->i2c->adap, 0x68, 0xf100, &val) < 0)
+	if (i2c_read_reg16(&port->i2c->adap, 0x68, 0xf100, id) < 0)
 		return 0;
 	return 1;
 }
@@ -1530,7 +1529,7 @@ static void ddb_port_probe(struct ddb_port *port)
 {
 	struct ddb *dev = port->dev;
 	char *modname = "NO MODULE";
-	u8 xo2_type, xo2_id, cxd_id;
+	u8 xo2_type, xo2_id, cxd_id, stv_id;
 
 	port->class = DDB_PORT_NONE;
 
@@ -1622,7 +1621,7 @@ static void ddb_port_probe(struct ddb_port *port)
 		port->class = DDB_PORT_TUNER;
 		port->type = DDB_TUNER_DVBS_ST;
 		ddbwritel(I2C_SPEED_100, port->i2c->regs + I2C_TIMING);
-	} else if (port_has_stv0900_aa(port)) {
+	} else if (port_has_stv0900_aa(port, &stv_id)) {
 		modname = "DUAL DVB-S2";
 		port->class = DDB_PORT_TUNER;
 		port->type = DDB_TUNER_DVBS_ST_AA;
Signature · 1 line
2.13.0
#10 lore raw

PATCH v2 8/10 ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

This adds all required glue code to support - in conjunction with the new stv0910 and stv6111 demod/tuner drivers and additionally the lnbh25 LNB controller driver - all current DVB-S/S2 hardware (bridges and flex modules) from Digital Devices like the DD CineS2 V7 and V7A, current S2 V4 DuoFlex modules, and probably all upcoming devices based on this STV0910/STV6111/LNBH25 hardware stack.

---
 drivers/media/pci/ddbridge/Kconfig         |   4 +
 drivers/media/pci/ddbridge/ddbridge-core.c | 135 ++++++++++++++++++++++++++++-
 drivers/media/pci/ddbridge/ddbridge.h      |   2 +
 3 files changed, 138 insertions(+), 3 deletions(-)
drivers/media/pci/ddbridge/Kconfig +4 -0
index ffed78c2ffb4..c79a58fa5fc3 100644
@@ -8,6 +8,9 @@ config DVB_DDBRIDGE
 	select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_STV0367 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_STV0910 if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_STV6111 if MEDIA_SUBDRV_AUTOSELECT
+	select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT
 	---help---
 	  Support for cards with the Digital Devices PCI express bridge:
@@ -20,5 +23,6 @@ config DVB_DDBRIDGE
 	  - CineCTv6 and DuoFlex CT (STV0367-based)
 	  - CineCTv7 and DuoFlex CT2/C2T2/C2T2I (Sony CXD28xx-based)
 	  - MaxA8 series
+	  - CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based)
 
 	  Say Y if you own such a card and want to use it.
drivers/media/pci/ddbridge/ddbridge-core.c +132 -3

177 lines not on this page · raw message

drivers/media/pci/ddbridge/ddbridge.h +2 -0
index 4a0e3283d646..4783a17175a8 100644
@@ -160,6 +160,8 @@ struct ddb_port {
 #define DDB_TUNER_DVBCT2_SONY_P		7
 #define DDB_TUNER_DVBC2T2_SONY_P	8
 #define DDB_TUNER_ISDBT_SONY_P		9
+#define DDB_TUNER_DVBS_STV0910_P	10
+#define DDB_TUNER_DVBS_STV0910_PR	14
 #define DDB_TUNER_DVBC2T2I_SONY_P	15
 #define DDB_TUNER_DVBCT_TR		16
 #define DDB_TUNER_DVBCT_ST		17
Signature · 1 line
2.13.0
#11 lore raw

PATCH v2 9/10 ddbridge: stv0910 single demod mode module option

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Adds a stv0910_single modparm which, when set, configures the stv0910 to run in single demodulator mode, currently intended for high bit rate testing.

---
 drivers/media/pci/ddbridge/ddbridge-core.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/media/pci/ddbridge/ddbridge-core.c +7 -0
index b3fc6a875279..e762396730db 100644
@@ -53,6 +53,10 @@ static int xo2_speed = 2;
 module_param(xo2_speed, int, 0444);
 MODULE_PARM_DESC(xo2_speed, "default transfer speed for xo2 based duoflex, 0=55,1=75,2=90,3=104 MBit/s, default=2, use attribute to change for individual cards");
 
+static int stv0910_single;
+module_param(stv0910_single, int, 0444);
+MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods");
+
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 /* MSI had problems with lost interrupts, fixed but needs testing */
@@ -942,6 +946,9 @@ static int demod_attach_stv0910(struct ddb_input *input, int type)
 	struct stv0910_cfg cfg = stv0910_p;
 	struct lnbh25_config lnbcfg = lnbh25_cfg;
 
+	if (stv0910_single)
+		cfg.single = 1;
+
 	if (type)
 		cfg.parallel = 2;
 	input->fe = dvb_attach(stv0910_attach, i2c, &cfg, (input->nr & 1));
Signature · 1 line
2.13.0
#12 lore raw

PATCH v2 10/10 MAINTAINERS: add entries for stv0910 and stv6111

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

---
 MAINTAINERS | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
MAINTAINERS +16 -0
index c4be6d4af7d2..7b85e578d238 100644
@@ -8246,6 +8246,22 @@ T:	git git://linuxtv.org/media_tree.git
 S:	Supported
 F:	drivers/media/pci/netup_unidvb/*
 
+MEDIA DRIVERS FOR ST STV0910 DEMODULATOR ICs
+M:	Daniel Scheller <[email protected]>
+L:	[email protected]
+W:	https://linuxtv.org
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/dvb-frontends/stv0910*
+
+MEDIA DRIVERS FOR ST STV6111 TUNER ICs
+M:	Daniel Scheller <[email protected]>
+L:	[email protected]
+W:	https://linuxtv.org
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/dvb-frontends/stv6111*
+
 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 M:	Mauro Carvalho Chehab <[email protected]>
 M:	Mauro Carvalho Chehab <[email protected]>
Signature · 1 line
2.13.0
#13 lore raw
In reply to Daniel Scheller
Quoted 9 lines · Daniel Scheller

From: Daniel Scheller <[email protected]>

For Linux 4.14.

This series adds drivers for the ST STV0910 DVB-S/S2 demodulator ICs and the ST STV6111 DVB-S/S2 tuners, and utilises them to enable ddbridge to support the current line of Digital Devices DVB-S/S2 hardware (e.g. Cine S2 V7/V7A adapters, DuoFlex S2 V4 addon modules and maybe more, with similar components).

-snip

Just posting to offer a "tested by", for this particular set of patches.

I have successfully been running a DD Cine S2 V7A alongside a TT S2 6400 since late March, working with Daniel to iron out minor problems during the development of this set.

Testing has been done on a dedicated PVR system based on VDR 2.3.X, with kernels 4.10 and 4.12, for 3-4 hours daily without issue. Multistream support works fine and STR/CNR stats seem realistic.

Many thanks to Daniel and the reviewers.

Regards,

Richard

#14 lore raw
In reply to Daniel Scheller

Hello!

Quoted 5 lines

This series adds drivers for the ST STV0910 DVB-S/S2 demodulator ICs and the ST STV6111 DVB-S/S2 tuners, and utilises them to enable ddbridge to support the current line of Digital Devices DVB-S/S2 hardware (e.g. Cine S2 V7/V7A adapters, DuoFlex S2 V4 addon modules and maybe more, with similar components).

I have a DuoFlex S2 V4 card and a Cine S2 V6. I did a rough test only and I checked the signal statistics, also.

I am using VDR 2.3.8 and Kernel 3.13.0 on an Ubuntu system.

On the DuoFlex S2 V4 (STV0910) the stats were a little high, I guess. At least VDR showed a too big value. I am using two cables from the same LNB. This needs to be fixed by Ralph M. in the upstream driver from DD.

DuoFlex S2 V4 (STV0910):

# dvb-fe-tool -m -a 4
Sperre (0x1f) Signal= -31,59dBm S/R= 14,50dB preBER= 0
Sperre (0x1f) Signal= -33,11dBm S/R= 14,40dB preBER= 0

Cine S2 V6 (STV090x):

# dvb-fe-tool -m -a 1
Sperre (0x1f) Signal= 75,00% S/R= 27,40% postBER= 0
Sperre (0x1f) Signal= 75,00% S/R= 27,20% postBER= 0
Sperre (0x1f) Signal= 75,00% S/R= 27,40% postBER= 0

Also from me a "tested by" for this particular set of patches.

BR,
Jasmin