From 829929a41f8c926ad59704eb712630b7fe0803a1 Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Thu, 10 Dec 2015 18:26:45 +0100 Subject: [PATCH] cine s2 v7 has TS lines crossed --- ddbridge/ddbridge-core.c | 49 ++++++++++++++++++++++++---------------- ddbridge/ddbridge.c | 6 +++-- ddbridge/ddbridge.h | 5 +++- ddbridge/octonet.c | 6 ++--- frontends/cxd2843.c | 8 +++---- frontends/stv0910.c | 6 +++-- 6 files changed, 49 insertions(+), 31 deletions(-) diff --git a/ddbridge/ddbridge-core.c b/ddbridge/ddbridge-core.c index 4421b1f..63a5270 100644 --- a/ddbridge/ddbridge-core.c +++ b/ddbridge/ddbridge-core.c @@ -1223,14 +1223,7 @@ static int tuner_attach_stv6110(struct ddb_input *input, int type) return 0; } -static struct stv0910_cfg stv0910 = { - .adr = 0x6c, - .parallel = 1, - .rptlvl = 4, - .clk = 30000000, -}; - -static struct stv0910_cfg stv0910_aa = { +static struct stv0910_cfg stv0910_p = { .adr = 0x68, .parallel = 1, .rptlvl = 4, @@ -1241,11 +1234,16 @@ static int demod_attach_stv0910(struct ddb_input *input, int type) { struct i2c_adapter *i2c = &input->port->i2c->adap; struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1]; + struct stv0910_cfg cfg = stv0910_p; - dvb->fe = dvb_attach(stv0910_attach, i2c, &stv0910_aa, (input->nr & 1)); - if (!dvb->fe) + if (type) + cfg.parallel = 2; + dvb->fe = dvb_attach(stv0910_attach, i2c, &cfg, (input->nr & 1)); + if (!dvb->fe) { + cfg.adr = 0x6c; dvb->fe = dvb_attach(stv0910_attach, i2c, - &stv0910, (input->nr & 1)); + &cfg, (input->nr & 1)); + } if (!dvb->fe) { pr_err("No STV0910 found!\n"); return -ENODEV; @@ -1910,12 +1908,18 @@ static int dvb_input_attach(struct ddb_input *input) if (tuner_attach_stv6111(input, 0) < 0) return -ENODEV; break; - case DDB_TUNER_DVBS_STV0910_P: + case DDB_TUNER_DVBS_STV0910_PR: if (demod_attach_stv0910(input, 1) < 0) return -ENODEV; if (tuner_attach_stv6111(input, 1) < 0) return -ENODEV; break; + case DDB_TUNER_DVBS_STV0910_P: + if (demod_attach_stv0910(input, 0) < 0) + return -ENODEV; + if (tuner_attach_stv6111(input, 1) < 0) + return -ENODEV; + break; #ifdef CONFIG_DVB_DRXK case DDB_TUNER_DVBCT_TR: if (demod_attach_drxk(input) < 0) @@ -1933,7 +1937,9 @@ static int dvb_input_attach(struct ddb_input *input) case DDB_TUNER_DVBCT2_SONY_P: case DDB_TUNER_DVBC2T2_SONY_P: case DDB_TUNER_ISDBT_SONY_P: - if (!input->port->dev->link[input->port->lnr].info->serial) + if (input->port->dev->link[input->port->lnr].info->ts_quirks & TS_QUIRK_SERIAL) + par = 0; + else par = 1; case DDB_TUNER_DVBCT2_SONY: case DDB_TUNER_DVBC2T2_SONY: @@ -2292,12 +2298,17 @@ static void ddb_port_probe(struct ddb_port *port) } else if (port_has_stv0900_aa(port, &id)) { port->name = "DUAL DVB-S2"; port->class = DDB_PORT_TUNER; - port->type = DDB_TUNER_DVBS_ST_AA; - port->type_name = "DVBS_ST_AA"; - if (id == 0x51) - port->type = DDB_TUNER_DVBS_STV0910_P; - else + if (id == 0x51) { + if (port->nr == 0 && + dev->link[l].info->ts_quirks & TS_QUIRK_REVERSED) + port->type = DDB_TUNER_DVBS_STV0910_PR; + else + port->type = DDB_TUNER_DVBS_STV0910_P; + port->type_name = "DVBS_ST_0910"; + } else { port->type = DDB_TUNER_DVBS_ST_AA; + port->type_name = "DVBS_ST_AA"; + } ddbwritel(dev, I2C_SPEED_100, port->i2c->regs + I2C_TIMING); } else if (port_has_drxks(port)) { port->name = "DUAL DVB-C/T"; @@ -4541,7 +4552,7 @@ static struct ddb_info octopus_ct_gtl = { .i2c_mask = 0x0f, .board_control = 0xff, .board_control_2 = 0xf00, - .serial = 1, + .ts_quirks = TS_QUIRK_SERIAL, }; diff --git a/ddbridge/ddbridge.c b/ddbridge/ddbridge.c index e80e0e9..7d5dc6d 100644 --- a/ddbridge/ddbridge.c +++ b/ddbridge/ddbridge.c @@ -63,6 +63,7 @@ static void __devexit ddb_remove(struct pci_dev *pdev) { struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev); + ddb_device_destroy(dev); ddb_nsd_detach(dev); ddb_ports_detach(dev); ddb_i2c_release(dev); @@ -70,6 +71,7 @@ static void __devexit ddb_remove(struct pci_dev *pdev) if (dev->link[0].info->ns_num) ddbwritel(dev, 0, ETHER_CONTROL); ddbwritel(dev, 0, INTERRUPT_ENABLE); + ddbwritel(dev, 0, MSI1_ENABLE); if (dev->msi == 2) free_irq(dev->pdev->irq + 1, dev); @@ -80,7 +82,6 @@ static void __devexit ddb_remove(struct pci_dev *pdev) #endif ddb_ports_release(dev); ddb_buffers_free(dev); - ddb_device_destroy(dev); ddb_unmap(dev); pci_set_drvdata(pdev, 0); @@ -359,6 +360,7 @@ static struct ddb_info ddb_v7 = { .i2c_mask = 0x0f, .board_control = 2, .board_control_2 = 4, + .ts_quirks = TS_QUIRK_REVERSED, }; static struct ddb_info ddb_ctv7 = { @@ -432,7 +434,7 @@ static struct ddb_info ddb_ct_8 = { .i2c_mask = 0x0f, .board_control = 0x0ff, .board_control_2 = 0xf00, - .serial = 1, + .ts_quirks = TS_QUIRK_SERIAL, }; static struct ddb_info ddb_mod = { diff --git a/ddbridge/ddbridge.h b/ddbridge/ddbridge.h index bad0dc6..e215624 100644 --- a/ddbridge/ddbridge.h +++ b/ddbridge/ddbridge.h @@ -160,7 +160,9 @@ struct ddb_info { u8 ns_num; u8 mdio_num; u8 con_clock; /* use a continuous clock */ - u8 serial; /* override to serial transfer */ + u8 ts_quirks; +#define TS_QUIRK_SERIAL 1 +#define TS_QUIRK_REVERSED 2 struct ddb_regmap *regmap; }; @@ -290,6 +292,7 @@ struct ddb_port { #define DDB_TUNER_MXL5XX 11 #define DDB_CI_EXTERNAL_XO2 12 #define DDB_CI_EXTERNAL_XO2_B 13 +#define DDB_TUNER_DVBS_STV0910_PR 14 #define DDB_TUNER_XO2 32 #define DDB_TUNER_DVBS_STV0910 (DDB_TUNER_XO2 + 0) diff --git a/ddbridge/octonet.c b/ddbridge/octonet.c index 05efed8..e5f7284 100644 --- a/ddbridge/octonet.c +++ b/ddbridge/octonet.c @@ -114,15 +114,15 @@ static int __exit octonet_remove(struct platform_device *pdev) dev = platform_get_drvdata(pdev); ddb_device_destroy(dev); - ddb_nsd_detach(dev); ddb_ports_detach(dev); ddb_i2c_release(dev); - ddbwritel(dev, 0, ETHER_CONTROL); + if (dev->link[0].info->ns_num) + ddbwritel(dev, 0, ETHER_CONTROL); ddbwritel(dev, 0, INTERRUPT_ENABLE); - free_irq(platform_get_irq(dev->pfdev, 0), dev); + free_irq(platform_get_irq(dev->pfdev, 0), dev); ddb_ports_release(dev); octonet_unmap(dev); platform_set_drvdata(pdev, 0); diff --git a/frontends/cxd2843.c b/frontends/cxd2843.c index e8b5e25..021969a 100644 --- a/frontends/cxd2843.c +++ b/frontends/cxd2843.c @@ -1898,7 +1898,7 @@ static struct dvb_frontend_ops common_ops_2843 = { FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | - FE_CAN_RECOVER | FE_CAN_MUTE_TS + FE_CAN_RECOVER | FE_CAN_MUTE_TS | FE_CAN_2G_MODULATION }, .release = release, .sleep = sleep, @@ -1936,7 +1936,7 @@ static struct dvb_frontend_ops common_ops_2837 = { FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | - FE_CAN_RECOVER | FE_CAN_MUTE_TS + FE_CAN_RECOVER | FE_CAN_MUTE_TS | FE_CAN_2G_MODULATION }, .release = release, .sleep = sleep, @@ -1966,13 +1966,13 @@ static struct dvb_frontend_ops common_ops_2838 = { .frequency_max = 865000000, .symbol_rate_min = 870000, .symbol_rate_max = 11700000, - .caps = FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | + .caps = FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | - FE_CAN_RECOVER | FE_CAN_MUTE_TS + FE_CAN_RECOVER | FE_CAN_MUTE_TS | FE_CAN_2G_MODULATION }, .release = release, .sleep = sleep, diff --git a/frontends/stv0910.c b/frontends/stv0910.c index 3bab948..aba0dff 100644 --- a/frontends/stv0910.c +++ b/frontends/stv0910.c @@ -103,6 +103,7 @@ struct stv { u16 regoff; u8 i2crpt; u8 tscfgh; + u8 tsgeneral; u8 tsspeed; unsigned long tune_time; @@ -932,7 +933,7 @@ static int probe(struct stv *state) if (id != 0x51) return -EINVAL; - pr_info("stv0910: found STV0910 id=0x%02x\n", id); + /* pr_info("stv0910: found STV0910 id=0x%02x\n", id); */ /* Configure the I2C repeater to off */ write_reg(state, RSTV0910_P1_I2CRPT, 0x24); @@ -944,7 +945,7 @@ static int probe(struct stv *state) write_reg(state, RSTV0910_OUTCFG, 0x00); /* OUTCFG */ write_reg(state, RSTV0910_PADCFG, 0x05); /* RF AGC Pads Dev = 05 */ write_reg(state, RSTV0910_SYNTCTRL, 0x02); /* SYNTCTRL */ - write_reg(state, RSTV0910_TSGENERAL, 0x00); /* TSGENERAL */ + write_reg(state, RSTV0910_TSGENERAL, state->tsgeneral); /* TSGENERAL */ write_reg(state, RSTV0910_CFGEXT, 0x02); /* CFGEXT */ write_reg(state, RSTV0910_GENCFG, 0x15); /* GENCFG */ @@ -1359,6 +1360,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, return NULL; state->tscfgh = 0x20 | (cfg->parallel ? 0 : 0x40); + state->tsgeneral = (cfg->parallel == 2) ? 0x02 : 0x00; state->i2crpt = 0x0A | ((cfg->rptlvl & 0x07) << 4); state->tsspeed = 0x40; state->nr = nr;