diff options
author | Ian Armstrong <ian@iarmst.demon.co.uk> | 2010-06-12 12:33:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 13:47:55 -0400 |
commit | 914610e8c508224a6fb9fb501ed4bda25b340ba6 (patch) | |
tree | 461d7bf99143ddda1847be4e9095a65268530ec3 /drivers/media/video/ivtv/ivtv-firmware.c | |
parent | a5ba334cda924eb0ae4754321ad7fc292c5a5288 (diff) |
V4L/DVB: ivtv: Add firmare monitoring and debug mode to ignore firmware problems
>From Ian's e-mail:
When a device is opened the firmware state will be checked. If it isn't
responding then the open will fail with -EIO. Due to the nature of the
hardware, a single failed check will block everything since we don't know
exactly what has failed. A side effect of this is the blocking of debug
access, so an additional debug level has been created which allows the block
to be bypassed.
Andy Walls' modifications:
I modified Ian's patch to add a separate fw_debug module parameter to change
the driver's behavior, as opposed to using the normal debug module parameter.
The fw_debug module parameter is only available when CONFIG_VIDEO_ADV_DEBUG
is set.
I also made some minor whitespace adjustments and changed some warning
messages to be a bit more specific. s/happy/glad/g
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-firmware.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-firmware.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index a71e8ba306b0..efb288d34ca3 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -271,3 +271,49 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv) | |||
271 | } | 271 | } |
272 | ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1); | 272 | ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1); |
273 | } | 273 | } |
274 | |||
275 | /* Check firmware running state. The checks fall through | ||
276 | allowing multiple failures to be logged. */ | ||
277 | int ivtv_firmware_check(struct ivtv *itv, char *where) | ||
278 | { | ||
279 | int res = 0; | ||
280 | |||
281 | /* Check encoder is still running */ | ||
282 | if (ivtv_vapi(itv, CX2341X_ENC_PING_FW, 0) < 0) { | ||
283 | IVTV_WARN("Encoder has died : %s\n", where); | ||
284 | res = -1; | ||
285 | } | ||
286 | |||
287 | /* Also check audio. Only check if not in use & encoder is okay */ | ||
288 | if (!res && !atomic_read(&itv->capturing) && | ||
289 | (!atomic_read(&itv->decoding) || | ||
290 | (atomic_read(&itv->decoding) < 2 && test_bit(IVTV_F_I_DEC_YUV, | ||
291 | &itv->i_flags)))) { | ||
292 | |||
293 | if (ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12) < 0) { | ||
294 | IVTV_WARN("Audio has died (Encoder OK) : %s\n", where); | ||
295 | res = -2; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | ||
300 | /* Second audio check. Skip if audio already failed */ | ||
301 | if (res != -2 && read_dec(0x100) != read_dec(0x104)) { | ||
302 | /* Wait & try again to be certain. */ | ||
303 | ivtv_msleep_timeout(14, 0); | ||
304 | if (read_dec(0x100) != read_dec(0x104)) { | ||
305 | IVTV_WARN("Audio has died (Decoder) : %s\n", | ||
306 | where); | ||
307 | res = -1; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | /* Check decoder is still running */ | ||
312 | if (ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0) < 0) { | ||
313 | IVTV_WARN("Decoder has died : %s\n", where); | ||
314 | res = -1; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | return res; | ||
319 | } | ||