diff options
author | Istvan Varga <istvan_v@mailbox.hu> | 2011-06-04 11:04:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:52:36 -0400 |
commit | 027fd361860e40736c0ad093a8f4194d727afb63 (patch) | |
tree | 4183af8c26bf70bbaf70a642f2d4912defcc4846 /drivers | |
parent | 5272f6b1f423d4ce636dc90f190e245897bdb045 (diff) |
[media] xc4000: firmware initialization
This patch fixes/cleans up the loading of the firmware file when the
driver is loaded and initialized.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/common/tuners/xc4000.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index c373f4b36f5a..ec5f1f1b3f3c 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c | |||
@@ -1400,21 +1400,8 @@ static int xc4000_sleep(struct dvb_frontend *fe) | |||
1400 | 1400 | ||
1401 | static int xc4000_init(struct dvb_frontend *fe) | 1401 | static int xc4000_init(struct dvb_frontend *fe) |
1402 | { | 1402 | { |
1403 | struct xc4000_priv *priv = fe->tuner_priv; | ||
1404 | int ret; | ||
1405 | dprintk(1, "%s()\n", __func__); | 1403 | dprintk(1, "%s()\n", __func__); |
1406 | 1404 | ||
1407 | mutex_lock(&priv->lock); | ||
1408 | ret = check_firmware(fe, DTV8, 0, priv->if_khz); | ||
1409 | mutex_unlock(&priv->lock); | ||
1410 | if (ret != XC_RESULT_SUCCESS) { | ||
1411 | printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); | ||
1412 | return -EREMOTEIO; | ||
1413 | } | ||
1414 | |||
1415 | if (debug) | ||
1416 | xc_debug_dump(priv); | ||
1417 | |||
1418 | return 0; | 1405 | return 0; |
1419 | } | 1406 | } |
1420 | 1407 | ||
@@ -1511,8 +1498,14 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1511 | instance of the driver has loaded the firmware. | 1498 | instance of the driver has loaded the firmware. |
1512 | */ | 1499 | */ |
1513 | 1500 | ||
1514 | if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) | 1501 | if (instance == 1) { |
1502 | if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) | ||
1503 | != XC_RESULT_SUCCESS) | ||
1515 | goto fail; | 1504 | goto fail; |
1505 | } else { | ||
1506 | id = ((priv->cur_fw.type & BASE) != 0 ? | ||
1507 | priv->hwmodel : XC_PRODUCT_ID_FW_NOT_LOADED); | ||
1508 | } | ||
1516 | 1509 | ||
1517 | switch (id) { | 1510 | switch (id) { |
1518 | case XC_PRODUCT_ID_FW_LOADED: | 1511 | case XC_PRODUCT_ID_FW_LOADED: |
@@ -1541,16 +1534,19 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1541 | memcpy(&fe->ops.tuner_ops, &xc4000_tuner_ops, | 1534 | memcpy(&fe->ops.tuner_ops, &xc4000_tuner_ops, |
1542 | sizeof(struct dvb_tuner_ops)); | 1535 | sizeof(struct dvb_tuner_ops)); |
1543 | 1536 | ||
1544 | /* FIXME: For now, load the firmware at startup. We will remove this | 1537 | if (instance == 1) { |
1545 | before the code goes to production... */ | 1538 | int ret; |
1546 | mutex_lock(&priv->lock); | 1539 | mutex_lock(&priv->lock); |
1547 | check_firmware(fe, DTV8, 0, priv->if_khz); | 1540 | ret = xc4000_fwupload(fe); |
1548 | mutex_unlock(&priv->lock); | 1541 | mutex_unlock(&priv->lock); |
1542 | if (ret != XC_RESULT_SUCCESS) | ||
1543 | goto fail2; | ||
1544 | } | ||
1549 | 1545 | ||
1550 | return fe; | 1546 | return fe; |
1551 | fail: | 1547 | fail: |
1552 | mutex_unlock(&xc4000_list_mutex); | 1548 | mutex_unlock(&xc4000_list_mutex); |
1553 | 1549 | fail2: | |
1554 | xc4000_release(fe); | 1550 | xc4000_release(fe); |
1555 | return NULL; | 1551 | return NULL; |
1556 | } | 1552 | } |