dvb: Add support for PT3 ISDB-S/T card
Subsystems (5)
[email protected]
maintainerv4 cover dvb: Add support for PT3 ISDB-S/T card
From: Akihiro Tsukada <[email protected]>
This patch series adds support for "PT3" ISDB-S/T receiver cards. It contains a PCI bridge driver, a dvb-frontend driver and two tuner drivers.
I know "Bud R" had already posted ones to this mailing list, (as in [email protected] ), but it seems that he stopped updating his patch and does not agree on splitting the single large patch into smaller, separate ones. This series is another version written independently by me.
Changes in v4:
- removed unnecessary fe->ops.tuner_ops.get_status() and its use.
- moved initial freq settings from tuner drivers to the bridge driver
- added a comment to notice the driver's incompleteness
- improved I2C transaction in mxl301rf
Akihiro Tsukada (4):
mxl301rf: add driver for MaxLinear MxL301RF OFDM tuner
qm1d1c0042: add driver for Sharp QM1D1C0042 ISDB-S tuner
tc90522: add driver for Toshiba TC90522 quad demodulator
pt3: add support for Earthsoft PT3 ISDB-S/T receiver card
drivers/media/dvb-frontends/Kconfig | 8 + drivers/media/dvb-frontends/Makefile | 1 + drivers/media/dvb-frontends/tc90522.c | 839 ++++++++++++++++++++++++++++++++ drivers/media/dvb-frontends/tc90522.h | 42 ++ drivers/media/pci/Kconfig | 1 + drivers/media/pci/Makefile | 1 + drivers/media/pci/pt3/Kconfig | 10 + drivers/media/pci/pt3/Makefile | 8 + drivers/media/pci/pt3/pt3.c | 877 ++++++++++++++++++++++++++++++++++ drivers/media/pci/pt3/pt3.h | 186 +++++++ drivers/media/pci/pt3/pt3_dma.c | 225 +++++++++ drivers/media/pci/pt3/pt3_i2c.c | 240 ++++++++++ drivers/media/tuners/Kconfig | 14 + drivers/media/tuners/Makefile | 2 + drivers/media/tuners/mxl301rf.c | 349 ++++++++++++++ drivers/media/tuners/mxl301rf.h | 26 + drivers/media/tuners/qm1d1c0042.c | 445 +++++++++++++++++ drivers/media/tuners/qm1d1c0042.h | 37 ++ 18 files changed, 3311 insertions(+) create mode 100644 drivers/media/dvb-frontends/tc90522.c create mode 100644 drivers/media/dvb-frontends/tc90522.h create mode 100644 drivers/media/pci/pt3/Kconfig create mode 100644 drivers/media/pci/pt3/Makefile create mode 100644 drivers/media/pci/pt3/pt3.c create mode 100644 drivers/media/pci/pt3/pt3.h create mode 100644 drivers/media/pci/pt3/pt3_dma.c create mode 100644 drivers/media/pci/pt3/pt3_i2c.c create mode 100644 drivers/media/tuners/mxl301rf.c create mode 100644 drivers/media/tuners/mxl301rf.h create mode 100644 drivers/media/tuners/qm1d1c0042.c create mode 100644 drivers/media/tuners/qm1d1c0042.h
Signature · 1 line
2.1.0
[email protected]
maintainerPATCH v4 1/4 mxl301rf: add driver for MaxLinear MxL301RF OFDM tuner
From: Akihiro Tsukada <[email protected]>
This patch adds driver for mxl301rf OFDM tuner chips. It is used as an ISDB-T tuner in earthsoft pt3 cards.
Note that this driver does not initilize the chip,
because the initilization sequence / register setting is not disclosed. Thus, the driver assumes that the chips are initilized externally by its parent board driver before tuner_ops->init() are called, like in PT3 driver where the bridge chip contains the init sequence in its private memory and provides a command to trigger the sequence.
---
Changes in v4:
- improved I2C transaction for register read
- removed unnecessary .get_status()
- removed initial frequency setting and moved to the bridge driver
- added a comment to notice incompleteness of the driver
drivers/media/tuners/Kconfig | 7 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/mxl301rf.c | 349 ++++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/mxl301rf.h | 26 +++ 4 files changed, 383 insertions(+) create mode 100644 drivers/media/tuners/mxl301rf.c create mode 100644 drivers/media/tuners/mxl301rf.h
drivers/media/tuners/Kconfig +7 -0
@@ -257,4 +257,11 @@ config MEDIA_TUNER_R820T default m if !MEDIA_SUBDRV_AUTOSELECT help Rafael Micro R820T silicon tuner driver. + +config MEDIA_TUNER_MXL301RF + tristate "MaxLinear MxL301RF tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + MaxLinear MxL301RF OFDM tuner driver. endmenu
drivers/media/tuners/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_MEDIA_TUNER_FC0012) += fc0012.o obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o obj-$(CONFIG_MEDIA_TUNER_IT913X) += tuner_it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o +obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
drivers/media/tuners/mxl301rf.c new file +349 -0
349 lines not on this page · raw message
drivers/media/tuners/mxl301rf.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* MaxLinear MxL301RF OFDM tuner driver +* +* Copyright (C) 2014 Akihiro Tsukada <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* +* 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 MXL301RF_H +#define MXL301RF_H + +#include "dvb_frontend.h" + +struct mxl301rf_config { +struct dvb_frontend *fe; +}; + +#endif /* MXL301RF_H */
Signature · 1 line
2.1.0
Re: [PATCH v4 1/4] mxl301rf: add driver for MaxLinear MxL301RF OFDM tuner
Moikka
It looks technically correct for my eyes, no any big issue. Driver itself is quite stub as most of the chip logic is put inside bridge firmware, though.
regards
Antti
Quoted 444 lines · On 09/08/2014 08:20 PM, [email protected] wrote:
From: Akihiro Tsukada <[email protected]>
This patch adds driver for mxl301rf OFDM tuner chips. It is used as an ISDB-T tuner in earthsoft pt3 cards.
Note that this driver does not initilize the chip,
because the initilization sequence / register setting is not disclosed. Thus, the driver assumes that the chips are initilized externally by its parent board driver beforetuner_ops->init()are called, like in PT3 driver where the bridge chip contains the init sequence in its private memory and provides a command to trigger the sequence.Signed-off-by Akihiro Tsukada <[email protected]>---
Changes in v4:
- improved I2C transaction for register read
- removed unnecessary .get_status()
- removed initial frequency setting and moved to the bridge driver
- added a comment to notice incompleteness of the driverdrivers/media/tuners/Kconfig | 7 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/mxl301rf.c | 349 ++++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/mxl301rf.h | 26 +++ 4 files changed, 383 insertions(+)create mode 100644
drivers/media/tuners/mxl301rf.ccreate mode 100644drivers/media/tuners/mxl301rf.hdrivers/media/tuners/Kconfig +7
-0@@ -257,4 +257,11 @@ config MEDIA_TUNER_R820T default m if !MEDIA_SUBDRV_AUTOSELECT help Rafael Micro R820T silicon tuner driver. + +config MEDIA_TUNER_MXL301RF + tristate "MaxLinear MxL301RF tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + MaxLinear MxL301RF OFDM tuner driver. endmenudrivers/media/tuners/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_MEDIA_TUNER_FC0012) += fc0012.o obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o obj-$(CONFIG_MEDIA_TUNER_IT913X) += tuner_it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o +obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontendsdrivers/media/tuners/mxl301rf.c new file +349
-0@@ -0,0 +1,349 @@ +/* +* MaxLinear MxL301RF OFDM tuner driver +* +* Copyright (C) 2014 Akihiro Tsukada <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* +* 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. +*/ + +/* +* NOTICE: +* This driver is incomplete and lacks init/config of the chips, +* as the necessary info is not disclosed. +* Other features like get_if_frequency() are missing as well. +* It assumes that users of this driver (such as a PCI bridge of +* DTV receiver cards) properly init and configure the chip +* via I2C *before* calling this driver's init() function. +* +* Currently, PT3 driver is the only one that uses this driver, +* and contains init/config code in its firmware. +* Thus some part of the code might be dependent on PT3 specific config. +*/ + +#include <linux/kernel.h> +#include "mxl301rf.h" + +struct mxl301rf_state { +struct mxl301rf_config cfg; +struct i2c_client *i2c; +}; + +static struct mxl301rf_state *cfg_to_state (struct mxl301rf_config *c) +{ + return container_of(c, struct mxl301rf_state, cfg); +} + +static int raw_write (struct mxl301rf_state *state,const u8 *buf,int len) +{ +int ret; + + ret =i2c_master_send (state->i2c, buf, len); +if (ret >=0 && ret < len) + ret = -EIO ; +return (ret == len) ?0 : ret; +} + +static int reg_write (struct mxl301rf_state *state,u8 reg,u8 val) +{ +u8 buf[2 ] = { reg, val }; + +return raw_write (state, buf,2 ); +} + +static int reg_read (struct mxl301rf_state *state,u8 reg,u8 *val) +{ +u8 wbuf[2 ] = {0xfb , reg }; +int ret; + + ret =raw_write (state, wbuf,sizeof (wbuf)); +if (ret ==0 ) + ret =i2c_master_recv (state->i2c, val,1 ); +if (ret >=0 && ret <1 ) + ret = -EIO ; +return (ret ==1 ) ?0 : ret; +} + +/* tuner_ops */ + +/* get RSSI and update propery cache, set to *out in % */ +static int mxl301rf_get_rf_strength (struct dvb_frontend *fe,u16 *out) +{ +struct mxl301rf_state *state; +int ret; +u8 rf_in1, rf_in2, rf_off1, rf_off2; +u16 rf_in, rf_off; +s64 level; +struct dtv_fe_stats *rssi; + + rssi = &fe->dtv_property_cache.strength; + rssi->len =1 ; + rssi->stat[0 ].scale =FE_SCALE_NOT_AVAILABLE ; + *out =0 ; + + state = fe->tuner_priv; + ret =reg_write (state,0x14 ,0x01 ); +if (ret <0 ) +return ret; +usleep_range (1000 ,2000 ); + + ret =reg_read (state,0x18 , &rf_in1); +if (ret ==0 ) + ret =reg_read (state,0x19 , &rf_in2); +if (ret ==0 ) + ret =reg_read (state,0xd6 , &rf_off1); +if (ret ==0 ) + ret =reg_read (state,0xd7 , &rf_off2); +if (ret !=0 ) +return ret; + + rf_in = (rf_in2 &0x07 ) <<8 | rf_in1; + rf_off = (rf_off2 &0x0f ) <<5 | (rf_off1 >>3 ); + level = rf_in - rf_off - (113 <<3 );/* x8 dBm */ + level = level *1000 /8 ; + rssi->stat[0 ].svalue = level; + rssi->stat[0 ].scale =FE_SCALE_DECIBEL ; +/* *out = (level - min) * 100 / (max - min) */ + *out = (rf_in - rf_off + (1 <<9 ) -1 ) *100 / ((5 <<9 ) -2 ); +return 0 ; +} + +/* spur shift parameters */ +struct shf { +u32 freq;/* Channel center frequency */ +u32 ofst_th;/* Offset frequency threshold */ +u8 shf_val;/* Spur shift value */ +u8 shf_dir;/* Spur shift direction */ +}; + +static const struct shf shf_tab[] = { + {64500 ,500 ,0x92 ,0x07 }, + {191500 ,300 ,0xe2 ,0x07 }, + {205500 ,500 ,0x2c ,0x04 }, + {212500 ,500 ,0x1e ,0x04 }, + {226500 ,500 ,0xd4 ,0x07 }, + {99143 ,500 ,0x9c ,0x07 }, + {173143 ,500 ,0xd4 ,0x07 }, + {191143 ,300 ,0xd4 ,0x07 }, + {207143 ,500 ,0xce ,0x07 }, + {225143 ,500 ,0xce ,0x07 }, + {243143 ,500 ,0xd4 ,0x07 }, + {261143 ,500 ,0xd4 ,0x07 }, + {291143 ,500 ,0xd4 ,0x07 }, + {339143 ,500 ,0x2c ,0x04 }, + {117143 ,500 ,0x7a ,0x07 }, + {135143 ,300 ,0x7a ,0x07 }, + {153143 ,500 ,0x01 ,0x07 } +}; + +struct reg_val { +u8 reg; +u8 val; +} __attribute__ ((__packed__ )); + +static const struct reg_val set_idac[] = { + {0x0d ,0x00 }, + {0x0c ,0x67 }, + {0x6f ,0x89 }, + {0x70 ,0x0c }, + {0x6f ,0x8a }, + {0x70 ,0x0e }, + {0x6f ,0x8b }, + {0x70 ,0x1c }, +}; + +static int mxl301rf_set_params (struct dvb_frontend *fe) +{ +struct reg_val tune0[] = { + {0x13 ,0x00 },/* abort tuning */ + {0x3b ,0xc0 }, + {0x3b ,0x80 }, + {0x10 ,0x95 },/* BW */ + {0x1a ,0x05 }, + {0x61 ,0x00 },/* spur shift value (placeholder) */ + {0x62 ,0xa0 }/* spur shift direction (placeholder) */ + }; + +struct reg_val tune1[] = { + {0x11 ,0x40 },/* RF frequency L (placeholder) */ + {0x12 ,0x0e },/* RF frequency H (placeholder) */ + {0x13 ,0x01 }/* start tune */ + }; + +struct mxl301rf_state *state; +u32 freq; +u16 f; +u32 tmp, div; +int i, ret; + + state = fe->tuner_priv; + freq = fe->dtv_property_cache.frequency; + +/* spur shift function (for analog) */ +for (i =0 ; i <ARRAY_SIZE (shf_tab); i++) { +if (freq >= (shf_tab[i].freq - shf_tab[i].ofst_th) *1000 && + freq <= (shf_tab[i].freq + shf_tab[i].ofst_th) *1000 ) { + tune0[5 ].val = shf_tab[i].shf_val; + tune0[6 ].val =0xa0 | shf_tab[i].shf_dir; +break ; + } + } + ret =raw_write (state, (u8 *) tune0,sizeof (tune0)); +if (ret <0 ) + goto failed; +usleep_range (3000 ,4000 ); + +/* convert freq to 10.6 fixed point float [MHz] */ + f = freq /1000000 ; + tmp = freq %1000000 ; + div =1000000 ; +for (i =0 ; i <6 ; i++) { + f <<=1 ; + div >>=1 ; +if (tmp > div) { + tmp -= div; + f |=1 ; + } + } +if (tmp >7812 ) + f++; + tune1[0 ].val = f &0xff ; + tune1[1 ].val = f >>8 ; + ret =raw_write (state, (u8 *) tune1,sizeof (tune1)); +if (ret <0 ) + goto failed; +msleep (31 ); + + ret =reg_write (state,0x1a ,0x0d ); +if (ret <0 ) + goto failed; + ret =raw_write (state, (u8 *) set_idac,sizeof (set_idac)); +if (ret <0 ) + goto failed; +return 0 ; + +failed: +dev_warn (&state->i2c->dev,"(%s) failed. [adap%d-fe%d]\n" , + __func__, fe->dvb->num, fe->id); +return ret; +} + +static const struct reg_val standby_data[] = { + {0x01 ,0x00 }, + {0x13 ,0x00 } +}; + +static int mxl301rf_sleep (struct dvb_frontend *fe) +{ +struct mxl301rf_state *state; +int ret; + + state = fe->tuner_priv; + ret =raw_write (state, (u8 *)standby_data,sizeof (standby_data)); +if (ret <0 ) +dev_warn (&state->i2c->dev,"(%s) failed. [adap%d-fe%d]\n" , + __func__, fe->dvb->num, fe->id); +return ret; +} + + +/* init sequence is not public. +* the parent must have init'ed the device. +* just wake up here. +*/ +static int mxl301rf_init (struct dvb_frontend *fe) +{ +struct mxl301rf_state *state; +int ret; + + state = fe->tuner_priv; + + ret =reg_write (state,0x01 ,0x01 ); +if (ret <0 ) { +dev_warn (&state->i2c->dev,"(%s) failed. [adap%d-fe%d]\n" , + __func__, fe->dvb->num, fe->id); +return ret; + } +return 0 ; +} + +/* I2C driver functions */ + +static const struct dvb_tuner_ops mxl301rf_ops = { + .info = { + .name ="MaxLinear MxL301RF" , + + .frequency_min =93000000 , + .frequency_max =803142857 , + }, + + .init = mxl301rf_init, + .sleep = mxl301rf_sleep, + + .set_params = mxl301rf_set_params, + .get_rf_strength = mxl301rf_get_rf_strength, +}; + + +static int mxl301rf_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +struct mxl301rf_state *state; +struct mxl301rf_config *cfg; +struct dvb_frontend *fe; + + state =kzalloc (sizeof (*state),GFP_KERNEL ); +if (!state) +return -ENOMEM ; + + state->i2c = client; + cfg = client->dev.platform_data; + +memcpy (&state->cfg, cfg,sizeof (state->cfg)); + fe = cfg->fe; + fe->tuner_priv = state; +memcpy (&fe->ops.tuner_ops, &mxl301rf_ops,sizeof (mxl301rf_ops)); + +i2c_set_clientdata (client, &state->cfg); +dev_info (&client->dev,"MaxLinear MxL301RF attached.\n" ); +return 0 ; +} + +static int mxl301rf_remove (struct i2c_client *client) +{ +struct mxl301rf_state *state; + + state =cfg_to_state (i2c_get_clientdata (client)); + state->cfg.fe->tuner_priv =NULL ; +kfree (state); +return 0 ; +} + + +static const struct i2c_device_id mxl301rf_id[] = { + {"mxl301rf" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, mxl301rf_id); + +static struct i2c_driver mxl301rf_driver = { + .driver = { + .name ="mxl301rf" , + }, + .probe = mxl301rf_probe, + .remove = mxl301rf_remove, + .id_table = mxl301rf_id, +}; + +module_i2c_driver (mxl301rf_driver); + +MODULE_DESCRIPTION ("MaxLinear MXL301RF tuner" ); +MODULE_AUTHOR ("Akihiro TSUKADA" ); +MODULE_LICENSE ("GPL" );drivers/media/tuners/mxl301rf.h new file +26
-0@@ -0,0 +1,26 @@ +/* +* MaxLinear MxL301RF OFDM tuner driver +* +* Copyright (C) 2014 Akihiro Tsukada <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* +* 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 MXL301RF_H +#define MXL301RF_H + +#include "dvb_frontend.h" + +struct mxl301rf_config { +struct dvb_frontend *fe; +}; + +#endif /* MXL301RF_H */
Signature · 1 line
http://palosaari.fi/
[email protected]
maintainerPATCH v4 2/4 qm1d1c0042: add driver for Sharp QM1D1C0042 ISDB-S tuner
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
This patch adds driver for qm1d1c0042 tuner chips. It is used as an ISDB-S tuner in earthsoft pt3 cards.
---
Changes in v4:
- removed unnecessary .get_status()
- removed initial frequency setting and moved to the bridge driver
- added a comment to notice incompleteness of the driver
drivers/media/tuners/Kconfig | 7 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/qm1d1c0042.c | 445 ++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/qm1d1c0042.h | 37 ++++ 4 files changed, 490 insertions(+) create mode 100644 drivers/media/tuners/qm1d1c0042.c create mode 100644 drivers/media/tuners/qm1d1c0042.h
drivers/media/tuners/Kconfig +7 -0
@@ -264,4 +264,11 @@ config MEDIA_TUNER_MXL301RF default m if !MEDIA_SUBDRV_AUTOSELECT help MaxLinear MxL301RF OFDM tuner driver. + +config MEDIA_TUNER_QM1D1C0042 + tristate "Sharp QM1D1C0042 tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Sharp QM1D1C0042 trellis coded 8PSK tuner driver. endmenu
drivers/media/tuners/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o obj-$(CONFIG_MEDIA_TUNER_IT913X) += tuner_it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o +obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
drivers/media/tuners/qm1d1c0042.c new file +445 -0
445 lines not on this page · raw message
drivers/media/tuners/qm1d1c0042.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Sharp QM1D1C0042 8PSK tuner driver +* +* Copyright (C) 2014 Akihiro Tsukada <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* +* 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 QM1D1C0042_H +#define QM1D1C0042_H + +#include "dvb_frontend.h" + + +struct qm1d1c0042_config { +struct dvb_frontend *fe; + +u32 xtal_freq;/* [kHz] */ /* currently ignored */ +bool lpf;/* enable LPF */ +bool fast_srch;/* enable fast search mode, no LPF */ +u32 lpf_wait;/* wait in tuning with LPF enabled. [ms] */ +u32 fast_srch_wait;/* with fast-search mode, no LPF. [ms] */ +u32 normal_srch_wait;/* with no LPF/fast-search mode. [ms] */ +}; +/* special values indicating to use the default in qm1d1c0042_config */ +#define QM1D1C0042_CFG_XTAL_DFLT 0 +#define QM1D1C0042_CFG_WAIT_DFLT 0 + +#endif /* QM1D1C0042_H */
Signature · 1 line
2.1.0
[email protected]
maintainerPATCH v4 3/4 tc90522: add driver for Toshiba TC90522 quad demodulator
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
This patch adds driver for tc90522 demodulator chips.
The chip contains 4 demod modules that run in parallel and are independently controllable via separate I2C addresses.
Two of the modules are for ISDB-T and the rest for ISDB-S.
It is used in earthsoft pt3 cards.
Note that this driver does not init the chip,
because the initilization sequence / register setting is not disclosed. Thus, the driver assumes that the chips are initilized externally by its parent board driver before fe->ops->init() are called. Earthsoft PT3 PCIe card, for example, contains the init sequence in its private memory and provides a command to trigger the sequence.
---
Changes in v4:
- removed cheking tuner lock in set_frontend()
- added a comment to notice incompleteness of the driver
drivers/media/dvb-frontends/Kconfig | 8 + drivers/media/dvb-frontends/Makefile | 1 + drivers/media/dvb-frontends/tc90522.c | 839 ++++++++++++++++++++++++++++++++++ drivers/media/dvb-frontends/tc90522.h | 42 ++ 4 files changed, 890 insertions(+) create mode 100644 drivers/media/dvb-frontends/tc90522.c create mode 100644 drivers/media/dvb-frontends/tc90522.h
drivers/media/dvb-frontends/Kconfig +8 -0
@@ -648,6 +648,14 @@ config DVB_MB86A20S A driver for Fujitsu mb86a20s ISDB-T/ISDB-Tsb demodulator. Say Y when you want to support this frontend. +config DVB_TC90522 + tristate "Toshiba TC90522" + depends on DVB_CORE && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + A Toshiba TC90522 2xISDB-T + 2xISDB-S demodulator. + Say Y when you want to support this frontend. + comment "Digital terrestrial only tuners/PLL" depends on DVB_CORE
drivers/media/dvb-frontends/Makefile +1 -0
@@ -114,3 +114,4 @@ obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o obj-$(CONFIG_DVB_AF9033) += af9033.o obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o +obj-$(CONFIG_DVB_TC90522) += tc90522.o
drivers/media/dvb-frontends/tc90522.c new file +839 -0
839 lines not on this page · raw message
drivers/media/dvb-frontends/tc90522.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Em Tue, 9 Sep 2014 02:20:42 +0900
[email protected] escreveu:
Quoted 8 lines
From: Akihiro Tsukada <[email protected]>
This patch adds driver for tc90522 demodulator chips.
The chip contains 4 demod modules that run in parallel and are independently controllable via separate I2C addresses.
Two of the modules are for ISDB-T and the rest for ISDB-S.
It is used in earthsoft pt3 cards.
Quoted 6 lines
Note that this driver does not init the chip,
because the initilization sequence / register setting is not disclosed. Thus, the driver assumes that the chips are initilized externally by its parent board driver beforefe->ops->init()are called. Earthsoft PT3 PCIe card, for example, contains the init sequence in its private memory and provides a command to trigger the sequence.
I applied this series, as we're discussing it already for a long time, and it seems in a good shape...
Yet, I got some minor issues with FE status. See below.
PS.: could you also test (and send us patches as needed) for ISDB-S support at libdvbv5 and dvbv5-utils[1]?
[1] http://linuxtv.org/wiki/index.php/DVBv5_Tools
Thanks!
Mauro
Quoted 8 lines
drivers/media/dvb-frontends/tc90522.c new file +8
-0+static int tc90522s_read_status (struct dvb_frontend *fe,fe_status_t *status) +{ +struct tc90522_state *state; +int ret; +u8 reg; + + state = fe->demodulator_priv; + ret =reg_read (state,0xc3 , ®,1 );
drivers/media/dvb-frontends/tc90522.c line 149
Quoted 10 lines
drivers/media/dvb-frontends/tc90522.c new file +10
-0+if (ret <0 ) +return ret; + + *status =0 ; +if (reg &0x80 )/* input level under min ? */ +return 0 ; + *status |=FE_HAS_SIGNAL ; + +if (reg &0x60 )/* carrier? */ +return 0 ;
Sure about that? Wouldn't it be, instead, reg & 0x60 == 0x60?
Quoted 29 lines
drivers/media/dvb-frontends/tc90522.c new file +29
-0+ *status |=FE_HAS_CARRIER |FE_HAS_VITERBI |FE_HAS_SYNC ; + +if (reg &0x10 ) +return 0 ; +if (reg_read (state,0xc5 , ®,1 ) <0 || !(reg &0x03 )) +return 0 ; + *status |=FE_HAS_LOCK ; +return 0 ; +} + +static int tc90522t_read_status (struct dvb_frontend *fe,fe_status_t *status) +{ +struct tc90522_state *state; +int ret; +u8 reg; + + state = fe->demodulator_priv; + ret =reg_read (state,0x96 , ®,1 ); +if (ret <0 ) +return ret; + + *status =0 ; +if (reg &0xe0 ) { + *status =FE_HAS_SIGNAL |FE_HAS_CARRIER |FE_HAS_VITERBI + |FE_HAS_SYNC |FE_HAS_LOCK ; +return 0 ; + } + + ret =reg_read (state,0x80 , ®,1 );
drivers/media/dvb-frontends/tc90522.c line 188
Quoted 10 lines
drivers/media/dvb-frontends/tc90522.c new file +10
-0+if (ret <0 ) +return ret; + +if (reg &0xf0 ) +return 0 ; + *status |=FE_HAS_SIGNAL |FE_HAS_CARRIER ; + +if (reg &0x0c ) +return 0 ; + *status |=FE_HAS_SYNC |FE_HAS_VITERBI ;
The entire series of checks above seems wrong on my eyes too.
For example, if reg = 0x20 or 0x40 or 0x80 or ..., it will return FE_HAS_LOCK.
Regards,
Mauro
Akihiro TSUKADA
maintainerRe: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Hi,
Quoted 2 lines · Mauro Carvalho Chehab
I applied this series, as we're discussing it already for a long time, and it seems in a good shape...
thanks for your reviews and advices.
Quoted 1 line
Quoted 1 line
+static int
tc90522s_read_status(struct dvb_frontend *fe, fe_status_t *status)
...........
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (reg & 0x60) /* carrier? */ + return 0;Sure about that? Wouldn't it be, instead, reg &
0x60==0x60?
Yes, I'm pretty sure about that.
The register indicates errors in the various demod stages, and if all go well, the reg should be 0.
Quoted 1 line
Quoted 1 line
+static int
tc90522t_read_status(struct dvb_frontend *fe, fe_status_t *status)
..............
Quoted 4 lines
The entire series of checks above seems wrong on my eyes too.
For example, if reg =
0x20or0x40or0x80or ..., it will returnFE_HAS_LOCK.
This register 0x96 should indicates "lock" status for each layers, and since layer config can vary in ISDB-T, the driver checks that any of the three bits is set, for faster lock detection.
and the register 0x80 is the same kind of the one in the above ISDB-S case.
Quoted 2 lines
PS.: could you also test (and send us patches as needed) for ISDB-S support at libdvbv5 and dvbv5-utils[1]?
I'll have a try.
regards,
akihiro
Mauro Carvalho Chehab
Acked-by Patrick BoettcherRe: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Em Wed, 24 Sep 2014 12:00:53 +0900
Akihiro TSUKADA <[email protected]> escreveu:
Quoted 24 lines
Hi,
Quoted 2 lines · Mauro Carvalho Chehab
I applied this series, as we're discussing it already for a long time, and it seems in a good shape...
thanks for your reviews and advices.
Quoted 1 line
Quoted 1 line
+static int
tc90522s_read_status(struct dvb_frontend *fe, fe_status_t *status)...........
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (reg & 0x60) /* carrier? */ + return 0;Sure about that? Wouldn't it be, instead, reg &
0x60==0x60?Yes, I'm pretty sure about that.
The register indicates errors in the various demod stages, and if all go well, the reg should be 0.Quoted 1 line
Quoted 1 line
+static int
tc90522t_read_status(struct dvb_frontend *fe, fe_status_t *status)..............
Quoted 2 lines
The entire series of checks above seems wrong on my eyes too.
Quoted 7 lines
Quoted 2 lines
For example, if reg =
0x20or0x40or0x80or ..., it will returnFE_HAS_LOCK.This register
0x96should indicates "lock" status for each layers, and since layer config can vary in ISDB-T, the driver checks that any of the three bits is set, for faster lock detection.
and the register0x80is the same kind of the one in the above ISDB-S case.
Ah, ok. It could be useful to document it, and eventually to add some debug printk's that would print the locks for each layer. Such printk were very useful for me to discover why dib8000 driver were not locking to a layer encoded using interleave equal to 4:
commit 34ba2e65bab3693cdd7c2ee0b8ba6477bd8c366b
Author: Mauro Carvalho Chehab <[email protected]> Date: Fri Jul 4 14:15:27 2014 -0300
[media] dib8000: Fix handling of interleave bigger than 2
If interleave is bigger than 2, the code will set it to 0, as dib8000 registers use a log2(). So, change the code to handle it accordingly.
Btw, please check if your driver is handling it well, as the valid values for interleave are 0, 1, 2, 4 (actually, dib8000 also supports interleaving equal to 8, if sound_broadcast).
Quoted 4 lines
Quoted 3 lines
PS.: could you also test (and send us patches as needed) for ISDB-S support at libdvbv5 and dvbv5-utils[1]?
I'll have a try.
Ok, thanks!
Regards,
Mauro
Akihiro TSUKADA
maintainerRe: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Quoted 3 lines
Btw, please check if your driver is handling it well, as the valid values for interleave are 0, 1, 2, 4 (actually, dib8000 also supports interleaving equal to 8, if
sound_broadcast).
I have no info on how to set time interleaving parameters, although I can read them as a part of TMCC info.
I guess I can also set them in the same registers, but I'm not sure.
Since the demod is intelligent and automatically reads TMCC and sets the related parameters accordingly,
I think it is safe to ignore user settings and let the demod set it. If someone would get more info in the future,
[s]he could set those parameters in advance and make a lock faster.
regards,
akihiro
Re: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Em Wed, 24 Sep 2014 20:14:01 +0900
Akihiro TSUKADA <[email protected]> escreveu:
Quoted 6 lines
Quoted 3 lines
Btw, please check if your driver is handling it well, as the valid values for interleave are 0, 1, 2, 4 (actually, dib8000 also supports interleaving equal to 8, if
sound_broadcast).I have no info on how to set time interleaving parameters, although I can read them as a part of TMCC info.
And TMCC returns it as 0, 1, 2, 3, 4, instead of 0, 1, 2, 4, 8.
Quoted 5 lines
I guess I can also set them in the same registers, but I'm not sure.
Since the demod is intelligent and automatically reads TMCC and sets the related parameters accordingly,
I think it is safe to ignore user settings and let the demod set it.
AFAIKT, that doesn't work in Sound Broadcast mode, as the demod won't be able to read the TMCC (at least on most demods - don't have any details about tc90522).
Quoted 5 lines
If someone would get more info in the future,
[s]he could set those parameters in advance and make a lock faster.regards,
akihiro
Akihiro TSUKADA
maintainerRe: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Quoted 1 line
And TMCC returns it as 0, 1, 2, 3, 4, instead of 0, 1, 2, 4, 8.
According to ARIB STD B31 3.15.6.7 (table 3.30),
The value is encoded and depends on the "mode".
so demods have to encode/decode anyway.
Quoted 3 lines
AFAIKT, that doesn't work in Sound Broadcast mode, as the demod won't be able to read the TMCC (at least on most demods - don't have any details about tc90522).
I forgat ISDB-Tsb;P, as in Japan terrestrial digital sound broadcast was cancelled in 2011 and it was unpopular.
--
akihiro
Re: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Em Wed, 24 Sep 2014 21:06:43 +0900
Akihiro TSUKADA <[email protected]> escreveu:
Quoted 5 lines
Quoted 1 line
And TMCC returns it as 0, 1, 2, 3, 4, instead of 0, 1, 2, 4, 8.
According to ARIB STD B31 3.15.6.7 (table 3.30),
The value is encoded and depends on the "mode".
so demods have to encode/decode anyway.
Ok, but see the definition at the API spec:
http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html#isdb-hierq-layers
Basically, we use 0, 1, 2, 4 no matter what mode, e. g.
DTV_ISDBT_LAYERA_TIME_INTERLEAVING 1
means:
Interleave = 4 for mode 1
Interleave = 2 for mode 2
Interleave = 1 for mode 3
Quoted 6 lines
Quoted 3 lines
AFAIKT, that doesn't work in Sound Broadcast mode, as the demod won't be able to read the TMCC (at least on most demods - don't have any details about tc90522).
I forgat ISDB-Tsb;P, as in Japan terrestrial digital sound broadcast was cancelled in 2011 and it was unpopular.
Ah, I wasn't aware that ISDB-Tsb was cancelled in Japan.
Regards,
Mauro
Akihiro TSUKADA
maintainerRe: [PATCH v4 3/4] tc90522: add driver for Toshiba TC90522 quad demodulator
Quoted 5 lines
Ok, but see the definition at the API spec:
http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html#isdb-hierq-layers
Basically, we use 0, 1, 2, 4 no matter what mode, e. g.
I understand.
(though I wonder why "4" is assigned instead of "3" when it is not a flag bit that can be OR'ed
and a kind of "raw" values are used anyway).
Quoted 1 line
Ah, I wasn't aware that ISDB-Tsb was cancelled in Japan.
The band used by ISDB-Tsb is now assigned to ISDB-Tmm (which is also very unpopular),
and there is a plan to use ISDB-Tsb in another freq band in the future, but no concrete one yet.
--
akihiro
[email protected]
maintainerPATCH v4 4/4 pt3: add support for Earthsoft PT3 ISDB-S/T receiver card
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
This patch adds support for PT3 PCIe cards.
PT3 has an FPGA PCIe bridge chip, a TC90522 demod chip and
a VA4M6JC2103 tuner module which contains two QM1D1C0042 chips for ISDB-S and two MxL301RF's for ISDB-T.
It can receive and deliver 4 (2x ISDB-S, 2x ISDB-T) streams simultaneously, and a kthread is used per stream to poll incoming data,
because PT3 does not have interrupts.
As an antenna input for each delivery system is split in the tuner module and shared between the corresponding two tuner chips,
LNB/LNA controls that the FPGA chip provides are (naturally) shared as well. The tuner chips also share the power line in the tuner module, which is controlled on/off by a GPIO pin of the demod chip.
As with the demod chip and the ISDB-T tuner chip,
the init sequences/register settings for those chips are not disclosed and stored in a private memory of the FPGA,
PT3 driver executes the init of those chips on behalf of their drivers.
---
Changes in v4:
- made initial frequency setting local to this driver, moved from tuner drivers
drivers/media/pci/Kconfig | 1 + drivers/media/pci/Makefile | 1 + drivers/media/pci/pt3/Kconfig | 10 + drivers/media/pci/pt3/Makefile | 8 + drivers/media/pci/pt3/pt3.c | 877 ++++++++++++++++++++++++++++++++++++++++ drivers/media/pci/pt3/pt3.h | 186 +++++++++ drivers/media/pci/pt3/pt3_dma.c | 225 +++++++++++ drivers/media/pci/pt3/pt3_i2c.c | 240 +++++++++++ 8 files changed, 1548 insertions(+) create mode 100644 drivers/media/pci/pt3/Kconfig create mode 100644 drivers/media/pci/pt3/Makefile create mode 100644 drivers/media/pci/pt3/pt3.c create mode 100644 drivers/media/pci/pt3/pt3.h create mode 100644 drivers/media/pci/pt3/pt3_dma.c create mode 100644 drivers/media/pci/pt3/pt3_i2c.c
drivers/media/pci/Kconfig +1 -0
@@ -41,6 +41,7 @@ source "drivers/media/pci/b2c2/Kconfig" source "drivers/media/pci/pluto2/Kconfig" source "drivers/media/pci/dm1105/Kconfig" source "drivers/media/pci/pt1/Kconfig" +source "drivers/media/pci/pt3/Kconfig" source "drivers/media/pci/mantis/Kconfig" source "drivers/media/pci/ngene/Kconfig" source "drivers/media/pci/ddbridge/Kconfig"
drivers/media/pci/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += ttpci/ \ pluto2/ \ dm1105/ \ pt1/ \ + pt3/ \ mantis/ \ ngene/ \ ddbridge/ \
drivers/media/pci/pt3/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config DVB_PT3 + tristate "Earthsoft PT3 cards" + depends on DVB_CORE && PCI && I2C + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1C0042 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_MXL301RF if MEDIA_SUBDRV_AUTOSELECT + help + Support for Earthsoft PT3 PCIe cards. + + Say Y or M if you own such a device and want to use it.
drivers/media/pci/pt3/Makefile new file +8 -0
@@ -0,0 +1,8 @@ + +earth-pt3-objs += pt3.o pt3_i2c.o pt3_dma.o + +obj-$(CONFIG_DVB_PT3) += earth-pt3.o + +ccflags-y += -Idrivers/media/dvb-core +ccflags-y += -Idrivers/media/dvb-frontends +ccflags-y += -Idrivers/media/tuners
drivers/media/pci/pt3/pt3.c new file +877 -0
877 lines not on this page · raw message
drivers/media/pci/pt3/pt3.h new file +186 -0
186 lines not on this page · raw message
drivers/media/pci/pt3/pt3_dma.c new file +225 -0
225 lines not on this page · raw message
drivers/media/pci/pt3/pt3_i2c.c new file +240 -0
240 lines not on this page · raw message
Signature · 1 line
2.1.0