aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c37
-rw-r--r--drivers/media/dvb/dvb-usb/it913x.c54
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c6
3 files changed, 79 insertions, 18 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 4555baa383b..0f64d718265 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -143,10 +143,12 @@ struct dvb_frontend_private {
143static void dvb_frontend_wakeup(struct dvb_frontend *fe); 143static void dvb_frontend_wakeup(struct dvb_frontend *fe);
144static int dtv_get_frontend(struct dvb_frontend *fe, 144static int dtv_get_frontend(struct dvb_frontend *fe,
145 struct dvb_frontend_parameters *p_out); 145 struct dvb_frontend_parameters *p_out);
146static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,
147 struct dvb_frontend_parameters *p);
146 148
147static bool has_get_frontend(struct dvb_frontend *fe) 149static bool has_get_frontend(struct dvb_frontend *fe)
148{ 150{
149 return fe->ops.get_frontend; 151 return fe->ops.get_frontend != NULL;
150} 152}
151 153
152/* 154/*
@@ -697,6 +699,7 @@ restart:
697 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; 699 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;
698 fepriv->delay = HZ / 2; 700 fepriv->delay = HZ / 2;
699 } 701 }
702 dtv_property_legacy_params_sync(fe, &fepriv->parameters_out);
700 fe->ops.read_status(fe, &s); 703 fe->ops.read_status(fe, &s);
701 if (s != fepriv->status) { 704 if (s != fepriv->status) {
702 dvb_frontend_add_event(fe, s); /* update event list */ 705 dvb_frontend_add_event(fe, s); /* update event list */
@@ -1443,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1443 __func__); 1446 __func__);
1444 return -EINVAL; 1447 return -EINVAL;
1445 } 1448 }
1449 /*
1450 * Get a delivery system that is compatible with DVBv3
1451 * NOTE: in order for this to work with softwares like Kaffeine that
1452 * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to
1453 * DVB-S, drivers that support both should put the SYS_DVBS entry
1454 * before the SYS_DVBS2, otherwise it won't switch back to DVB-S.
1455 * The real fix is that userspace applications should not use DVBv3
1456 * and not trust on calling FE_SET_FRONTEND to switch the delivery
1457 * system.
1458 */
1459 ncaps = 0;
1460 while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) {
1461 if (fe->ops.delsys[ncaps] == desired_system) {
1462 delsys = desired_system;
1463 break;
1464 }
1465 ncaps++;
1466 }
1467 if (delsys == SYS_UNDEFINED) {
1468 dprintk("%s() Couldn't find a delivery system that matches %d\n",
1469 __func__, desired_system);
1470 }
1446 } else { 1471 } else {
1447 /* 1472 /*
1448 * This is a DVBv5 call. So, it likely knows the supported 1473 * This is a DVBv5 call. So, it likely knows the supported
@@ -1491,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1491 __func__); 1516 __func__);
1492 return -EINVAL; 1517 return -EINVAL;
1493 } 1518 }
1494 c->delivery_system = delsys;
1495 } 1519 }
1496 1520
1521 c->delivery_system = delsys;
1522
1497 /* 1523 /*
1498 * The DVBv3 or DVBv5 call is requesting a different system. So, 1524 * The DVBv3 or DVBv5 call is requesting a different system. So,
1499 * emulation is needed. 1525 * emulation is needed.
@@ -1833,6 +1859,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
1833 return -EINVAL; 1859 return -EINVAL;
1834 1860
1835 /* 1861 /*
1862 * Initialize output parameters to match the values given by
1863 * the user. FE_SET_FRONTEND triggers an initial frontend event
1864 * with status = 0, which copies output parameters to userspace.
1865 */
1866 dtv_property_legacy_params_sync(fe, &fepriv->parameters_out);
1867
1868 /*
1836 * Be sure that the bandwidth will be filled for all 1869 * Be sure that the bandwidth will be filled for all
1837 * non-satellite systems, as tuners need to know what 1870 * non-satellite systems, as tuners need to know what
1838 * low pass/Nyquist half filter should be applied, in 1871 * low pass/Nyquist half filter should be applied, in
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c
index 3b7b102f20a..482d249ca7f 100644
--- a/drivers/media/dvb/dvb-usb/it913x.c
+++ b/drivers/media/dvb/dvb-usb/it913x.c
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg)
238 238
239static u32 it913x_query(struct usb_device *udev, u8 pro) 239static u32 it913x_query(struct usb_device *udev, u8 pro)
240{ 240{
241 int ret; 241 int ret, i;
242 u8 data[4]; 242 u8 data[4];
243 ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, 243 u8 ver;
244 0x1222, 0, &data[0], 3); 244
245 for (i = 0; i < 5; i++) {
246 ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,
247 0x1222, 0, &data[0], 3);
248 ver = data[0];
249 if (ver > 0 && ver < 3)
250 break;
251 msleep(100);
252 }
245 253
246 it913x_config.chip_ver = data[0]; 254 if (ver < 1 || ver > 2) {
255 info("Failed to identify chip version applying 1");
256 it913x_config.chip_ver = 0x1;
257 it913x_config.chip_type = 0x9135;
258 return 0;
259 }
260
261 it913x_config.chip_ver = ver;
247 it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; 262 it913x_config.chip_type = (u16)(data[2] << 8) + data[1];
248 263
249 info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, 264 info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver,
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev,
660 if ((packet_size > min_pkt) || (i == fw->size)) { 675 if ((packet_size > min_pkt) || (i == fw->size)) {
661 fw_data = (u8 *)(fw->data + pos); 676 fw_data = (u8 *)(fw->data + pos);
662 pos += packet_size; 677 pos += packet_size;
663 if (packet_size > 0) 678 if (packet_size > 0) {
664 ret |= it913x_io(udev, WRITE_DATA, 679 ret = it913x_io(udev, WRITE_DATA,
665 DEV_0, CMD_SCATTER_WRITE, 0, 680 DEV_0, CMD_SCATTER_WRITE, 0,
666 0, fw_data, packet_size); 681 0, fw_data, packet_size);
682 if (ret < 0)
683 break;
684 }
667 udelay(1000); 685 udelay(1000);
668 } 686 }
669 } 687 }
670 i++; 688 i++;
671 } 689 }
672 690
673 ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);
674
675 msleep(100);
676
677 if (ret < 0) 691 if (ret < 0)
678 info("FRM Firmware Download Failed (%04x)" , ret); 692 info("FRM Firmware Download Failed (%d)" , ret);
679 else 693 else
680 info("FRM Firmware Download Completed - Resetting Device"); 694 info("FRM Firmware Download Completed - Resetting Device");
681 695
682 ret |= it913x_return_status(udev); 696 msleep(30);
697
698 ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);
699 if (ret < 0)
700 info("FRM Device not responding to reboot");
701
702 ret = it913x_return_status(udev);
703 if (ret == 0) {
704 info("FRM Failed to reboot device");
705 return -ENODEV;
706 }
683 707
684 msleep(30); 708 msleep(30);
685 709
686 ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); 710 ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);
711
712 msleep(30);
687 713
688 /* Tuner function */ 714 /* Tuner function */
689 if (it913x_config.dual_mode) 715 if (it913x_config.dual_mode)
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver);
901 927
902MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 928MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
903MODULE_DESCRIPTION("it913x USB 2 Driver"); 929MODULE_DESCRIPTION("it913x USB 2 Driver");
904MODULE_VERSION("1.27"); 930MODULE_VERSION("1.28");
905MODULE_LICENSE("GPL"); 931MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 36d11756492..a414b1f2b6a 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state,
1520 dprintk(1, "\n"); 1520 dprintk(1, "\n");
1521 1521
1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || 1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) ||
1523 ((resultLen > 0) && (result == NULL))) 1523 ((resultLen > 0) && (result == NULL))) {
1524 goto error; 1524 printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
1525 return status;
1526 }
1525 1527
1526 mutex_lock(&state->mutex); 1528 mutex_lock(&state->mutex);
1527 1529