summaryrefslogtreecommitdiff
path: root/drivers/media/video/ivtv/ivtv-fileops.c
diff options
context:
space:
mode:
authorIan Armstrong <ian@iarmst.demon.co.uk>2010-06-12 13:41:57 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 14:48:13 -0300
commit215659d14f9dbc849ccda1655c94d710f8cc6384 (patch)
tree7f1c65043106c2b14492616e48b17d76243a20f4 /drivers/media/video/ivtv/ivtv-fileops.c
parent914610e8c508224a6fb9fb501ed4bda25b340ba6 (diff)
V4L/DVB: ivtv: Automatic firmware reload
If the firmware has failed, this patch will automatically reload & restart the card. The previous card state will be restored on a successful restart. Firmware reload will only happen if neither the encoder or decoder is active. If the card is busy then behaviour is as before, returning -EIO on device access until the reload can occur. On cards that support video output, coloured bars will be displayed during the reload. Andy Walls (ivtv maintainer and patch committer) made minor tweaks to comments and the logged messages, but nothing substantial otherwise. Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk> Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-fileops.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 3fb21e1406a1..a6a2cdb81566 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -536,8 +536,12 @@ int ivtv_start_decoding(struct ivtv_open_id *id, int speed)
return -EBUSY;
}
rc = ivtv_start_v4l2_decode_stream(s, 0);
- if (rc < 0)
- return rc;
+ if (rc < 0) {
+ if (rc == -EAGAIN)
+ rc = ivtv_start_v4l2_decode_stream(s, 0);
+ if (rc < 0)
+ return rc;
+ }
}
if (s->type == IVTV_DEC_STREAM_TYPE_MPG)
return ivtv_set_speed(itv, speed);
@@ -926,19 +930,21 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp)
IVTV_DEBUG_FILE("open %s\n", s->name);
#ifdef CONFIG_VIDEO_ADV_DEBUG
+ /* Unless ivtv_fw_debug is set, error out if firmware dead. */
if (ivtv_fw_debug) {
IVTV_WARN("Opening %s with dead firmware lockout disabled\n",
video_device_node_name(vdev));
IVTV_WARN("Selected firmware errors will be ignored\n");
- }
-
- /* Unless ivtv_fw_debug is set, error out if firmware dead. */
- if (ivtv_firmware_check(itv, "ivtv_serialized_open") && !ivtv_fw_debug)
- return -EIO;
+ } else {
#else
- if (ivtv_firmware_check(itv, "ivtv_serialized_open"))
- return -EIO;
+ if (1) {
#endif
+ res = ivtv_firmware_check(itv, "ivtv_serialized_open");
+ if (res == -EAGAIN)
+ res = ivtv_firmware_check(itv, "ivtv_serialized_open");
+ if (res < 0)
+ return -EIO;
+ }
if (s->type == IVTV_DEC_STREAM_TYPE_MPG &&
test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags))