v4l2: add hardware frequency seek ioctl interface
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20080226163918.GB9178@plankton
Quoted 4 lines · On Tue, 26 Feb 2008 08:39:18 -0800 Brandon Philips <[email protected]> wrote:
Quoted 3 lines · Keith Mok
Add hardware frequency seek ioctl and capacity as supported by many chipsets but no interface in v4l2. Any comments about adding a new ioctl or use the reserved parameters in
v4l2_frequency?
Seems fine to me to have an specific ioctl for doing radio frequency seeks.
Quoted 2 lines
If we do end up adding this we will need to add it to the spec:
http://v4l2spec.bytesex.org/
Yes. API should describe how this works.
Quoted 2 lines
So, could you please explain what this control does? And perhaps some pseudo code of how it would be used.
It is good to have a patch to a real driver, implementing this feature. I don't like the idea of implementing newer ioctls at the API without having an in-kernel driver using. Having the driver ioctl implementation helps other developers that may need to use this interface on other places.
Cheers,
Mauro
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
Hi,
Quoted 1 line
Seems fine to me to have an specific ioctl for doing radio frequency seeks.
That seems to be a good approach. Is there any documentation on how the interface is currently implemented?
Quoted 4 lines
It is good to have a patch to a real driver, implementing this feature. I don't like the idea of implementing newer ioctls at the API without having an in-kernel driver using. Having the driver ioctl implementation helps other developers that may need to use this interface on other places.
I would be very happy to add this functionality to my radio-si470x.c driver. Seek support can be parameterized with this device in many ways.
This is all described in a document from Silabs (available via Google) called AN284Rev0_1.pdf
These parameters are not only used when seeking up/down, but also during frequency tuning. They are already implemented as module parameters,
as they are country specific and should not be changed during normal operation:
- Band selection (upper/lower frequency limits)
- Spacing selection
- De-emphasis selection
Additionally these parameters are only used by the seek algorithm:
- RSSI Seek Threshold (range: 0..254, 254=highest threshold)
- Signal-Noise-Ratio (range: 0..15, 15=higest SNR ratio)
- FM-Impulse Noise Detection Counter (range: 0..15, 15=best audio quality)
Propably it is wise to give the user space applications the possiblity to change these parameters at run time (ioctl). Else I'll implement them as module parameters, too.
Bye,
Toby
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
Quoted 9 lines · Tobias Lorenz
Additionally these parameters are only used by the seek algorithm: - RSSI Seek Threshold (range: 0..254, 254=highest threshold) - Signal-Noise-Ratio (range: 0..15, 15=higest SNR ratio) - FM-Impulse Noise Detection Counter (range: 0..15, 15=best audio quality)
Propably it is wise to give the user space applications the possiblity to change these parameters at run time (ioctl).
Else I'll implement them as module parameters, too.
Please don't implement things like this as module parameters. What happens when you have two device plugged in and want different values?
Example case: Drivers that use module parameters for devices without EEPROMs. What happens when I have two different models without EEPROMs in my box at the same time.
It would be far better to see these things defined per device in sysfs if you can't manage an IOCTL. However, in this case it should be an IOCTL.
Cheers,
Brandon
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
Quoted 6 lines · On Mon, 3 Mar 2008 13:06:50 -0800 Brandon Philips <[email protected]> wrote:
Quoted 5 lines · Tobias Lorenz
Additionally these parameters are only used by the seek algorithm: - RSSI Seek Threshold (range: 0..254, 254=highest threshold) - Signal-Noise-Ratio (range: 0..15, 15=higest SNR ratio) - FM-Impulse Noise Detection Counter (range: 0..15, 15=best audio quality)
Quoted 7 lines
Quoted 4 lines
Propably it is wise to give the user space applications the possiblity to change these parameters at run time (ioctl).
Else I'll implement them as module parameters, too.
Please don't implement things like this as module parameters. What happens when you have two device plugged in and want different values?
Agreed.
Quoted 3 lines
It would be far better to see these things defined per device in sysfs if you can't manage an IOCTL. However, in this case it should be an IOCTL.
The better would be to use VIDIOC_[G/S/ENUM]_CTRL to allow specifying those parameters.
Cheers,
Mauro
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Keith,
I fully agree, that having something different then an ioctl to control the seek behavior is not the right way.
Quoted 7 lines
For the usage of hardware frequency seek (struct
v4l2_hw_freq_seek), it is as follows:
tuner, type andstart_freqhave the same meaning as the fields inv4l2_frequency.wrap_aroundmeans the search will wrap around or stop if seek reach maximum/minimum limit.seek_upward= 1 means seek frequency upward 0 means seek frequency downward.
That sounds, like there's already a proposal.
Can you provide me with the current patches and documentation?
They don't seem to be part of the V4L2 documentation, the mercurial V4L or the Linux git repository yet.
Quoted 1 line
Any suggestions or improvement recommendations ?
The answer to that question depends on what's already planned or probably already implemented.
As said, the SI470x has several options to change the seek behavior:
Quoted 3 lines
RSSI Seek Threshold (range: 0..254, 254=highest threshold) - Signal-Noise-Ratio (range: 0..15, 15=highest SNR ratio) - FM-Impulse Noise Detection Counter (range: 0..15, 15=best audio quality)
I would implement these features as recommended by Mauro using VIDIOC_[G/S/ENUM]_CTRL. Especially I need some additional V4L2_CID_* for it.
When named corresponding to the register names, they would look like this:
#define V4L2_CID_SEEKTH (V4L2_CID_BASE+24) /* RSSI Seek Threshold */ #define V4L2_CID_SKSNR (V4L2_CID_BASE+25) /* Seek SNR Threshold */ #define V4L2_CID_SKCNT (V4L2_CID_BASE+26) /* Seek FM Impulse Detection Threshold */
The implementation is then rather simple and will provide proper default settings for these registers. I guess, the patch has less then 50 code lines.
More problematic is to patch one of the radio applications to test the new seek behavior.
Another question: If we implement a dedicated ioctl for seek operations,
will we also implement a compatibility function, that can be used for all devices,
that doesn't have hardware seek functionality?
I mean, a radio application should be able to just call the seek ioctl, independent of whether the hardware supports it or not. If a specific version is available to support the device's hardware seek functionality, then that's fine and we use it. If the hardware doesn't support seek operations, then we have the compatibility function,
that executes the usual "tune and check for signal strength" operation, as currently done in every application. So we basically should move the functionality from the application to the kernel.
Bye,
Toby
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
Quoted 6 lines · Tobias Lorenz
If a specific version is available to support the device's hardware seek functionality, then that's fine and we use it. If the hardware doesn't support seek operations, then we have the compatibility function, that executes the usual "tune and check for signal strength" operation, as currently done in every application. So we basically should move the functionality from the application to the kernel.
Please don't emulate hardware features in the Kernel.
The V4L layer should do its best to expose all features of a device. However, if a device needs emulation, translation or conversion of any sort it should be done in userspace- preferably in a library.
Plus, I am sure the application developers would love to see a libradio for V4L radio devices to simplify their apps :D
Cheers,
Brandon
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Keith,
Quoted 3 lines
I have already submit the patch to the group but we need an example patch/code also for the patch to be applied. I attached the previous submit patch here again.
Sorry, I have not found it on the v4l mailing list.
Quoted 2 lines
Such as different chipset vendor may have different seek tuning parameters and limits.
Therefore I would not implement this as ioctls, but using VIDIOC_[G/S/ENUM]_CTRL. #define V4L2_CID_SEEKTH (V4L2_CID_BASE+24) /* RSSI Seek Threshold */ #define V4L2_CID_SKSNR (V4L2_CID_BASE+25) /* Seek SNR Threshold */ #define V4L2_CID_SKCNT (V4L2_CID_BASE+26) /* Seek FM Impulse Detection Threshold */ But this is not done in the current implementation of the driver radio-si470x. The device is currently just initialized using the default/recommended parameters.
include/linux/videodev2.h
Quoted 4 lines
Signed-off-by Keith Mok <[email protected]>include/linux/videodev2.h +0
-0
I guess that there is also a patch to linux/include/media/v4l2-dev.h containing at least:
include/media/v4l2-dev.h 2008-03-23 14:39:16.000000000 +0100 renamed from include/media/v4l2-dev.h 2007-10-09 22:31:38.000000000 +0200 +2 -0
@@ -301,6 +301,8 @@ struct v4l2_frequency *a); int (*vidioc_s_frequency) (struct file *file, void *fh, struct v4l2_frequency *a); + int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, + struct v4l2_hw_freq_seek *a); /* Sliced VBI cap */ int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
Is there also a function, that indicated if seek is in progress, completed or failed, propably named vidioc_g_hw_freq_seek?
Okay, I made a patch to my driver radio-si470x to implement the functionality as your patch currently needs it. Implementing it, I found some remaining questions/issues:
1. When does seeking finish? Should the ioctl wait and return after a timeout, as currently implemented? Where and how is it indicated else?
=> I would suggest to have a vidioc_g_hw_freq_seek to indicate that seek is in progress, completed or failed.
2. At least my device does not support wrap around at the end of the frequency band. => I suggest to remove that parameter. The application has to handle seek failures anyway.
3. Do we need a start_freq parameter? The usual case for the application is to start seeking at the current frequency. And we have a vidioc_s_frequency for it, that applications can use, if they want to start seeking somewhere else. => I suggest to remove that parameter too.
Here is my patch. I have not modified any application yet to test the functionality. But the driver compiles cleanly. May I update your patch using my three suggestions above?
So for my ToDo list, I have:
- modify the seek patch and the radio-si470x driver.
- add code to change the seek parameters using VIDIOC_[G/S/ENUM]_CTRL.
- patch an application to test everything.
Bye,
Toby
radio-si470x.c 2008-03-23 14:40:53.000000000 +0100 renamed from radio-si470x.c 2008-03-23 11:12:07.000000000 +0100 +104 -4
154 lines not on this page · raw message
--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list