DVB driver for Earthsoft PT3, PLEX PX-Q3PE ISDB-S/T PCIE cards & PX-BCUD ISDB-S USB dongle
Subsystems (6)
cover DVB driver for Earthsoft PT3, PLEX PX-Q3PE ISDB-S/T PCIE cards & PX-BCUD ISDB-S USB dongle
From: Буди Романто, AreMa Inc <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To: [email protected]
Cc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
DVB driver for Earthsoft PT3, PLEX PX-Q3PE ISDB-S/T PCIE cards & PX-BCUD ISDB-S USB dongle
==========================================================================================
Status: stable
Features:
1. in addition to the real frequency:
ISDB-S : freq. channel ID ISDB-T : freq# (I/O# +128), ch#, ch# +64 for CATV
2. in addition to TSID:
ISDB-S : slot#
Supported Cards & Main components:
A. EarthSoft PT3:
1. Altera EP4CGX15BF14C8N : customized FPGA PCI bridge
2. Toshiba TC90522XBG : quad demodulator (2ch OFDM + 2ch 8PSK)
3. Sharp VA4M6JC2103 : contains 2 ISDB-S + 2 ISDB-T tuners
ISDB-S : Sharp QM1D1C0042 RF-IC, chip ver. 0x48 ISDB-T : MaxLinear CMOS Hybrid TV MxL301RF
B. PLEX PX-Q3PE:
1. ASICEN ASV5220 : PCI-E bridge
2. Toshiba TC90522XBG : quad demodulator (2ch OFDM + 2ch 8PSK)
3. NXP Semiconductors TDA20142 : ISDB-S tuner
4. Newport Media NM120 : ISDB-T tuner
5. ASICEN ASIE5606X8 : crypting controller
C. PLEX PX-BCUD (ISDB-S USB dongle)
1. Empia EM28178 : USB I/F (courtesy of Nagahama Satoshi)
2. Toshiba TC90532 : demodulator (using TC90522 driver)
3. Sharp QM1D1C0045_2 : ISDB-S RF-IC, chip ver. 0x68
Notes:
This is a complex but smartly polished driver package containing 2 (dual head) PCI-E bridge I/F drivers, single demodulator frontend, and 4 (quad tail) tuner drivers, plus, simplified Nagahama's patch for PLEX PX-BCUD (ISDB-S USB dongle). Generic registration related procedures (subdevices, frontend, etc.) summarized in ptx_common.c are very useful also for other DVB drivers, and would be very handy if inserted into the core (e.g. dvb_frontend.c & dvb_frontend.h).
For example, currently, the entity of struct dvb_frontend is created sometimes in demodulators, some in tuners, or even in the parent (bridge) drivers. IMHO, this entity should be provided by dvb_core. ptx_register_fe() included in ptx_common.c simplifies the tasks and in fact, significantly reduces coding & kernel size.
Also, currently dvb_frontend's .demodulator_priv & .tuner_priv are of type (void *). These should be changed to (struct i2c_client *), IMHO. Private data for demodulator or tuner should be attached under i2c_client, using i2c_set_clientdata() for instance.
FILENAME SUPPORTED CHIPS
======== ===============tc90522.c TC90522XBG, TC90532XBG,...tda2014x.c TDA20142qm1d1c004x.c QM1D1C0042, QM1D1C0045, QM1D1C0045_2nm131.c NM131, NM130, NM120mxl301rf.c MxL301RFpt3_pci.c EP4CGX15BF14C8Npxq3pe_pci.c ASV5220
Full package:
- URL: https://github.com/knight-rider/ptx
Буди Романто, AreMa Inc (8):
The current limit is too low for latest cards with 8+ tuners on a
single slot, change to 64.
NXP tda2014x & Newport Media nm120/130/131 tuner drivers for PLEX
PX-Q3PE
Obsoleted & superseded, please read cover letter for details. Toshiba TC905xx demodulator driver for PT3, PX-Q3PE & PX-BCUD MaxLinear MxL301RF ISDB-T tuner
Sharp QM1D1C004x ISDB-S tuner driver for PT3 and PX-BCUD
PCIE bridge driver for PT3 & PX-Q3PE Please read cover letter for
details.
Support for PLEX PX-BCUD (ISDB-S usb dongle) Nagahama's patch
simplified...
drivers/media/dvb-core/dvbdev.h | 2 +- drivers/media/dvb-frontends/tc90522.c | 965 +++++++------------------------- drivers/media/dvb-frontends/tc90522.h | 36 +- drivers/media/pci/Kconfig | 2 +- drivers/media/pci/Makefile | 2 +- drivers/media/pci/pt3/Kconfig | 10 - drivers/media/pci/pt3/Makefile | 8 - drivers/media/pci/pt3/pt3.c | 874 ----------------------------- 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/pci/ptx/Kconfig | 21 + drivers/media/pci/ptx/Makefile | 8 + drivers/media/pci/ptx/pt3_pci.c | 425 ++++++++++++++ drivers/media/pci/ptx/ptx_common.c | 252 +++++++++ drivers/media/pci/ptx/ptx_common.h | 74 +++ drivers/media/pci/ptx/pxq3pe_pci.c | 585 +++++++++++++++++++ drivers/media/tuners/Kconfig | 21 +- drivers/media/tuners/Makefile | 4 +- drivers/media/tuners/mxl301rf.c | 471 ++++++---------- drivers/media/tuners/mxl301rf.h | 19 +- drivers/media/tuners/nm131.c | 248 ++++++++ drivers/media/tuners/nm131.h | 13 + drivers/media/tuners/qm1d1c0042.c | 448 --------------- drivers/media/tuners/qm1d1c0042.h | 37 -- drivers/media/tuners/qm1d1c004x.c | 242 ++++++++ drivers/media/tuners/qm1d1c004x.h | 23 + drivers/media/tuners/tda2014x.c | 342 +++++++++++ drivers/media/tuners/tda2014x.h | 13 + drivers/media/usb/em28xx/Kconfig | 2 + drivers/media/usb/em28xx/em28xx-cards.c | 27 + drivers/media/usb/em28xx/em28xx-dvb.c | 79 ++- drivers/media/usb/em28xx/em28xx.h | 1 + 33 files changed, 2752 insertions(+), 3153 deletions(-) delete mode 100644 drivers/media/pci/pt3/Kconfig delete mode 100644 drivers/media/pci/pt3/Makefile delete mode 100644 drivers/media/pci/pt3/pt3.c delete mode 100644 drivers/media/pci/pt3/pt3.h delete mode 100644 drivers/media/pci/pt3/pt3_dma.c delete mode 100644 drivers/media/pci/pt3/pt3_i2c.c create mode 100644 drivers/media/pci/ptx/Kconfig create mode 100644 drivers/media/pci/ptx/Makefile create mode 100644 drivers/media/pci/ptx/pt3_pci.c create mode 100644 drivers/media/pci/ptx/ptx_common.c create mode 100644 drivers/media/pci/ptx/ptx_common.h create mode 100644 drivers/media/pci/ptx/pxq3pe_pci.c create mode 100644 drivers/media/tuners/nm131.c create mode 100644 drivers/media/tuners/nm131.h delete mode 100644 drivers/media/tuners/qm1d1c0042.c delete mode 100644 drivers/media/tuners/qm1d1c0042.h create mode 100644 drivers/media/tuners/qm1d1c004x.c create mode 100644 drivers/media/tuners/qm1d1c004x.h create mode 100644 drivers/media/tuners/tda2014x.c create mode 100644 drivers/media/tuners/tda2014x.h
Signature · 1 line
2.7.4
PATCH 1/8 raise adapter number limit
From: Буди Романто, AreMa Inc <[email protected]>
The current limit is too low for latest cards with 8+ tuners on a single slot, change to 64.
--- drivers/media/dvb-core/dvbdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvbdev.h +1 -1
@@ -34,7 +34,7 @@#if defined(CONFIG_DVB_MAX_ADAPTERS ) &&CONFIG_DVB_MAX_ADAPTERS >0 #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS#else -#define DVB_MAX_ADAPTERS 8 +#define DVB_MAX_ADAPTERS 64#endif #define DVB_UNSET (-1)
Signature · 1 line
2.7.4
PATCH 2/8 NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
NXP tda2014x & Newport Media nm120/130/131 tuner drivers for PLEX PX-Q3PE
--- drivers/media/tuners/Kconfig | 21 ++- drivers/media/tuners/Makefile | 4 +- drivers/media/tuners/nm131.c | 248 +++++++++++++++++++++++++++++ drivers/media/tuners/nm131.h | 13 ++ drivers/media/tuners/tda2014x.c | 342 ++++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/tda2014x.h | 13 ++ 6 files changed, 637 insertions(+), 4 deletions(-) create mode 100644 drivers/media/tuners/nm131.c create mode 100644 drivers/media/tuners/nm131.h create mode 100644 drivers/media/tuners/tda2014x.c create mode 100644 drivers/media/tuners/tda2014x.h
drivers/media/tuners/Kconfig +18 -3
@@ -271,10 +271,25 @@ config MEDIA_TUNER_MXL301RF help MaxLinear MxL301RF OFDM tuner driver. -config MEDIA_TUNER_QM1D1C0042 - tristate "Sharp QM1D1C0042 tuner" +config MEDIA_TUNER_QM1D1C004X + tristate "Sharp QM1D1C004x tuner" depends on MEDIA_SUPPORT && I2C default m if !MEDIA_SUBDRV_AUTOSELECT help - Sharp QM1D1C0042 trellis coded 8PSK tuner driver. + Sharp trellis coded 8PSK tuner driver. + Supported chips: QM1D1C0042, QM1D1C0045 + +config MEDIA_TUNER_NM131 + tristate "Newport Media tuners NM131, NM130 and NM120" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Newport Media NM131, NM130 and NM120 tuner driver. + +config MEDIA_TUNER_TDA2014X + tristate "NXP Semiconductors TDA2014x tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + NXP Semiconductor TDA2014x tuner driver. endmenu
drivers/media/tuners/Makefile +3 -1
@@ -39,8 +39,10 @@ obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o -obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_QM1D1C004X) += qm1d1c004x.o obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o +obj-$(CONFIG_MEDIA_TUNER_NM131) += nm131.o +obj-$(CONFIG_MEDIA_TUNER_TDA2014X) += tda2014x.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
drivers/media/tuners/nm131.c new file +248 -0
248 lines not on this page · raw message
drivers/media/tuners/nm131.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Driver for Newport Media tuners NMI131, NMI130 and NMI120 +* +* Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> +*/ + +#ifndef NM131_H +#define NM131_H + +#define NM131_MODNAME "nm131" + +#endif +
drivers/media/tuners/tda2014x.c new file +342 -0
342 lines not on this page · raw message
drivers/media/tuners/tda2014x.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Driver for NXP Semiconductors tuner TDA2014x +* +* Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> +*/ + +#ifndef TDA2014X_H +#define TDA2014X_H + +#define TDA2014X_MODNAME "tda2014x" + +#endif +
Signature · 1 line
2.7.4
kbuild test robot
build botRe: [media 2/8] NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
reproduce:
Hi Буди,
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.6-rc1 next-20160331]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-s0-04011126 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
Note: the linux-review/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 HEAD a28878c9675f849df56f4623c33ca431f03e240a builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
>> make[4]: *** No rule to make target 'drivers/media/tuners/qm1d1c004x.o', needed by 'drivers/media/tuners/built-in.o'.
make[4]: Target '__build' not remade because of errors.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [media 2/8] NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
In reply to [email protected]reproduce:
Hi Буди,
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.6-rc1 next-20160331]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-s5-04011138 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
Note: the linux-review/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 HEAD a28878c9675f849df56f4623c33ca431f03e240a builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
>> make[4]: *** No rule to make target 'drivers/media/tuners/qm1d1c004x.c', needed by 'drivers/media/tuners/qm1d1c004x.o'.
make[4]: Target '__build' not remade because of errors.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 3/8 drop backstabbing drivers
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
Obsoleted & superseded, please read cover letter for details.
--- drivers/media/dvb-frontends/tc90522.c | 840 -------------------------------- drivers/media/dvb-frontends/tc90522.h | 42 -- drivers/media/pci/pt3/Kconfig | 10 - drivers/media/pci/pt3/Makefile | 8 - drivers/media/pci/pt3/pt3.c | 874 ---------------------------------- 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/mxl301rf.c | 349 -------------- drivers/media/tuners/mxl301rf.h | 26 - drivers/media/tuners/qm1d1c0042.c | 448 ----------------- drivers/media/tuners/qm1d1c0042.h | 37 -- 12 files changed, 3285 deletions(-) delete mode 100644 drivers/media/dvb-frontends/tc90522.c delete mode 100644 drivers/media/dvb-frontends/tc90522.h delete mode 100644 drivers/media/pci/pt3/Kconfig delete mode 100644 drivers/media/pci/pt3/Makefile delete mode 100644 drivers/media/pci/pt3/pt3.c delete mode 100644 drivers/media/pci/pt3/pt3.h delete mode 100644 drivers/media/pci/pt3/pt3_dma.c delete mode 100644 drivers/media/pci/pt3/pt3_i2c.c delete mode 100644 drivers/media/tuners/mxl301rf.c delete mode 100644 drivers/media/tuners/mxl301rf.h delete mode 100644 drivers/media/tuners/qm1d1c0042.c delete mode 100644 drivers/media/tuners/qm1d1c0042.h
drivers/media/dvb-frontends/tc90522.c deleted +0 -840
@@ -1,840 +0,0 @@ -/* -* Toshiba TC90522 Demodulator -* -* 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. -* 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 <linux/math64.h> -#include <linux/dvb/frontend.h> -#include "dvb_math.h" -#include "tc90522.h" - -#define TC90522_I2C_THRU_REG 0xfe - -#define TC90522_MODULE_IDX (addr) (((u8)(addr) & 0x02U) >> 1) - -struct tc90522_state { -struct tc90522_config cfg; -struct dvb_frontend fe; -struct i2c_client *i2c_client; -struct i2c_adapter tuner_i2c; - -bool lna; -}; - -struct reg_val { -u8 reg; -u8 val; -}; - -static int -reg_write (struct tc90522_state *state,const struct reg_val *regs,int num) -{ -int i, ret; -struct i2c_msg msg; - - ret =0 ; - msg.addr = state->i2c_client->addr; - msg.flags =0 ; - msg.len =2 ; -for (i =0 ; i < num; i++) { - msg.buf = (u8 *)®s[i]; - ret =i2c_transfer (state->i2c_client->adapter, &msg,1 ); -if (ret ==0 ) - ret = -EIO ; -if (ret <0 ) -return ret; - } -return 0 ; -} - -static int reg_read (struct tc90522_state *state,u8 reg,u8 *val,u8 len) -{ -struct i2c_msg msgs[2 ] = { - { - .addr = state->i2c_client->addr, - .flags =0 , - .buf = ®, - .len =1 , - }, - { - .addr = state->i2c_client->addr, - .flags =I2C_M_RD , - .buf = val, - .len = len, - }, - }; -int ret; - - ret =i2c_transfer (state->i2c_client->adapter, msgs,ARRAY_SIZE (msgs)); -if (ret ==ARRAY_SIZE (msgs)) - ret =0 ; -else if (ret >=0 ) - ret = -EIO ; -return ret; -} - -static struct tc90522_state *cfg_to_state (struct tc90522_config *c) -{ - return container_of(c, struct tc90522_state, cfg); -} - - -static int tc90522s_set_tsid (struct dvb_frontend *fe) -{ -struct reg_val set_tsid[] = { - {0x8f ,00 }, - {0x90 ,00 } - }; - - set_tsid[0 ].val = (fe->dtv_property_cache.stream_id &0xff00 ) >>8 ; - set_tsid[1 ].val = fe->dtv_property_cache.stream_id &0xff ; -return reg_write (fe->demodulator_priv, set_tsid,ARRAY_SIZE (set_tsid)); -} - -static int tc90522t_set_layers (struct dvb_frontend *fe) -{ -struct reg_val rv; -u8 laysel; - - laysel = ~fe->dtv_property_cache.isdbt_layer_enabled &0x07 ; - laysel = (laysel &0x01 ) <<2 | (laysel &0x02 ) | (laysel &0x04 ) >>2 ; - rv.reg =0x71 ; - rv.val = laysel; -return reg_write (fe->demodulator_priv, &rv,1 ); -} - -/* frontend ops */ - -static int tc90522s_read_status (struct dvb_frontend *fe,enum fe_status *status) -{ -struct tc90522_state *state; -int ret; -u8 reg; - - state = fe->demodulator_priv; - ret =reg_read (state,0xc3 , ®,1 ); -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 ; - *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,enum fe_status *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 ); -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 ; - -if (reg &0x02 ) -return 0 ; - *status |=FE_HAS_LOCK ; -return 0 ; -} - -static const enum fe_code_rate fec_conv_sat[] = { -FEC_NONE ,/* unused */ -FEC_1_2 ,/* for BPSK */ -FEC_1_2 ,FEC_2_3 ,FEC_3_4 ,FEC_5_6 ,FEC_7_8 ,/* for QPSK */ -FEC_2_3 ,/* for 8PSK. (trellis code) */ -}; - -static int tc90522s_get_frontend (struct dvb_frontend *fe, -struct dtv_frontend_properties *c) -{ -struct tc90522_state *state; -struct dtv_fe_stats *stats; -int ret, i; -int layers; -u8 val[10 ]; -u32 cndat; - - state = fe->demodulator_priv; - c->delivery_system =SYS_ISDBS ; - c->symbol_rate =28860000 ; - - layers =0 ; - ret =reg_read (state,0xe6 , val,5 ); -if (ret ==0 ) { -u8 v; - - c->stream_id = val[0 ] <<8 | val[1 ]; - -/* high/single layer */ - v = (val[2 ] &0x70 ) >>4 ; - c->modulation = (v ==7 ) ?PSK_8 :QPSK ; - c->fec_inner = fec_conv_sat[v]; - c->layer[0 ].fec = c->fec_inner; - c->layer[0 ].modulation = c->modulation; - c->layer[0 ].segment_count = val[3 ] &0x3f ;/* slots */ - -/* low layer */ - v = (val[2 ] &0x07 ); - c->layer[1 ].fec = fec_conv_sat[v]; -if (v ==0 )/* no low layer */ - c->layer[1 ].segment_count =0 ; -else - c->layer[1 ].segment_count = val[4 ] &0x3f ;/* slots */ -/* -* actually, BPSK if v==1, but not defined in -* enum fe_modulation -*/ - c->layer[1 ].modulation =QPSK ; - layers = (v >0 ) ?2 :1 ; - } - -/* statistics */ - - stats = &c->strength; - stats->len =0 ; -/* let the connected tuner set RSSI property cache */ -if (fe->ops.tuner_ops.get_rf_strength) { -u16 dummy; - - fe->ops.tuner_ops.get_rf_strength (fe, &dummy); - } - - stats = &c->cnr; - stats->len =1 ; - stats->stat[0 ].scale =FE_SCALE_NOT_AVAILABLE ; - cndat =0 ; - ret =reg_read (state,0xbc , val,2 ); -if (ret ==0 ) - cndat = val[0 ] <<8 | val[1 ]; -if (cndat >=3000 ) { -u32 p, p4; -s64 cn; - - cndat -=3000 ;/* cndat: 4.12 fixed point float */ -/* -* cnr[mdB] = -1634.6 * P^5 + 14341 * P^4 - 50259 * P^3 -* + 88977 * P^2 - 89565 * P + 58857 -* (P = sqrt(cndat) / 64) -*/ -/* p := sqrt(cndat) << 8 = P << 14, 2.14 fixed point float */ -/* cn = cnr << 3 */ - p =int_sqrt (cndat <<16 ); - p4 = cndat * cndat; - cn =div64_s64 (-16346LL * p4 * p,10 ) >>35 ; - cn += (14341LL * p4) >>21 ; - cn -= (50259LL * cndat * p) >>23 ; - cn += (88977LL * cndat) >>9 ; - cn -= (89565LL * p) >>11 ; - cn +=58857 <<3 ; - stats->stat[0 ].svalue = cn >>3 ; - stats->stat[0 ].scale =FE_SCALE_DECIBEL ; - } - -/* per-layer post viterbi BER (or PER? config dependent?) */ - stats = &c->post_bit_error; -memset (stats,0 ,sizeof (*stats)); - stats->len = layers; - ret =reg_read (state,0xeb , val,10 ); -if (ret <0 ) -for (i =0 ; i < layers; i++) - stats->stat[i].scale =FE_SCALE_NOT_AVAILABLE ; -else { -for (i =0 ; i < layers; i++) { - stats->stat[i].scale =FE_SCALE_COUNTER ; - stats->stat[i].uvalue = val[i *5 ] <<16 - | val[i *5 +1 ] <<8 | val[i *5 +2 ]; - } - } - stats = &c->post_bit_count; -memset (stats,0 ,sizeof (*stats)); - stats->len = layers; -if (ret <0 ) -for (i =0 ; i < layers; i++) - stats->stat[i].scale =FE_SCALE_NOT_AVAILABLE ; -else { -for (i =0 ; i < layers; i++) { - stats->stat[i].scale =FE_SCALE_COUNTER ; - stats->stat[i].uvalue = - val[i *5 +3 ] <<8 | val[i *5 +4 ]; - stats->stat[i].uvalue *=204 *8 ; - } - } - -return 0 ; -} - - -static const enum fe_transmit_mode tm_conv[] = { -TRANSMISSION_MODE_2K , -TRANSMISSION_MODE_4K , -TRANSMISSION_MODE_8K , -0 -}; - -static const enum fe_code_rate fec_conv_ter[] = { -FEC_1_2 ,FEC_2_3 ,FEC_3_4 ,FEC_5_6 ,FEC_7_8 ,0 ,0 ,0 -}; - -static const enum fe_modulation mod_conv[] = { -DQPSK ,QPSK ,QAM_16 ,QAM_64 ,0 ,0 ,0 ,0 -}; - -static int tc90522t_get_frontend (struct dvb_frontend *fe, -struct dtv_frontend_properties *c) -{ -struct tc90522_state *state; -struct dtv_fe_stats *stats; -int ret, i; -int layers; -u8 val[15 ], mode; -u32 cndat; - - state = fe->demodulator_priv; - c->delivery_system =SYS_ISDBT ; - c->bandwidth_hz =6000000 ; - mode =1 ; - ret =reg_read (state,0xb0 , val,1 ); -if (ret ==0 ) { - mode = (val[0 ] &0xc0 ) >>2 ; - c->transmission_mode = tm_conv[mode]; - c->guard_interval = (val[0 ] &0x30 ) >>4 ; - } - - ret =reg_read (state,0xb2 , val,6 ); - layers =0 ; -if (ret ==0 ) { -u8 v; - - c->isdbt_partial_reception = val[0 ] &0x01 ; - c->isdbt_sb_mode = (val[0 ] &0xc0 ) ==0x40 ; - -/* layer A */ - v = (val[2 ] &0x78 ) >>3 ; -if (v ==0x0f ) - c->layer[0 ].segment_count =0 ; -else { - layers++; - c->layer[0 ].segment_count = v; - c->layer[0 ].fec = fec_conv_ter[(val[1 ] &0x1c ) >>2 ]; - c->layer[0 ].modulation = mod_conv[(val[1 ] &0xe0 ) >>5 ]; - v = (val[1 ] &0x03 ) <<1 | (val[2 ] &0x80 ) >>7 ; - c->layer[0 ].interleaving = v; - } - -/* layer B */ - v = (val[3 ] &0x03 ) <<1 | (val[4 ] &0xc0 ) >>6 ; -if (v ==0x0f ) - c->layer[1 ].segment_count =0 ; -else { - layers++; - c->layer[1 ].segment_count = v; - c->layer[1 ].fec = fec_conv_ter[(val[3 ] &0xe0 ) >>5 ]; - c->layer[1 ].modulation = mod_conv[(val[2 ] &0x07 )]; - c->layer[1 ].interleaving = (val[3 ] &0x1c ) >>2 ; - } - -/* layer C */ - v = (val[5 ] &0x1e ) >>1 ; -if (v ==0x0f ) - c->layer[2 ].segment_count =0 ; -else { - layers++; - c->layer[2 ].segment_count = v; - c->layer[2 ].fec = fec_conv_ter[(val[4 ] &0x07 )]; - c->layer[2 ].modulation = mod_conv[(val[4 ] &0x38 ) >>3 ]; - c->layer[2 ].interleaving = (val[5 ] &0xe0 ) >>5 ; - } - } - -/* statistics */ - - stats = &c->strength; - stats->len =0 ; -/* let the connected tuner set RSSI property cache */ -if (fe->ops.tuner_ops.get_rf_strength) { -u16 dummy; - - fe->ops.tuner_ops.get_rf_strength (fe, &dummy); - } - - stats = &c->cnr; - stats->len =1 ; - stats->stat[0 ].scale =FE_SCALE_NOT_AVAILABLE ; - cndat =0 ; - ret =reg_read (state,0x8b , val,3 ); -if (ret ==0 ) - cndat = val[0 ] <<16 | val[1 ] <<8 | val[2 ]; -if (cndat !=0 ) { -u32 p, tmp; -s64 cn; - -/* -* cnr[mdB] = 0.024 P^4 - 1.6 P^3 + 39.8 P^2 + 549.1 P + 3096.5 -* (P = 10log10(5505024/cndat)) -*/ -/* cn = cnr << 3 (61.3 fixed point float */ -/* p = 10log10(5505024/cndat) << 24 (8.24 fixed point float)*/ - p =intlog10 (5505024 ) -intlog10 (cndat); - p *=10 ; - - cn =24772 ; - cn +=div64_s64 (43827LL * p,10 ) >>24 ; - tmp = p >>8 ; - cn +=div64_s64 (3184LL * tmp * tmp,10 ) >>32 ; - tmp = p >>13 ; - cn -=div64_s64 (128LL * tmp * tmp * tmp,10 ) >>33 ; - tmp = p >>18 ; - cn +=div64_s64 (192LL * tmp * tmp * tmp * tmp,1000 ) >>24 ; - - stats->stat[0 ].svalue = cn >>3 ; - stats->stat[0 ].scale =FE_SCALE_DECIBEL ; - } - -/* per-layer post viterbi BER (or PER? config dependent?) */ - stats = &c->post_bit_error; -memset (stats,0 ,sizeof (*stats)); - stats->len = layers; - ret =reg_read (state,0x9d , val,15 ); -if (ret <0 ) -for (i =0 ; i < layers; i++) - stats->stat[i].scale =FE_SCALE_NOT_AVAILABLE ; -else { -for (i =0 ; i < layers; i++) { - stats->stat[i].scale =FE_SCALE_COUNTER ; - stats->stat[i].uvalue = val[i *3 ] <<16 - | val[i *3 +1 ] <<8 | val[i *3 +2 ]; - } - } - stats = &c->post_bit_count; -memset (stats,0 ,sizeof (*stats)); - stats->len = layers; -if (ret <0 ) -for (i =0 ; i < layers; i++) - stats->stat[i].scale =FE_SCALE_NOT_AVAILABLE ; -else { -for (i =0 ; i < layers; i++) { - stats->stat[i].scale =FE_SCALE_COUNTER ; - stats->stat[i].uvalue = - val[9 + i *2 ] <<8 | val[9 + i *2 +1 ]; - stats->stat[i].uvalue *=204 *8 ; - } - } - -return 0 ; -} - -static const struct reg_val reset_sat = {0x03 ,0x01 }; -static const struct reg_val reset_ter = {0x01 ,0x40 }; - -static int tc90522_set_frontend (struct dvb_frontend *fe) -{ -struct tc90522_state *state; -int ret; - - state = fe->demodulator_priv; - -if (fe->ops.tuner_ops.set_params) - ret = fe->ops.tuner_ops.set_params (fe); -else - ret = -ENODEV ; -if (ret <0 ) - goto failed; - -if (fe->ops.delsys[0 ] ==SYS_ISDBS ) { - ret =tc90522s_set_tsid (fe); -if (ret <0 ) - goto failed; - ret =reg_write (state, &reset_sat,1 ); - }else { - ret =tc90522t_set_layers (fe); -if (ret <0 ) - goto failed; - ret =reg_write (state, &reset_ter,1 ); - } -if (ret <0 ) - goto failed; - -return 0 ; - -failed: -dev_warn (&state->tuner_i2c.dev,"(%s) failed. [adap%d-fe%d]\n" , - __func__, fe->dvb->num, fe->id); -return ret; -} - -static int tc90522_get_tune_settings (struct dvb_frontend *fe, -struct dvb_frontend_tune_settings *settings) -{ -if (fe->ops.delsys[0 ] ==SYS_ISDBS ) { - settings->min_delay_ms =250 ; - settings->step_size =1000 ; - settings->max_drift = settings->step_size *2 ; - }else { - settings->min_delay_ms =400 ; - settings->step_size =142857 ; - settings->max_drift = settings->step_size; - } -return 0 ; -} - -static int tc90522_set_if_agc (struct dvb_frontend *fe,bool on) -{ -struct reg_val agc_sat[] = { - {0x0a ,0x00 }, - {0x10 ,0x30 }, - {0x11 ,0x00 }, - {0x03 ,0x01 }, - }; -struct reg_val agc_ter[] = { - {0x25 ,0x00 }, - {0x23 ,0x4c }, - {0x01 ,0x40 }, - }; -struct tc90522_state *state; -struct reg_val *rv; -int num; - - state = fe->demodulator_priv; -if (fe->ops.delsys[0 ] ==SYS_ISDBS ) { - agc_sat[0 ].val = on ?0xff :0x00 ; - agc_sat[1 ].val |=0x80 ; - agc_sat[1 ].val |= on ?0x01 :0x00 ; - agc_sat[2 ].val |= on ?0x40 :0x00 ; - rv = agc_sat; - num =ARRAY_SIZE (agc_sat); - }else { - agc_ter[0 ].val = on ?0x40 :0x00 ; - agc_ter[1 ].val |= on ?0x00 :0x01 ; - rv = agc_ter; - num =ARRAY_SIZE (agc_ter); - } -return reg_write (state, rv, num); -} - -static const struct reg_val sleep_sat = {0x17 ,0x01 }; -static const struct reg_val sleep_ter = {0x03 ,0x90 }; - -static int tc90522_sleep (struct dvb_frontend *fe) -{ -struct tc90522_state *state; -int ret; - - state = fe->demodulator_priv; -if (fe->ops.delsys[0 ] ==SYS_ISDBS ) - ret =reg_write (state, &sleep_sat,1 ); -else { - ret =reg_write (state, &sleep_ter,1 ); -if (ret ==0 && fe->ops.set_lna && - fe->dtv_property_cache.lna ==LNA_AUTO ) { - fe->dtv_property_cache.lna =0 ; - ret = fe->ops.set_lna (fe); - fe->dtv_property_cache.lna =LNA_AUTO ; - } - } -if (ret <0 ) -dev_warn (&state->tuner_i2c.dev, -"(%s) failed. [adap%d-fe%d]\n" , - __func__, fe->dvb->num, fe->id); -return ret; -} - -static const struct reg_val wakeup_sat = {0x17 ,0x00 }; -static const struct reg_val wakeup_ter = {0x03 ,0x80 }; - -static int tc90522_init (struct dvb_frontend *fe) -{ -struct tc90522_state *state; -int ret; - -/* -* Because the init sequence is not public, -* the parent device/driver should have init'ed the device before. -* just wake up the device here. -*/ - - state = fe->demodulator_priv; -if (fe->ops.delsys[0 ] ==SYS_ISDBS ) - ret =reg_write (state, &wakeup_sat,1 ); -else { - ret =reg_write (state, &wakeup_ter,1 ); -if (ret ==0 && fe->ops.set_lna && - fe->dtv_property_cache.lna ==LNA_AUTO ) { - fe->dtv_property_cache.lna =1 ; - ret = fe->ops.set_lna (fe); - fe->dtv_property_cache.lna =LNA_AUTO ; - } - } -if (ret <0 ) { -dev_warn (&state->tuner_i2c.dev, -"(%s) failed. [adap%d-fe%d]\n" , - __func__, fe->dvb->num, fe->id); -return ret; - } - -/* prefer 'all-layers' to 'none' as a default */ -if (fe->dtv_property_cache.isdbt_layer_enabled ==0 ) - fe->dtv_property_cache.isdbt_layer_enabled =7 ; -return tc90522_set_if_agc (fe, true); -} - - -/* -* tuner I2C adapter functions -*/ - -static int -tc90522_master_xfer (struct i2c_adapter *adap,struct i2c_msg *msgs,int num) -{ -struct tc90522_state *state; -struct i2c_msg *new_msgs; -int i, j; -int ret, rd_num; -u8 wbuf[256 ]; -u8 *p, *bufend; - -if (num <=0 ) -return -EINVAL ; - - rd_num =0 ; -for (i =0 ; i < num; i++) -if (msgs[i].flags &I2C_M_RD ) - rd_num++; - new_msgs =kmalloc (sizeof (*new_msgs) * (num + rd_num),GFP_KERNEL ); -if (!new_msgs) -return -ENOMEM ; - - state =i2c_get_adapdata (adap); - p = wbuf; - bufend = wbuf +sizeof (wbuf); -for (i =0 , j =0 ; i < num; i++, j++) { - new_msgs[j].addr = state->i2c_client->addr; - new_msgs[j].flags = msgs[i].flags; - -if (msgs[i].flags &I2C_M_RD ) { - new_msgs[j].flags &= ~I2C_M_RD ; -if (p +2 > bufend) -break ; - p[0 ] =TC90522_I2C_THRU_REG ; - p[1 ] = msgs[i].addr <<1 |0x01 ; - new_msgs[j].buf = p; - new_msgs[j].len =2 ; - p +=2 ; - j++; - new_msgs[j].addr = state->i2c_client->addr; - new_msgs[j].flags = msgs[i].flags; - new_msgs[j].buf = msgs[i].buf; - new_msgs[j].len = msgs[i].len; -continue ; - } - -if (p + msgs[i].len +2 > bufend) -break ; - p[0 ] =TC90522_I2C_THRU_REG ; - p[1 ] = msgs[i].addr <<1 ; -memcpy (p +2 , msgs[i].buf, msgs[i].len); - new_msgs[j].buf = p; - new_msgs[j].len = msgs[i].len +2 ; - p += new_msgs[j].len; - } - -if (i < num) - ret = -ENOMEM ; -else - ret =i2c_transfer (state->i2c_client->adapter, new_msgs, j); -if (ret >=0 && ret < j) - ret = -EIO ; -kfree (new_msgs); -return (ret == j) ? num : ret; -} - -static u32 tc90522_functionality (struct i2c_adapter *adap) -{ -return I2C_FUNC_I2C ; -} - -static const struct i2c_algorithm tc90522_tuner_i2c_algo = { - .master_xfer = &tc90522_master_xfer, - .functionality = &tc90522_functionality, -}; - - -/* -* I2C driver functions -*/ - -static const struct dvb_frontend_ops tc90522_ops_sat = { - .delsys = {SYS_ISDBS }, - .info = { - .name ="Toshiba TC90522 ISDB-S module" , - .frequency_min =950000 , - .frequency_max =2150000 , - .caps =FE_CAN_INVERSION_AUTO |FE_CAN_FEC_AUTO | -FE_CAN_QAM_AUTO |FE_CAN_TRANSMISSION_MODE_AUTO | -FE_CAN_GUARD_INTERVAL_AUTO |FE_CAN_HIERARCHY_AUTO , - }, - - .init = tc90522_init, - .sleep = tc90522_sleep, - .set_frontend = tc90522_set_frontend, - .get_tune_settings = tc90522_get_tune_settings, - - .get_frontend = tc90522s_get_frontend, - .read_status = tc90522s_read_status, -}; - -static const struct dvb_frontend_ops tc90522_ops_ter = { - .delsys = {SYS_ISDBT }, - .info = { - .name ="Toshiba TC90522 ISDB-T module" , - .frequency_min =470000000 , - .frequency_max =770000000 , - .frequency_stepsize =142857 , - .caps =FE_CAN_INVERSION_AUTO | -FE_CAN_FEC_1_2 |FE_CAN_FEC_2_3 |FE_CAN_FEC_3_4 | -FE_CAN_FEC_5_6 |FE_CAN_FEC_7_8 |FE_CAN_FEC_AUTO | -FE_CAN_QPSK |FE_CAN_QAM_16 |FE_CAN_QAM_64 | -FE_CAN_QAM_AUTO |FE_CAN_TRANSMISSION_MODE_AUTO | -FE_CAN_GUARD_INTERVAL_AUTO |FE_CAN_RECOVER | -FE_CAN_HIERARCHY_AUTO , - }, - - .init = tc90522_init, - .sleep = tc90522_sleep, - .set_frontend = tc90522_set_frontend, - .get_tune_settings = tc90522_get_tune_settings, - - .get_frontend = tc90522t_get_frontend, - .read_status = tc90522t_read_status, -}; - - -static int tc90522_probe (struct i2c_client *client, -const struct i2c_device_id *id) -{ -struct tc90522_state *state; -struct tc90522_config *cfg; -const struct dvb_frontend_ops *ops; -struct i2c_adapter *adap; -int ret; - - state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return -ENOMEM ; - state->i2c_client = client; - - cfg = client->dev.platform_data; -memcpy (&state->cfg, cfg,sizeof (state->cfg)); - cfg->fe = state->cfg.fe = &state->fe; - ops = id->driver_data ==0 ? &tc90522_ops_sat : &tc90522_ops_ter; -memcpy (&state->fe.ops, ops,sizeof (*ops)); - state->fe.demodulator_priv = state; - - adap = &state->tuner_i2c; - adap->owner =THIS_MODULE ; - adap->algo = &tc90522_tuner_i2c_algo; - adap->dev.parent = &client->dev; -strlcpy (adap->name,"tc90522_sub" ,sizeof (adap->name)); -i2c_set_adapdata (adap, state); - ret =i2c_add_adapter (adap); -if (ret <0 ) - goto err; - cfg->tuner_i2c = state->cfg.tuner_i2c = adap; - -i2c_set_clientdata (client, &state->cfg); -dev_info (&client->dev,"Toshiba TC90522 attached.\n" ); -return 0 ; - -err: -kfree (state); -return ret; -} - -static int tc90522_remove (struct i2c_client *client) -{ -struct tc90522_state *state; - - state =cfg_to_state (i2c_get_clientdata (client)); -i2c_del_adapter (&state->tuner_i2c); -kfree (state); -return 0 ; -} - - -static const struct i2c_device_id tc90522_id[] = { - {TC90522_I2C_DEV_SAT ,0 }, - {TC90522_I2C_DEV_TER ,1 }, - {} -}; -MODULE_DEVICE_TABLE (i2c, tc90522_id); - -static struct i2c_driver tc90522_driver = { - .driver = { - .name ="tc90522" , - }, - .probe = tc90522_probe, - .remove = tc90522_remove, - .id_table = tc90522_id, -}; - -module_i2c_driver (tc90522_driver); - -MODULE_DESCRIPTION ("Toshiba TC90522 frontend" ); -MODULE_AUTHOR ("Akihiro TSUKADA" ); -MODULE_LICENSE ("GPL" );
drivers/media/dvb-frontends/tc90522.h deleted +0 -42
42 lines not on this page · raw message
drivers/media/pci/pt3/Kconfig deleted +0 -10
@@ -1,10 +0,0 @@ -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 deleted +0 -8
@@ -1,8 +0,0 @@ - -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 deleted +0 -874
874 lines not on this page · raw message
drivers/media/pci/pt3/pt3.h deleted +0 -186
186 lines not on this page · raw message
drivers/media/pci/pt3/pt3_dma.c deleted +0 -225
225 lines not on this page · raw message
drivers/media/pci/pt3/pt3_i2c.c deleted +0 -240
240 lines not on this page · raw message
drivers/media/tuners/mxl301rf.c deleted +0 -349
349 lines not on this page · raw message
drivers/media/tuners/mxl301rf.h deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* 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 */
drivers/media/tuners/qm1d1c0042.c deleted +0 -448
200 lines not on this page · raw message
drivers/media/tuners/qm1d1c0042.h deleted +0 -37
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
PATCH 4/8 Toshiba TC905xx demodulator for PT3/PX-Q3PE/PX-BCUD
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
Toshiba TC905xx demodulator driver for PT3, PX-Q3PE & PX-BCUD
--- drivers/media/dvb-frontends/tc90522.c | 255 ++++++++++++++++++++++++++++++++++ drivers/media/dvb-frontends/tc90522.h | 18 +++ 2 files changed, 273 insertions(+) create mode 100644 drivers/media/dvb-frontends/tc90522.c create mode 100644 drivers/media/dvb-frontends/tc90522.h
drivers/media/dvb-frontends/tc90522.c new file +255 -0
@@ -0,0 +1,255 @@ +/* +Toshiba TC90522XBG 2ch OFDM(ISDB-T) + 2ch 8PSK(ISDB-S) demodulator + +Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> + +CHIP CARDS +TC90522XBG Earthsoft PT3, PLEX PX-Q3PE +TC90532 PLEX PX-BCUD + +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. +*/ + +#include <linux/pci.h> +#include "dvb_math.h" +#include "dvb_frontend.h" +#include "tc90522.h" + +bool tc90522_r (struct i2c_client *d,u8 slvadr,u8 *buf,u8 len) +{ +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = &slvadr, .len =1 ,}, + {.addr = d->addr, .flags =I2C_M_RD , .buf = buf, .len = len,}, + }; +return i2c_transfer (d->adapter, msg,2 ) ==2 ; +} + +bool tc90522_w (struct i2c_client *d,u8 slvadr,u8 dat) +{ +u8 buf[] = {slvadr, dat}; +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = buf, .len =2 ,}, + }; +return i2c_transfer (d->adapter, msg,1 ) ==1 ; +} + +u64 tc90522_n2int (const u8 *data,u8 n)/* convert n_bytes data from stream (network byte order) to integer */ +{/* can't use <arpa/inet.h>'s ntoh*() as sometimes n = 3,5,... */ +u32 i, val =0 ; + +for (i =0 ; i < n; i++) { + val <<=8 ; + val |= data[i]; + } +return val; +} + +int tc90522_cn_raw (struct dvb_frontend *fe,u16 *raw)/* for DVBv3 compatibility */ +{ +u8 buf[3 ], + len = fe->dtv_property_cache.delivery_system ==SYS_ISDBS ?2 :3 , + adr = fe->dtv_property_cache.delivery_system ==SYS_ISDBS ?0xbc :0x8b ; +bool ok =tc90522_r (fe->demodulator_priv, adr, buf, len); +int cn =tc90522_n2int (buf, len); + +if (!ok) +return -EIO ; + *raw = cn; +return cn; +} + +int tc90522_status (struct dvb_frontend *fe,enum fe_status *stat) +{ +enum fe_status *festat =i2c_get_clientdata (fe->demodulator_priv); +struct dtv_frontend_properties *c = &fe->dtv_property_cache; +u16 v16; +s64 raw =tc90522_cn_raw (fe, &v16), + x, + y; + +s64 cn_s (void )/* @ .0001 dB */ + { + raw -=3000 ; +if (raw <0 ) + raw =0 ; + x =int_sqrt (raw <<20 ); + y =16346ll * x - (143410ll <<16 ); + y = ((x * y) >>16 ) + (502590ll <<16 ); + y = ((x * y) >>16 ) - (889770ll <<16 ); + y = ((x * y) >>16 ) + (895650ll <<16 ); + y = (588570ll <<16 ) - ((x * y) >>16 ); +return y <0 ?0 : y >>16 ; + } + +s64 cn_t (void )/* @ .0001 dB */ + { +if (!raw) +return 0 ; + x = (1130911733ll -10ll *intlog10 (raw)) >>2 ; + y = (x >>2 ) - (x >>6 ) + (x >>8 ) + (x >>9 ) - (x >>10 ) + (x >>11 ) + (x >>12 ) - (16ll <<22 ); + y = ((x * y) >>22 ) + (398ll <<22 ); + y = ((x * y) >>22 ) + (5491ll <<22 ); + y = ((x * y) >>22 ) + (30965ll <<22 ); +return y >>22 ; + } + + c->cnr.len =1 ; + c->cnr.stat[0 ].svalue = fe->dtv_property_cache.delivery_system ==SYS_ISDBS ?cn_s () :cn_t (); + c->cnr.stat[0 ].scale =FE_SCALE_DECIBEL ; + *stat = *festat; +return *festat; +} + +int tc90522_get_frontend_algo (struct dvb_frontend *fe) +{ +return DVBFE_ALGO_HW ; +} + +int tc90522_tune (struct dvb_frontend *fe,bool retune,u32 mode_flags,u32 *delay,enum fe_status *stat) +{ +u32 fno2kHz (u32 fno) + { +if (fno <12 ) +return 1049480 +38360 * fno;/* BS */ +else if (fno <24 ) +return 1613000 +40000 * (fno -12 );/* CS110 right */ +return 1593000 +40000 * (fno -24 );/* CS110 left */ + } + +void s_kHz (u32 *f) + { + *f = *f >3000000 ?fno2kHz (14 ) :/* max kHz, CNN */ + *f >=1049480 ? *f :/* min real kHz */ + *f >48 ?fno2kHz (4 ) :/* BS11 etc. */ +fno2kHz (*f -1 ); + } + +u32 fno2Hz (u32 fno) + { +return (fno >112 ?557 :93 +6 * fno + (fno <12 ?0 : fno <17 ?2 : fno <63 ?0 :2 )) *1000000 +142857 ; + } + +void t_Hz (u32 *f) + { + *f = *f >=90000000 ? *f :/* real_freq Hz */ + *f >255 ?fno2Hz (77 ) :/* NHK */ + *f >127 ?fno2Hz (*f -128 ) :/* freqno (IO#) */ + *f >63 ? (*f -=64 ,/* CATV */ + *f >22 ?fno2Hz (*f -1 ) :/* C23-C62 */ + *f >12 ?fno2Hz (*f -10 ) :/* C13-C22 */ +fno2Hz (77 )) : + *f >62 ?fno2Hz (77 ) : + *f >12 ?fno2Hz (*f +50 ) :/* 13-62 */ + *f >3 ?fno2Hz (*f +9 ) :/* 4-12 */ + *f ?fno2Hz (*f -1 ) :/* 1-3 */ +fno2Hz (77 ); + } +struct i2c_client *d = fe->demodulator_priv; +enum fe_status *festat =i2c_get_clientdata (d); +u16 set_id = fe->dtv_property_cache.stream_id, + i =999 ; +u8 data[16 ]; + +if (!retune)/* once is enough */ +return 0 ; + *festat =0 ; +if (fe->dtv_property_cache.delivery_system ==SYS_ISDBT ) + goto ISDBT; + +s_kHz (&fe->dtv_property_cache.frequency); +if (fe->ops.tuner_ops.set_params (fe)) +return -EIO ; +while (i--) { +if ((tc90522_r (d,0xC3 , data,1 ), !(data[0 ] &0x10 )) &&/* locked */ + (tc90522_r (d,0xCE , data,2 ), *(u16 *)data !=0 ) &&/* valid TSID */ +tc90522_r (d,0xC3 , data,1 ) && +tc90522_r (d,0xCE , data,16 )) +break ; +msleep_interruptible (5 ); + } +if (!i) + goto ERR; +for (i =0 ; i <8 ; i++) { +u16 tsid =tc90522_n2int (data + i*2 ,2 ); + +if ((tsid == set_id || set_id == i) && +tc90522_w (d,0x8F , tsid >>8 ) && +tc90522_w (d,0x90 , tsid &0xFF ) && +tc90522_r (d,0xE6 , data,2 ) && +tc90522_n2int (data,2 ) == tsid) + goto LOCK; + } + goto ERR; +ISDBT: +t_Hz (&fe->dtv_property_cache.frequency); +if (fe->ops.tuner_ops.set_params (fe)) +return -EIO ; +while (i--) { +bool retryov, + lock0, + lock1; +if (!tc90522_r (d,0x80 , data,1 ) || !tc90522_r (d,0xB0 , data +1 ,1 )) +break ; + retryov = data[0 ] &0b10000000 ? true : false; + lock0 = data[0 ] &0b00001000 ? false : true; + lock1 = data[1 ] &0b00001000 ? true : false; +if (lock0 && lock1) { +LOCK: + *festat =FE_HAS_SIGNAL |FE_HAS_CARRIER |FE_HAS_LOCK ; + *stat = *festat; +return 0 ; + } +if (retryov) +break ; +msleep_interruptible (1 ); + } +ERR: + *stat = *festat; +return -ETIMEDOUT ; +} + +static struct dvb_frontend_ops tc90522_ops = { + .info = { + .name =TC90522_MODNAME , + .caps =FE_CAN_INVERSION_AUTO |FE_CAN_FEC_AUTO |FE_CAN_QAM_AUTO |FE_CAN_MULTISTREAM | +FE_CAN_TRANSMISSION_MODE_AUTO |FE_CAN_GUARD_INTERVAL_AUTO |FE_CAN_HIERARCHY_AUTO , + .frequency_min =1 ,/* actual limit settings are set by .tune */ + .frequency_max =770000000 , + }, + .get_frontend_algo = tc90522_get_frontend_algo, + .read_snr = tc90522_cn_raw, + .read_status = tc90522_status, + .tune = tc90522_tune, +}; + +int tc90522_probe (struct i2c_client *d,const struct i2c_device_id *id) +{ +struct dvb_frontend *fe = d->dev.platform_data; +static enum fe_status festat; + +memcpy (&fe->ops, &tc90522_ops,sizeof (struct dvb_frontend_ops )); + festat =0 ; +i2c_set_clientdata (d, &festat); +return 0 ; +} + +static struct i2c_device_id tc90522_id[] = { + {TC90522_MODNAME ,0 }, + {}, +}; +MODULE_DEVICE_TABLE (i2c, tc90522_id); + +static struct i2c_driver tc90522_driver = { + .driver.name = tc90522_id->name, + .probe = tc90522_probe, + .id_table = tc90522_id, +}; +module_i2c_driver (tc90522_driver); + +MODULE_AUTHOR ("Budi Rachmanto, AreMa Inc. <knightrider(@)are.ma>" ); +MODULE_DESCRIPTION ("Toshiba TC90522 8PSK(ISDB-S)/OFDM(ISDB-T) quad demodulator" ); +MODULE_LICENSE ("GPL" ); +
drivers/media/dvb-frontends/tc90522.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Toshiba TC90522XBG 2ch OFDM(ISDB-T) + 2ch 8PSK(ISDB-S) demodulator +* +* Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> +* +* 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 TC90522_H +#define TC90522_H + +#define TC90522_MODNAME "tc90522" + +#endif +
Signature · 1 line
2.7.4
PATCH 5/8 MaxLinear MxL301RF ISDB-T tuner
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
--- drivers/media/tuners/mxl301rf.c | 220 ++++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/mxl301rf.h | 23 +++++ 2 files changed, 243 insertions(+) create mode 100644 drivers/media/tuners/mxl301rf.c create mode 100644 drivers/media/tuners/mxl301rf.h
drivers/media/tuners/mxl301rf.c new file +220 -0
@@ -0,0 +1,220 @@ +/* +Sharp VA4M6JC2103 - Earthsoft PT3 ISDB-T tuner MaxLinear CMOS Hybrid TV MxL301RF + +Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> + +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. +*/ + +#include "dvb_frontend.h" +#include "mxl301rf.h" + +int mxl301rf_w (struct dvb_frontend *fe,u8 slvadr,const u8 *dat,int len) +{ +struct i2c_client *d = fe->demodulator_priv; +u8 buf[len +1 ]; +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = buf, .len = len +1 ,}, + }; + + buf[0 ] = slvadr; +memcpy (buf +1 , dat, len); +return i2c_transfer (d->adapter, msg,1 ) ==1 ?0 : -EIO ; +} + +int mxl301rf_w_tuner (struct dvb_frontend *fe,const u8 *dat,int len) +{ +u8 buf[len +1 ]; + + buf[0 ] = ((struct i2c_client *)fe->tuner_priv)->addr <<1 ; +memcpy (buf +1 , dat, len); +return mxl301rf_w (fe,0xFE , buf, len +1 ); +} + +u8 mxl301rf_r (struct dvb_frontend *fe,u8 regadr) +{ +struct i2c_client *d = fe->demodulator_priv, + *t = fe->tuner_priv; +u8 wbuf[] = {0xFB , regadr}, + rbuf[] = {0xFE , (t->addr <<1 ) |1 ,0 }; +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = rbuf, .len =2 ,}, + {.addr = d->addr, .flags =I2C_M_RD , .buf = rbuf +2 , .len =1 ,}, + }; +mxl301rf_w_tuner (fe, wbuf,sizeof (wbuf)); +return t->addr && (i2c_transfer (d->adapter, msg,2 ) ==2 ) ? rbuf[2 ] :0 ; +} + +enum mxl301rf_agc { +MXL301RF_AGC_AUTO , +MXL301RF_AGC_MANUAL , +}; + +int mxl301rf_set_agc (struct dvb_frontend *fe,enum mxl301rf_agc agc) +{ +u8 dat = agc ==MXL301RF_AGC_AUTO ?0x40 :0x00 , + imsrst =0x01 <<6 ; +int err =mxl301rf_w (fe,0x25 , &dat,1 ); + + dat =0x4c | (agc ==MXL301RF_AGC_AUTO ?0 :1 ); +return err || +mxl301rf_w (fe,0x23 , &dat,1 ) || +mxl301rf_w (fe,0x01 , &imsrst,1 ); +} + +int mxl301rf_sleep (struct dvb_frontend *fe) +{ +u8 buf = (1 <<7 ) | (1 <<4 ), + dat[] = {0x01 ,0x00 ,0x13 ,0x00 }; +int err =mxl301rf_set_agc (fe,MXL301RF_AGC_MANUAL ); + +if (err) +return err; +mxl301rf_w_tuner (fe, dat,sizeof (dat)); +return mxl301rf_w (fe,0x03 , &buf,1 ); +} + +int mxl301rf_tune (struct dvb_frontend *fe) +{ +struct shf_dvbt { +u32 freq,/* Channel center frequency @ kHz */ + freq_th;/* Offset frequency threshold @ kHz */ +u8 shf_val,/* Spur shift value */ + shf_dir;/* Spur shift direction */ + } shf_dvbt_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 } + }; +u8 rf_dat[] = { +0x13 ,0x00 ,/* abort tune */ +0x3b ,0xc0 , +0x3b ,0x80 , +0x10 ,0x95 ,/* BW */ +0x1a ,0x05 , +0x61 ,0x00 , +0x62 ,0xa0 , +0x11 ,0x40 ,/* 2 bytes to store RF */ +0x12 ,0x0e ,/* 2 bytes to store RF */ +0x13 ,0x01 /* start tune */ + }; +const u8 idac[] = { +0x0d ,0x00 , +0x0c ,0x67 , +0x6f ,0x89 , +0x70 ,0x0c , +0x6f ,0x8a , +0x70 ,0x0e , +0x6f ,0x8b , +0x70 ,0x10 +12 , + }; +u8 dat[20 ]; +int err =mxl301rf_set_agc (fe,MXL301RF_AGC_MANUAL ); +u32 freq = fe->dtv_property_cache.frequency, + kHz =1000 , + MHz =1000000 , + dig_rf = freq / MHz, + tmp = freq % MHz, + i, + fdiv =1000000 ; +unsigned long timeout; + +if (err) +return err; +for (i =0 ; i <6 ; i++) { + dig_rf <<=1 ; + fdiv /=2 ; +if (tmp > fdiv) { + tmp -= fdiv; + dig_rf++; + } + } +if (tmp >7812 ) + dig_rf++; + rf_dat[2 *7 +1 ] = (u8)(dig_rf); + rf_dat[2 *8 +1 ] = (u8)(dig_rf >>8 ); +for (i =0 ; i <ARRAY_SIZE (shf_dvbt_tab); i++) { +if ((freq >= (shf_dvbt_tab[i].freq - shf_dvbt_tab[i].freq_th) * kHz) && + (freq <= (shf_dvbt_tab[i].freq + shf_dvbt_tab[i].freq_th) * kHz)) { + rf_dat[2 *5 +1 ] = shf_dvbt_tab[i].shf_val; + rf_dat[2 *6 +1 ] =0xa0 | shf_dvbt_tab[i].shf_dir; +break ; + } + } +memcpy (dat, rf_dat,sizeof (rf_dat)); + +mxl301rf_w_tuner (fe, dat,14 ); +msleep_interruptible (1 ); +mxl301rf_w_tuner (fe, dat +14 ,6 ); +msleep_interruptible (1 ); + dat[0 ] =0x1a ; + dat[1 ] =0x0d ; +mxl301rf_w_tuner (fe, dat,2 ); +mxl301rf_w_tuner (fe, idac,sizeof (idac)); + timeout = jiffies +msecs_to_jiffies (100 ); +while (time_before (jiffies, timeout)) { +if ((mxl301rf_r (fe,0x16 ) &0x0c ) ==0x0c && (mxl301rf_r (fe,0x16 ) &0x03 ) ==0x03 ) +return mxl301rf_set_agc (fe,MXL301RF_AGC_AUTO ); +msleep_interruptible (1 ); + } +return -ETIMEDOUT ; +} + +int mxl301rf_wakeup (struct dvb_frontend *fe) +{ +u8 buf = (1 <<7 ) | (0 <<4 ), + dat[2 ] = {0x01 ,0x01 }; +int err =mxl301rf_w (fe,0x03 , &buf,1 ); + +if (err) +return err; +mxl301rf_w_tuner (fe, dat,sizeof (dat)); +return 0 ; +} + +int mxl301rf_probe (struct i2c_client *t,const struct i2c_device_id *id) +{ +struct dvb_frontend *fe = t->dev.platform_data; +u8 d[] = {0x10 ,0x01 }; + + fe->ops.tuner_ops.set_params = mxl301rf_tune; + fe->ops.tuner_ops.sleep = mxl301rf_sleep; + fe->ops.tuner_ops.init = mxl301rf_wakeup; +return mxl301rf_w (fe,0x1c , d,1 ) || +mxl301rf_w (fe,0x1d , d+1 ,1 ); +} + +static struct i2c_device_id mxl301rf_id[] = { + {MXL301RF_MODNAME ,0 }, + {}, +}; +MODULE_DEVICE_TABLE (i2c, mxl301rf_id); + +static struct i2c_driver mxl301rf_driver = { + .driver.name = mxl301rf_id->name, + .probe = mxl301rf_probe, + .id_table = mxl301rf_id, +}; +module_i2c_driver (mxl301rf_driver); + +MODULE_AUTHOR ("Budi Rachmanto, AreMa Inc. <knightrider(@)are.ma>" ); +MODULE_DESCRIPTION ("Earthsoft PT3 MxL301RF MaxLinear CMOS Hybrid TV ISDB-T tuner driver" ); +MODULE_LICENSE ("GPL" ); +
drivers/media/tuners/mxl301rf.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Sharp VA4M6JC2103 - Earthsoft PT3 ISDB-T tuner MaxLinear CMOS Hybrid TV MxL301RF +* +* Copyright (C) 2014 Budi Rachmanto, AreMa Inc. <[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; either version 2 of the License, or +* (at your option) any later version. +* +* 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 + +#define MXL301RF_MODNAME "mxl301rf" + +#endif +
Signature · 1 line
2.7.4
PATCH 6/8 Sharp QM1D1C004x ISDB-S tuner driver for PT3 and PX-BCUD
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
--- drivers/media/tuners/qm1d1c004x.c | 242 ++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/qm1d1c004x.h | 23 ++++ 2 files changed, 265 insertions(+) create mode 100644 drivers/media/tuners/qm1d1c004x.c create mode 100644 drivers/media/tuners/qm1d1c004x.h
drivers/media/tuners/qm1d1c004x.c new file +242 -0
@@ -0,0 +1,242 @@ +/* +Sharp VA4M6JC2103 QM1D1C004x ISDB-S tuner driver + +Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> + +CHIP VER. CARD +QM1D1C0042 0x48 Earthsoft PT3 +QM1D1C0045 0x58 +QM1D1C0045_2 0x68 PLEX PX-BCUD + +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. +*/ + +#include "dvb_frontend.h" +#include "qm1d1c004x.h" + +struct qm1d1c004x { +u8 reg[32 ]; +}; + +bool qm1d1c004x_r (struct dvb_frontend *fe,u8 slvadr,u8 *dat) +{ +struct i2c_client *d = fe->demodulator_priv, + *t = fe->tuner_priv; +u8 buf[] = {0xFE , t->addr <<1 , slvadr,0xFE , (t->addr <<1 ) |1 ,0 }; +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = buf, .len =3 ,}, + {.addr = d->addr, .flags =0 , .buf = buf +3 , .len =2 ,}, + {.addr = d->addr, .flags =I2C_M_RD , .buf = buf +5 , .len =1 ,}, + }; +bool ret =i2c_transfer (d->adapter, msg,3 ) ==3 ; + + *dat = buf[5 ]; +return ret; +} + +int qm1d1c004x_w (struct dvb_frontend *fe,u8 slvadr,u8 *dat,int len) +{ +struct i2c_client *d = fe->demodulator_priv; +u8 buf[len +1 ]; +struct i2c_msg msg[] = { + {.addr = d->addr, .flags =0 , .buf = buf, .len = len +1 ,}, + }; + + buf[0 ] = slvadr; +memcpy (buf +1 , dat, len); +return i2c_transfer (d->adapter, msg,1 ) ==1 ?0 : -EIO ; +} + +int qm1d1c004x_w_tuner (struct dvb_frontend *fe,u8 adr,u8 dat) +{ +struct i2c_client *t = fe->tuner_priv; +struct qm1d1c004x *q =i2c_get_clientdata (t); +u8 buf[] = {t->addr <<1 , adr, dat}; +int err =qm1d1c004x_w (fe,0xFE , buf,3 ); + + q->reg[adr] = dat; +return err; +} + +enum qm1d1c004x_agc { +QM1D1C004X_AGC_AUTO , +QM1D1C004X_AGC_MANUAL , +}; + +int qm1d1c004x_set_agc (struct dvb_frontend *fe,enum qm1d1c004x_agc agc) +{ +u8 dat = (agc ==QM1D1C004X_AGC_AUTO ) ?0xff :0x00 , + pskmsrst =0x01 ; +int err =qm1d1c004x_w (fe,0x0a , &dat,1 ); + +if (err) +return err; + dat =0xb0 | (agc ==QM1D1C004X_AGC_AUTO ?1 :0 ); + err =qm1d1c004x_w (fe,0x10 , &dat,1 ); +if (err) +return err; + dat = (agc ==QM1D1C004X_AGC_AUTO ) ?0x40 :0x00 ; +return (err =qm1d1c004x_w (fe,0x11 , &dat,1 )) ? + err :qm1d1c004x_w (fe,0x03 , &pskmsrst,1 ); +} + +int qm1d1c004x_sleep (struct dvb_frontend *fe) +{ +u8 buf =1 , + *reg = ((struct qm1d1c004x *)fe->tuner_priv)->reg; + + reg[0x01 ] &= (~(1 <<3 )) &0xff ; + reg[0x01 ] |=1 <<0 ; + reg[0x05 ] |=1 <<3 ; +return qm1d1c004x_set_agc (fe,QM1D1C004X_AGC_MANUAL ) || +qm1d1c004x_w_tuner (fe,0x05 , reg[0x05 ]) || +qm1d1c004x_w_tuner (fe,0x01 , reg[0x01 ]) || +qm1d1c004x_w (fe,0x17 , &buf,1 ); +} + +int qm1d1c004x_wakeup (struct dvb_frontend *fe) +{ +u8 regs[][32 ] = { + {/* QM1D1C0042 Earthsoft PT3 */ +0x48 ,0x1c ,0xa0 ,0x10 ,0xbc ,0xc5 ,0x20 ,0x33 ,0x06 ,0x00 ,0x00 ,0x00 ,0x03 ,0x00 ,0x00 ,0x00 , +0x00 ,0xff ,0xf3 ,0x00 ,0x2a ,0x64 ,0xa6 ,0x86 ,0x8c ,0xcf ,0xb8 ,0xf1 ,0xa8 ,0xf2 ,0x89 ,0x00 , + }, {/* QM1D1C0045 untested! */ +0x58 ,0x1C ,0xC0 ,0x10 ,0xBC ,0xC1 ,0x15 ,0x34 ,0x06 ,0x3e ,0x00 ,0x00 ,0x43 ,0x00 ,0x00 ,0x00 , +0x11 ,0xFF ,0xF3 ,0x00 ,0x3E ,0x25 ,0x5C ,0xD6 ,0x55 ,0x8F ,0x95 ,0xF6 ,0x36 ,0xF2 ,0x09 ,0x00 , + }, {/* QM1D1C0045_2 PLEX PX-BCUD */ +0x68 ,0x1c ,0xc0 ,0x10 ,0xbc ,0xc1 ,0x11 ,0x33 ,0x03 ,0x00 ,0x00 ,0x00 ,0x03 ,0x00 ,0x00 ,0x00 , +0x00 ,0xff ,0xf3 ,0x00 ,0x3f ,0x25 ,0x5c ,0xd6 ,0x55 ,0xcf ,0x95 ,0xf6 ,0x36 ,0xf2 ,0x09 ,0x00 , + } + }, + *reg = ((struct qm1d1c004x *)i2c_get_clientdata (fe->tuner_priv))->reg, + dat =0 , + i; + +for (i =0 ; i <ARRAY_SIZE (regs); i++) { +if (!qm1d1c004x_r (fe,0 , &dat)) +return -EIO ; +if (dat == regs[i][0 ]) +break ; + } +if (i ==ARRAY_SIZE (regs)) +return -ENOTSUPP ; +memcpy (reg, regs[i],32 ); + reg[0x01 ] |=1 <<3 ; + reg[0x01 ] &= (~(1 <<0 )) &0xff ; + reg[0x05 ] &= (~(1 <<3 )) &0xff ; + dat =0 ; +return qm1d1c004x_w (fe,0x17 , &dat,1 ) || +qm1d1c004x_w_tuner (fe,0x01 , reg[0x01 ]) || +qm1d1c004x_w_tuner (fe,0x05 , reg[0x05 ]); +} + +int qm1d1c004x_tune (struct dvb_frontend *fe) +{ +u32 fgap_tab[9 ][3 ] = { + {2151000 ,1 ,7 }, {1950000 ,1 ,6 }, {1800000 ,1 ,5 }, + {1600000 ,1 ,4 }, {1450000 ,1 ,3 }, {1250000 ,1 ,2 }, + {1200000 ,0 ,7 }, {975000 ,0 ,6 }, {950000 ,0 ,0 } + }; +u8 *reg = ((struct qm1d1c004x *)fe->tuner_priv)->reg; +u32 kHz = fe->dtv_property_cache.frequency -500 , + XtalkHz =16000 , + i = ((kHz + XtalkHz /2 ) / XtalkHz) * XtalkHz; +s64 b = kHz - i; +u8 N = i / (4 * XtalkHz) -3 , +A = (i / XtalkHz) -4 * (N +1 ) -5 ; +int sd = b <0 ? (0x100000 / XtalkHz) * b +0x400000 : (0x100000 / XtalkHz) * b, + err =qm1d1c004x_set_agc (fe,QM1D1C004X_AGC_MANUAL ); + +if (err) +return -EIO ; + +/* div2/vco_band */ +for (i =0 ; i <8 ; i++) +if ((fgap_tab[i+1 ][0 ] <= kHz) && (kHz < fgap_tab[i][0 ])) +qm1d1c004x_w_tuner (fe,0x02 , (reg[0x02 ] &0x0f ) | fgap_tab[i][1 ] <<7 | fgap_tab[i][2 ] <<4 ); + + reg[0x06 ] &=0x40 ; + reg[0x06 ] |=N ; + reg[0x07 ] &=0xf0 ; + reg[0x07 ] |=A &0x0f ; + +/* LPF */ + reg[0x08 ] &=0xf0 ; + reg[0x08 ] |=0x09 ; + reg[0x13 ] &=0x9f ; + reg[0x13 ] |=0x20 ; + err =qm1d1c004x_w_tuner (fe,0x06 , reg[0x06 ]) || +qm1d1c004x_w_tuner (fe,0x07 , reg[0x07 ]) || +qm1d1c004x_w_tuner (fe,0x08 , (reg[0x08 ] &0xf0 ) |2 ); +if (err) +return err; + reg[0x09 ] &=0xc0 ; + reg[0x09 ] |= (sd >>16 ) &0x3f ; + reg[0x0a ] = (sd >>8 ) &0xff ; + reg[0x0b ] = (sd >>0 ) &0xff ; + err =qm1d1c004x_w_tuner (fe,0x09 , reg[0x09 ]) || +qm1d1c004x_w_tuner (fe,0x0a , reg[0x0a ]) || +qm1d1c004x_w_tuner (fe,0x0b , reg[0x0b ]) || +qm1d1c004x_w_tuner (fe,0x0c , reg[0x0c ] &0x3f ); +if (err) +return err; +msleep_interruptible (1 ); + err =qm1d1c004x_w_tuner (fe,0x0c , reg[0x0c ] |0xc0 ) || +qm1d1c004x_w_tuner (fe,0x08 ,0x09 ) || +qm1d1c004x_w_tuner (fe,0x13 , reg[0x13 ]); +if (err) +return err; +for (i =0 ; i <500 ; i++) { +if (!qm1d1c004x_r (fe,0x0d , ®[0x0d ])) +return -EIO ; +if (reg[0x0d ] &0x40 )/* locked */ +return qm1d1c004x_set_agc (fe,QM1D1C004X_AGC_AUTO ); +msleep_interruptible (1 ); + } +return -ETIMEDOUT ; +} + +int qm1d1c004x_remove (struct i2c_client *t) +{ +kfree (i2c_get_clientdata (t)); +return 0 ; +} + +int qm1d1c004x_probe (struct i2c_client *t,const struct i2c_device_id *id) +{ +struct dvb_frontend *fe = t->dev.platform_data; +struct qm1d1c004x *q =kzalloc (sizeof (struct qm1d1c004x ),GFP_KERNEL ); +u8 d[] = {0x10 ,0x15 ,0x04 }; + +if (!q) +return -ENOMEM ; +i2c_set_clientdata (t, q); + fe->ops.tuner_ops.set_params = qm1d1c004x_tune; + fe->ops.tuner_ops.sleep = qm1d1c004x_sleep; + fe->ops.tuner_ops.init = qm1d1c004x_wakeup; +return qm1d1c004x_w (fe,0x1e , d,1 ) || +qm1d1c004x_w (fe,0x1c , d+1 ,1 ) || +qm1d1c004x_w (fe,0x1f , d+2 ,1 ); +} + +static struct i2c_device_id qm1d1c004x_id[] = { + {QM1D1C004X_MODNAME ,0 }, + {}, +}; +MODULE_DEVICE_TABLE (i2c, qm1d1c004x_id); + +static struct i2c_driver qm1d1c004x_driver = { + .driver.name = qm1d1c004x_id->name, + .probe = qm1d1c004x_probe, + .remove = qm1d1c004x_remove, + .id_table = qm1d1c004x_id, +}; +module_i2c_driver (qm1d1c004x_driver); + +MODULE_AUTHOR ("Budi Rachmanto, AreMa Inc. <knightrider(@)are.ma>" ); +MODULE_DESCRIPTION ("Earthsoft PT3 QM1D1C004X ISDB-S tuner driver" ); +MODULE_LICENSE ("GPL" ); +
drivers/media/tuners/qm1d1c004x.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +Sharp VA4M6JC2103 QM1D1C004x ISDB-S tuner driver + +Copyright (C) Budi Rachmanto, AreMa Inc. <[email protected]> + +CHIP VER. CARD +QM1D1C0042 0x48 Earthsoft PT3 +QM1D1C0045 0x58 +QM1D1C0045_2 0x68 PLEX PX-BCUD + +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 QM1D1C004X_H +#define QM1D1C004X_H + +#define QM1D1C004X_MODNAME "qm1d1c004x" + +#endif +
Signature · 1 line
2.7.4
PATCH 7/8 PCIE bridge driver for PT3 & PX-Q3PE
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
PCIE bridge driver for PT3 & PX-Q3PE
Please read cover letter for details.
--- drivers/media/pci/Kconfig | 2 +- drivers/media/pci/Makefile | 2 +- drivers/media/pci/ptx/Kconfig | 21 ++ drivers/media/pci/ptx/Makefile | 8 + drivers/media/pci/ptx/pt3_pci.c | 425 +++++++++++++++++++++++++++ drivers/media/pci/ptx/ptx_common.c | 252 ++++++++++++++++ drivers/media/pci/ptx/ptx_common.h | 74 +++++ drivers/media/pci/ptx/pxq3pe_pci.c | 585 +++++++++++++++++++++++++++++++++++++ 8 files changed, 1367 insertions(+), 2 deletions(-) create mode 100644 drivers/media/pci/ptx/Kconfig create mode 100644 drivers/media/pci/ptx/Makefile create mode 100644 drivers/media/pci/ptx/pt3_pci.c create mode 100644 drivers/media/pci/ptx/ptx_common.c create mode 100644 drivers/media/pci/ptx/ptx_common.h create mode 100644 drivers/media/pci/ptx/pxq3pe_pci.c
drivers/media/pci/Kconfig +1 -1
@@ -44,7 +44,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/ptx/Kconfig" source "drivers/media/pci/mantis/Kconfig" source "drivers/media/pci/ngene/Kconfig" source "drivers/media/pci/ddbridge/Kconfig"
drivers/media/pci/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y += ttpci/ \ pluto2/ \ dm1105/ \ pt1/ \ - pt3/ \ + ptx/ \ mantis/ \ ngene/ \ ddbridge/ \
drivers/media/pci/ptx/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +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 ISDB-S/T PCIe cards. + + Say Y or M if you own such a device and want to use it. + +config DVB_PXQ3PE + tristate "PLEX PX-Q3PE 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 PLEX PX-Q3PE ISDB-S/T PCIe cards. + + Say Y or M if you own such a device and want to use it.
drivers/media/pci/ptx/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +pt3-objs := pt3_pci.o ptx_common.o +pxq3pe-objs := pxq3pe_pci.o ptx_common.o + +obj-$(CONFIG_DVB_PT3) += pt3.o +obj-$(CONFIG_DVB_PXQ3PE) += pxq3pe.o + +ccflags-y += -Idrivers/media/dvb-core -Idrivers/media/dvb-frontends -Idrivers/media/tuners +
drivers/media/pci/ptx/pt3_pci.c new file +425 -0
425 lines not on this page · raw message
drivers/media/pci/ptx/ptx_common.c new file +252 -0
252 lines not on this page · raw message
drivers/media/pci/ptx/ptx_common.h new file +74 -0
74 lines not on this page · raw message
drivers/media/pci/ptx/pxq3pe_pci.c new file +585 -0
585 lines not on this page · raw message
Signature · 1 line
2.7.4
kbuild test robot
build botRe: [media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
reproduce:
Hi Буди,
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.6-rc1 next-20160331]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: i386-allyesconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
>> drivers/media/pci/ptx/ptx_common.c:187:536: error: 'KBUILD_MODNAME' undeclared here (not in a function) >> drivers/media/pci/ptx/ptx_common.c:187:551: error: expected ',' or ';' before string constant
vim +/KBUILD_MODNAME +187 drivers/media/pci/ptx/ptx_common.c
181 pci_release_regions(card->pdev);
182 pci_set_drvdata(card->pdev, NULL);
183 pci_disable_device(card->pdev);
184 kfree(card);
185 }
186
> 187 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adap_no);
188 int ptx_register_adap(struct ptx_card *card, const struct ptx_subdev_info *info,
189 int (*thread)(void *), int (*dma)(struct ptx_adap *, bool))
190 {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
In reply to [email protected]reproduce:
Hi Буди,
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.6-rc1 next-20160331]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_remove':
drivers/media/pci/ptx/pxq3pe_pci.c:484:3: error: implicit declaration of function 'vfree' [-Werror=implicit-function-declaration]
vfree(p->sBuf);
^
drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_probe':
drivers/media/pci/ptx/pxq3pe_pci.c:536:14: error: implicit declaration of function 'vzalloc' [-Werror=implicit-function-declaration]
p->sBuf = vzalloc(p->sBufSize);
^
>> drivers/media/pci/ptx/pxq3pe_pci.c:536:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
p->sBuf = vzalloc(p->sBufSize);
^cc1: some warnings being treated as errors
vim +536 drivers/media/pci/ptx/pxq3pe_pci.c
478 if (c->dma.dat)
479 pci_free_consistent(card->pdev, c->dma.sz, c->dma.dat, c->dma.adr);
480 for (i = 0; i < card->adapn; i++) {
481 struct ptx_adap *adap = &card->adap[i];
482 struct pxq3pe_adap *p = adap->priv;
483
> 484 vfree(p->sBuf);
485 }
486 if (c->bar)
487 pci_iounmap(pdev, c->bar);
488 ptx_unregister_adap(card);
489 }
490
491 static const struct i2c_algorithm pxq3pe_algo = {
492 .functionality = ptx_i2c_func,
493 .master_xfer = pxq3pe_xfr,
494 };
495
496 static int pxq3pe_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
497 {
498 struct ptx_subdev_info pxq3pe_subdev_info[] = {
499 {SYS_ISDBT, 0x20, TC90522_MODNAME, 0x10, NM131_MODNAME},
500 {SYS_ISDBS, 0x22, TC90522_MODNAME, 0x11, TDA2014X_MODNAME},
501 {SYS_ISDBT, 0x24, TC90522_MODNAME, 0x12, NM131_MODNAME},
502 {SYS_ISDBS, 0x26, TC90522_MODNAME, 0x13, TDA2014X_MODNAME},
503 {SYS_ISDBT, 0x28, TC90522_MODNAME, 0x14, NM131_MODNAME},
504 {SYS_ISDBS, 0x2A, TC90522_MODNAME, 0x15, TDA2014X_MODNAME},
505 {SYS_ISDBT, 0x2C, TC90522_MODNAME, 0x16, NM131_MODNAME},
506 {SYS_ISDBS, 0x2E, TC90522_MODNAME, 0x17, TDA2014X_MODNAME},
507 };
508 struct ptx_card *card = ptx_alloc(pdev, KBUILD_MODNAME, ARRAY_SIZE(pxq3pe_subdev_info),
509 sizeof(struct pxq3pe_card), sizeof(struct pxq3pe_adap), pxq3pe_lnb);
510 struct pxq3pe_card *c;
511 u8 regctl = 0xA0,
512 i;
513 u16 cfg;
514 int err = !card || pci_read_config_word(pdev, PCI_COMMAND, &cfg);
515
516 if (err)
517 return ptx_abort(pdev, pxq3pe_remove, err, "Memory/PCI error, card=%p", card);
518 c = card->priv;
519 if (!(cfg & PCI_COMMAND_MASTER)) {
520 pci_set_master(pdev);
521 pci_read_config_word(pdev, PCI_COMMAND, &cfg);
522 if (!(cfg & PCI_COMMAND_MASTER))
523 return ptx_abort(pdev, pxq3pe_remove, -EIO, "Bus Mastering is disabled");
524 }
525 c->bar = pci_iomap(pdev, 0, 0);
526 if (!c->bar)
527 return ptx_abort(pdev, pxq3pe_remove, -EIO, "I/O map failed");
528 if (ptx_i2c_add_adapter(card, &pxq3pe_algo))
529 return ptx_abort(pdev, pxq3pe_remove, -EIO, "Cannot add I2C");
530
531 for (i = 0; i < card->adapn; i++) {
532 struct ptx_adap *adap = &card->adap[i];
533 struct pxq3pe_adap *p = adap->priv;
534
535 p->sBufSize = PTX_TS_SIZE * 100 << 9;
> 536 p->sBuf = vzalloc(p->sBufSize); 537 if (!p->sBuf)
538 return ptx_abort(pdev, pxq3pe_remove, -ENOMEM, "No memory for stream buffer");
539 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
In reply to [email protected]reproduce:
Hi Буди,
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.6-rc1 next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/media/pci/ptx/pt3_pci.c: In function 'pt3_dma_run':
>> drivers/media/pci/ptx/pt3_pci.c:225:3: error: implicit declaration of function 'writeq' [-Werror=implicit-function-declaration]
writeq(p->desc_info->adr, base + PT3_DMA_DESC);
^
cc1: some warnings being treated as errors
--
drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_remove':
>> drivers/media/pci/ptx/pxq3pe_pci.c:484:3: error: implicit declaration of function 'vfree' [-Werror=implicit-function-declaration]
vfree(p->sBuf);
^
drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_probe':
>> drivers/media/pci/ptx/pxq3pe_pci.c:536:14: error: implicit declaration of function 'vzalloc' [-Werror=implicit-function-declaration]
p->sBuf = vzalloc(p->sBufSize);
^
drivers/media/pci/ptx/pxq3pe_pci.c:536:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
p->sBuf = vzalloc(p->sBufSize);
^cc1: some warnings being treated as errors
vim +/writeq +225 drivers/media/pci/ptx/pt3_pci.c
219
220 if (ON) {
221 for (i = 0; i < p->ts_blk_cnt; i++) /* 17 */
222 *p->ts_info[i].dat = PTX_TS_NOT_SYNC;
223 p->ts_blk_idx = 0;
224 writel(2, base + PT3_DMA_CTL); /* stop DMA */
> 225 writeq(p->desc_info->adr, base + PT3_DMA_DESC);
226 writel(1, base + PT3_DMA_CTL); /* start DMA */
227 } else {
228 writel(2, base + PT3_DMA_CTL); /* stop DMA */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 8/8 Support for PLEX PX-BCUD (ISDB-S usb dongle)
In reply to [email protected]From: Буди Романто, AreMa Inc <[email protected]>
Support for PLEX PX-BCUD (ISDB-S usb dongle)
Nagahama's patch simplified...
--- drivers/media/usb/em28xx/Kconfig | 2 + drivers/media/usb/em28xx/em28xx-cards.c | 27 +++++++++++ drivers/media/usb/em28xx/em28xx-dvb.c | 79 ++++++++++++++++++++++++++++++++- drivers/media/usb/em28xx/em28xx.h | 1 + 4 files changed, 107 insertions(+), 2 deletions(-)
drivers/media/usb/em28xx/Kconfig +2 -0
@@ -59,6 +59,8 @@ config VIDEO_EM28XX_DVB select DVB_DRX39XYJ if MEDIA_SUBDRV_AUTOSELECT select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1C004X if MEDIA_SUBDRV_AUTOSELECT ---help--- This adds support for DVB cards based on the Empiatech em28xx chips.
drivers/media/usb/em28xx/em28xx-cards.c +27 -0
@@ -492,6 +492,20 @@ static struct em28xx_reg_seq terratec_t2_stick_hd[] = { {-1, -1, -1, -1}, }; +static struct em28xx_reg_seq plex_px_bcud[] = { + {EM2874_R80_GPIO_P0_CTRL ,0xff ,0xff ,0 }, + {0x0d ,0xff ,0xff ,0 }, + {EM2874_R50_IR_CONFIG ,0x01 ,0xff ,0 }, + {EM28XX_R06_I2C_CLK ,0x40 ,0xff ,0 }, + {EM2874_R80_GPIO_P0_CTRL ,0xfd ,0xff ,100 }, + {EM28XX_R12_VINENABLE ,0x20 ,0x20 ,0 }, + {0x0d ,0x42 ,0xff ,1000 }, + {EM2874_R80_GPIO_P0_CTRL ,0xfc ,0xff ,10 }, + {EM2874_R80_GPIO_P0_CTRL ,0xfd ,0xff ,10 }, + {0x73 ,0xfd ,0xff ,100 }, + {-1 ,-1 ,-1 ,-1 }, +}; +/* * Button definitions */
@@ -2306,6 +2320,17 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .ir_codes = RC_MAP_TERRATEC_SLIM_2, }, +/* 3275:0085 PLEX PX-BCUD. +* Empia EM28178, TOSHIBA TC90532XBG, Sharp QM1D1C0042 */ + [EM28178_BOARD_PLEX_PX_BCUD] = { + .name = "PLEX PX-BCUD", + .xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ, + .def_i2c_bus = 1, + .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE, + .tuner_type = TUNER_ABSENT, + .tuner_gpio = plex_px_bcud, + .has_dvb = 1, + }, };EXPORT_SYMBOL_GPL (em28xx_boards);
@@ -2495,6 +2520,8 @@ struct usb_device_id em28xx_id_table[] = { .driver_info = EM2861_BOARD_LEADTEK_VC100 }, { USB_DEVICE(0xeb1a, 0x8179), .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD }, + { USB_DEVICE(0x3275, 0x0085), + .driver_info = EM28178_BOARD_PLEX_PX_BCUD }, { }, };MODULE_DEVICE_TABLE (usb, em28xx_id_table);
drivers/media/usb/em28xx/em28xx-dvb.c +77 -2
106 lines not on this page · raw message
drivers/media/usb/em28xx/em28xx.h +1 -0
@@ -145,6 +145,7 @@#define EM2861_BOARD_LEADTEK_VC100 95#define EM28178_BOARD_TERRATEC_T2_STICK_HD 96#define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008 97 +#define EM28178_BOARD_PLEX_PX_BCUD 98/* Limits minimum and default number of buffers */ #define EM28XX_MIN_BUF 4
Signature · 1 line
2.7.4