diff options
Diffstat (limited to 'drivers/media/dvb')
25 files changed, 321 insertions, 58 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop.c b/drivers/media/dvb/b2c2/flexcop.c index 123ed96f6faa..56ba52470676 100644 --- a/drivers/media/dvb/b2c2/flexcop.c +++ b/drivers/media/dvb/b2c2/flexcop.c @@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300); struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) { void *bus; - struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL); + struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL); if (!fc) { err("no memory"); return NULL; } - memset(fc, 0, sizeof(struct flexcop_device)); - bus = kmalloc(bus_specific_len, GFP_KERNEL); + bus = kzalloc(bus_specific_len, GFP_KERNEL); if (!bus) { err("no memory"); kfree(fc); return NULL; } - memset(bus, 0, bus_specific_len); fc->bus_specific = bus; diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 01b4e0aac049..f65f64b00ff3 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev) struct pci_dev* bttv_pci_dev; int ret; - if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) + if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) return -ENOMEM; - memset(card, 0, sizeof(*card)); init_MUTEX(&card->lock); card->bttv_nr = sub->core->nr; strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 4bb779aeff6a..00347a750681 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, return -EINVAL; /* initialise the system data */ - if ((ca = - (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private), - GFP_KERNEL)) == NULL) { + if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) { ret = -ENOMEM; goto error; } - memset(ca, 0, sizeof(struct dvb_ca_private)); ca->pub = pubca; ca->flags = flags; ca->slot_count = slot_count; - if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) { + if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) { ret = -ENOMEM; goto error; } - memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count); init_waitqueue_head(&ca->wait_queue); ca->thread_pid = 0; init_waitqueue_head(&ca->thread_queue); diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4a08c4ab6730..771f32d889e6 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1024,13 +1024,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb, if (down_interruptible (&frontend_mutex)) return -ERESTARTSYS; - fe->frontend_priv = kmalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); + fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); if (fe->frontend_priv == NULL) { up(&frontend_mutex); return -ENOMEM; } fepriv = fe->frontend_priv; - memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private)); init_MUTEX (&fepriv->sem); init_waitqueue_head (&fepriv->wait_queue); diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 358ed153865f..18d169836c9c 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -253,6 +253,26 @@ static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) return 0; } +static int cxusb_mt352_demod_init(struct dvb_frontend* fe) +{ /* used in both lgz201 and th7579 */ + static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; + static u8 reset [] = { RESET, 0x80 }; + static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; + static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; + static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 }; + static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 }; + + mt352_write(fe, clock_config, sizeof(clock_config)); + udelay(200); + mt352_write(fe, reset, sizeof(reset)); + mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); + + mt352_write(fe, agc_cfg, sizeof(agc_cfg)); + mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); + mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); + return 0; +} + struct cx22702_config cxusb_cx22702_config = { .demod_address = 0x63, @@ -274,6 +294,13 @@ struct mt352_config cxusb_dee1601_config = { .pll_set = dvb_usb_pll_set, }; +struct mt352_config cxusb_mt352_config = { + /* used in both lgz201 and th7579 */ + .demod_address = 0x0f, + .demod_init = cxusb_mt352_demod_init, + .pll_set = dvb_usb_pll_set, +}; + /* Callbacks for DVB USB */ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d) { @@ -302,6 +329,20 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d) return 0; } +static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d) +{ + d->pll_addr = 0x61; + d->pll_desc = &dvb_pll_lg_z201; + return 0; +} + +static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d) +{ + d->pll_addr = 0x60; + d->pll_desc = &dvb_pll_thomson_dtt7579; + return 0; +} + static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d) { u8 b; @@ -329,6 +370,19 @@ static int cxusb_lgdt330x_frontend_attach(struct dvb_usb_device *d) return -EIO; } +static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d) +{ /* used in both lgz201 and th7579 */ + if (usb_set_interface(d->udev,0,0) < 0) + err("set interface failed"); + + cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); + + if ((d->fe = mt352_attach(&cxusb_mt352_config, &d->i2c_adap)) != NULL) + return 0; + + return -EIO; +} + static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d) { if (usb_set_interface(d->udev,0,0) < 0) @@ -370,13 +424,17 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const static struct dvb_usb_properties cxusb_medion_properties; static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; static struct dvb_usb_properties cxusb_bluebird_dee1601_properties; +static struct dvb_usb_properties cxusb_bluebird_lgz201_properties; +static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties; static int cxusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || - dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0) { + dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 || + dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 || + dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0) { return 0; } @@ -389,6 +447,12 @@ static struct usb_device_id cxusb_table [] = { { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) }, { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) }, + { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) }, {} /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, cxusb_table); @@ -505,12 +569,96 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { } }, - .num_device_descs = 1, + .num_device_descs = 2, .devices = { { "DViCO FusionHDTV DVB-T Dual USB", { &cxusb_table[3], NULL }, { &cxusb_table[4], NULL }, }, + { "DigitalNow DVB-T Dual USB", + { &cxusb_table[9], NULL }, + { &cxusb_table[10], NULL }, + }, + } +}; + +static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + + .usb_ctrl = DEVICE_SPECIFIC, + .firmware = "dvb-usb-bluebird-01.fw", + .download_firmware = bluebird_patch_dvico_firmware_download, + /* use usb alt setting 0 for EP4 transfer (dvb-t), + use usb alt setting 7 for EP2 transfer (atsc) */ + + .size_of_priv = sizeof(struct cxusb_state), + + .streaming_ctrl = cxusb_streaming_ctrl, + .power_ctrl = cxusb_power_ctrl, + .frontend_attach = cxusb_mt352_frontend_attach, + .tuner_attach = cxusb_lgz201_tuner_attach, + + .i2c_algo = &cxusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_BULK, + .count = 5, + .endpoint = 0x04, + .u = { + .bulk = { + .buffersize = 8192, + } + } + }, + + .num_device_descs = 1, + .devices = { + { "DViCO FusionHDTV DVB-T USB (LGZ201)", + { &cxusb_table[5], NULL }, + { &cxusb_table[6], NULL }, + }, + } +}; + +static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + + .usb_ctrl = DEVICE_SPECIFIC, + .firmware = "dvb-usb-bluebird-01.fw", + .download_firmware = bluebird_patch_dvico_firmware_download, + /* use usb alt setting 0 for EP4 transfer (dvb-t), + use usb alt setting 7 for EP2 transfer (atsc) */ + + .size_of_priv = sizeof(struct cxusb_state), + + .streaming_ctrl = cxusb_streaming_ctrl, + .power_ctrl = cxusb_power_ctrl, + .frontend_attach = cxusb_mt352_frontend_attach, + .tuner_attach = cxusb_dtt7579_tuner_attach, + + .i2c_algo = &cxusb_i2c_algo, + + .generic_bulk_ctrl_endpoint = 0x01, + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_BULK, + .count = 5, + .endpoint = 0x04, + .u = { + .bulk = { + .buffersize = 8192, + } + } + }, + + .num_device_descs = 1, + .devices = { + { "DViCO FusionHDTV DVB-T USB (TH7579)", + { &cxusb_table[7], NULL }, + { &cxusb_table[8], NULL }, + }, } }; diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 0a94ec22aeb8..cd21ddbfd054 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c @@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) struct dtt200u_fe_state* state = NULL; /* allocate memory for the internal state */ - state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dtt200u_fe_state)); deb_info("attaching frontend dtt200u\n"); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index d22934383226..4a1b9e77e339 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -95,6 +95,8 @@ #define USB_PID_DVICO_BLUEBIRD_TH7579_WARM 0xdb11 #define USB_PID_DVICO_BLUEBIRD_DEE1601_COLD 0xdb50 #define USB_PID_DVICO_BLUEBIRD_DEE1601_WARM 0xdb51 +#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD 0xdb54 +#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM 0xdb55 #define USB_PID_MEDION_MD95700 0x0932 #define USB_PID_KYE_DVB_T_COLD 0x701e #define USB_PID_KYE_DVB_T_WARM 0x701f diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 2e23060cbbca..716f8bf528cd 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c @@ -154,12 +154,11 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties } info("found a '%s' in warm state.",desc->name); - d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); + d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); if (d == NULL) { err("no memory for 'struct dvb_usb_device'"); return ret; } - memset(d,0,sizeof(struct dvb_usb_device)); d->udev = udev; memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); @@ -167,13 +166,12 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties d->owner = owner; if (d->props.size_of_priv > 0) { - d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); + d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); if (d->priv == NULL) { err("no memory for priv in 'struct dvb_usb_device'"); kfree(d); return -ENOMEM; } - memset(d->priv,0,d->props.size_of_priv); } usb_set_intfdata(intf, d); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 36b7048c02d2..ee821974dc60 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -175,15 +175,13 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un deb_mem("all in all I will use %lu bytes for streaming\n",num*size); - if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL) + if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL) return -ENOMEM; - if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { + if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) { kfree(d->buf_list); return -ENOMEM; } - memset(d->buf_list,0,num*sizeof(u8 *)); - memset(d->dma_addr,0,num*sizeof(dma_addr_t)); d->state |= DVB_USB_STATE_URB_BUF; @@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d) usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); /* allocate the array for the data transfer URBs */ - d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); + d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); if (d->urb_list == NULL) return -ENOMEM; - memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); d->state |= DVB_USB_STATE_URB_LIST; switch (d->props.urb.type) { diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c index 0885d9fb2bf2..b6d95e1c9c52 100644 --- a/drivers/media/dvb/dvb-usb/vp702x-fe.c +++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c @@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops; struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) { - struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); + struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp702x_fe_state)); s->d = d; s->fe.ops = &vp702x_fe_ops; diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c index 83f1de1e7e57..5242cca5db4a 100644 --- a/drivers/media/dvb/dvb-usb/vp7045-fe.c +++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c @@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops; struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) { - struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); + struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); if (s == NULL) goto error; - memset(s,0,sizeof(struct vp7045_fe_state)); s->d = d; s->fe.ops = &vp7045_fe_ops; diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c index 3b132bafd4de..caaee893ca76 100644 --- a/drivers/media/dvb/frontends/bcm3510.c +++ b/drivers/media/dvb/frontends/bcm3510.c @@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, bcm3510_register_value v; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); + state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct bcm3510_state)); /* setup the state */ diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 6b0553608610..ae589adb1c0a 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c @@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, struct dib3000_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dib3000_state)); /* setup the state */ state->i2c = i2c; diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index c024fad17337..3b303dbb6156 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, u16 devid; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(struct dib3000_state)); /* setup the state */ state->i2c = i2c; diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index a3d57ce9dd12..757075f007c1 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c @@ -345,6 +345,23 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = { }; EXPORT_SYMBOL(dvb_pll_tbmv30111in); +/* + * Philips SD1878 Tuner. + */ +struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = { + .name = "Philips SD1878", + .min = 950000, + .max = 2150000, + .count = 4, + .entries = { + { 1250000, 499, 500, 0xc4, 0x00}, + { 1550000, 499, 500, 0xc4, 0x40}, + { 2050000, 499, 500, 0xc4, 0x80}, + { 2150000, 499, 500, 0xc4, 0xc0}, + }, +}; +EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261); + /* ----------------------------------------------------------- */ /* code */ diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index 24d4d2e9acd8..f682c09189b3 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h @@ -39,6 +39,7 @@ extern struct dvb_pll_desc dvb_pll_tded4; extern struct dvb_pll_desc dvb_pll_tuv1236d; extern struct dvb_pll_desc dvb_pll_tdhu2; extern struct dvb_pll_desc dvb_pll_tbmv30111in; +extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261; int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, u32 freq, int bandwidth); diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 9d214643b87a..4691ac54bc1d 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -714,10 +714,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, u8 buf[1]; /* Allocate memory for the internal state */ - state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); + state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* Setup the state */ state->config = config; diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index f0c610f2c2df..aaaec909ddf8 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c @@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, struct mt352_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL); + state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* setup the state */ state->i2c = i2c; diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index aeafef46e3eb..78d2b93d35b9 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c @@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, u8 buf [] = {0,0,0,0,0}; /* allocate memory for the internal state */ - state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL); + state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL); if (state == NULL) goto error; - memset(state,0,sizeof(*state)); /* setup the state */ state->config = config; diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index bbebd1c4caca..1c5316e209ef 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c @@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, struct dmx_demux *dmx; int ret = -ENOMEM; - pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL); + pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL); if (!pluto) goto out; - memset(pluto, 0, sizeof(struct pluto)); pluto->pdev = pdev; ret = pci_enable_device(pdev); diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 8ce4146f55f1..327a8089193b 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d } /* prepare the av7110 device struct */ - av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL); + av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL); if (!av7110) { dprintk(1, "out of memory\n"); return -ENOMEM; } - memset(av7110, 0, sizeof(struct av7110)); - av7110->card_name = (char*) pci_ext->ext_priv; av7110->dev = dev; dev->ext_priv = av7110; diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index f9d00452e639..1465c04e49aa 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c @@ -37,6 +37,7 @@ #include "stv0299.h" #include "tda10021.h" #include "tda1004x.h" +#include "dvb-pll.h" #include <media/saa7146_vv.h> #include <linux/module.h> #include <linux/errno.h> @@ -864,8 +865,117 @@ static struct tda1004x_config philips_tu1216_config = { .request_firmware = philips_tu1216_request_firmware, }; +static u8 philips_sd1878_inittab[] = { + 0x01, 0x15, + 0x02, 0x30, + 0x03, 0x00, + 0x04, 0x7d, + 0x05, 0x35, + 0x06, 0x40, + 0x07, 0x00, + 0x08, 0x43, + 0x09, 0x02, + 0x0C, 0x51, + 0x0D, 0x82, + 0x0E, 0x23, + 0x10, 0x3f, + 0x11, 0x84, + 0x12, 0xb9, + 0x15, 0xc9, + 0x16, 0x19, + 0x17, 0x8c, + 0x18, 0x59, + 0x19, 0xf8, + 0x1a, 0xfe, + 0x1c, 0x7f, + 0x1d, 0x00, + 0x1e, 0x00, + 0x1f, 0x50, + 0x20, 0x00, + 0x21, 0x00, + 0x22, 0x00, + 0x23, 0x00, + 0x28, 0x00, + 0x29, 0x28, + 0x2a, 0x14, + 0x2b, 0x0f, + 0x2c, 0x09, + 0x2d, 0x09, + 0x31, 0x1f, + 0x32, 0x19, + 0x33, 0xfc, + 0x34, 0x93, + 0xff, 0xff +}; + +static int philips_sd1878_tda8261_pll_set(struct dvb_frontend *fe, + struct i2c_adapter *i2c, + struct dvb_frontend_parameters *params) +{ + u8 buf[4]; + int rc; + struct i2c_msg tuner_msg = {.addr=0x60,.flags=0,.buf=buf,.len=sizeof(buf)}; + + if((params->frequency < 950000) || (params->frequency > 2150000)) + return -EINVAL; + + rc=dvb_pll_configure(&dvb_pll_philips_sd1878_tda8261, buf, + params->frequency, 0); + if(rc < 0) return rc; + + if(i2c_transfer(i2c, &tuner_msg, 1) != 1) + return -EIO; + + return 0; +} + +static int philips_sd1878_ci_set_symbol_rate(struct dvb_frontend *fe, + u32 srate, u32 ratio) +{ + u8 aclk = 0; + u8 bclk = 0; + u8 m1; + + aclk = 0xb5; + if (srate < 2000000) + bclk = 0x86; + else if (srate < 5000000) + bclk = 0x89; + else if (srate < 15000000) + bclk = 0x8f; + else if (srate < 45000000) + bclk = 0x95; + + m1 = 0x14; + if (srate < 4000000) + m1 = 0x10; + + stv0299_writereg(fe, 0x0e, 0x23); + stv0299_writereg(fe, 0x0f, 0x94); + stv0299_writereg(fe, 0x10, 0x39); + stv0299_writereg(fe, 0x13, aclk); + stv0299_writereg(fe, 0x14, bclk); + stv0299_writereg(fe, 0x15, 0xc9); + stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); + stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); + stv0299_writereg(fe, 0x21, (ratio) & 0xf0); + stv0299_writereg(fe, 0x0f, 0x80 | m1); + return 0; +} +static struct stv0299_config philips_sd1878_config = { + .demod_address = 0x68, + .inittab = philips_sd1878_inittab, + .mclk = 88000000UL, + .invert = 0, + .skip_reinit = 0, + .lock_output = STV0229_LOCKOUTPUT_1, + .volt13_op0_op1 = STV0299_VOLT13_OP0, + .min_delay_ms = 100, + .set_symbol_rate = philips_sd1878_ci_set_symbol_rate, + .pll_set = philips_sd1878_tda8261_pll_set, +}; static u8 read_pwm(struct budget_av *budget_av) { @@ -886,7 +996,10 @@ static u8 read_pwm(struct budget_av *budget_av) #define SUBID_DVBS_KNC1_PLUS 0x0011 #define SUBID_DVBS_TYPHOON 0x4f56 #define SUBID_DVBS_CINERGY1200 0x1154 +#define SUBID_DVBS_CYNERGY1200N 0x1155 +#define SUBID_DVBS_TV_STAR 0x0014 +#define SUBID_DVBS_TV_STAR_CI 0x0016 #define SUBID_DVBC_KNC1 0x0020 #define SUBID_DVBC_KNC1_PLUS 0x0021 #define SUBID_DVBC_CINERGY1200 0x1156 @@ -922,6 +1035,13 @@ static void frontend_init(struct budget_av *budget_av) } break; + case SUBID_DVBS_TV_STAR: + case SUBID_DVBS_TV_STAR_CI: + case SUBID_DVBS_CYNERGY1200N: + fe = stv0299_attach(&philips_sd1878_config, + &budget_av->budget.i2c_adap); + break; + case SUBID_DVBS_KNC1_PLUS: case SUBID_DVBS_TYPHOON: fe = stv0299_attach(&typhoon_config, @@ -1027,11 +1147,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio dprintk(2, "dev: %p\n", dev); - if (!(budget_av = kmalloc(sizeof(struct budget_av), GFP_KERNEL))) + if (!(budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL))) return -ENOMEM; - memset(budget_av, 0, sizeof(struct budget_av)); - budget_av->has_saa7113 = 0; budget_av->budget.ci_present = 0; @@ -1166,10 +1284,12 @@ static struct saa7146_extension budget_extension; MAKE_BUDGET_INFO(knc1s, "KNC1 DVB-S", BUDGET_KNC1S); MAKE_BUDGET_INFO(knc1c, "KNC1 DVB-C", BUDGET_KNC1C); MAKE_BUDGET_INFO(knc1t, "KNC1 DVB-T", BUDGET_KNC1T); +MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR); MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); +MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); @@ -1178,11 +1298,14 @@ static struct pci_device_id pci_tbl[] = { MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x0010), MAKE_EXTENSION_PCI(knc1s, 0x1894, 0x0010), MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), + MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014), + MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016), MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), + MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), { diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h index c8d48cfba277..c7bb63c4d98d 100644 --- a/drivers/media/dvb/ttpci/budget.h +++ b/drivers/media/dvb/ttpci/budget.h @@ -95,6 +95,7 @@ static struct saa7146_pci_extension_data x_var = { \ #define BUDGET_KNC1SP 11 #define BUDGET_KNC1CP 12 #define BUDGET_KNC1TP 13 +#define BUDGET_TVSTAR 14 #define BUDGET_VIDEO_PORTA 0 #define BUDGET_VIDEO_PORTB 1 diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 104df610dbe1..5a13c4744f61 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -1489,11 +1489,9 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; - if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL))) + if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL))) return -ENOMEM; - memset(ttusb, 0, sizeof(struct ttusb)); - ttusb->dev = udev; ttusb->c = 0; ttusb->mux_state = 0; diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index d8966d1d25ee..df831171e03c 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf, udev = interface_to_usbdev(intf); - if (!(dec = kmalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { + if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { printk("%s: couldn't allocate memory.\n", __FUNCTION__); return -ENOMEM; } usb_set_intfdata(intf, (void *)dec); - memset(dec, 0, sizeof(struct ttusb_dec)); - switch (le16_to_cpu(id->idProduct)) { case 0x1006: ttusb_dec_set_model(dec, TTUSB_DEC3000S); |