V4L/DVB (12900): DiB8000: added support for DiBcom ISDB-T/ISDB-Tsb demodulator DiB8000
This commit adds support for the DiB8000 ISDB-T demodulator made by DiBcom. Signed-off-by: Olivier Grenie <Olivier.Grenie@dibcom.fr> Signed-off-by: Patrick Boettcher <pboettcher@dibcom.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
2a6a30e05c
commit
77e2c0f5d4
7 changed files with 2449 additions and 47 deletions
|
@ -71,6 +71,7 @@ config DVB_USB_DIB0700
|
||||||
depends on DVB_USB
|
depends on DVB_USB
|
||||||
select DVB_DIB7000P if !DVB_FE_CUSTOMISE
|
select DVB_DIB7000P if !DVB_FE_CUSTOMISE
|
||||||
select DVB_DIB7000M if !DVB_FE_CUSTOMISE
|
select DVB_DIB7000M if !DVB_FE_CUSTOMISE
|
||||||
|
select DVB_DIB8000 if !DVB_FE_CUSTOMISE
|
||||||
select DVB_DIB3000MC if !DVB_FE_CUSTOMISE
|
select DVB_DIB3000MC if !DVB_FE_CUSTOMISE
|
||||||
select DVB_S5H1411 if !DVB_FE_CUSTOMISE
|
select DVB_S5H1411 if !DVB_FE_CUSTOMISE
|
||||||
select DVB_LGDT3305 if !DVB_FE_CUSTOMISE
|
select DVB_LGDT3305 if !DVB_FE_CUSTOMISE
|
||||||
|
@ -87,7 +88,7 @@ config DVB_USB_DIB0700
|
||||||
Avermedia and other big and small companies.
|
Avermedia and other big and small companies.
|
||||||
|
|
||||||
For an up-to-date list of devices supported by this driver, have a look
|
For an up-to-date list of devices supported by this driver, have a look
|
||||||
on the Linux-DVB Wiki at www.linuxtv.org.
|
on the LinuxTV Wiki at www.linuxtv.org.
|
||||||
|
|
||||||
Say Y if you own such a device and want to use it. You should build it as
|
Say Y if you own such a device and want to use it. You should build it as
|
||||||
a module.
|
a module.
|
||||||
|
|
|
@ -484,6 +484,14 @@ config DVB_S921
|
||||||
AN ISDB-T DQPSK, QPSK, 16QAM and 64QAM 1seg tuner module.
|
AN ISDB-T DQPSK, QPSK, 16QAM and 64QAM 1seg tuner module.
|
||||||
Say Y when you want to support this frontend.
|
Say Y when you want to support this frontend.
|
||||||
|
|
||||||
|
config DVB_DIB8000
|
||||||
|
tristate "DiBcom 8000MB/MC"
|
||||||
|
depends on DVB_CORE && I2C
|
||||||
|
default m if DVB_FE_CUSTOMISE
|
||||||
|
help
|
||||||
|
A driver for DiBcom's DiB8000 ISDB-T/ISDB-Tsb demodulator.
|
||||||
|
Say Y when you want to support this frontend.
|
||||||
|
|
||||||
comment "Digital terrestrial only tuners/PLL"
|
comment "Digital terrestrial only tuners/PLL"
|
||||||
depends on DVB_CORE
|
depends on DVB_CORE
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ obj-$(CONFIG_DVB_DIB3000MB) += dib3000mb.o
|
||||||
obj-$(CONFIG_DVB_DIB3000MC) += dib3000mc.o dibx000_common.o
|
obj-$(CONFIG_DVB_DIB3000MC) += dib3000mc.o dibx000_common.o
|
||||||
obj-$(CONFIG_DVB_DIB7000M) += dib7000m.o dibx000_common.o
|
obj-$(CONFIG_DVB_DIB7000M) += dib7000m.o dibx000_common.o
|
||||||
obj-$(CONFIG_DVB_DIB7000P) += dib7000p.o dibx000_common.o
|
obj-$(CONFIG_DVB_DIB7000P) += dib7000p.o dibx000_common.o
|
||||||
|
obj-$(CONFIG_DVB_DIB8000) += dib8000.o dibx000_common.o
|
||||||
obj-$(CONFIG_DVB_MT312) += mt312.o
|
obj-$(CONFIG_DVB_MT312) += mt312.o
|
||||||
obj-$(CONFIG_DVB_VES1820) += ves1820.o
|
obj-$(CONFIG_DVB_VES1820) += ves1820.o
|
||||||
obj-$(CONFIG_DVB_VES1X93) += ves1x93.o
|
obj-$(CONFIG_DVB_VES1X93) += ves1x93.o
|
||||||
|
|
2279
drivers/media/dvb/frontends/dib8000.c
Normal file
2279
drivers/media/dvb/frontends/dib8000.c
Normal file
File diff suppressed because it is too large
Load diff
79
drivers/media/dvb/frontends/dib8000.h
Normal file
79
drivers/media/dvb/frontends/dib8000.h
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
#ifndef DIB8000_H
|
||||||
|
#define DIB8000_H
|
||||||
|
|
||||||
|
#include "dibx000_common.h"
|
||||||
|
|
||||||
|
struct dib8000_config {
|
||||||
|
u8 output_mpeg2_in_188_bytes;
|
||||||
|
u8 hostbus_diversity;
|
||||||
|
u8 tuner_is_baseband;
|
||||||
|
int (*update_lna) (struct dvb_frontend *, u16 agc_global);
|
||||||
|
|
||||||
|
u8 agc_config_count;
|
||||||
|
struct dibx000_agc_config *agc;
|
||||||
|
struct dibx000_bandwidth_config *pll;
|
||||||
|
|
||||||
|
#define DIB8000_GPIO_DEFAULT_DIRECTIONS 0xffff
|
||||||
|
u16 gpio_dir;
|
||||||
|
#define DIB8000_GPIO_DEFAULT_VALUES 0x0000
|
||||||
|
u16 gpio_val;
|
||||||
|
#define DIB8000_GPIO_PWM_POS0(v) ((v & 0xf) << 12)
|
||||||
|
#define DIB8000_GPIO_PWM_POS1(v) ((v & 0xf) << 8 )
|
||||||
|
#define DIB8000_GPIO_PWM_POS2(v) ((v & 0xf) << 4 )
|
||||||
|
#define DIB8000_GPIO_PWM_POS3(v) (v & 0xf)
|
||||||
|
#define DIB8000_GPIO_DEFAULT_PWM_POS 0xffff
|
||||||
|
u16 gpio_pwm_pos;
|
||||||
|
u16 pwm_freq_div;
|
||||||
|
|
||||||
|
void (*agc_control) (struct dvb_frontend *, u8 before);
|
||||||
|
|
||||||
|
u16 drives;
|
||||||
|
u16 diversity_delay;
|
||||||
|
u8 div_cfg;
|
||||||
|
u8 output_mode;
|
||||||
|
u8 refclksel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DEFAULT_DIB8000_I2C_ADDRESS 18
|
||||||
|
|
||||||
|
#if defined(CONFIG_DVB_DIB8000) || (defined(CONFIG_DVB_DIB8000_MODULE) && defined(MODULE))
|
||||||
|
extern struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg);
|
||||||
|
extern struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
|
||||||
|
|
||||||
|
extern int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr);
|
||||||
|
|
||||||
|
extern int dib8000_set_gpio(struct dvb_frontend *, u8 num, u8 dir, u8 val);
|
||||||
|
extern int dib8000_set_wbd_ref(struct dvb_frontend *, u16 value);
|
||||||
|
#else
|
||||||
|
static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg)
|
||||||
|
{
|
||||||
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface i, int x)
|
||||||
|
{
|
||||||
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr)
|
||||||
|
{
|
||||||
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dib8000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
|
||||||
|
{
|
||||||
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value)
|
||||||
|
{
|
||||||
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -21,7 +21,8 @@ static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, enum dibx000_i2c_interface intf)
|
static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst,
|
||||||
|
enum dibx000_i2c_interface intf)
|
||||||
{
|
{
|
||||||
if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) {
|
if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) {
|
||||||
dprintk("selecting interface: %d\n", intf);
|
dprintk("selecting interface: %d\n", intf);
|
||||||
|
@ -31,7 +32,8 @@ static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, enum dib
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4], u8 addr, int onoff)
|
static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4],
|
||||||
|
u8 addr, int onoff)
|
||||||
{
|
{
|
||||||
u16 val;
|
u16 val;
|
||||||
|
|
||||||
|
@ -57,7 +59,8 @@ static u32 dibx000_i2c_func(struct i2c_adapter *adapter)
|
||||||
return I2C_FUNC_I2C;
|
return I2C_FUNC_I2C;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num)
|
static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap,
|
||||||
|
struct i2c_msg msg[], int num)
|
||||||
{
|
{
|
||||||
struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
|
struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
|
||||||
struct i2c_msg m[2 + num];
|
struct i2c_msg m[2 + num];
|
||||||
|
@ -87,7 +90,9 @@ static struct i2c_algorithm dibx000_i2c_gated_tuner_algo = {
|
||||||
.functionality = dibx000_i2c_func,
|
.functionality = dibx000_i2c_func,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enum dibx000_i2c_interface intf, int gating)
|
struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst,
|
||||||
|
enum dibx000_i2c_interface intf,
|
||||||
|
int gating)
|
||||||
{
|
{
|
||||||
struct i2c_adapter *i2c = NULL;
|
struct i2c_adapter *i2c = NULL;
|
||||||
|
|
||||||
|
@ -103,13 +108,29 @@ struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enu
|
||||||
|
|
||||||
return i2c;
|
return i2c;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(dibx000_get_i2c_adapter);
|
EXPORT_SYMBOL(dibx000_get_i2c_adapter);
|
||||||
|
|
||||||
static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *algo, const char *name, struct dibx000_i2c_master *mst)
|
void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst)
|
||||||
|
{
|
||||||
|
/* initialize the i2c-master by closing the gate */
|
||||||
|
u8 tx[4];
|
||||||
|
struct i2c_msg m = {.addr = mst->i2c_addr,.buf = tx,.len = 4 };
|
||||||
|
|
||||||
|
dibx000_i2c_gate_ctrl(mst, tx, 0, 0);
|
||||||
|
i2c_transfer(mst->i2c_adap, &m, 1);
|
||||||
|
mst->selected_interface = 0xff; // the first time force a select of the I2C
|
||||||
|
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(dibx000_reset_i2c_master);
|
||||||
|
|
||||||
|
static int i2c_adapter_init(struct i2c_adapter *i2c_adap,
|
||||||
|
struct i2c_algorithm *algo, const char *name,
|
||||||
|
struct dibx000_i2c_master *mst)
|
||||||
{
|
{
|
||||||
strncpy(i2c_adap->name, name, sizeof(i2c_adap->name));
|
strncpy(i2c_adap->name, name, sizeof(i2c_adap->name));
|
||||||
i2c_adap->class = I2C_CLASS_TV_DIGITAL,
|
i2c_adap->class = I2C_CLASS_TV_DIGITAL, i2c_adap->algo = algo;
|
||||||
i2c_adap->algo = algo;
|
|
||||||
i2c_adap->algo_data = NULL;
|
i2c_adap->algo_data = NULL;
|
||||||
i2c_set_adapdata(i2c_adap, mst);
|
i2c_set_adapdata(i2c_adap, mst);
|
||||||
if (i2c_add_adapter(i2c_adap) < 0)
|
if (i2c_add_adapter(i2c_adap) < 0)
|
||||||
|
@ -117,7 +138,8 @@ static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, struct i2c_adapter *i2c_adap, u8 i2c_addr)
|
int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev,
|
||||||
|
struct i2c_adapter *i2c_adap, u8 i2c_addr)
|
||||||
{
|
{
|
||||||
u8 tx[4];
|
u8 tx[4];
|
||||||
struct i2c_msg m = {.addr = i2c_addr >> 1,.buf = tx,.len = 4 };
|
struct i2c_msg m = {.addr = i2c_addr >> 1,.buf = tx,.len = 4 };
|
||||||
|
@ -126,25 +148,30 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, stru
|
||||||
mst->i2c_adap = i2c_adap;
|
mst->i2c_adap = i2c_adap;
|
||||||
mst->i2c_addr = i2c_addr >> 1;
|
mst->i2c_addr = i2c_addr >> 1;
|
||||||
|
|
||||||
if (device_rev == DIB7000P)
|
if (device_rev == DIB7000P || device_rev == DIB8000)
|
||||||
mst->base_reg = 1024;
|
mst->base_reg = 1024;
|
||||||
else
|
else
|
||||||
mst->base_reg = 768;
|
mst->base_reg = 768;
|
||||||
|
|
||||||
if (i2c_adapter_init(&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo, "DiBX000 tuner I2C bus", mst) != 0)
|
if (i2c_adapter_init
|
||||||
printk(KERN_ERR "DiBX000: could not initialize the tuner i2c_adapter\n");
|
(&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo,
|
||||||
|
"DiBX000 tuner I2C bus", mst) != 0)
|
||||||
|
printk(KERN_ERR
|
||||||
|
"DiBX000: could not initialize the tuner i2c_adapter\n");
|
||||||
|
|
||||||
/* initialize the i2c-master by closing the gate */
|
/* initialize the i2c-master by closing the gate */
|
||||||
dibx000_i2c_gate_ctrl(mst, tx, 0, 0);
|
dibx000_i2c_gate_ctrl(mst, tx, 0, 0);
|
||||||
|
|
||||||
return i2c_transfer(i2c_adap, &m, 1) == 1;
|
return i2c_transfer(i2c_adap, &m, 1) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(dibx000_init_i2c_master);
|
EXPORT_SYMBOL(dibx000_init_i2c_master);
|
||||||
|
|
||||||
void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst)
|
void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst)
|
||||||
{
|
{
|
||||||
i2c_del_adapter(&mst->gated_tuner_i2c_adap);
|
i2c_del_adapter(&mst->gated_tuner_i2c_adap);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(dibx000_exit_i2c_master);
|
EXPORT_SYMBOL(dibx000_exit_i2c_master);
|
||||||
|
|
||||||
MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>");
|
MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>");
|
||||||
|
|
|
@ -12,6 +12,7 @@ struct dibx000_i2c_master {
|
||||||
#define DIB7000 2
|
#define DIB7000 2
|
||||||
#define DIB7000P 11
|
#define DIB7000P 11
|
||||||
#define DIB7000MC 12
|
#define DIB7000MC 12
|
||||||
|
#define DIB8000 13
|
||||||
u16 device_rev;
|
u16 device_rev;
|
||||||
|
|
||||||
enum dibx000_i2c_interface selected_interface;
|
enum dibx000_i2c_interface selected_interface;
|
||||||
|
@ -25,9 +26,15 @@ struct dibx000_i2c_master {
|
||||||
u16 base_reg;
|
u16 base_reg;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, struct i2c_adapter *i2c_adap, u8 i2c_addr);
|
extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst,
|
||||||
extern struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enum dibx000_i2c_interface intf, int gating);
|
u16 device_rev, struct i2c_adapter *i2c_adap,
|
||||||
|
u8 i2c_addr);
|
||||||
|
extern struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master
|
||||||
|
*mst,
|
||||||
|
enum dibx000_i2c_interface
|
||||||
|
intf, int gating);
|
||||||
extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst);
|
extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst);
|
||||||
|
extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst);
|
||||||
|
|
||||||
#define BAND_LBAND 0x01
|
#define BAND_LBAND 0x01
|
||||||
#define BAND_UHF 0x02
|
#define BAND_UHF 0x02
|
||||||
|
|
Loading…
Add table
Reference in a new issue