From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43410 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755586Ab2GKSgh (ORCPT ); Wed, 11 Jul 2012 14:36:37 -0400 Message-ID: <4FFDC7DA.1090808@redhat.com> Date: Wed, 11 Jul 2012 20:37:14 +0200 From: Hans de Goede MIME-Version: 1.0 To: Hans Verkuil CC: Linux Media Mailing List , halli manjunatha Subject: Re: [PATCH 1/5] v4l2: Add rangelow and rangehigh fields to the v4l2_hw_freq_seek struct References: <1342021658-27821-1-git-send-email-hdegoede@redhat.com> <1342021658-27821-2-git-send-email-hdegoede@redhat.com> <201207112001.18960.hverkuil@xs4all.nl> In-Reply-To: <201207112001.18960.hverkuil@xs4all.nl> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: Hi Hans, On 07/11/2012 08:01 PM, Hans Verkuil wrote: > Hi Hans, > > Thanks for the patch. > > I've CC-ed Halli as well. > > On Wed July 11 2012 17:47:34 Hans de Goede wrote: >> To allow apps to limit a hw-freq-seek to a specific band, for further >> info see the documentation this patch adds for these new fields. >> >> Signed-off-by: Hans de Goede >> --- >> .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | 44 ++++++++++++++++---- >> include/linux/videodev2.h | 5 ++- >> 2 files changed, 40 insertions(+), 9 deletions(-) >> >> diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml >> index f4db44d..50dc9f8 100644 >> --- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml >> +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml >> @@ -52,11 +52,21 @@ >> Start a hardware frequency seek from the current frequency. >> To do this applications initialize the tuner, >> type, seek_upward, >> -spacing and >> -wrap_around fields, and zero out the >> -reserved array of a &v4l2-hw-freq-seek; and >> -call the VIDIOC_S_HW_FREQ_SEEK ioctl with a pointer >> -to this structure. >> +wrap_around, spacing, >> +rangelow and rangehigh >> +fields, and zero out the reserved array of a >> +&v4l2-hw-freq-seek; and call the VIDIOC_S_HW_FREQ_SEEK >> +ioctl with a pointer to this structure. >> + >> + The rangelow and >> +rangehigh fields can be set to a non-zero value to >> +tell the driver to search a specific band. If the &v4l2-tuner; >> +capability field has the >> +V4L2_TUNER_CAP_HWSEEK_PROG_LIM flag set, these values >> +must fall within one of the bands returned by &VIDIOC-ENUM-FREQ-BANDS;. If >> +the V4L2_TUNER_CAP_HWSEEK_PROG_LIM flag is not set, >> +then these values must exactly match those of one of the bands returned by >> +&VIDIOC-ENUM-FREQ-BANDS;. > > OK, I have some questions here: > > 1) If you have a multiband tuner, what should happen if both low and high are > zero? Currently it is undefined, other than that the seek should start from > the current frequency until it reaches some limit. That would be driver specific, we could add the same "If rangelow/high is zero a reasonable default value is used." language as used for the spacing. For example for the si470x if both are zero I simply switch to the "Japan wide" band which covers all frequencies handled by the other bands, but if there is no such covers all ranges band, then the logical thing todo would just keep the band as is (so as determined by the last s_freq). > Halli, what does your hardware do? In particular, is the hwseek limited by the > US/Europe or Japan band range or can it do the full range? If I'm not mistaken > it is the former, right? > > If it is the former, then you need to explicitly set low + high to ensure that > the hwseek uses the correct range because the driver can't guess which of the > overlapping bands to use. > > 2) What happens if the current frequency is outside the low/high range? The > hwseek spec says that the seek starts from the current frequency, so that might > mean that hwseek returns -ERANGE in this case. What the si470x code currently does is just clamp the frequency to the new range before seeking, but -ERANGE works for me too. Regards, Hans