Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] dw2102: use separate firmwares for Prof 1100, TeVii S630, S660

Before this patch we can use only one card type from list due to
sharing one firmware name. Now it's fixed.
Also driver tries to attach only appropriate demod for this cards.

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Igor M. Liplianin and committed by
Mauro Carvalho Chehab
195288da feb16e98

+59 -15
+59 -15
drivers/media/dvb/dvb-usb/dw2102.c
··· 886 886 return -EIO; 887 887 } 888 888 889 - static int s6x0_frontend_attach(struct dvb_usb_adapter *d) 889 + static int zl100313_frontend_attach(struct dvb_usb_adapter *d) 890 890 { 891 891 d->fe = dvb_attach(mt312_attach, &zl313_config, 892 892 &d->dev->i2c_adap); ··· 899 899 } 900 900 } 901 901 902 + return -EIO; 903 + } 904 + 905 + static int stv0288_frontend_attach(struct dvb_usb_adapter *d) 906 + { 902 907 d->fe = dvb_attach(stv0288_attach, &earda_config, 903 908 &d->dev->i2c_adap); 904 909 if (d->fe != NULL) { ··· 915 910 } 916 911 } 917 912 913 + return -EIO; 914 + } 915 + 916 + static int ds3000_frontend_attach(struct dvb_usb_adapter *d) 917 + { 918 918 d->fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config, 919 919 &d->dev->i2c_adap); 920 920 if (d->fe != NULL) { ··· 1428 1418 .read_mac_address = s6x0_read_mac_address, 1429 1419 .adapter = { 1430 1420 { 1431 - .frontend_attach = s6x0_frontend_attach, 1421 + .frontend_attach = zl100313_frontend_attach, 1432 1422 .streaming_ctrl = NULL, 1433 1423 .tuner_attach = NULL, 1434 1424 .stream = { ··· 1443 1433 }, 1444 1434 } 1445 1435 }, 1446 - .num_device_descs = 3, 1436 + .num_device_descs = 1, 1447 1437 .devices = { 1448 1438 {"TeVii S630 USB", 1449 1439 {&dw2102_table[6], NULL}, 1450 1440 {NULL}, 1451 1441 }, 1452 - {"Prof 1100 USB ", 1453 - {&dw2102_table[7], NULL}, 1454 - {NULL}, 1455 - }, 1456 - {"TeVii S660 USB", 1457 - {&dw2102_table[8], NULL}, 1458 - {NULL}, 1459 - }, 1460 1442 } 1443 + }; 1444 + 1445 + struct dvb_usb_device_properties *p1100; 1446 + static struct dvb_usb_device_description d1100 = { 1447 + "Prof 1100 USB ", 1448 + {&dw2102_table[7], NULL}, 1449 + {NULL}, 1450 + }; 1451 + 1452 + struct dvb_usb_device_properties *s660; 1453 + static struct dvb_usb_device_description d660 = { 1454 + "TeVii S660 USB", 1455 + {&dw2102_table[8], NULL}, 1456 + {NULL}, 1461 1457 }; 1462 1458 1463 1459 struct dvb_usb_device_properties *p7500; ··· 1476 1460 static int dw2102_probe(struct usb_interface *intf, 1477 1461 const struct usb_device_id *id) 1478 1462 { 1479 - 1480 - p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); 1481 - if (!p7500) 1463 + p1100 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); 1464 + if (!p1100) 1482 1465 return -ENOMEM; 1483 1466 /* copy default structure */ 1484 - memcpy(p7500, &s6x0_properties, 1467 + memcpy(p1100, &s6x0_properties, 1485 1468 sizeof(struct dvb_usb_device_properties)); 1486 1469 /* fill only different fields */ 1470 + p1100->firmware = "dvb-usb-p1100.fw"; 1471 + p1100->devices[0] = d1100; 1472 + p1100->rc.legacy.rc_map_table = rc_map_tbs_table; 1473 + p1100->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table); 1474 + p1100->adapter->frontend_attach = stv0288_frontend_attach; 1475 + 1476 + s660 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); 1477 + if (!s660) { 1478 + kfree(p1100); 1479 + return -ENOMEM; 1480 + } 1481 + memcpy(s660, &s6x0_properties, 1482 + sizeof(struct dvb_usb_device_properties)); 1483 + s660->firmware = "dvb-usb-s660.fw"; 1484 + s660->devices[0] = d660; 1485 + s660->adapter->frontend_attach = ds3000_frontend_attach; 1486 + 1487 + p7500 = kzalloc(sizeof(struct dvb_usb_device_properties), GFP_KERNEL); 1488 + if (!p7500) { 1489 + kfree(p1100); 1490 + kfree(s660); 1491 + return -ENOMEM; 1492 + } 1493 + memcpy(p7500, &s6x0_properties, 1494 + sizeof(struct dvb_usb_device_properties)); 1487 1495 p7500->firmware = "dvb-usb-p7500.fw"; 1488 1496 p7500->devices[0] = d7500; 1489 1497 p7500->rc.legacy.rc_map_table = rc_map_tbs_table; ··· 1521 1481 0 == dvb_usb_device_init(intf, &dw3101_properties, 1522 1482 THIS_MODULE, NULL, adapter_nr) || 1523 1483 0 == dvb_usb_device_init(intf, &s6x0_properties, 1484 + THIS_MODULE, NULL, adapter_nr) || 1485 + 0 == dvb_usb_device_init(intf, p1100, 1486 + THIS_MODULE, NULL, adapter_nr) || 1487 + 0 == dvb_usb_device_init(intf, s660, 1524 1488 THIS_MODULE, NULL, adapter_nr) || 1525 1489 0 == dvb_usb_device_init(intf, p7500, 1526 1490 THIS_MODULE, NULL, adapter_nr))