Module Name: src
Committed By: jmcneill
Date: Sun Dec 26 23:41:46 UTC 2010
Modified Files:
src/sys/dev: video.c
Log Message:
don't try to set frequencies lower or higher than the tuner's allowed
range -- the v4l2 spec says "when the requested frequency is not possible
the driver assumes the closest possible value".
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/video.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/video.c
diff -u src/sys/dev/video.c:1.25 src/sys/dev/video.c:1.26
--- src/sys/dev/video.c:1.25 Fri Dec 24 20:54:28 2010
+++ src/sys/dev/video.c Sun Dec 26 23:41:45 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.25 2010/12/24 20:54:28 jmcneill Exp $ */
+/* $NetBSD: video.c,v 1.26 2010/12/26 23:41:45 jmcneill Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <[email protected]>
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.25 2010/12/24 20:54:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.26 2010/12/26 23:41:45 jmcneill Exp $");
#include "video.h"
#if NVIDEO > 0
@@ -1319,12 +1319,24 @@
{
const struct video_hw_if *hw = sc->hw_if;
struct video_frequency vfreq;
+ struct video_tuner vt;
+ int error;
- if (hw->set_frequency == NULL)
+ if (hw->set_frequency == NULL || hw->get_tuner == NULL)
return ENOTTY;
if (freq->type != V4L2_TUNER_ANALOG_TV)
return EINVAL;
+ vt.index = freq->tuner;
+ error = hw->get_tuner(sc->hw_softc, &vt);
+ if (error)
+ return error;
+
+ if (freq->frequency < vt.freq_lo)
+ freq->frequency = vt.freq_lo;
+ else if (freq->frequency > vt.freq_hi)
+ freq->frequency = vt.freq_hi;
+
vfreq.tuner_index = freq->tuner;
vfreq.frequency = freq->frequency;