diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2009-07-27 22:51:54 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:52:29 -0400 |
commit | ee4c3cd67b90cb42143e230485d3aad60768c551 (patch) | |
tree | a7197c277a2dbcbd754e014cba3f5ec991baf5c3 /drivers/media/common/tuners/xc4000.c | |
parent | d0962382cf6ca55e5a33413b39a10fe2f56bae78 (diff) |
[media] xc4000: continued cleanup of the firmware loading routine
Properly setup the standard firmware loading and scode loading, as well as
getting rid of a ton of dead code. Note that I am getting a single i2c
error when the standard firmware sets the video standard, but everything else
seems to be loading properly now.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r-- | drivers/media/common/tuners/xc4000.c | 180 |
1 files changed, 44 insertions, 136 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c index 19973887312a..65d07ebcd2c9 100644 --- a/drivers/media/common/tuners/xc4000.c +++ b/drivers/media/common/tuners/xc4000.c | |||
@@ -108,23 +108,21 @@ struct xc4000_priv { | |||
108 | 108 | ||
109 | /* Product id */ | 109 | /* Product id */ |
110 | #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 | 110 | #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 |
111 | #define XC_PRODUCT_ID_FW_LOADED 0x0FA0 /* WAS: 0x1388*/ | 111 | #define XC_PRODUCT_ID_FW_LOADED 0x0FA0 |
112 | 112 | ||
113 | /* Registers */ | 113 | /* Registers (Write-only) */ |
114 | #define XREG_INIT 0x00 | 114 | #define XREG_INIT 0x00 |
115 | #define XREG_VIDEO_MODE 0x01 | 115 | #define XREG_VIDEO_MODE 0x01 |
116 | #define XREG_AUDIO_MODE 0x02 | 116 | #define XREG_AUDIO_MODE 0x02 |
117 | #define XREG_RF_FREQ 0x03 | 117 | #define XREG_RF_FREQ 0x03 |
118 | #define XREG_D_CODE 0x04 | 118 | #define XREG_D_CODE 0x04 |
119 | #define XREG_IF_OUT 0x05 /* ?? */ | 119 | #define XREG_DIRECTSITTING_MODE 0x05 |
120 | #define XREG_SEEK_MODE 0x07 /* WAS: 0x06 */ | 120 | #define XREG_SEEK_MODE 0x06 |
121 | #define XREG_POWER_DOWN 0x08 /* WAS: 0x0A Obsolete */ | 121 | #define XREG_POWER_DOWN 0x08 |
122 | #define XREG_SIGNALSOURCE 0x0A /* WAS: 0x0D 0=Air, 1=Cable */ | 122 | #define XREG_SIGNALSOURCE 0x0A |
123 | //#define XREG_SMOOTHEDCVBS 0x0E | 123 | #define XREG_AMPLITUDE 0x10 |
124 | //#define XREG_XTALFREQ 0x0F | ||
125 | //#define XREG_FINERFREQ 0x10 | ||
126 | //#define XREG_DDIMODE 0x11 | ||
127 | 124 | ||
125 | /* Registers (Read-only) */ | ||
128 | #define XREG_ADC_ENV 0x00 | 126 | #define XREG_ADC_ENV 0x00 |
129 | #define XREG_QUALITY 0x01 | 127 | #define XREG_QUALITY 0x01 |
130 | #define XREG_FRAME_LINES 0x02 | 128 | #define XREG_FRAME_LINES 0x02 |
@@ -134,7 +132,6 @@ struct xc4000_priv { | |||
134 | #define XREG_SNR 0x06 | 132 | #define XREG_SNR 0x06 |
135 | #define XREG_VERSION 0x07 | 133 | #define XREG_VERSION 0x07 |
136 | #define XREG_PRODUCT_ID 0x08 | 134 | #define XREG_PRODUCT_ID 0x08 |
137 | //#define XREG_BUILD 0x0D | ||
138 | 135 | ||
139 | /* | 136 | /* |
140 | Basic firmware description. This will remain with | 137 | Basic firmware description. This will remain with |
@@ -249,7 +246,6 @@ static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = { | |||
249 | {"FM Radio-INPUT1", 0x0008, 0x9000} | 246 | {"FM Radio-INPUT1", 0x0008, 0x9000} |
250 | }; | 247 | }; |
251 | 248 | ||
252 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe); | ||
253 | static int xc4000_is_firmware_loaded(struct dvb_frontend *fe); | 249 | static int xc4000_is_firmware_loaded(struct dvb_frontend *fe); |
254 | static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); | 250 | static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); |
255 | static int xc4000_TunerReset(struct dvb_frontend *fe); | 251 | static int xc4000_TunerReset(struct dvb_frontend *fe); |
@@ -258,7 +254,6 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) | |||
258 | { | 254 | { |
259 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, | 255 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, |
260 | .flags = 0, .buf = buf, .len = len }; | 256 | .flags = 0, .buf = buf, .len = len }; |
261 | |||
262 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { | 257 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { |
263 | printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); | 258 | printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", len); |
264 | return XC_RESULT_I2C_WRITE_FAILURE; | 259 | return XC_RESULT_I2C_WRITE_FAILURE; |
@@ -269,17 +264,6 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) | |||
269 | /* This routine is never used because the only time we read data from the | 264 | /* This routine is never used because the only time we read data from the |
270 | i2c bus is when we read registers, and we want that to be an atomic i2c | 265 | i2c bus is when we read registers, and we want that to be an atomic i2c |
271 | transaction in case we are on a multi-master bus */ | 266 | transaction in case we are on a multi-master bus */ |
272 | static int xc_read_i2c_data(struct xc4000_priv *priv, u8 *buf, int len) | ||
273 | { | ||
274 | struct i2c_msg msg = { .addr = priv->i2c_props.addr, | ||
275 | .flags = I2C_M_RD, .buf = buf, .len = len }; | ||
276 | |||
277 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { | ||
278 | printk(KERN_ERR "xc4000 I2C read failed (len=%i)\n", len); | ||
279 | return -EREMOTEIO; | ||
280 | } | ||
281 | return 0; | ||
282 | } | ||
283 | 267 | ||
284 | static void xc_wait(int wait_ms) | 268 | static void xc_wait(int wait_ms) |
285 | { | 269 | { |
@@ -378,12 +362,6 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) | |||
378 | return XC_RESULT_SUCCESS; | 362 | return XC_RESULT_SUCCESS; |
379 | } | 363 | } |
380 | 364 | ||
381 | static int xc_initialize(struct xc4000_priv *priv) | ||
382 | { | ||
383 | dprintk(1, "%s()\n", __func__); | ||
384 | return xc_write_reg(priv, XREG_INIT, 0); | ||
385 | } | ||
386 | |||
387 | static int xc_SetTVStandard(struct xc4000_priv *priv, | 365 | static int xc_SetTVStandard(struct xc4000_priv *priv, |
388 | u16 VideoMode, u16 AudioMode) | 366 | u16 VideoMode, u16 AudioMode) |
389 | { | 367 | { |
@@ -435,16 +413,6 @@ static int xc_set_RF_frequency(struct xc4000_priv *priv, u32 freq_hz) | |||
435 | } | 413 | } |
436 | 414 | ||
437 | 415 | ||
438 | static int xc_set_IF_frequency(struct xc4000_priv *priv, u32 freq_khz) | ||
439 | { | ||
440 | u32 freq_code = (freq_khz * 1024)/1000; | ||
441 | dprintk(1, "%s(freq_khz = %d) freq_code = 0x%x\n", | ||
442 | __func__, freq_khz, freq_code); | ||
443 | |||
444 | return xc_write_reg(priv, XREG_IF_OUT, freq_code); | ||
445 | } | ||
446 | |||
447 | |||
448 | static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) | 416 | static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope) |
449 | { | 417 | { |
450 | return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); | 418 | return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope); |
@@ -751,6 +719,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, | |||
751 | (unsigned long long)*id); | 719 | (unsigned long long)*id); |
752 | 720 | ||
753 | p = priv->firm[pos].ptr; | 721 | p = priv->firm[pos].ptr; |
722 | printk("firmware length = %d\n", priv->firm[pos].size); | ||
754 | 723 | ||
755 | rc = xc_load_i2c_sequence(fe, p); | 724 | rc = xc_load_i2c_sequence(fe, p); |
756 | 725 | ||
@@ -911,7 +880,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, | |||
911 | struct xc4000_priv *priv = fe->tuner_priv; | 880 | struct xc4000_priv *priv = fe->tuner_priv; |
912 | int pos, rc; | 881 | int pos, rc; |
913 | unsigned char *p; | 882 | unsigned char *p; |
914 | u8 direct_mode[4]; | 883 | u8 scode_buf[13]; |
915 | u8 indirect_mode[5]; | 884 | u8 indirect_mode[5]; |
916 | 885 | ||
917 | dprintk(1, "%s called\n", __func__); | 886 | dprintk(1, "%s called\n", __func__); |
@@ -951,24 +920,28 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type, | |||
951 | printk("(%x), id %016llx.\n", priv->firm[pos].type, | 920 | printk("(%x), id %016llx.\n", priv->firm[pos].type, |
952 | (unsigned long long)*id); | 921 | (unsigned long long)*id); |
953 | 922 | ||
923 | scode_buf[0] = 0x00; | ||
924 | memcpy(&scode_buf[1], p, 12); | ||
954 | 925 | ||
955 | /* Enter direct-mode */ | 926 | /* Enter direct-mode */ |
956 | memset(direct_mode, 0, sizeof(direct_mode)); | 927 | rc = xc_write_reg(priv, XREG_DIRECTSITTING_MODE, 0); |
957 | direct_mode[1] = 0x05; | 928 | if (rc < 0) { |
958 | rc = xc_send_i2c_data(priv, direct_mode, sizeof(direct_mode)); | 929 | printk("failed to put device into direct mode!\n"); |
959 | if (rc < 0) | ||
960 | return -EIO; | 930 | return -EIO; |
931 | } | ||
961 | 932 | ||
962 | rc = xc_send_i2c_data(priv, p, 12); | 933 | rc = xc_send_i2c_data(priv, scode_buf, 13); |
963 | if (rc != XC_RESULT_SUCCESS) | 934 | if (rc != XC_RESULT_SUCCESS) { |
964 | return -EIO; | 935 | /* Even if the send failed, make sure we set back to indirect |
936 | mode */ | ||
937 | printk("Failed to set scode %d\n", rc); | ||
938 | } | ||
965 | 939 | ||
966 | /* Switch back to indirect-mode */ | 940 | /* Switch back to indirect-mode */ |
967 | memset(indirect_mode, 0, sizeof(indirect_mode)); | 941 | memset(indirect_mode, 0, sizeof(indirect_mode)); |
968 | indirect_mode[4] = 0x88; | 942 | indirect_mode[4] = 0x88; |
969 | rc = xc_send_i2c_data(priv, indirect_mode, sizeof(indirect_mode)); | 943 | xc_send_i2c_data(priv, indirect_mode, sizeof(indirect_mode)); |
970 | if (rc < 0) | 944 | msleep(10); |
971 | return -EIO; | ||
972 | 945 | ||
973 | return 0; | 946 | return 0; |
974 | } | 947 | } |
@@ -1057,6 +1030,8 @@ retry: | |||
1057 | goto fail; | 1030 | goto fail; |
1058 | } | 1031 | } |
1059 | 1032 | ||
1033 | printk("Done with init1\n"); | ||
1034 | |||
1060 | skip_base: | 1035 | skip_base: |
1061 | /* | 1036 | /* |
1062 | * No need to reload standard specific firmware if base firmware | 1037 | * No need to reload standard specific firmware if base firmware |
@@ -1071,9 +1046,8 @@ skip_base: | |||
1071 | /* Reloading std-specific firmware forces a SCODE update */ | 1046 | /* Reloading std-specific firmware forces a SCODE update */ |
1072 | priv->cur_fw.scode_table = 0; | 1047 | priv->cur_fw.scode_table = 0; |
1073 | 1048 | ||
1049 | /* Load the standard firmware */ | ||
1074 | rc = load_firmware(fe, new_fw.type, &new_fw.id); | 1050 | rc = load_firmware(fe, new_fw.type, &new_fw.id); |
1075 | if (rc == -ENOENT) | ||
1076 | rc = load_firmware(fe, new_fw.type & ~F8MHZ, &new_fw.id); | ||
1077 | 1051 | ||
1078 | if (rc < 0) | 1052 | if (rc < 0) |
1079 | goto fail; | 1053 | goto fail; |
@@ -1089,10 +1063,10 @@ skip_std_specific: | |||
1089 | goto check_device; | 1063 | goto check_device; |
1090 | 1064 | ||
1091 | /* Load SCODE firmware, if exists */ | 1065 | /* Load SCODE firmware, if exists */ |
1092 | dprintk(1, "Trying to load scode %d\n", new_fw.scode_nr); | ||
1093 | |||
1094 | rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, | 1066 | rc = load_scode(fe, new_fw.type | new_fw.scode_table, &new_fw.id, |
1095 | new_fw.int_freq, new_fw.scode_nr); | 1067 | new_fw.int_freq, new_fw.scode_nr); |
1068 | if (rc != XC_RESULT_SUCCESS) | ||
1069 | dprintk(1, "load scode failed %d\n", rc); | ||
1096 | 1070 | ||
1097 | check_device: | 1071 | check_device: |
1098 | rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); | 1072 | rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); |
@@ -1209,11 +1183,13 @@ static int xc4000_set_params(struct dvb_frontend *fe, | |||
1209 | struct xc4000_priv *priv = fe->tuner_priv; | 1183 | struct xc4000_priv *priv = fe->tuner_priv; |
1210 | int ret; | 1184 | int ret; |
1211 | 1185 | ||
1212 | if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) | ||
1213 | xc_load_fw_and_init_tuner(fe); | ||
1214 | |||
1215 | dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); | 1186 | dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); |
1216 | 1187 | ||
1188 | /* FIXME: setup proper parameters */ | ||
1189 | if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { | ||
1190 | return -EREMOTEIO; | ||
1191 | } | ||
1192 | |||
1217 | if (fe->ops.info.type == FE_ATSC) { | 1193 | if (fe->ops.info.type == FE_ATSC) { |
1218 | dprintk(1, "%s() ATSC\n", __func__); | 1194 | dprintk(1, "%s() ATSC\n", __func__); |
1219 | switch (params->u.vsb.modulation) { | 1195 | switch (params->u.vsb.modulation) { |
@@ -1281,14 +1257,14 @@ static int xc4000_set_params(struct dvb_frontend *fe, | |||
1281 | printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); | 1257 | printk(KERN_ERR "xc4000: xc_SetTVStandard failed\n"); |
1282 | return -EREMOTEIO; | 1258 | return -EREMOTEIO; |
1283 | } | 1259 | } |
1284 | 1260 | #ifdef DJH_DEBUG | |
1285 | ret = xc_set_IF_frequency(priv, priv->if_khz); | 1261 | ret = xc_set_IF_frequency(priv, priv->if_khz); |
1286 | if (ret != XC_RESULT_SUCCESS) { | 1262 | if (ret != XC_RESULT_SUCCESS) { |
1287 | printk(KERN_ERR "xc4000: xc_Set_IF_frequency(%d) failed\n", | 1263 | printk(KERN_ERR "xc4000: xc_Set_IF_frequency(%d) failed\n", |
1288 | priv->if_khz); | 1264 | priv->if_khz); |
1289 | return -EIO; | 1265 | return -EIO; |
1290 | } | 1266 | } |
1291 | 1267 | #endif | |
1292 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); | 1268 | xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL); |
1293 | 1269 | ||
1294 | if (debug) | 1270 | if (debug) |
@@ -1322,12 +1298,14 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe, | |||
1322 | struct xc4000_priv *priv = fe->tuner_priv; | 1298 | struct xc4000_priv *priv = fe->tuner_priv; |
1323 | int ret; | 1299 | int ret; |
1324 | 1300 | ||
1325 | if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) | ||
1326 | xc_load_fw_and_init_tuner(fe); | ||
1327 | |||
1328 | dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", | 1301 | dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n", |
1329 | __func__, params->frequency); | 1302 | __func__, params->frequency); |
1330 | 1303 | ||
1304 | /* FIXME: setup proper parameters */ | ||
1305 | if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { | ||
1306 | return -EREMOTEIO; | ||
1307 | } | ||
1308 | |||
1331 | /* Fix me: it could be air. */ | 1309 | /* Fix me: it could be air. */ |
1332 | priv->rf_mode = params->mode; | 1310 | priv->rf_mode = params->mode; |
1333 | if (params->mode > XC_RF_MODE_CABLE) | 1311 | if (params->mode > XC_RF_MODE_CABLE) |
@@ -1435,54 +1413,10 @@ static int xc4000_get_status(struct dvb_frontend *fe, u32 *status) | |||
1435 | return 0; | 1413 | return 0; |
1436 | } | 1414 | } |
1437 | 1415 | ||
1438 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) | ||
1439 | { | ||
1440 | struct xc4000_priv *priv = fe->tuner_priv; | ||
1441 | int ret = 0; | ||
1442 | |||
1443 | if (xc4000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { | ||
1444 | ret = xc4000_fwupload(fe); | ||
1445 | if (ret != XC_RESULT_SUCCESS) | ||
1446 | return ret; | ||
1447 | } | ||
1448 | |||
1449 | /* Start the tuner self-calibration process */ | ||
1450 | ret |= xc_initialize(priv); | ||
1451 | |||
1452 | /* Wait for calibration to complete. | ||
1453 | * We could continue but XC4000 will clock stretch subsequent | ||
1454 | * I2C transactions until calibration is complete. This way we | ||
1455 | * don't have to rely on clock stretching working. | ||
1456 | */ | ||
1457 | xc_wait(100); | ||
1458 | |||
1459 | /* Default to "CABLE" mode */ | ||
1460 | ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); | ||
1461 | |||
1462 | return ret; | ||
1463 | } | ||
1464 | |||
1465 | static int xc4000_sleep(struct dvb_frontend *fe) | 1416 | static int xc4000_sleep(struct dvb_frontend *fe) |
1466 | { | 1417 | { |
1467 | int ret; | 1418 | /* FIXME: djh disable this for now... */ |
1468 | 1419 | return XC_RESULT_SUCCESS; | |
1469 | dprintk(1, "%s()\n", __func__); | ||
1470 | |||
1471 | /* Avoid firmware reload on slow devices */ | ||
1472 | if (no_poweroff) | ||
1473 | return 0; | ||
1474 | |||
1475 | /* According to Xceive technical support, the "powerdown" register | ||
1476 | was removed in newer versions of the firmware. The "supported" | ||
1477 | way to sleep the tuner is to pull the reset pin low for 10ms */ | ||
1478 | ret = xc4000_TunerReset(fe); | ||
1479 | if (ret != XC_RESULT_SUCCESS) { | ||
1480 | printk(KERN_ERR | ||
1481 | "xc4000: %s() unable to shutdown tuner\n", | ||
1482 | __func__); | ||
1483 | return -EREMOTEIO; | ||
1484 | } else | ||
1485 | return XC_RESULT_SUCCESS; | ||
1486 | } | 1420 | } |
1487 | 1421 | ||
1488 | static int xc4000_init(struct dvb_frontend *fe) | 1422 | static int xc4000_init(struct dvb_frontend *fe) |
@@ -1490,7 +1424,7 @@ static int xc4000_init(struct dvb_frontend *fe) | |||
1490 | struct xc4000_priv *priv = fe->tuner_priv; | 1424 | struct xc4000_priv *priv = fe->tuner_priv; |
1491 | dprintk(1, "%s()\n", __func__); | 1425 | dprintk(1, "%s()\n", __func__); |
1492 | 1426 | ||
1493 | if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { | 1427 | if (check_firmware(fe, DTV8, 0, 5400) != XC_RESULT_SUCCESS) { |
1494 | printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); | 1428 | printk(KERN_ERR "xc4000: Unable to initialise tuner\n"); |
1495 | return -EREMOTEIO; | 1429 | return -EREMOTEIO; |
1496 | } | 1430 | } |
@@ -1544,9 +1478,7 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1544 | { | 1478 | { |
1545 | struct xc4000_priv *priv = NULL; | 1479 | struct xc4000_priv *priv = NULL; |
1546 | int instance; | 1480 | int instance; |
1547 | v4l2_std_id std0; | ||
1548 | u16 id = 0; | 1481 | u16 id = 0; |
1549 | int rc; | ||
1550 | 1482 | ||
1551 | dprintk(1, "%s(%d-%04x)\n", __func__, | 1483 | dprintk(1, "%s(%d-%04x)\n", __func__, |
1552 | i2c ? i2c_adapter_id(i2c) : -1, | 1484 | i2c ? i2c_adapter_id(i2c) : -1, |
@@ -1615,32 +1547,8 @@ struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | |||
1615 | 1547 | ||
1616 | /* FIXME: For now, load the firmware at startup. We will remove this | 1548 | /* FIXME: For now, load the firmware at startup. We will remove this |
1617 | before the code goes to production... */ | 1549 | before the code goes to production... */ |
1618 | #ifdef DJH_DEBUG | ||
1619 | xc4000_fwupload(fe); | ||
1620 | printk("xc4000_fwupload done\n"); | ||
1621 | |||
1622 | std0 = 0; | ||
1623 | // rc = load_firmware(fe, BASE | new_fw.type, &std0); | ||
1624 | rc = load_firmware(fe, BASE, &std0); | ||
1625 | if (rc != XC_RESULT_SUCCESS) { | ||
1626 | tuner_err("Error %d while loading base firmware\n", | ||
1627 | rc); | ||
1628 | goto fail; | ||
1629 | } | ||
1630 | |||
1631 | /* Load INIT1, if needed */ | ||
1632 | dprintk("Load init1 firmware, if exists\n"); | ||
1633 | |||
1634 | // rc = load_firmware(fe, BASE | INIT1 | new_fw.type, &std0); | ||
1635 | rc = load_firmware(fe, BASE | INIT1, &std0); | ||
1636 | printk("init1 load result %x\n", rc); | ||
1637 | #endif | ||
1638 | check_firmware(fe, DTV8, 0, 5400); | 1550 | check_firmware(fe, DTV8, 0, 5400); |
1639 | 1551 | ||
1640 | if (xc4000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) | ||
1641 | goto fail; | ||
1642 | printk("djh id is now %x\n", id); | ||
1643 | |||
1644 | return fe; | 1552 | return fe; |
1645 | fail: | 1553 | fail: |
1646 | mutex_unlock(&xc4000_list_mutex); | 1554 | mutex_unlock(&xc4000_list_mutex); |