Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev don't try to set frequencies lower or higher than th...
details: https://anonhg.NetBSD.org/src/rev/f4b3e409a23e
branches: trunk
changeset: 760101:f4b3e409a23e
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Dec 26 23:41:45 2010 +0000
description:
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".
diffstat:
sys/dev/video.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r e13321ac7044 -r f4b3e409a23e sys/dev/video.c
--- a/sys/dev/video.c Sun Dec 26 21:05:34 2010 +0000
+++ b/sys/dev/video.c Sun Dec 26 23:41:45 2010 +0000
@@ -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 <pat%polycrystal.org@localhost>
@@ -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;
-
- if (hw->set_frequency == NULL)
+ struct video_tuner vt;
+ int error;
+
+ 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;
Home |
Main Index |
Thread Index |
Old Index