Commit 6bca3580 authored by Andrew de Quincey's avatar Andrew de Quincey Committed by Mauro Carvalho Chehab

V4L/DVB (4396): Add drivers for tda10086 + tda826x chips

TDA10086 is a new DVB-S demodulator
TDA826x is a DVB-S Silicon Tuner
Signed-off-by: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 2cd885aa
......@@ -46,6 +46,13 @@ config DVB_S5H1420
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_TDA10086
tristate "Philips TDA10086 based"
depends on DVB_CORE
default m if DVB_FE_CUSTOMISE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
comment "DVB-T (terrestrial) frontends"
depends on DVB_CORE
......@@ -216,6 +223,15 @@ config DVB_LGDT330X
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
comment "Tuners/PLL support"
depends on DVB_CORE
config DVB_TDA826X
tristate "Philips TDA826X silicon tuner"
depends on DVB_CORE
default m if DVB_FE_CUSTOMISE
help
A DVB-S silicon tuner module. Say Y when you want to support this tuner.
comment "Miscellaneous devices"
depends on DVB_CORE
......
......@@ -33,3 +33,5 @@ obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
obj-$(CONFIG_DVB_CX24123) += cx24123.o
obj-$(CONFIG_DVB_LNBP21) += lnbp21.o
obj-$(CONFIG_DVB_ISL6421) += isl6421.o
obj-$(CONFIG_DVB_TDA10086) += tda10086.o
obj-$(CONFIG_DVB_TDA826X) += tda826x.o
This diff is collapsed.
/*
Driver for Philips tda10086 DVBS Frontend
(c) 2006 Andrew de Quincey
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef TDA10086_H
#define TDA10086_H
#include <linux/dvb/frontend.h>
#include <linux/firmware.h>
struct tda10086_config
{
/* the demodulator's i2c address */
u8 demod_address;
/* does the "inversion" need inverted? */
u8 invert;
};
extern struct dvb_frontend* tda10086_attach(const struct tda10086_config* config,
struct i2c_adapter* i2c);
#endif // TDA10086_H
/*
Driver for Philips tda8262/tda8263 DVBS Silicon tuners
(c) 2006 Andrew de Quincey
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/dvb/frontend.h>
#include <asm/types.h>
#include "tda826x.h"
struct tda826x_priv {
/* i2c details */
int i2c_address;
struct i2c_adapter *i2c;
u8 has_loopthrough:1;
u32 frequency;
};
static int tda826x_release(struct dvb_frontend *fe)
{
if (fe->tuner_priv)
kfree(fe->tuner_priv);
fe->tuner_priv = NULL;
return 0;
}
static int tda826x_sleep(struct dvb_frontend *fe)
{
struct tda826x_priv *priv = fe->tuner_priv;
int ret;
u8 buf [] = { 0x00, 0x8d };
struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 2 };
if (!priv->has_loopthrough)
buf[1] = 0xad;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) {
printk("%s: i2c error\n", __FUNCTION__);
}
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
printk("%s:\n", __FUNCTION__);
return (ret == 1) ? 0 : ret;
}
static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
{
struct tda826x_priv *priv = fe->tuner_priv;
int ret;
u32 div;
u8 buf [11];
struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 11 };
div = (params->frequency + (1000-1)) / 1000;
buf[0] = 0x00; // subaddress
buf[1] = 0x09; // powerdown RSSI + the magic value 1
if (!priv->has_loopthrough)
buf[1] |= 0x20; // power down loopthrough if not needed
buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO
buf[3] = div >> 7;
buf[4] = div << 1;
buf[5] = 0xff; // basedband filter to max
buf[6] = 0xfe; // gains at max + no RF attenuation
buf[7] = 0x83; // charge pumps at high, tests off
buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports.
buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL
buf[10] = 0xd4; // recommended value 13 for BBIAS + unknown bit set on
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if ((ret = i2c_transfer (priv->i2c, &msg, 1)) != 1) {
printk("%s: i2c error\n", __FUNCTION__);
}
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
priv->frequency = div * 1000;
printk("%s:\n", __FUNCTION__);
return (ret == 1) ? 0 : ret;
}
static int tda826x_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tda826x_priv *priv = fe->tuner_priv;
*frequency = priv->frequency;
return 0;
}
static struct dvb_tuner_ops tda826x_tuner_ops = {
.release = tda826x_release,
.sleep = tda826x_sleep,
.set_params = tda826x_set_params,
.get_frequency = tda826x_get_frequency,
};
struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c, int has_loopthrough)
{
struct tda826x_priv *priv = NULL;
u8 b1 [] = { 0, 0 };
struct i2c_msg msg [] = { { .addr = addr, .flags = 0, .buf = NULL, .len = 0 },
{ .addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 2 } };
int ret;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
ret = i2c_transfer (i2c, msg, 2);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
if (ret != 2)
return NULL;
if (!(b1[1] & 0x80))
return NULL;
priv = kzalloc(sizeof(struct tda826x_priv), GFP_KERNEL);
if (priv == NULL)
return NULL;
priv->i2c_address = addr;
priv->i2c = i2c;
priv->has_loopthrough = has_loopthrough;
memcpy(&fe->ops.tuner_ops, &tda826x_tuner_ops, sizeof(struct dvb_tuner_ops));
strncpy(fe->ops.tuner_ops.info.name, "Philips TDA826X", 128);
fe->ops.tuner_ops.info.frequency_min = 950000;
fe->ops.tuner_ops.info.frequency_min = 2175000;
fe->tuner_priv = priv;
printk("%s:\n", __FUNCTION__);
return fe;
}
EXPORT_SYMBOL(tda826x_attach);
MODULE_DESCRIPTION("DVB TDA826x driver");
MODULE_AUTHOR("Andrew de Quincey");
MODULE_LICENSE("GPL");
/*
Driver for Philips tda8262/tda8263 DVBS Silicon tuners
(c) 2006 Andrew de Quincey
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __DVB_TDA826X_H__
#define __DVB_TDA826X_H__
#include <linux/i2c.h>
#include "dvb_frontend.h"
/**
* Attach a tda826x tuner to the supplied frontend structure.
*
* @param fe Frontend to attach to.
* @param addr i2c address of the tuner.
* @param i2c i2c adapter to use.
* @param has_loopthrough Set to 1 if the card has a loopthrough RF connector.
* @return FE pointer on success, NULL on failure.
*/
extern struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c, int has_loopthrough);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment