diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-18 15:00:37 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:56 -0400 |
commit | 7f37cc9bae7aa29d567460c3ac8178d587f710bc (patch) | |
tree | c57ec377e502cfcef0acdcf53016434dc74e98a3 | |
parent | aff88bca73a16039ed0988660dc7ab755c3e1741 (diff) |
V4L/DVB (10710): zoran: cleanups in an attempt to make the source a bit more readable.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/zoran/zoran_card.c | 9 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_device.c | 404 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 4 |
3 files changed, 184 insertions, 233 deletions
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 1ad9ed48dbd..18834b18435 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -919,15 +919,12 @@ zoran_check_jpg_settings (struct zoran *zr, | |||
919 | err0++; | 919 | err0++; |
920 | if (settings->img_x + settings->img_width > BUZ_MAX_WIDTH) | 920 | if (settings->img_x + settings->img_width > BUZ_MAX_WIDTH) |
921 | err0++; | 921 | err0++; |
922 | if (settings->img_y + settings->img_height > | 922 | if (settings->img_y + settings->img_height > BUZ_MAX_HEIGHT / 2) |
923 | BUZ_MAX_HEIGHT / 2) | ||
924 | err0++; | 923 | err0++; |
925 | if (settings->HorDcm && settings->VerDcm) { | 924 | if (settings->HorDcm && settings->VerDcm) { |
926 | if (settings->img_width % | 925 | if (settings->img_width % (16 * settings->HorDcm) != 0) |
927 | (16 * settings->HorDcm) != 0) | ||
928 | err0++; | 926 | err0++; |
929 | if (settings->img_height % | 927 | if (settings->img_height % (8 * settings->VerDcm) != 0) |
930 | (8 * settings->VerDcm) != 0) | ||
931 | err0++; | 928 | err0++; |
932 | } | 929 | } |
933 | 930 | ||
diff --git a/drivers/media/video/zoran/zoran_device.c b/drivers/media/video/zoran/zoran_device.c index 5d948ff7faf..1bcfa270d63 100644 --- a/drivers/media/video/zoran/zoran_device.c +++ b/drivers/media/video/zoran/zoran_device.c | |||
@@ -1208,22 +1208,52 @@ zoran_reap_stat_com (struct zoran *zr) | |||
1208 | } | 1208 | } |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | static void zoran_restart(struct zoran *zr) | ||
1212 | { | ||
1213 | /* Now the stat_comm buffer is ready for restart */ | ||
1214 | int status, mode; | ||
1215 | |||
1216 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { | ||
1217 | decoder_command(zr, DECODER_GET_STATUS, &status); | ||
1218 | mode = CODEC_DO_COMPRESSION; | ||
1219 | } else { | ||
1220 | status = 0; | ||
1221 | mode = CODEC_DO_EXPANSION; | ||
1222 | } | ||
1223 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || | ||
1224 | (status & DECODER_STATUS_GOOD)) { | ||
1225 | /********** RESTART code *************/ | ||
1226 | jpeg_codec_reset(zr); | ||
1227 | zr->codec->set_mode(zr->codec, mode); | ||
1228 | zr36057_set_jpg(zr, zr->codec_mode); | ||
1229 | jpeg_start(zr); | ||
1230 | |||
1231 | if (zr->num_errors <= 8) | ||
1232 | dprintk(2, KERN_INFO "%s: Restart\n", | ||
1233 | ZR_DEVNAME(zr)); | ||
1234 | |||
1235 | zr->JPEG_missed = 0; | ||
1236 | zr->JPEG_error = 2; | ||
1237 | /********** End RESTART code ***********/ | ||
1238 | } | ||
1239 | } | ||
1240 | |||
1211 | static void | 1241 | static void |
1212 | error_handler (struct zoran *zr, | 1242 | error_handler (struct zoran *zr, |
1213 | u32 astat, | 1243 | u32 astat, |
1214 | u32 stat) | 1244 | u32 stat) |
1215 | { | 1245 | { |
1246 | int i, j; | ||
1247 | |||
1216 | /* This is JPEG error handling part */ | 1248 | /* This is JPEG error handling part */ |
1217 | if ((zr->codec_mode != BUZ_MODE_MOTION_COMPRESS) && | 1249 | if (zr->codec_mode != BUZ_MODE_MOTION_COMPRESS && |
1218 | (zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS)) { | 1250 | zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS) { |
1219 | //dprintk(1, KERN_ERR "%s: Internal error: error handling request in mode %d\n", ZR_DEVNAME(zr), zr->codec_mode); | ||
1220 | return; | 1251 | return; |
1221 | } | 1252 | } |
1222 | 1253 | ||
1223 | if ((stat & 1) == 0 && | 1254 | if ((stat & 1) == 0 && |
1224 | zr->codec_mode == BUZ_MODE_MOTION_COMPRESS && | 1255 | zr->codec_mode == BUZ_MODE_MOTION_COMPRESS && |
1225 | zr->jpg_dma_tail - zr->jpg_que_tail >= | 1256 | zr->jpg_dma_tail - zr->jpg_que_tail >= zr->jpg_buffers.num_buffers) { |
1226 | zr->jpg_buffers.num_buffers) { | ||
1227 | /* No free buffers... */ | 1257 | /* No free buffers... */ |
1228 | zoran_reap_stat_com(zr); | 1258 | zoran_reap_stat_com(zr); |
1229 | zoran_feed_stat_com(zr); | 1259 | zoran_feed_stat_com(zr); |
@@ -1232,142 +1262,95 @@ error_handler (struct zoran *zr, | |||
1232 | return; | 1262 | return; |
1233 | } | 1263 | } |
1234 | 1264 | ||
1235 | if (zr->JPEG_error != 1) { | 1265 | if (zr->JPEG_error == 1) { |
1236 | /* | 1266 | zoran_restart(zr); |
1237 | * First entry: error just happened during normal operation | 1267 | return; |
1238 | * | 1268 | } |
1239 | * In BUZ_MODE_MOTION_COMPRESS: | ||
1240 | * | ||
1241 | * Possible glitch in TV signal. In this case we should | ||
1242 | * stop the codec and wait for good quality signal before | ||
1243 | * restarting it to avoid further problems | ||
1244 | * | ||
1245 | * In BUZ_MODE_MOTION_DECOMPRESS: | ||
1246 | * | ||
1247 | * Bad JPEG frame: we have to mark it as processed (codec crashed | ||
1248 | * and was not able to do it itself), and to remove it from queue. | ||
1249 | */ | ||
1250 | btand(~ZR36057_JMC_Go_en, ZR36057_JMC); | ||
1251 | udelay(1); | ||
1252 | stat = stat | (post_office_read(zr, 7, 0) & 3) << 8; | ||
1253 | btwrite(0, ZR36057_JPC); | ||
1254 | btor(ZR36057_MCTCR_CFlush, ZR36057_MCTCR); | ||
1255 | jpeg_codec_reset(zr); | ||
1256 | jpeg_codec_sleep(zr, 1); | ||
1257 | zr->JPEG_error = 1; | ||
1258 | zr->num_errors++; | ||
1259 | |||
1260 | /* Report error */ | ||
1261 | if (zr36067_debug > 1 && zr->num_errors <= 8) { | ||
1262 | long frame; | ||
1263 | frame = | ||
1264 | zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; | ||
1265 | printk(KERN_ERR | ||
1266 | "%s: JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ", | ||
1267 | ZR_DEVNAME(zr), stat, zr->last_isr, | ||
1268 | zr->jpg_que_tail, zr->jpg_dma_tail, | ||
1269 | zr->jpg_dma_head, zr->jpg_que_head, | ||
1270 | zr->jpg_seq_num, frame); | ||
1271 | printk("stat_com frames:"); | ||
1272 | { | ||
1273 | int i, j; | ||
1274 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | ||
1275 | for (i = 0; | ||
1276 | i < zr->jpg_buffers.num_buffers; | ||
1277 | i++) { | ||
1278 | if (le32_to_cpu(zr->stat_com[j]) == | ||
1279 | zr->jpg_buffers. | ||
1280 | buffer[i]. | ||
1281 | frag_tab_bus) { | ||
1282 | printk("% d->%d", | ||
1283 | j, i); | ||
1284 | } | ||
1285 | } | ||
1286 | } | ||
1287 | printk("\n"); | ||
1288 | } | ||
1289 | } | ||
1290 | /* Find an entry in stat_com and rotate contents */ | ||
1291 | { | ||
1292 | int i; | ||
1293 | |||
1294 | if (zr->jpg_settings.TmpDcm == 1) | ||
1295 | i = (zr->jpg_dma_tail - | ||
1296 | zr->jpg_err_shift) & BUZ_MASK_STAT_COM; | ||
1297 | else | ||
1298 | i = ((zr->jpg_dma_tail - | ||
1299 | zr->jpg_err_shift) & 1) * 2; | ||
1300 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) { | ||
1301 | /* Mimic zr36067 operation */ | ||
1302 | zr->stat_com[i] |= cpu_to_le32(1); | ||
1303 | if (zr->jpg_settings.TmpDcm != 1) | ||
1304 | zr->stat_com[i + 1] |= cpu_to_le32(1); | ||
1305 | /* Refill */ | ||
1306 | zoran_reap_stat_com(zr); | ||
1307 | zoran_feed_stat_com(zr); | ||
1308 | wake_up_interruptible(&zr->jpg_capq); | ||
1309 | /* Find an entry in stat_com again after refill */ | ||
1310 | if (zr->jpg_settings.TmpDcm == 1) | ||
1311 | i = (zr->jpg_dma_tail - | ||
1312 | zr->jpg_err_shift) & | ||
1313 | BUZ_MASK_STAT_COM; | ||
1314 | else | ||
1315 | i = ((zr->jpg_dma_tail - | ||
1316 | zr->jpg_err_shift) & 1) * 2; | ||
1317 | } | ||
1318 | if (i) { | ||
1319 | /* Rotate stat_comm entries to make current entry first */ | ||
1320 | int j; | ||
1321 | __le32 bus_addr[BUZ_NUM_STAT_COM]; | ||
1322 | |||
1323 | /* Here we are copying the stat_com array, which | ||
1324 | * is already in little endian format, so | ||
1325 | * no endian conversions here | ||
1326 | */ | ||
1327 | memcpy(bus_addr, zr->stat_com, | ||
1328 | sizeof(bus_addr)); | ||
1329 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | ||
1330 | zr->stat_com[j] = | ||
1331 | bus_addr[(i + j) & | ||
1332 | BUZ_MASK_STAT_COM]; | ||
1333 | 1269 | ||
1334 | } | 1270 | /* |
1335 | zr->jpg_err_shift += i; | 1271 | * First entry: error just happened during normal operation |
1336 | zr->jpg_err_shift &= BUZ_MASK_STAT_COM; | 1272 | * |
1273 | * In BUZ_MODE_MOTION_COMPRESS: | ||
1274 | * | ||
1275 | * Possible glitch in TV signal. In this case we should | ||
1276 | * stop the codec and wait for good quality signal before | ||
1277 | * restarting it to avoid further problems | ||
1278 | * | ||
1279 | * In BUZ_MODE_MOTION_DECOMPRESS: | ||
1280 | * | ||
1281 | * Bad JPEG frame: we have to mark it as processed (codec crashed | ||
1282 | * and was not able to do it itself), and to remove it from queue. | ||
1283 | */ | ||
1284 | btand(~ZR36057_JMC_Go_en, ZR36057_JMC); | ||
1285 | udelay(1); | ||
1286 | stat = stat | (post_office_read(zr, 7, 0) & 3) << 8; | ||
1287 | btwrite(0, ZR36057_JPC); | ||
1288 | btor(ZR36057_MCTCR_CFlush, ZR36057_MCTCR); | ||
1289 | jpeg_codec_reset(zr); | ||
1290 | jpeg_codec_sleep(zr, 1); | ||
1291 | zr->JPEG_error = 1; | ||
1292 | zr->num_errors++; | ||
1293 | |||
1294 | /* Report error */ | ||
1295 | if (zr36067_debug > 1 && zr->num_errors <= 8) { | ||
1296 | long frame; | ||
1297 | |||
1298 | frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; | ||
1299 | printk(KERN_ERR | ||
1300 | "%s: JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ", | ||
1301 | ZR_DEVNAME(zr), stat, zr->last_isr, | ||
1302 | zr->jpg_que_tail, zr->jpg_dma_tail, | ||
1303 | zr->jpg_dma_head, zr->jpg_que_head, | ||
1304 | zr->jpg_seq_num, frame); | ||
1305 | printk(KERN_INFO "stat_com frames:"); | ||
1306 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) { | ||
1307 | for (i = 0; i < zr->jpg_buffers.num_buffers; i++) { | ||
1308 | if (le32_to_cpu(zr->stat_com[j]) == zr->jpg_buffers.buffer[i].frag_tab_bus) | ||
1309 | printk(KERN_CONT "% d->%d", j, i); | ||
1337 | } | 1310 | } |
1338 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) | ||
1339 | zr->jpg_err_seq = zr->jpg_seq_num; /* + 1; */ | ||
1340 | } | 1311 | } |
1312 | printk(KERN_CONT "\n"); | ||
1341 | } | 1313 | } |
1314 | /* Find an entry in stat_com and rotate contents */ | ||
1315 | if (zr->jpg_settings.TmpDcm == 1) | ||
1316 | i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; | ||
1317 | else | ||
1318 | i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; | ||
1319 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) { | ||
1320 | /* Mimic zr36067 operation */ | ||
1321 | zr->stat_com[i] |= cpu_to_le32(1); | ||
1322 | if (zr->jpg_settings.TmpDcm != 1) | ||
1323 | zr->stat_com[i + 1] |= cpu_to_le32(1); | ||
1324 | /* Refill */ | ||
1325 | zoran_reap_stat_com(zr); | ||
1326 | zoran_feed_stat_com(zr); | ||
1327 | wake_up_interruptible(&zr->jpg_capq); | ||
1328 | /* Find an entry in stat_com again after refill */ | ||
1329 | if (zr->jpg_settings.TmpDcm == 1) | ||
1330 | i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; | ||
1331 | else | ||
1332 | i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; | ||
1333 | } | ||
1334 | if (i) { | ||
1335 | /* Rotate stat_comm entries to make current entry first */ | ||
1336 | int j; | ||
1337 | __le32 bus_addr[BUZ_NUM_STAT_COM]; | ||
1338 | |||
1339 | /* Here we are copying the stat_com array, which | ||
1340 | * is already in little endian format, so | ||
1341 | * no endian conversions here | ||
1342 | */ | ||
1343 | memcpy(bus_addr, zr->stat_com, sizeof(bus_addr)); | ||
1342 | 1344 | ||
1343 | /* Now the stat_comm buffer is ready for restart */ | 1345 | for (j = 0; j < BUZ_NUM_STAT_COM; j++) |
1344 | do { | 1346 | zr->stat_com[j] = bus_addr[(i + j) & BUZ_MASK_STAT_COM]; |
1345 | int status, mode; | ||
1346 | |||
1347 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { | ||
1348 | decoder_command(zr, DECODER_GET_STATUS, &status); | ||
1349 | mode = CODEC_DO_COMPRESSION; | ||
1350 | } else { | ||
1351 | status = 0; | ||
1352 | mode = CODEC_DO_EXPANSION; | ||
1353 | } | ||
1354 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || | ||
1355 | (status & DECODER_STATUS_GOOD)) { | ||
1356 | /********** RESTART code *************/ | ||
1357 | jpeg_codec_reset(zr); | ||
1358 | zr->codec->set_mode(zr->codec, mode); | ||
1359 | zr36057_set_jpg(zr, zr->codec_mode); | ||
1360 | jpeg_start(zr); | ||
1361 | |||
1362 | if (zr->num_errors <= 8) | ||
1363 | dprintk(2, KERN_INFO "%s: Restart\n", | ||
1364 | ZR_DEVNAME(zr)); | ||
1365 | 1347 | ||
1366 | zr->JPEG_missed = 0; | 1348 | zr->jpg_err_shift += i; |
1367 | zr->JPEG_error = 2; | 1349 | zr->jpg_err_shift &= BUZ_MASK_STAT_COM; |
1368 | /********** End RESTART code ***********/ | 1350 | } |
1369 | } | 1351 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) |
1370 | } while (0); | 1352 | zr->jpg_err_seq = zr->jpg_seq_num; /* + 1; */ |
1353 | zoran_restart(zr); | ||
1371 | } | 1354 | } |
1372 | 1355 | ||
1373 | irqreturn_t | 1356 | irqreturn_t |
@@ -1425,10 +1408,8 @@ zoran_irq (int irq, | |||
1425 | * We simply ignore them */ | 1408 | * We simply ignore them */ |
1426 | 1409 | ||
1427 | if (zr->v4l_memgrab_active) { | 1410 | if (zr->v4l_memgrab_active) { |
1428 | |||
1429 | /* A lot more checks should be here ... */ | 1411 | /* A lot more checks should be here ... */ |
1430 | if ((btread(ZR36057_VSSFGR) & | 1412 | if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) == 0) |
1431 | ZR36057_VSSFGR_SnapShot) == 0) | ||
1432 | dprintk(1, | 1413 | dprintk(1, |
1433 | KERN_WARNING | 1414 | KERN_WARNING |
1434 | "%s: BuzIRQ with SnapShot off ???\n", | 1415 | "%s: BuzIRQ with SnapShot off ???\n", |
@@ -1436,10 +1417,7 @@ zoran_irq (int irq, | |||
1436 | 1417 | ||
1437 | if (zr->v4l_grab_frame != NO_GRAB_ACTIVE) { | 1418 | if (zr->v4l_grab_frame != NO_GRAB_ACTIVE) { |
1438 | /* There is a grab on a frame going on, check if it has finished */ | 1419 | /* There is a grab on a frame going on, check if it has finished */ |
1439 | 1420 | if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_FrameGrab) == 0) { | |
1440 | if ((btread(ZR36057_VSSFGR) & | ||
1441 | ZR36057_VSSFGR_FrameGrab) == | ||
1442 | 0) { | ||
1443 | /* it is finished, notify the user */ | 1421 | /* it is finished, notify the user */ |
1444 | 1422 | ||
1445 | zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE; | 1423 | zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE; |
@@ -1457,9 +1435,7 @@ zoran_irq (int irq, | |||
1457 | 1435 | ||
1458 | if (zr->v4l_grab_frame == NO_GRAB_ACTIVE && | 1436 | if (zr->v4l_grab_frame == NO_GRAB_ACTIVE && |
1459 | zr->v4l_pend_tail != zr->v4l_pend_head) { | 1437 | zr->v4l_pend_tail != zr->v4l_pend_head) { |
1460 | 1438 | int frame = zr->v4l_pend[zr->v4l_pend_tail & V4L_MASK_FRAME]; | |
1461 | int frame = zr->v4l_pend[zr->v4l_pend_tail & | ||
1462 | V4L_MASK_FRAME]; | ||
1463 | u32 reg; | 1439 | u32 reg; |
1464 | 1440 | ||
1465 | zr->v4l_grab_frame = frame; | 1441 | zr->v4l_grab_frame = frame; |
@@ -1468,27 +1444,17 @@ zoran_irq (int irq, | |||
1468 | 1444 | ||
1469 | /* Buffer address */ | 1445 | /* Buffer address */ |
1470 | 1446 | ||
1471 | reg = | 1447 | reg = zr->v4l_buffers.buffer[frame].fbuffer_bus; |
1472 | zr->v4l_buffers.buffer[frame]. | ||
1473 | fbuffer_bus; | ||
1474 | btwrite(reg, ZR36057_VDTR); | 1448 | btwrite(reg, ZR36057_VDTR); |
1475 | if (zr->v4l_settings.height > | 1449 | if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) |
1476 | BUZ_MAX_HEIGHT / 2) | 1450 | reg += zr->v4l_settings.bytesperline; |
1477 | reg += | ||
1478 | zr->v4l_settings. | ||
1479 | bytesperline; | ||
1480 | btwrite(reg, ZR36057_VDBR); | 1451 | btwrite(reg, ZR36057_VDBR); |
1481 | 1452 | ||
1482 | /* video stride, status, and frame grab register */ | 1453 | /* video stride, status, and frame grab register */ |
1483 | reg = 0; | 1454 | reg = 0; |
1484 | if (zr->v4l_settings.height > | 1455 | if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) |
1485 | BUZ_MAX_HEIGHT / 2) | 1456 | reg += zr->v4l_settings.bytesperline; |
1486 | reg += | 1457 | reg = (reg << ZR36057_VSSFGR_DispStride); |
1487 | zr->v4l_settings. | ||
1488 | bytesperline; | ||
1489 | reg = | ||
1490 | (reg << | ||
1491 | ZR36057_VSSFGR_DispStride); | ||
1492 | reg |= ZR36057_VSSFGR_VidOvf; | 1458 | reg |= ZR36057_VSSFGR_VidOvf; |
1493 | reg |= ZR36057_VSSFGR_SnapShot; | 1459 | reg |= ZR36057_VSSFGR_SnapShot; |
1494 | reg |= ZR36057_VSSFGR_FrameGrab; | 1460 | reg |= ZR36057_VSSFGR_FrameGrab; |
@@ -1506,77 +1472,66 @@ zoran_irq (int irq, | |||
1506 | #if (IRQ_MASK & ZR36057_ISR_CodRepIRQ) | 1472 | #if (IRQ_MASK & ZR36057_ISR_CodRepIRQ) |
1507 | if (astat & ZR36057_ISR_CodRepIRQ) { | 1473 | if (astat & ZR36057_ISR_CodRepIRQ) { |
1508 | zr->intr_counter_CodRepIRQ++; | 1474 | zr->intr_counter_CodRepIRQ++; |
1509 | IDEBUG(printk | 1475 | IDEBUG(printk(KERN_DEBUG "%s: ZR36057_ISR_CodRepIRQ\n", |
1510 | (KERN_DEBUG "%s: ZR36057_ISR_CodRepIRQ\n", | ||
1511 | ZR_DEVNAME(zr))); | 1476 | ZR_DEVNAME(zr))); |
1512 | btand(~ZR36057_ICR_CodRepIRQ, ZR36057_ICR); | 1477 | btand(~ZR36057_ICR_CodRepIRQ, ZR36057_ICR); |
1513 | } | 1478 | } |
1514 | #endif /* (IRQ_MASK & ZR36057_ISR_CodRepIRQ) */ | 1479 | #endif /* (IRQ_MASK & ZR36057_ISR_CodRepIRQ) */ |
1515 | 1480 | ||
1516 | #if (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) | 1481 | #if (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) |
1517 | if (astat & ZR36057_ISR_JPEGRepIRQ) { | 1482 | if ((astat & ZR36057_ISR_JPEGRepIRQ) && |
1518 | 1483 | (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || | |
1519 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || | 1484 | zr->codec_mode == BUZ_MODE_MOTION_COMPRESS)) { |
1520 | zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { | 1485 | if (zr36067_debug > 1 && (!zr->frame_num || zr->JPEG_error)) { |
1521 | if (zr36067_debug > 1 && | 1486 | char sc[] = "0000"; |
1522 | (!zr->frame_num || zr->JPEG_error)) { | 1487 | char sv[5]; |
1523 | printk(KERN_INFO | 1488 | int i; |
1524 | "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n", | 1489 | |
1525 | ZR_DEVNAME(zr), stat, | 1490 | printk(KERN_INFO |
1526 | zr->jpg_settings.odd_even, | 1491 | "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n", |
1527 | zr->jpg_settings. | 1492 | ZR_DEVNAME(zr), stat, |
1528 | field_per_buff, | 1493 | zr->jpg_settings.odd_even, |
1529 | zr->JPEG_missed); | 1494 | zr->jpg_settings.field_per_buff, |
1530 | { | 1495 | zr->JPEG_missed); |
1531 | char sc[] = "0000"; | 1496 | |
1532 | char sv[5]; | 1497 | strcpy(sv, sc); |
1533 | int i; | 1498 | for (i = 0; i < 4; i++) { |
1534 | strcpy(sv, sc); | 1499 | if (le32_to_cpu(zr->stat_com[i]) & 1) |
1535 | for (i = 0; i < 4; i++) { | 1500 | sv[i] = '1'; |
1536 | if (le32_to_cpu(zr->stat_com[i]) & 1) | ||
1537 | sv[i] = '1'; | ||
1538 | } | ||
1539 | sv[4] = 0; | ||
1540 | printk(KERN_INFO | ||
1541 | "%s: stat_com=%s queue_state=%ld/%ld/%ld/%ld\n", | ||
1542 | ZR_DEVNAME(zr), sv, | ||
1543 | zr->jpg_que_tail, | ||
1544 | zr->jpg_dma_tail, | ||
1545 | zr->jpg_dma_head, | ||
1546 | zr->jpg_que_head); | ||
1547 | } | ||
1548 | } else { | ||
1549 | if (zr->JPEG_missed > zr->JPEG_max_missed) // Get statistics | ||
1550 | zr->JPEG_max_missed = | ||
1551 | zr->JPEG_missed; | ||
1552 | if (zr->JPEG_missed < | ||
1553 | zr->JPEG_min_missed) | ||
1554 | zr->JPEG_min_missed = | ||
1555 | zr->JPEG_missed; | ||
1556 | } | 1501 | } |
1502 | sv[4] = 0; | ||
1503 | printk(KERN_INFO | ||
1504 | "%s: stat_com=%s queue_state=%ld/%ld/%ld/%ld\n", | ||
1505 | ZR_DEVNAME(zr), sv, | ||
1506 | zr->jpg_que_tail, | ||
1507 | zr->jpg_dma_tail, | ||
1508 | zr->jpg_dma_head, | ||
1509 | zr->jpg_que_head); | ||
1510 | } else { | ||
1511 | /* Get statistics */ | ||
1512 | if (zr->JPEG_missed > zr->JPEG_max_missed) | ||
1513 | zr->JPEG_max_missed = zr->JPEG_missed; | ||
1514 | if (zr->JPEG_missed < zr->JPEG_min_missed) | ||
1515 | zr->JPEG_min_missed = zr->JPEG_missed; | ||
1516 | } | ||
1557 | 1517 | ||
1558 | if (zr36067_debug > 2 && zr->frame_num < 6) { | 1518 | if (zr36067_debug > 2 && zr->frame_num < 6) { |
1559 | int i; | 1519 | int i; |
1560 | printk("%s: seq=%ld stat_com:", | 1520 | |
1561 | ZR_DEVNAME(zr), zr->jpg_seq_num); | 1521 | printk(KERN_INFO "%s: seq=%ld stat_com:", |
1562 | for (i = 0; i < 4; i++) { | 1522 | ZR_DEVNAME(zr), zr->jpg_seq_num); |
1563 | printk(" %08x", | 1523 | for (i = 0; i < 4; i++) { |
1564 | le32_to_cpu(zr->stat_com[i])); | 1524 | printk(KERN_CONT " %08x", |
1565 | } | 1525 | le32_to_cpu(zr->stat_com[i])); |
1566 | printk("\n"); | ||
1567 | } | 1526 | } |
1568 | zr->frame_num++; | 1527 | printk(KERN_CONT "\n"); |
1569 | zr->JPEG_missed = 0; | 1528 | } |
1570 | zr->JPEG_error = 0; | 1529 | zr->frame_num++; |
1571 | zoran_reap_stat_com(zr); | 1530 | zr->JPEG_missed = 0; |
1572 | zoran_feed_stat_com(zr); | 1531 | zr->JPEG_error = 0; |
1573 | wake_up_interruptible(&zr->jpg_capq); | 1532 | zoran_reap_stat_com(zr); |
1574 | } /*else { | 1533 | zoran_feed_stat_com(zr); |
1575 | dprintk(1, | 1534 | wake_up_interruptible(&zr->jpg_capq); |
1576 | KERN_ERR | ||
1577 | "%s: JPEG interrupt while not in motion (de)compress mode!\n", | ||
1578 | ZR_DEVNAME(zr)); | ||
1579 | }*/ | ||
1580 | } | 1535 | } |
1581 | #endif /* (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) */ | 1536 | #endif /* (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) */ |
1582 | 1537 | ||
@@ -1585,8 +1540,7 @@ zoran_irq (int irq, | |||
1585 | zr->JPEG_missed > 25 || | 1540 | zr->JPEG_missed > 25 || |
1586 | zr->JPEG_error == 1 || | 1541 | zr->JPEG_error == 1 || |
1587 | ((zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) && | 1542 | ((zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) && |
1588 | (zr->frame_num & (zr->JPEG_missed > | 1543 | (zr->frame_num & (zr->JPEG_missed > zr->jpg_settings.field_per_buff)))) { |
1589 | zr->jpg_settings.field_per_buff)))) { | ||
1590 | error_handler(zr, astat, stat); | 1544 | error_handler(zr, astat, stat); |
1591 | } | 1545 | } |
1592 | 1546 | ||
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 0e4b8d03fda..0cce652011f 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -2314,7 +2314,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, | |||
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | /* we actually need to set 'real' parameters now */ | 2316 | /* we actually need to set 'real' parameters now */ |
2317 | if ((fmt->fmt.pix.height * 2) > BUZ_MAX_HEIGHT) | 2317 | if (fmt->fmt.pix.height * 2 > BUZ_MAX_HEIGHT) |
2318 | settings.TmpDcm = 1; | 2318 | settings.TmpDcm = 1; |
2319 | else | 2319 | else |
2320 | settings.TmpDcm = 2; | 2320 | settings.TmpDcm = 2; |
@@ -2501,7 +2501,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe | |||
2501 | if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) { | 2501 | if (fh->v4l_buffers.allocated || fh->jpg_buffers.allocated) { |
2502 | dprintk(1, | 2502 | dprintk(1, |
2503 | KERN_ERR | 2503 | KERN_ERR |
2504 | "%s: VIDIOC_REQBUFS - buffers allready allocated\n", | 2504 | "%s: VIDIOC_REQBUFS - buffers already allocated\n", |
2505 | ZR_DEVNAME(zr)); | 2505 | ZR_DEVNAME(zr)); |
2506 | res = -EBUSY; | 2506 | res = -EBUSY; |
2507 | goto v4l2reqbuf_unlock_and_return; | 2507 | goto v4l2reqbuf_unlock_and_return; |