[media] tda10071: NXP TDA10071 DVB-S/S2 driver

NXP TDA10071 DVB-S/S2 demodulator & Conexant CX24118A tuner combo driver

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Antti Palosaari 2011-08-01 01:07:39 -03:00 committed by Mauro Carvalho Chehab
parent 85bc9b510a
commit de8e420350
5 changed files with 1477 additions and 0 deletions

View File

@ -236,6 +236,13 @@ config DVB_MB86A16
A DVB-S/DSS Direct Conversion reveiver.
Say Y when you want to support this frontend.
config DVB_TDA10071
tristate "NXP TDA10071"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
help
Say Y when you want to support this frontend.
comment "DVB-T (terrestrial) frontends"
depends on DVB_CORE

View File

@ -93,4 +93,5 @@ obj-$(CONFIG_DVB_DRXK) += drxk.o
obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o
obj-$(CONFIG_DVB_A8293) += a8293.o
obj-$(CONFIG_DVB_TDA10071) += tda10071.o

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
/*
* NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
*
* Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TDA10071_H
#define TDA10071_H
#include <linux/dvb/frontend.h>
struct tda10071_config {
/* Demodulator I2C address.
* Default: none, must set
* Values: 0x55,
*/
u8 i2c_address;
/* Max bytes I2C provider can write at once.
* Note: Buffer is taken from the stack currently!
* Default: none, must set
* Values:
*/
u16 i2c_wr_max;
/* TS output mode.
* Default: TDA10071_TS_SERIAL
* Values:
*/
#define TDA10071_TS_SERIAL 0
#define TDA10071_TS_PARALLEL 1
u8 ts_mode;
/* Input spectrum inversion.
* Default: 0
* Values: 0, 1
*/
bool spec_inv;
/* Xtal frequency Hz
* Default: none, must set
* Values:
*/
u32 xtal;
/* PLL multiplier.
* Default: none, must set
* Values:
*/
u8 pll_multiplier;
};
#if defined(CONFIG_DVB_TDA10071) || \
(defined(CONFIG_DVB_TDA10071_MODULE) && defined(MODULE))
extern struct dvb_frontend *tda10071_attach(
const struct tda10071_config *config, struct i2c_adapter *i2c);
#else
static inline struct dvb_frontend *tda10071_attach(
const struct tda10071_config *config, struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif
#endif /* TDA10071_H */

View File

@ -0,0 +1,122 @@
/*
* NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
*
* Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TDA10071_PRIV
#define TDA10071_PRIV
#include "dvb_frontend.h"
#include "tda10071.h"
#include <linux/firmware.h>
#define LOG_PREFIX "tda10071"
#undef dbg
#define dbg(f, arg...) \
if (tda10071_debug) \
printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
#undef info
#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef warn
#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
struct tda10071_priv {
struct i2c_adapter *i2c;
struct dvb_frontend fe;
struct tda10071_config cfg;
u8 meas_count[2];
u32 ber;
u32 ucb;
fe_status_t fe_status;
fe_delivery_system_t delivery_system;
bool warm; /* FW running */
};
static struct tda10071_modcod {
fe_delivery_system_t delivery_system;
fe_modulation_t modulation;
fe_code_rate_t fec;
u8 val;
} TDA10071_MODCOD[] = {
/* NBC-QPSK */
{ SYS_DVBS2, QPSK, FEC_AUTO, 0x00 },
{ SYS_DVBS2, QPSK, FEC_1_2, 0x04 },
{ SYS_DVBS2, QPSK, FEC_3_5, 0x05 },
{ SYS_DVBS2, QPSK, FEC_2_3, 0x06 },
{ SYS_DVBS2, QPSK, FEC_3_4, 0x07 },
{ SYS_DVBS2, QPSK, FEC_4_5, 0x08 },
{ SYS_DVBS2, QPSK, FEC_5_6, 0x09 },
{ SYS_DVBS2, QPSK, FEC_8_9, 0x0a },
{ SYS_DVBS2, QPSK, FEC_9_10, 0x0b },
/* 8PSK */
{ SYS_DVBS2, PSK_8, FEC_3_5, 0x0c },
{ SYS_DVBS2, PSK_8, FEC_2_3, 0x0d },
{ SYS_DVBS2, PSK_8, FEC_3_4, 0x0e },
{ SYS_DVBS2, PSK_8, FEC_5_6, 0x0f },
{ SYS_DVBS2, PSK_8, FEC_8_9, 0x10 },
{ SYS_DVBS2, PSK_8, FEC_9_10, 0x11 },
/* QPSK */
{ SYS_DVBS, QPSK, FEC_AUTO, 0x2d },
{ SYS_DVBS, QPSK, FEC_1_2, 0x2e },
{ SYS_DVBS, QPSK, FEC_2_3, 0x2f },
{ SYS_DVBS, QPSK, FEC_3_4, 0x30 },
{ SYS_DVBS, QPSK, FEC_5_6, 0x31 },
{ SYS_DVBS, QPSK, FEC_7_8, 0x32 },
};
struct tda10071_reg_val_mask {
u8 reg;
u8 val;
u8 mask;
};
/* firmware filename */
#define TDA10071_DEFAULT_FIRMWARE "dvb-fe-tda10071.fw"
/* firmware commands */
#define CMD_DEMOD_INIT 0x10
#define CMD_CHANGE_CHANNEL 0x11
#define CMD_MPEG_CONFIG 0x13
#define CMD_TUNER_INIT 0x15
#define CMD_GET_AGCACC 0x1a
#define CMD_LNB_CONFIG 0x20
#define CMD_LNB_SEND_DISEQC 0x21
#define CMD_LNB_SET_DC_LEVEL 0x22
#define CMD_LNB_PCB_CONFIG 0x23
#define CMD_LNB_SEND_TONEBURST 0x24
#define CMD_LNB_UPDATE_REPLY 0x25
#define CMD_GET_FW_VERSION 0x35
#define CMD_SET_SLEEP_MODE 0x36
#define CMD_BER_CONTROL 0x3e
#define CMD_BER_UPDATE_COUNTERS 0x3f
/* firmare command struct */
#define TDA10071_ARGLEN 0x1e
struct tda10071_cmd {
u8 args[TDA10071_ARGLEN];
u8 len;
};
#endif /* TDA10071_PRIV */