V4L/DVB (8555): au8522: add mechanism to configure IF frequency for vsb and qam
Add a mechanism to configure IF frequency for vsb and qam. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
bef69ea0dc
commit
2e7acd75cb
@ -304,6 +304,70 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 3.25 MHz IF Frequency table */
|
||||||
|
static struct {
|
||||||
|
u16 reg;
|
||||||
|
u16 data;
|
||||||
|
} if_3_25_mhz_tab[] = {
|
||||||
|
{ 0x80b5, 0x00 },
|
||||||
|
{ 0x80b6, 0x3d },
|
||||||
|
{ 0x80b7, 0xa0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 4.00 MHz IF Frequency table */
|
||||||
|
static struct {
|
||||||
|
u16 reg;
|
||||||
|
u16 data;
|
||||||
|
} if_4_mhz_tab[] = {
|
||||||
|
{ 0x80b5, 0x00 },
|
||||||
|
{ 0x80b6, 0x4b },
|
||||||
|
{ 0x80b7, 0xd9 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 6.00 MHz IF Frequency table */
|
||||||
|
static struct {
|
||||||
|
u16 reg;
|
||||||
|
u16 data;
|
||||||
|
} if_6_mhz_tab[] = {
|
||||||
|
{ 0x80b5, 0xfb },
|
||||||
|
{ 0x80b6, 0x8e },
|
||||||
|
{ 0x80b7, 0x39 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq)
|
||||||
|
{
|
||||||
|
struct au8522_state *state = fe->demodulator_priv;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
switch (if_freq) {
|
||||||
|
case AU8522_IF_3_25MHZ:
|
||||||
|
dprintk("%s() 3.25 MHz\n", __func__);
|
||||||
|
for (i = 0; i < ARRAY_SIZE(if_3_25_mhz_tab); i++)
|
||||||
|
au8522_writereg(state,
|
||||||
|
if_3_25_mhz_tab[i].reg,
|
||||||
|
if_3_25_mhz_tab[i].data);
|
||||||
|
break;
|
||||||
|
case AU8522_IF_4MHZ:
|
||||||
|
dprintk("%s() 4.00 MHz\n", __func__);
|
||||||
|
for (i = 0; i < ARRAY_SIZE(if_4_mhz_tab); i++)
|
||||||
|
au8522_writereg(state,
|
||||||
|
if_4_mhz_tab[i].reg,
|
||||||
|
if_4_mhz_tab[i].data);
|
||||||
|
break;
|
||||||
|
case AU8522_IF_6MHZ:
|
||||||
|
dprintk("%s() 6.00 MHz\n", __func__);
|
||||||
|
for (i = 0; i < ARRAY_SIZE(if_6_mhz_tab); i++)
|
||||||
|
au8522_writereg(state,
|
||||||
|
if_6_mhz_tab[i].reg,
|
||||||
|
if_6_mhz_tab[i].data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dprintk("%s() IF Frequency not supported\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* VSB Modulation table */
|
/* VSB Modulation table */
|
||||||
static struct {
|
static struct {
|
||||||
u16 reg;
|
u16 reg;
|
||||||
@ -438,6 +502,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe,
|
|||||||
au8522_writereg(state,
|
au8522_writereg(state,
|
||||||
VSB_mod_tab[i].reg,
|
VSB_mod_tab[i].reg,
|
||||||
VSB_mod_tab[i].data);
|
VSB_mod_tab[i].data);
|
||||||
|
au8522_set_if(fe, state->config->vsb_if);
|
||||||
break;
|
break;
|
||||||
case QAM_64:
|
case QAM_64:
|
||||||
case QAM_256:
|
case QAM_256:
|
||||||
@ -446,6 +511,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe,
|
|||||||
au8522_writereg(state,
|
au8522_writereg(state,
|
||||||
QAM_mod_tab[i].reg,
|
QAM_mod_tab[i].reg,
|
||||||
QAM_mod_tab[i].data);
|
QAM_mod_tab[i].data);
|
||||||
|
au8522_set_if(fe, state->config->qam_if);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dprintk("%s() Invalid modulation\n", __func__);
|
dprintk("%s() Invalid modulation\n", __func__);
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
|
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
|
|
||||||
|
enum au8522_if_freq {
|
||||||
|
AU8522_IF_6MHZ = 0,
|
||||||
|
AU8522_IF_4MHZ,
|
||||||
|
AU8522_IF_3_25MHZ,
|
||||||
|
};
|
||||||
|
|
||||||
struct au8522_config {
|
struct au8522_config {
|
||||||
/* the demodulator's i2c address */
|
/* the demodulator's i2c address */
|
||||||
u8 demod_address;
|
u8 demod_address;
|
||||||
@ -32,6 +38,9 @@ struct au8522_config {
|
|||||||
#define AU8522_TUNERLOCKING 0
|
#define AU8522_TUNERLOCKING 0
|
||||||
#define AU8522_DEMODLOCKING 1
|
#define AU8522_DEMODLOCKING 1
|
||||||
u8 status_mode;
|
u8 status_mode;
|
||||||
|
|
||||||
|
enum au8522_if_freq vsb_if;
|
||||||
|
enum au8522_if_freq qam_if;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_DVB_AU8522) || \
|
#if defined(CONFIG_DVB_AU8522) || \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user