diff options
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/au0828/Kconfig | 2 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-cards.c | 1 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-core.c | 26 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828-i2c.c | 6 | ||||
-rw-r--r-- | drivers/media/video/au0828/au0828.h | 8 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 6 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-cards.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 32 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 21 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.c | 28 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-devattr.h | 22 | ||||
-rw-r--r-- | drivers/media/video/tuner-core.c | 92 | ||||
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 2 | ||||
-rw-r--r-- | drivers/media/video/vivi.c | 2 |
19 files changed, 149 insertions, 110 deletions
diff --git a/drivers/media/video/au0828/Kconfig b/drivers/media/video/au0828/Kconfig index c97c4bd24841..41708267e7a4 100644 --- a/drivers/media/video/au0828/Kconfig +++ b/drivers/media/video/au0828/Kconfig @@ -1,7 +1,7 @@ config VIDEO_AU0828 tristate "Auvitek AU0828 support" - depends on VIDEO_DEV && I2C && INPUT + depends on VIDEO_DEV && I2C && INPUT && DVB_CORE select I2C_ALGOBIT select DVB_AU8522 if !DVB_FE_CUSTOMIZE select DVB_TUNER_XC5000 if !DVB_FE_CUSTOMIZE diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 8ca91f814277..a2a6983444fa 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c @@ -36,7 +36,6 @@ struct au0828_board au0828_boards[] = { .name = "DViCO FusionHDTV USB", }, }; -const unsigned int au0828_bcount = ARRAY_SIZE(au0828_boards); /* Tuner callback function for au0828 boards. Currently only needed * for HVR1500Q, which has an xc5000 tuner. diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c index e65d5642cb1d..54bfc0f05295 100644 --- a/drivers/media/video/au0828/au0828-core.c +++ b/drivers/media/video/au0828/au0828-core.c @@ -32,18 +32,10 @@ * 4 = I2C related * 8 = Bridge related */ -unsigned int debug; -module_param(debug, int, 0644); +int au0828_debug; +module_param_named(debug, au0828_debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); -unsigned int usb_debug; -module_param(usb_debug, int, 0644); -MODULE_PARM_DESC(usb_debug, "enable usb debug messages"); - -unsigned int bridge_debug; -module_param(bridge_debug, int, 0644); -MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages"); - #define _AU0828_BULKPIPE 0x03 #define _BULKPIPESIZE 0xffff @@ -229,24 +221,18 @@ static int __init au0828_init(void) { int ret; - if (debug) + if (au0828_debug & 1) printk(KERN_INFO "%s() Debugging is enabled\n", __func__); - if (usb_debug) { + if (au0828_debug & 2) printk(KERN_INFO "%s() USB Debugging is enabled\n", __func__); - debug |= 2; - } - if (i2c_debug) { + if (au0828_debug & 4) printk(KERN_INFO "%s() I2C Debugging is enabled\n", __func__); - debug |= 4; - } - if (bridge_debug) { + if (au0828_debug & 8) printk(KERN_INFO "%s() Bridge Debugging is enabled\n", __func__); - debug |= 8; - } printk(KERN_INFO "au0828 driver loaded\n"); diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c index 85d0ae9a322f..5040d7fc4af5 100644 --- a/drivers/media/video/au0828/au0828-dvb.c +++ b/drivers/media/video/au0828/au0828-dvb.c @@ -204,7 +204,7 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed) return ret; } -int dvb_register(struct au0828_dev *dev) +static int dvb_register(struct au0828_dev *dev) { struct au0828_dvb *dvb = &dev->dvb; int result; diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c index 94c8b74a6651..741a4937b050 100644 --- a/drivers/media/video/au0828/au0828-i2c.c +++ b/drivers/media/video/au0828/au0828-i2c.c @@ -29,11 +29,7 @@ #include <media/v4l2-common.h> -unsigned int i2c_debug; -module_param(i2c_debug, int, 0444); -MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); - -unsigned int i2c_scan; +static int i2c_scan; module_param(i2c_scan, int, 0444); MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h index 0200b9fc5dc4..7beb571798e5 100644 --- a/drivers/media/video/au0828/au0828.h +++ b/drivers/media/video/au0828/au0828.h @@ -96,15 +96,12 @@ struct au0828_buff { /* au0828-core.c */ extern u32 au0828_read(struct au0828_dev *dev, u16 reg); extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val); -extern unsigned int debug; -extern unsigned int usb_debug; -extern unsigned int bridge_debug; +extern int au0828_debug; /* ----------------------------------------------------------- */ /* au0828-cards.c */ extern struct au0828_board au0828_boards[]; extern struct usb_device_id au0828_usb_id_table[]; -extern const unsigned int au0828_bcount; extern void au0828_gpio_setup(struct au0828_dev *dev); extern int au0828_tuner_callback(void *priv, int command, int arg); extern void au0828_card_setup(struct au0828_dev *dev); @@ -115,7 +112,6 @@ extern int au0828_i2c_register(struct au0828_dev *dev); extern int au0828_i2c_unregister(struct au0828_dev *dev); extern void au0828_call_i2c_clients(struct au0828_dev *dev, unsigned int cmd, void *arg); -extern unsigned int i2c_debug; /* ----------------------------------------------------------- */ /* au0828-dvb.c */ @@ -123,6 +119,6 @@ extern int au0828_dvb_register(struct au0828_dev *dev); extern void au0828_dvb_unregister(struct au0828_dev *dev); #define dprintk(level, fmt, arg...)\ - do { if (debug & level)\ + do { if (au0828_debug & level)\ printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ } while (0) diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 870d6e197d65..f05649727b60 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c @@ -191,7 +191,7 @@ static struct tda18271_config hauppauge_hvr1200_tuner_config = { .gate = TDA18271_GATE_ANALOG, }; -struct dibx000_agc_config xc3028_agc_config = { +static struct dibx000_agc_config xc3028_agc_config = { BAND_VHF | BAND_UHF, /* band_caps */ /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, @@ -237,7 +237,7 @@ struct dibx000_agc_config xc3028_agc_config = { /* PLL Configuration for COFDM BW_MHz = 8.000000 * With external clock = 30.000000 */ -struct dibx000_bandwidth_config xc3028_bw_config = { +static struct dibx000_bandwidth_config xc3028_bw_config = { 60000, /* internal */ 30000, /* sampling */ 1, /* pll_cfg: prediv */ diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index bcf6d9ba063d..27635cdcbaf2 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -58,6 +58,7 @@ config VIDEO_CX88_DVB select DVB_CX24123 if !DVB_FE_CUSTOMISE select DVB_ISL6421 if !DVB_FE_CUSTOMISE select TUNER_SIMPLE if !DVB_FE_CUSTOMISE + select DVB_S5H1411 if !DVB_FE_CUSTOMISE ---help--- This adds support for DVB/ATSC cards based on the Conexant 2388x chip. diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 61c4f72644b8..6c0c94c5ef91 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -546,10 +546,12 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) if (retval < 0) return retval; - dev->mailbox = blackbird_find_mailbox(dev); - if (dev->mailbox < 0) + retval = blackbird_find_mailbox(dev); + if (retval < 0) return -1; + dev->mailbox = retval; + retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */ if (retval < 0) { dprintk(0, "ERROR: Firmware ping failed!\n"); diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 620159d05506..2b6b283cda15 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -1591,6 +1591,7 @@ static const struct cx88_board cx88_boards[] = { .vmux = 2, .gpio0 = 0x16d9, }}, + .mpeg = CX88_MPEG_DVB, }, [CX88_BOARD_PROLINK_PV_8000GT] = { .name = "Prolink Pixelview MPEG 8000GT", diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index f1251b844e08..1c7fe6862a60 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -47,6 +47,7 @@ #include "isl6421.h" #include "tuner-simple.h" #include "tda9887.h" +#include "s5h1411.h" MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); @@ -463,6 +464,22 @@ static struct zl10353_config cx88_geniatech_x8000_mt = { .no_tuner = 1, }; +static struct s5h1411_config dvico_fusionhdtv7_config = { + .output_mode = S5H1411_SERIAL_OUTPUT, + .gpio = S5H1411_GPIO_ON, + .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, + .qam_if = S5H1411_IF_44000, + .vsb_if = S5H1411_IF_44000, + .inversion = S5H1411_INVERSION_OFF, + .status_mode = S5H1411_DEMODLOCKING +}; + +static struct xc5000_config dvico_fusionhdtv7_tuner_config = { + .i2c_address = 0xc2 >> 1, + .if_khz = 5380, + .tuner_callback = cx88_tuner_callback, +}; + static int attach_xc3028(u8 addr, struct cx8802_dev *dev) { struct dvb_frontend *fe; @@ -844,6 +861,21 @@ static int dvb_register(struct cx8802_dev *dev) if (attach_xc3028(0x61, dev) < 0) return -EINVAL; break; + case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: + dev->dvb.frontend = dvb_attach(s5h1411_attach, + &dvico_fusionhdtv7_config, + &dev->core->i2c_adap); + if (dev->dvb.frontend != NULL) { + /* tuner_config.video_dev must point to + * i2c_adap.algo_data + */ + dvico_fusionhdtv7_tuner_config.priv = + dev->core->i2c_adap.algo_data; + dvb_attach(xc5000_attach, dev->dvb.frontend, + &dev->core->i2c_adap, + &dvico_fusionhdtv7_tuner_config); + } + break; default: printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", dev->core->name); diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index f8c41d8c74c4..5d837c16ee22 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -650,7 +650,7 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs, GFP_KERNEL); - if (!dev->isoc_ctl.urb) { + if (!dev->isoc_ctl.transfer_buffer) { em28xx_errdev("cannot allocate memory for usbtransfer\n"); kfree(dev->isoc_ctl.urb); return -ENOMEM; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 11c5fdedc23b..7b65f5e537f8 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -509,8 +509,11 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; static const int probe_cx23885[] = { 0x6b, -1 }; const int *probe; - struct i2c_client *c; - unsigned char buf; + struct i2c_msg msg = { + .flags = I2C_M_RD, + .len = 0, + .buf = NULL, + }; int i, rc; switch (adap->id) { @@ -536,23 +539,17 @@ static int ir_probe(struct i2c_adapter *adap) return 0; } - c = kzalloc(sizeof(*c), GFP_KERNEL); - if (!c) - return -ENOMEM; - - c->adapter = adap; for (i = 0; -1 != probe[i]; i++) { - c->addr = probe[i]; - rc = i2c_master_recv(c, &buf, 0); + msg.addr = probe[i]; + rc = i2c_transfer(adap, &msg, 1); dprintk(1,"probe 0x%02x @ %s: %s\n", probe[i], adap->name, - (0 == rc) ? "yes" : "no"); - if (0 == rc) { + (1 == rc) ? "yes" : "no"); + if (1 == rc) { ir_attach(adap, probe[i], 0, 0); break; } } - kfree(c); return 0; } diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig index a8da90f69dd9..158b3d0c6532 100644 --- a/drivers/media/video/pvrusb2/Kconfig +++ b/drivers/media/video/pvrusb2/Kconfig @@ -64,6 +64,7 @@ config VIDEO_PVRUSB2_DVB depends on VIDEO_PVRUSB2 && DVB_CORE && EXPERIMENTAL select DVB_LGDT330X if !DVB_FE_CUSTOMISE select DVB_S5H1409 if !DVB_FE_CUSTOMISE + select DVB_S5H1411 if !DVB_FE_CUSTOMISE select DVB_TDA10048 if !DVB_FE_CUSTOMIZE select DVB_TDA18271 if !DVB_FE_CUSTOMIZE select TUNER_SIMPLE if !DVB_FE_CUSTOMISE diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c index 2dd06a90adce..3a141d93e1a9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c @@ -36,6 +36,7 @@ pvr2_device_desc structures. #include "pvrusb2-hdw-internal.h" #include "lgdt330x.h" #include "s5h1409.h" +#include "s5h1411.h" #include "tda10048.h" #include "tda18271.h" #include "tda8290.h" @@ -368,6 +369,15 @@ static struct s5h1409_config pvr2_s5h1409_config = { .status_mode = S5H1409_DEMODLOCKING, }; +static struct s5h1411_config pvr2_s5h1411_config = { + .output_mode = S5H1411_PARALLEL_OUTPUT, + .gpio = S5H1411_GPIO_OFF, + .vsb_if = S5H1411_IF_44000, + .qam_if = S5H1411_IF_4000, + .inversion = S5H1411_INVERSION_ON, + .status_mode = S5H1411_DEMODLOCKING, +}; + static struct tda18271_std_map hauppauge_tda18271_std_map = { .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3, .if_lvl = 6, .rfagc_top = 0x37, }, @@ -390,6 +400,16 @@ static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap) return -EIO; } +static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap) +{ + adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config, + &adap->channel.hdw->i2c_adap); + if (adap->fe) + return 0; + + return -EIO; +} + static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap) { dvb_attach(tda829x_attach, adap->fe, @@ -406,6 +426,11 @@ struct pvr2_dvb_props pvr2_750xx_dvb_props = { .frontend_attach = pvr2_s5h1409_attach, .tuner_attach = pvr2_tda18271_8295_attach, }; + +struct pvr2_dvb_props pvr2_751xx_dvb_props = { + .frontend_attach = pvr2_s5h1411_attach, + .tuner_attach = pvr2_tda18271_8295_attach, +}; #endif static const char *pvr2_client_75xxx[] = { @@ -454,6 +479,9 @@ static const struct pvr2_device_desc pvr2_device_751xx = { .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, .default_std_mask = V4L2_STD_NTSC_M, .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, +#ifdef CONFIG_VIDEO_PVRUSB2_DVB + .dvb_props = &pvr2_751xx_dvb_props, +#endif }; diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h index c2e2b06fe2e0..d016f8b6c70b 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h +++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h @@ -104,28 +104,28 @@ struct pvr2_device_desc { unsigned char digital_control_scheme; /* If set, we don't bother trying to load cx23416 firmware. */ - int flag_skip_cx23416_firmware:1; + unsigned int flag_skip_cx23416_firmware:1; /* If set, the encoder must be healthy in order for digital mode to work (otherwise we assume that digital streaming will work even if we fail to locate firmware for the encoder). If the device doesn't support digital streaming then this flag has no effect. */ - int flag_digital_requires_cx23416:1; + unsigned int flag_digital_requires_cx23416:1; /* Device has a hauppauge eeprom which we can interrogate. */ - int flag_has_hauppauge_rom:1; + unsigned int flag_has_hauppauge_rom:1; /* Device does not require a powerup command to be issued. */ - int flag_no_powerup:1; + unsigned int flag_no_powerup:1; /* Device has a cx25840 - this enables special additional logic to handle it. */ - int flag_has_cx25840:1; + unsigned int flag_has_cx25840:1; /* Device has a wm8775 - this enables special additional logic to ensure that it is found. */ - int flag_has_wm8775:1; + unsigned int flag_has_wm8775:1; /* Device has IR hardware that can be faked into looking like a normal Hauppauge i2c IR receiver. This is currently very @@ -135,15 +135,15 @@ struct pvr2_device_desc { to virtualize the presence of the non-existant IR receiver chip and implement the virtual receiver in terms of appropriate FX2 commands. */ - int flag_has_hauppauge_custom_ir:1; + unsigned int flag_has_hauppauge_custom_ir:1; /* These bits define which kinds of sources the device can handle. Note: Digital tuner presence is inferred by the digital_control_scheme enumeration. */ - int flag_has_fmradio:1; /* Has FM radio receiver */ - int flag_has_analogtuner:1; /* Has analog tuner */ - int flag_has_composite:1; /* Has composite input */ - int flag_has_svideo:1; /* Has s-video input */ + unsigned int flag_has_fmradio:1; /* Has FM radio receiver */ + unsigned int flag_has_analogtuner:1; /* Has analog tuner */ + unsigned int flag_has_composite:1; /* Has composite input */ + unsigned int flag_has_svideo:1; /* Has s-video input */ }; extern struct usb_device_id pvr2_device_table[]; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 529e00952a8d..2b72e10e6b9f 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -369,19 +369,13 @@ static void set_type(struct i2c_client *c, unsigned int type, break; } case TUNER_TEA5767: - if (tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!tea5767_attach(&t->fe, t->i2c->adapter, t->i2c->addr)) + goto attach_failed; t->mode_mask = T_RADIO; break; case TUNER_TEA5761: - if (tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr) == NULL) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!tea5761_attach(&t->fe, t->i2c->adapter, t->i2c->addr)) + goto attach_failed; t->mode_mask = T_RADIO; break; case TUNER_PHILIPS_FMD1216ME_MK3: @@ -394,12 +388,9 @@ static void set_type(struct i2c_client *c, unsigned int type, buffer[2] = 0x86; buffer[3] = 0x54; i2c_master_send(c, buffer, 4); - if (simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, - t->type) == NULL) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, + t->type)) + goto attach_failed; break; case TUNER_PHILIPS_TD1316: buffer[0] = 0x0b; @@ -407,12 +398,9 @@ static void set_type(struct i2c_client *c, unsigned int type, buffer[2] = 0x86; buffer[3] = 0xa4; i2c_master_send(c,buffer,4); - if (simple_tuner_attach(&t->fe, t->i2c->adapter, - t->i2c->addr, t->type) == NULL) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!simple_tuner_attach(&t->fe, t->i2c->adapter, + t->i2c->addr, t->type)) + goto attach_failed; break; case TUNER_XC2028: { @@ -421,40 +409,34 @@ static void set_type(struct i2c_client *c, unsigned int type, .i2c_addr = t->i2c->addr, .callback = t->tuner_callback, }; - if (!xc2028_attach(&t->fe, &cfg)) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!xc2028_attach(&t->fe, &cfg)) + goto attach_failed; break; } case TUNER_TDA9887: tda9887_attach(&t->fe, t->i2c->adapter, t->i2c->addr); break; case TUNER_XC5000: + { + struct dvb_tuner_ops *xc_tuner_ops; + xc5000_cfg.i2c_address = t->i2c->addr; xc5000_cfg.if_khz = 5380; xc5000_cfg.priv = c->adapter->algo_data; xc5000_cfg.tuner_callback = t->tuner_callback; - if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg)) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } - { - struct dvb_tuner_ops *xc_tuner_ops; + if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg)) + goto attach_failed; + xc_tuner_ops = &t->fe.ops.tuner_ops; - if(xc_tuner_ops->init != NULL) + if (xc_tuner_ops->init) xc_tuner_ops->init(&t->fe); - } break; + } default: - if (simple_tuner_attach(&t->fe, t->i2c->adapter, - t->i2c->addr, t->type) == NULL) { - t->type = TUNER_ABSENT; - t->mode_mask = T_UNINITIALIZED; - return; - } + if (!simple_tuner_attach(&t->fe, t->i2c->adapter, + t->i2c->addr, t->type)) + goto attach_failed; + break; } @@ -476,11 +458,27 @@ static void set_type(struct i2c_client *c, unsigned int type, if (t->mode_mask == T_UNINITIALIZED) t->mode_mask = new_mode_mask; - set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq); + /* xc2028/3028 and xc5000 requires a firmware to be set-up later + trying to set a frequency here will just fail + FIXME: better to move set_freq to the tuner code. This is needed + on analog tuners for PLL to properly work + */ + if (t->type != TUNER_XC2028 && t->type != TUNER_XC5000) + set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? + t->radio_freq : t->tv_freq); + tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", c->adapter->name, c->driver->driver.name, c->addr << 1, type, t->mode_mask); tuner_i2c_address_check(t); + return; + +attach_failed: + tuner_dbg("Tuner attach for type = %d failed.\n", t->type); + t->type = TUNER_ABSENT; + t->mode_mask = T_UNINITIALIZED; + + return; } /* @@ -495,14 +493,16 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) { struct tuner *t = i2c_get_clientdata(c); - tuner_dbg("set addr for type %i\n", t->type); - if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) && (t->mode_mask & tun_setup->mode_mask))) || (tun_setup->addr == c->addr)) { set_type(c, tun_setup->type, tun_setup->mode_mask, tun_setup->config, tun_setup->tuner_callback); - } + } else + tuner_dbg("set addr discarded for type %i, mask %x. " + "Asked to change tuner at addr 0x%02x, with mask %x\n", + t->type, t->mode_mask, + tun_setup->addr, tun_setup->mode_mask); } static inline int check_mode(struct tuner *t, char *cmd) diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index cc3db7d79a0d..9e9003cffc7f 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c @@ -432,7 +432,7 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, type &= type_mask; - if (!type & SCODE) + if (!(type & SCODE)) type_mask = ~0; /* Seek for exact match */ diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index b1e9592acb90..845be1864f68 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -888,7 +888,7 @@ static int vivi_open(struct inode *inode, struct file *file) { int minor = iminor(inode); struct vivi_dev *dev; - struct vivi_fh *fh; + struct vivi_fh *fh = NULL; int i; int retval = 0; |