Commit 136cafbf authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab

V4L/DVB (4646): Misc. changes, DiB3000MC, MT2060

Changed the attach-function of the dib3000mc-driver to return only one
frontend. In case of multiple dib3000-chips on one board, one has to call the
i2c-enumeration manually before.
Added a field to Microtune 2060 config to output the clock to other
tuners/device on a board.
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 6870ab57
...@@ -37,5 +37,6 @@ dvb-usb-cxusb-objs = cxusb.o ...@@ -37,5 +37,6 @@ dvb-usb-cxusb-objs = cxusb.o
obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o
dvb-usb-dib0700-objs = dib0700_core.o dib0700_devices.o dvb-usb-dib0700-objs = dib0700_core.o dib0700_devices.o
obj-$(CONFIG_DVB_USB_DIB0700) += dvb-usb-dib0700.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
...@@ -230,8 +230,8 @@ static struct dib3000mc_config mod3000p_dib3000p_config = { ...@@ -230,8 +230,8 @@ static struct dib3000mc_config mod3000p_dib3000p_config = {
int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
{ {
if (dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0 || if ((adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000P_I2C_ADDRESS, &mod3000p_dib3000p_config)) == NULL ||
dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &adap->fe) == 0) { (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000MC_I2C_ADDRESS, &mod3000p_dib3000p_config)) == NULL) {
if (adap->priv != NULL) { if (adap->priv != NULL) {
struct dibusb_state *st = adap->priv; struct dibusb_state *st = adap->priv;
st->ops.pid_parse = dib3000mc_pid_parse; st->ops.pid_parse = dib3000mc_pid_parse;
...@@ -247,10 +247,9 @@ static struct mt2060_config stk3000p_mt2060_config = { ...@@ -247,10 +247,9 @@ static struct mt2060_config stk3000p_mt2060_config = {
0x60 0x60
}; };
int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap) int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
{ {
struct dibusb_state *st = adap->priv; struct dibusb_state *st = adap->priv;
int ret;
u8 a,b; u8 a,b;
u16 if1 = 1220; u16 if1 = 1220;
struct i2c_adapter *tun_i2c; struct i2c_adapter *tun_i2c;
...@@ -287,9 +286,9 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap) ...@@ -287,9 +286,9 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap)
} }
tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
if ((ret = mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) { if (dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk3000p_mt2060_config, if1) != NULL) {
/* not found - use panasonic pll parameters */ /* not found - use panasonic pll parameters */
if (dvb_pll_attach(adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) if (dvb_attach(dvb_pll_attach, adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL)
return -ENOMEM; return -ENOMEM;
} else { } else {
st->mt2060_present = 1; st->mt2060_present = 1;
......
...@@ -49,7 +49,6 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { ...@@ -49,7 +49,6 @@ static struct dvb_usb_device_properties dibusb_mc_properties = {
.usb_ctrl = CYPRESS_FX2, .usb_ctrl = CYPRESS_FX2,
.firmware = "dvb-usb-dibusb-6.0.0.8.fw", .firmware = "dvb-usb-dibusb-6.0.0.8.fw",
.num_adapters = 1, .num_adapters = 1,
.adapter = { .adapter = {
{ {
......
...@@ -24,9 +24,6 @@ static struct usb_cypress_controller cypress[] = { ...@@ -24,9 +24,6 @@ static struct usb_cypress_controller cypress[] = {
{ .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 },
}; };
static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
int *pos);
/* /*
* load a firmware packet to the device * load a firmware packet to the device
*/ */
...@@ -115,7 +112,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_pro ...@@ -115,7 +112,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_pro
return ret; return ret;
} }
static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
int *pos) int *pos)
{ {
u8 *b = (u8 *) &fw->data[*pos]; u8 *b = (u8 *) &fw->data[*pos];
...@@ -146,3 +143,4 @@ static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, ...@@ -146,3 +143,4 @@ static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
return *pos; return *pos;
} }
EXPORT_SYMBOL(dvb_usb_get_hexline);
...@@ -52,8 +52,7 @@ ...@@ -52,8 +52,7 @@
#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9
#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6
#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
#define USB_PID_DIBCOM_STK7700 0x1e14 #define USB_PID_DIBCOM_STK7700P 0x1e14
#define USB_PID_DIBCOM_STK7700_REENUM 0x1e15
#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131
#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
...@@ -95,6 +94,9 @@ ...@@ -95,6 +94,9 @@
#define USB_PID_WT220U_ZL0353_WARM 0x022b #define USB_PID_WT220U_ZL0353_WARM 0x022b
#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
#define USB_PID_HAUPPAUGE_NOVA_T_500 0x1234
#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x1234
#define USB_PID_AVERMEDIA_VOLAR 0x1234
#define USB_PID_NEBULA_DIGITV 0x0201 #define USB_PID_NEBULA_DIGITV 0x0201
#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820
#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500
......
...@@ -90,8 +90,8 @@ struct dvb_usb_adapter; ...@@ -90,8 +90,8 @@ struct dvb_usb_adapter;
struct usb_data_stream; struct usb_data_stream;
/** /**
* Properties of USB streaming - TODO this structure does not belong here actually * Properties of USB streaming - TODO this structure should be somewhere else
* describes the kind of USB transfer used for MPEG2-TS-streaming. * describes the kind of USB transfer used for data-streaming.
* (BULK or ISOC) * (BULK or ISOC)
*/ */
struct usb_data_stream_properties { struct usb_data_stream_properties {
...@@ -194,8 +194,8 @@ struct dvb_usb_device_properties { ...@@ -194,8 +194,8 @@ struct dvb_usb_device_properties {
#define CYPRESS_AN2235 2 #define CYPRESS_AN2235 2
#define CYPRESS_FX2 3 #define CYPRESS_FX2 3
int usb_ctrl; int usb_ctrl;
const char firmware[FIRMWARE_NAME_MAX];
int (*download_firmware) (struct usb_device *, const struct firmware *); int (*download_firmware) (struct usb_device *, const struct firmware *);
const char firmware[FIRMWARE_NAME_MAX];
int no_reconnect; int no_reconnect;
int size_of_priv; int size_of_priv;
...@@ -234,8 +234,6 @@ struct dvb_usb_device_properties { ...@@ -234,8 +234,6 @@ struct dvb_usb_device_properties {
* *
* @urbs_initialized: number of URBs initialized. * @urbs_initialized: number of URBs initialized.
* @urbs_submitted: number of URBs submitted. * @urbs_submitted: number of URBs submitted.
*
* TODO put this in the correct place.
*/ */
#define MAX_NO_URBS_FOR_DATA_STREAM 10 #define MAX_NO_URBS_FOR_DATA_STREAM 10
struct usb_data_stream { struct usb_data_stream {
...@@ -249,7 +247,6 @@ struct usb_data_stream { ...@@ -249,7 +247,6 @@ struct usb_data_stream {
void (*complete) (struct usb_data_stream *, u8 *, size_t); void (*complete) (struct usb_data_stream *, u8 *, size_t);
struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM];
int buf_num; int buf_num;
unsigned long buf_size; unsigned long buf_size;
u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM];
...@@ -271,8 +268,8 @@ struct usb_data_stream { ...@@ -271,8 +268,8 @@ struct usb_data_stream {
* @pll_addr: I2C address of the tuner for programming * @pll_addr: I2C address of the tuner for programming
* @pll_init: array containing the initialization buffer * @pll_init: array containing the initialization buffer
* @pll_desc: pointer to the appropriate struct dvb_pll_desc * @pll_desc: pointer to the appropriate struct dvb_pll_desc
*
* @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board
*
* @dvb_adap: device's dvb_adapter. * @dvb_adap: device's dvb_adapter.
* @dmxdev: device's dmxdev. * @dmxdev: device's dmxdev.
* @demux: device's software demuxer. * @demux: device's software demuxer.
...@@ -280,8 +277,10 @@ struct usb_data_stream { ...@@ -280,8 +277,10 @@ struct usb_data_stream {
* @dvb_frontend: device's frontend. * @dvb_frontend: device's frontend.
* @max_feed_count: how many feeds can be handled simultaneously by this * @max_feed_count: how many feeds can be handled simultaneously by this
* device * device
* @fe_sleep: rerouted frontend-sleep function. *
* @fe_init: rerouted frontend-init (wakeup) function. * @fe_init: rerouted frontend-init (wakeup) function.
* @fe_sleep: rerouted frontend-sleep function.
*
* @stream: the usb data stream. * @stream: the usb data stream.
*/ */
struct dvb_usb_adapter { struct dvb_usb_adapter {
...@@ -292,7 +291,7 @@ struct dvb_usb_adapter { ...@@ -292,7 +291,7 @@ struct dvb_usb_adapter {
#define DVB_USB_ADAP_STATE_DVB 0x001 #define DVB_USB_ADAP_STATE_DVB 0x001
int state; int state;
int id; u8 id;
int feedcount; int feedcount;
int pid_filtering; int pid_filtering;
...@@ -311,8 +310,8 @@ struct dvb_usb_adapter { ...@@ -311,8 +310,8 @@ struct dvb_usb_adapter {
struct dvb_frontend *fe; struct dvb_frontend *fe;
int max_feed_count; int max_feed_count;
int (*fe_sleep) (struct dvb_frontend *);
int (*fe_init) (struct dvb_frontend *); int (*fe_init) (struct dvb_frontend *);
int (*fe_sleep) (struct dvb_frontend *);
struct usb_data_stream stream; struct usb_data_stream stream;
...@@ -400,5 +399,7 @@ struct hexline { ...@@ -400,5 +399,7 @@ struct hexline {
u8 chk; u8 chk;
}; };
extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos);
#endif #endif
...@@ -122,7 +122,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num, ...@@ -122,7 +122,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num,
usb_free_stream_buffers(stream); usb_free_stream_buffers(stream);
return -ENOMEM; return -ENOMEM;
} }
deb_mem("buffer %d: %p (dma: %ld)\n", deb_mem("buffer %d: %p (dma: %u)\n",
stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]); stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]);
memset(stream->buf_list[stream->buf_num],0,size); memset(stream->buf_list[stream->buf_num],0,size);
stream->state |= USB_STATE_URB_BUF; stream->state |= USB_STATE_URB_BUF;
......
...@@ -584,56 +584,6 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dibx000_ofdm_channe ...@@ -584,56 +584,6 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dibx000_ofdm_channe
return 0; return 0;
} }
static int dib3000mc_demod_output_mode(struct dvb_frontend *demod, int mode)
{
struct dib3000mc_state *state = demod->demodulator_priv;
return dib3000mc_set_output_mode(state, mode);
}
static int dib3000mc_i2c_enumeration(struct dvb_frontend *demod[], int no_of_demods, u8 default_addr)
{
struct dib3000mc_state *st;
int k,ret=0;
u8 new_addr;
static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
for (k = no_of_demods-1; k >= 0; k--) {
st = demod[k]->demodulator_priv;
/* designated i2c address */
new_addr = DIB3000MC_I2C_ADDRESS[k];
st->i2c_addr = new_addr;
if (dib3000mc_identify(st) != 0) {
st->i2c_addr = default_addr;
if (dib3000mc_identify(st) != 0) {
dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
return -EINVAL;
}
}
/* turn on div_out */
dib3000mc_demod_output_mode(demod[k], OUTMODE_MPEG2_PAR_CONT_CLK);
// set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
ret |= dib3000mc_write_word(st, 1024, (new_addr << 3) | 0x1);
st->i2c_addr = new_addr;
}
for (k = 0; k < no_of_demods; k++) {
st = demod[k]->demodulator_priv;
ret |= dib3000mc_write_word(st, 1024, st->i2c_addr << 3);
/* turn off data output */
dib3000mc_demod_output_mode(demod[k],OUTMODE_HIGH_Z);
dib3000mc_write_word(st, 769, (1 << 7) );
}
return 0;
}
struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating) struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating)
{ {
struct dib3000mc_state *st = demod->demodulator_priv; struct dib3000mc_state *st = demod->demodulator_priv;
...@@ -826,61 +776,76 @@ void dib3000mc_set_config(struct dvb_frontend *fe, struct dib3000mc_config *cfg) ...@@ -826,61 +776,76 @@ void dib3000mc_set_config(struct dvb_frontend *fe, struct dib3000mc_config *cfg)
} }
EXPORT_SYMBOL(dib3000mc_set_config); EXPORT_SYMBOL(dib3000mc_set_config);
static struct dvb_frontend_ops dib3000mc_ops; int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[])
int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[])
{ {
struct dib3000mc_state *st; struct dib3000mc_state st = { .i2c_adap = i2c };
int k, num=0; int k;
u8 new_addr;
if (no_of_demods < 1) static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
return -EINVAL;
for (k = no_of_demods-1; k >= 0; k--) {
st.cfg = &cfg[k];
/* designated i2c address */
new_addr = DIB3000MC_I2C_ADDRESS[k];
st.i2c_addr = new_addr;
if (dib3000mc_identify(&st) != 0) {
st.i2c_addr = default_addr;
if (dib3000mc_identify(&st) != 0) {
dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
return -ENODEV;
}
}
dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK);
// set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1);
st.i2c_addr = new_addr;
}
for (k = 0; k < no_of_demods; k++) { for (k = 0; k < no_of_demods; k++) {
st.cfg = &cfg[k];
st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
dib3000mc_write_word(&st, 1024, st.i2c_addr << 3);
/* turn off data output */
dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z);
}
return 0;
}
EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
static struct dvb_frontend_ops dib3000mc_ops;
struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg)
{
struct dvb_frontend *demod;
struct dib3000mc_state *st;
st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
if (st == NULL) if (st == NULL)
goto error; return NULL;
num++; st->cfg = cfg;
st->cfg = &cfg[k];
// st->gpio_val = cfg[k].gpio_val;
// st->gpio_dir = cfg[k].gpio_dir;
st->i2c_adap = i2c_adap; st->i2c_adap = i2c_adap;
demod[k] = &st->demod; demod = &st->demod;
demod[k]->demodulator_priv = st; demod->demodulator_priv = st;
memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
// INIT_COMPONENT_REGISTER_ACCESS(&st->register_access, 12, 16, dib7000p_register_read, dib7000p_register_write, st);
// demod[k]->register_access = &st->register_access;
}
if (do_i2c_enum) {
if (dib3000mc_i2c_enumeration(demod,no_of_demods,default_addr) != 0)
goto error;
} else {
st = demod[0]->demodulator_priv;
st->i2c_addr = default_addr;
if (dib3000mc_identify(st) != 0) if (dib3000mc_identify(st) != 0)
goto error; goto error;
}
for (k = 0; k < num; k++) {
st = demod[k]->demodulator_priv;
dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr); dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr);
}
return 0; return demod;
error: error:
for (k = 0; k < num; k++) { kfree(st);
kfree(demod[k]->demodulator_priv); return NULL;
demod[k] = NULL;
}
return -EINVAL;
} }
EXPORT_SYMBOL(dib3000mc_attach); EXPORT_SYMBOL(dib3000mc_attach);
static struct dvb_frontend_ops dib3000mc_ops = { static struct dvb_frontend_ops dib3000mc_ops = {
......
...@@ -37,17 +37,17 @@ struct dib3000mc_config { ...@@ -37,17 +37,17 @@ struct dib3000mc_config {
#define DEFAULT_DIB3000P_I2C_ADDRESS 24 #define DEFAULT_DIB3000P_I2C_ADDRESS 24
#if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE) #if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE)
extern int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, extern struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg);
u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[]);
#else #else
static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg)
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return NULL; return NULL;
} }
#endif // CONFIG_DVB_DIB3000MC #endif // CONFIG_DVB_DIB3000MC
extern int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]);
extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating); extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating);
extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff); extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff);
......
...@@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv) ...@@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv)
if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2))) if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2)))
return; return;
/* initialize the clock output */
mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
do { do {
b |= (1 << 6); // FM1SS; b |= (1 << 6); // FM1SS;
mt2060_writereg(priv, REG_LO2C1,b); mt2060_writereg(priv, REG_LO2C1,b);
...@@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) ...@@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
static int mt2060_init(struct dvb_frontend *fe) static int mt2060_init(struct dvb_frontend *fe)
{ {
struct mt2060_priv *priv = fe->tuner_priv; struct mt2060_priv *priv = fe->tuner_priv;
return mt2060_writereg(priv, REG_VGAG,0x33); return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33);
} }
static int mt2060_sleep(struct dvb_frontend *fe) static int mt2060_sleep(struct dvb_frontend *fe)
{ {
struct mt2060_priv *priv = fe->tuner_priv; struct mt2060_priv *priv = fe->tuner_priv;
return mt2060_writereg(priv, REG_VGAG,0x30); return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
} }
static int mt2060_release(struct dvb_frontend *fe) static int mt2060_release(struct dvb_frontend *fe)
......
...@@ -27,7 +27,7 @@ struct i2c_adapter; ...@@ -27,7 +27,7 @@ struct i2c_adapter;
struct mt2060_config { struct mt2060_config {
u8 i2c_address; u8 i2c_address;
/* Shall we add settings for the discrete outputs ? */ u8 clock_out; /* 0 = off, 1 = CLK/1, 2 = CLK/2, 3 = CLK/4 */
}; };
extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
......
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