diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-common.c | 11 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dibusb-mc.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 6 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb.h | 41 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/usb-urb.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 147 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.h | 8 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.c | 7 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/mt2060.h | 2 |
11 files changed, 100 insertions, 132 deletions
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 275cbc2925c..e239107998e 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile @@ -37,5 +37,6 @@ dvb-usb-cxusb-objs = cxusb.o obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.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/ diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 5f8afec96a3..b4d6e539ff5 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -230,8 +230,8 @@ static struct dib3000mc_config mod3000p_dib3000p_config = { 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 || - dib3000mc_attach(&adap->dev->i2c_adap, 1, DEFAULT_DIB3000MC_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 || + (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000MC_I2C_ADDRESS, &mod3000p_dib3000p_config)) == NULL) { if (adap->priv != NULL) { struct dibusb_state *st = adap->priv; st->ops.pid_parse = dib3000mc_pid_parse; @@ -247,10 +247,9 @@ static struct mt2060_config stk3000p_mt2060_config = { 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; - int ret; u8 a,b; u16 if1 = 1220; struct i2c_adapter *tun_i2c; @@ -287,9 +286,9 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *adap) } 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 */ - 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; } else { st->mt2060_present = 1; diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index d823e7d5b26..a0fd37efc04 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -49,7 +49,6 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-dibusb-6.0.0.8.fw", - .num_adapters = 1, .adapter = { { diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c index 122ff8157d1..e1112e39fb6 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c @@ -24,9 +24,6 @@ static struct usb_cypress_controller cypress[] = { { .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 */ @@ -115,7 +112,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_pro 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) { u8 *b = (u8 *) &fw->data[*pos]; @@ -146,3 +143,4 @@ static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, return *pos; } +EXPORT_SYMBOL(dvb_usb_get_hexline); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 57a10de1d3d..feb098727dc 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -52,8 +52,7 @@ #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 -#define USB_PID_DIBCOM_STK7700 0x1e14 -#define USB_PID_DIBCOM_STK7700_REENUM 0x1e15 +#define USB_PID_DIBCOM_STK7700P 0x1e14 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 @@ -95,6 +94,9 @@ #define USB_PID_WT220U_ZL0353_WARM 0x022b #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 #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_DVICO_BLUEBIRD_LGDT 0xd820 #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 5546554d387..44b49db4992 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -90,8 +90,8 @@ struct dvb_usb_adapter; struct usb_data_stream; /** - * Properties of USB streaming - TODO this structure does not belong here actually - * describes the kind of USB transfer used for MPEG2-TS-streaming. + * Properties of USB streaming - TODO this structure should be somewhere else + * describes the kind of USB transfer used for data-streaming. * (BULK or ISOC) */ struct usb_data_stream_properties { @@ -193,10 +193,10 @@ struct dvb_usb_device_properties { #define CYPRESS_AN2135 1 #define CYPRESS_AN2235 2 #define CYPRESS_FX2 3 - int usb_ctrl; + int usb_ctrl; + int (*download_firmware) (struct usb_device *, const struct firmware *); const char firmware[FIRMWARE_NAME_MAX]; - int (*download_firmware) (struct usb_device *, const struct firmware *); - int no_reconnect; + int no_reconnect; int size_of_priv; @@ -212,7 +212,7 @@ struct dvb_usb_device_properties { #define REMOTE_NO_KEY_PRESSED 0x00 #define REMOTE_KEY_PRESSED 0x01 #define REMOTE_KEY_REPEAT 0x02 - struct dvb_usb_rc_key *rc_key_map; + struct dvb_usb_rc_key *rc_key_map; int rc_key_map_size; int (*rc_query) (struct dvb_usb_device *, u32 *, int *); int rc_interval; @@ -234,13 +234,11 @@ struct dvb_usb_device_properties { * * @urbs_initialized: number of URBs initialized. * @urbs_submitted: number of URBs submitted. - * - * TODO put this in the correct place. */ #define MAX_NO_URBS_FOR_DATA_STREAM 10 struct usb_data_stream { - struct usb_device *udev; - struct usb_data_stream_properties props; + struct usb_device *udev; + struct usb_data_stream_properties props; #define USB_STATE_INIT 0x00 #define USB_STATE_URB_BUF 0x01 @@ -248,12 +246,11 @@ struct usb_data_stream { void (*complete) (struct usb_data_stream *, u8 *, size_t); - struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; - - int buf_num; - unsigned long buf_size; - u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; - dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; + struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; + int buf_num; + unsigned long buf_size; + u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; + dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; int urbs_initialized; int urbs_submitted; @@ -271,8 +268,8 @@ struct usb_data_stream { * @pll_addr: I2C address of the tuner for programming * @pll_init: array containing the initialization buffer * @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 + * * @dvb_adap: device's dvb_adapter. * @dmxdev: device's dmxdev. * @demux: device's software demuxer. @@ -280,8 +277,10 @@ struct usb_data_stream { * @dvb_frontend: device's frontend. * @max_feed_count: how many feeds can be handled simultaneously by this * device + * + * @fe_init: rerouted frontend-init (wakeup) function. * @fe_sleep: rerouted frontend-sleep function. - * @fe_init: rerouted frontend-init (wakeup) function. + * * @stream: the usb data stream. */ struct dvb_usb_adapter { @@ -292,7 +291,7 @@ struct dvb_usb_adapter { #define DVB_USB_ADAP_STATE_DVB 0x001 int state; - int id; + u8 id; int feedcount; int pid_filtering; @@ -311,8 +310,8 @@ struct dvb_usb_adapter { struct dvb_frontend *fe; int max_feed_count; - int (*fe_sleep) (struct dvb_frontend *); int (*fe_init) (struct dvb_frontend *); + int (*fe_sleep) (struct dvb_frontend *); struct usb_data_stream stream; @@ -400,5 +399,7 @@ struct hexline { u8 chk; }; 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 diff --git a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c index f2f3bb6044a..8728cf347a7 100644 --- a/drivers/media/dvb/dvb-usb/usb-urb.c +++ b/drivers/media/dvb/dvb-usb/usb-urb.c @@ -122,7 +122,7 @@ static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num, usb_free_stream_buffers(stream); 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]); memset(stream->buf_list[stream->buf_num],0,size); stream->state |= USB_STATE_URB_BUF; diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index cc28417fa33..d7c4a98da12 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -584,56 +584,6 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dibx000_ofdm_channe 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 dib3000mc_state *st = demod->demodulator_priv; @@ -826,61 +776,76 @@ void dib3000mc_set_config(struct dvb_frontend *fe, struct dib3000mc_config *cfg) } EXPORT_SYMBOL(dib3000mc_set_config); -static struct dvb_frontend_ops dib3000mc_ops; - -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[]) +int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]) { - struct dib3000mc_state *st; - int k, num=0; - - if (no_of_demods < 1) - return -EINVAL; + struct dib3000mc_state st = { .i2c_adap = i2c }; + int k; + u8 new_addr; - for (k = 0; k < no_of_demods; k++) { - st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); - if (st == NULL) - goto error; + static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26}; - num++; + for (k = no_of_demods-1; k >= 0; k--) { + st.cfg = &cfg[k]; - st->cfg = &cfg[k]; - // st->gpio_val = cfg[k].gpio_val; - // st->gpio_dir = cfg[k].gpio_dir; - st->i2c_adap = i2c_adap; + /* 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; + } + } - demod[k] = &st->demod; - demod[k]->demodulator_priv = st; - memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); + dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK); -// INIT_COMPONENT_REGISTER_ACCESS(&st->register_access, 12, 16, dib7000p_register_read, dib7000p_register_write, st); -// demod[k]->register_access = &st->register_access; + // 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; } - 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) - goto error; - } + for (k = 0; k < no_of_demods; k++) { + st.cfg = &cfg[k]; + st.i2c_addr = DIB3000MC_I2C_ADDRESS[k]; - 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); - } + 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); + if (st == NULL) + return NULL; + + st->cfg = cfg; + st->i2c_adap = i2c_adap; + + demod = &st->demod; + demod->demodulator_priv = st; + memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops)); + + if (dib3000mc_identify(st) != 0) + goto error; + + dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr); + + return demod; error: - for (k = 0; k < num; k++) { - kfree(demod[k]->demodulator_priv); - demod[k] = NULL; - } - return -EINVAL; + kfree(st); + return NULL; } - EXPORT_SYMBOL(dib3000mc_attach); static struct dvb_frontend_ops dib3000mc_ops = { diff --git a/drivers/media/dvb/frontends/dib3000mc.h b/drivers/media/dvb/frontends/dib3000mc.h index fd0b2e75599..b198cd5b184 100644 --- a/drivers/media/dvb/frontends/dib3000mc.h +++ b/drivers/media/dvb/frontends/dib3000mc.h @@ -37,17 +37,17 @@ struct dib3000mc_config { #define DEFAULT_DIB3000P_I2C_ADDRESS 24 #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, - u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[]); +extern struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg); #else -static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, - struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) +static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); return NULL; } #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 int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff); diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c index 508ec1b6d1f..19bd66a1816 100644 --- a/drivers/media/dvb/frontends/mt2060.c +++ b/drivers/media/dvb/frontends/mt2060.c @@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv) if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2))) return; + /* initialize the clock output */ + mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30); + do { b |= (1 << 6); // FM1SS; mt2060_writereg(priv, REG_LO2C1,b); @@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) static int mt2060_init(struct dvb_frontend *fe) { 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) { 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) diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h index c58b03e8234..471d3326e29 100644 --- a/drivers/media/dvb/frontends/mt2060.h +++ b/drivers/media/dvb/frontends/mt2060.h @@ -27,7 +27,7 @@ struct i2c_adapter; struct mt2060_config { 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); |