Trent Piepho [Wed, 31 Jan 2007 02:25:41 +0000 (23:25 -0300)]
V4L/DVB (5163): Add checks for CAP_SYS_ADMIN to VIDIOC_DBG_G_REGISTER
Before, root privileges were only needed to set hardware registers, not
to read them. On some hardware, reading from the wrong place at the
wrong time can hang the machine. So, to be consistent, root privileges
are required to read registers on all hardware.
Trent Piepho [Wed, 31 Jan 2007 01:47:18 +0000 (22:47 -0300)]
V4L/DVB (5162): Change VIDIOC_DBG_[SG]_REGISTER ioctls' reg address to 64 bits
Maybe someday there will be a device with a register address space >
32-bits, or maybe an i2c device which uses a protocol > 4 bytes long to
address its registers.
V4L/DVB (5157): Set phys, bustype, version, vendor and product for input device
Add phys-string, bustype, version, vendor and product to help udev and
others using EVIOCPHYS ioctl to identify the input device node.
Code taken (with little changes) from budget-ci.c
V4L/DVB (5154): Add some debug info, depending on debug level
With debug>0, it will show mute/unmute and set frequency events
with debug>=4, it will show get frequency events
Also, some kernel CodingStyle fixes were done.
V4L/DVB (5147): Make vivi driver to use vmalloced pointers
Before this patch, vivi were simulating a scatter gather DMA transfer.
While this is academic, showing how stuff really works on a real PCI
device, this means a non-optimized code.
There are only two memory models that vivi implements:
1) kernel alloced memory. This is also used by read() method.
On this case, a vmalloc32 buffer is allocated at kernel;
2) userspace allocated memory. This is used by most userspace apps.
video-buf will store this pointer.
a simple copy_to_user is enough to transfer data.
The third memory model scenario supported by video-buf is overlay mode.
This model is not implemented on vivi and unlikely to be implemented on
newer drivers, since now, most userspace apps do some post-processing
(like de-interlacing).
After this patch, some cleanups may be done at video-buf.c to avoid
allocating pages, when the driver doesn't need a PCI buffer. This is the
case of vivi and usb drivers.
Trent Piepho [Wed, 24 Jan 2007 01:38:13 +0000 (22:38 -0300)]
V4L/DVB (5146): Make VIDIOC_INT_[SG]_REGISTER ioctls no longer internal only
The direct register access ioctls were defined as kernel internal only,
but they are very useful for debugging hardware from userspace and are
used as such. Officially export them.
VIDIOC_INT_[SG]_REGISTER is renamed to VIDIOC_DBG_[SG]_REGISTER
Definition of ioctl and struct v4l2_register is moved from v4l2-common.h
to videodev2.h.
Types used in struct v4l2_register are changed to the userspace
exportable versions (u32 -> __u32, etc).
Use of VIDIOC_DBG_S_REGISTER requires CAP_SYS_ADMIN permission, so move
the check into the video_ioctl2() dispatcher so it doesn't need to be
duplicated in each driver's call-back function. CAP_SYS_ADMIN check is
added to pvrusb2 (which doesn't use video_ioctl2).
Antti Palosaari [Sun, 21 Jan 2007 18:56:10 +0000 (15:56 -0300)]
V4L/DVB (5137): Dvb: add new qt1010 tuner module
QT1010:
- old qt1010-code totally rewritten and put in own kernel module
- same enhancements as my earlier QT1010 125kHz patch
- tuner initialization
- register 1f calculation
- register 20 calculation
- register 25 calculation
m920x: (MSI Megasky)
- use new QT1010 module instead of old code
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Jan Nijs [Sat, 7 Oct 2006 04:06:54 +0000 (01:06 -0300)]
V4L/DVB (5135): Qt1010: correct hardlockup when an app access the DVB dongle
This patch changes qt1010.h to use dvb_usb_device struct instead of a
dvb_usb_adapter for accessing the private area of the driver.
Without this patch my PC hard locks when an application tries to access
the DVB tuner.
Signed-off-by: Jan Nijs <jan.nijs@scarlet.be> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Michael Krufky [Thu, 28 Sep 2006 17:47:21 +0000 (14:47 -0300)]
V4L/DVB (5133): M920x: move qt1010_tuner_attach function into qt1010.h
The megasky_tuner_attach function is not specific to this device.
This patch renames it to qt1010_tuner_attach and moves it into the qt1010
header file.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Michael Krufky [Thu, 28 Sep 2006 04:46:49 +0000 (01:46 -0300)]
V4L/DVB (5131): M920x: more cleanups
Some cleanups and suggestions from Patrick Boettcher.
Dropped the mutex in m9206_rc_query using #if 0, because
M9206_CORE, M9206_I2C, M9206_FILTER and M9206_FW can be accessed
concurrently.
Thanks to both Aapo Tahkola and Patrick Boettcher.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
- hardware pid filtering no longer enabled unless in usb 1.x mode
- more responsive rc handling
- some minor bug fixes and code refolding
- m9206_write delay dropped (doesn't seem to be needed)
V4L/DVB (5124): Dvb-usb: Initial support for MSI Mega Sky 580 based on Uli m9206
Currently, the driver works in bulk mode supporting both USB 2.0 and
1.0 with and without hardware pid filters.
The ULi m9205 also supports isochronous transfer mode, but I have
dropped support for it because it depends on firmware and does not work
on all USB host chips. Further, I have no firmware with remote
controller support for this mode.
Tino Keitel [Mon, 22 Jan 2007 21:33:07 +0000 (18:33 -0300)]
V4L/DVB (5121): Proper vendor/device ID for the CinergyT2 input device
I noticed that udev does not create a symlink for the CinergyT2 remote input
device in /dev/input/by-id, which is required if I want to have a
unique device name for lircd.
The attached patch tries to achive this. However, udev still omits the
input device for /dev/input/by-id symlinks. I think something is still
not reported correctly.
V4L/DVB (5117): Fix: VIDIOC_G_TUNER were returning an endless number of tuners
pvrusb2 have only one tuner inside. However, as it were not handling
index, a call to v4l-info were returning as if it were an infinite
number of tuners:
$ v4l-info|grep VIDIOC_G_TUNER |head -5
VIDIOC_G_TUNER(0)
VIDIOC_G_TUNER(1)
VIDIOC_G_TUNER(2)
VIDIOC_G_TUNER(3)
VIDIOC_G_TUNER(4)
Acked-by: Mike Isely <isely@isely.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
V4L/DVB (5116): Remove some warnings when compiling on x86_64
pvrusb2-encoder.c: In function 'pvr2_encoder_cmd':
pvrusb2-encoder.c:195: warning: format '%u' expects
type 'unsigned int', but argument 3 has type 'long unsigned int'
pvrusb2-encoder.c:205: warning: format '%u' expects
type 'unsigned int', but argument 3 has type 'long unsigned int'
pvrusb2-encoder.c: In function 'pvr2_encoder_vcmd':
pvrusb2-encoder.c:303: warning: format '%u' expects
type 'unsigned int', but argument 3 has type 'long unsigned int'
Acked-by: Mike Isely <isely@isely.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
V4L/DVB (5110): Keep the previous tvnorm default for cx88 and cx88-blackbird
The video_ioctl2 conversion replaced the default from NTSC to PAL_BG.
This broke cx88-blackbird. Probably, there are some badness at this
driver, not doing all required stuff to change video standard.
V4L/DVB (5109): Convert cx88-blackbird to use video_ioctl2
This patch finishes cx88-blackbird conversion to use video_ioctl2. Video
standards are generated automatically inside videodev.c. the big ioctl
parser is removed, using, instead, video_ioctl2.
V4L/DVB (5102): make videodev to auto-generate standards
v4l2_tvnorm were meant to describe video standards and its names to V4L2 API.
However, this were doing by some static structures at the driver.
This patch changes the internals in a way that, at the driver, only a
v4l2_tvnorm (a 64 bit integer) should be filled, with all supported
tvnorms. videodev will dynamically generate the proper API array
based on supported standards.
V4L/DVB (5097): Convert cx8800 driver to video_ioctl2 handler
video_ioctl2 handler provides V4L2 API parsing.
Using it makes the driver simpler, and isolates API parsing.
This allows future reusage of driver controls using other ways, like sysfs
and/or procfs and increases isolation of driver-specific handling from the
generic common ioctl processing.
V4L/DVB (5095): Pvrusb2: Allow VIDIOC_S_FMT with -1 for resolution values
With the previous patch, mplayer started but was polling the video
device forever without any video actually coming out. Further analysis
showed that it does a VIDIOC_S_FMT with width and height set to -1 (!!!).
The code handling this only cares that both are lower than the minimum
range allowed so it ends up setting the size to 19x17 (!!) This pretty
much breaks the encoder here. Even if this breakage is yet another (TM)
result of my setup, setting the size to 19x17 by default would surprise
most users IMHO.
So, special case for -1 and interpret this to be a request for the
default size, please. Users can then set their favorite size both
through mplayer and through sysfs.
With this patch, mplayer finally works in pvr:// mode (not that we
really gain anything over operating it through sysfs with lirc,
sometime I might actually get off my lazy a** and contribute this
setup too)
This should allow mplayer pvr:// to start. The trick is that no matter
what actual input we use under this "fake" one, it will be able to do
stereo :-)
Audio mode changes are not private to the audio chip - other I2C
modules need to see this as well. And since the command in question
is VIDIOC_S_TUNER which is a standard v4l2 command, we really should
be broadcasting it out. This change sets up a broadcast pathway for
VIDIOC_S_TUNER and also eliminates the now redundant code from the
audio chip handler.
This fix enables stereo reception for the FM radio
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Ahmed S. Darwish [Sat, 20 Jan 2007 03:35:03 +0000 (00:35 -0300)]
V4L/DVB (5090): Pvrusb2: A patch to use ARRAY_SIZE macro when appropriate
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Sat, 20 Jan 2007 03:30:23 +0000 (00:30 -0300)]
V4L/DVB (5089): Pvrusb2: V4L EXT_CTRLS fixup
Attempts to enumerate or operate on a group of EXT_CTRLS where the
group size is zero is OK; don't fail on such operations. At least one
application uses this to probe for the existence of this API so let it
succeed.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Sat, 20 Jan 2007 03:15:41 +0000 (00:15 -0300)]
V4L/DVB (5083): Pvrusb2: Remove automodeswitch control
The automodeswitch control was a feature that enable automatic radio /
tv switching based on the selected frequency. However since frequency
ranges can overlap and also since apparently in some cases it's
possible for the same frequency range to be both tv and radio in a
specific region, then this feature can't safely work. So it's removed.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Michael Schimek [Thu, 18 Jan 2007 19:17:39 +0000 (16:17 -0300)]
V4L/DVB (5077): Bttv cropping support
Adds the missing VIDIOC_CROPCAP, G_CROP and S_CROP ioctls, permitting
applications to capture or overlay a subsection of the picture or to
extend the capture window beyond active video, into the VBI area and the
horizontal blanking. VBI capturing can start and end on any line,
including the picture area, and apps can capture different lines of each
field and single fields.
For compatibility with existing applications, the open() function
resets the cropping and VBI capturing parameters and a VIDIOC_S_CROP
call is necessary to actually enable cropping.
Regrettably in PAL-M, PAL-N, PAL-Nc and NTSC-JP mode the maximum image
width will increase from 640 and 768 to 747 and 923 pixels respectively.
Like the VBI changes however, this should only affect applications which
depend on former driver limitations, such as never getting more than 640
pixels regardless of the requested width.
Also, new freedoms require additional checks for conflicts and some
applications may not expect an EBUSY error from the VIDIOC_QBUF and
VIDIOCMCAPTURE ioctls. These errors should be rare though.
So far, the patch has been tested on a UP machine with a bt878 in PAL-
BGHI and NTSC-M mode using xawtv, tvtime, mplayer/mencoder, zapping/
libzvbi and these tools: http://zapping.sf.net/bttv-crop-test.tar.bz2
I'd be grateful about comments or bug reports.
Signed-off-by: Michael H. Schimek <mschimek@gmx.at> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Sat, 30 Dec 2006 21:31:22 +0000 (18:31 -0300)]
V4L/DVB (5059): Pvrusb2: Be smarter about mode restoration
Switch back to the previous input selection when the radio device is
closed - but only do that if the current input selection is still the
radio (i.e. it appears that it hasn't been messed with).
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Clean up and tighten logic involving stream configuration. This
mainly involves changes to pvrusb2-v4l2.c, where we better clarify how
we use the stream configuration enum and implement a cleaner means to
control streaming for a given device node.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:36:33 +0000 (23:36 -0300)]
V4L/DVB (5053): Pvrusb2: Change default volume to something sane
The default volume of 65535 is too high. Make is something smaller.
Note that this _only_ changes the default value. Specifically, there
are no scaling or other more intrusive changes here. I'm just sick of
constantly having to reduce the volume every time I plug in and test
the device! (And unfortunately we can't do a better fix like scaling
the volume so that 65535 makes sense because doing so will screw up
any app - like MythTV - which expects the old scaling.) Too bad V4L
controls don't have better defined ranges.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:33:00 +0000 (23:33 -0300)]
V4L/DVB (5052): Pvrusb2: Remove stream claiming hack from /dev/radio
Trying to temporarily check that the stream is not claimed during open
of the radio device is at best a race condition. What's to stop
another app from claiming the stream anyway the instant after the
check is done? The implementation for this was dicey anyway. So it's
removed. The only "price" for this is that if /dev/radioX is opened
while streaming video, then the video stream is just going to switch
to radio mode anyway. If a user does this, he gets what he expects...
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:30:13 +0000 (23:30 -0300)]
V4L/DVB (5051): Pvrusb2: Better radio versus tv frequency handling
Separate track radio versus tv frequency so that when we switch modes
we can also switch to a sane frequency appropriate for the mode. Also
implement logic to automate mode switching in certain cases.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:23:22 +0000 (23:23 -0300)]
V4L/DVB (5047): Pvrusb2: Fix tuning calculation when in radio mode
Frequency units in V4L2 are apparently different when in radio mode
compared to tv mode. Why? Who knows. This change adapts the driver
appropriately - so that internally we always only deal in Hz and don't
have to muck with craziness like this.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:19:42 +0000 (23:19 -0300)]
V4L/DVB (5045): Pvrusb2: Fix heap corruption introduced by radio mods
We can't allocate v4l device structures in a block, since the v4l core
governs when each device actually gets freed. This bug was introduced
as part of the core radio implementation. Fix it.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 28 Dec 2006 02:12:28 +0000 (23:12 -0300)]
V4L/DVB (5041): Pvrusb2: Use separate enumeration for get/store of minor number
Use separate enum for get/store of minor number; we want pvr2_config
to go away eventually and since it really means something different,
don't use it here
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
The "main" V4L2 interface patch. This is yet very incomplete, incorrect and
probably inappropriate for inclusion as-is, but at least with this I 'm able
to tune and play radio through a V4L2 program (pvr-radio.c, a "thumb" version
of ivtv-radio.c with just the essentials).
Therefore, it kinda gives an idea of what is needed to support this, hm,
interface (partly used also by e.g., kradio). Please point out any mistakes
on this code. I 'm sure I 'm messing up some struct initialization somewhere
but currently I 'm too lazy to actually think this through until I complete
the functionality (e.g., handle the VIDIOC_S_STD, ENUMINPUT, etc ioctls
appropriately).
V4L/DVB (5038): Pvrusb2: Implement stream claim checking function
Add (and expose) a new function, pvr2_channel_check_stream_no_lock(), in
pvrusb2-context.c. This is hopefully the last V4L2 interface related patch
to change anything outside pvrusb2-v4l2.c.
We need this to implement the open() for the radio device. The reason is
that within the *enter_context() section of open() we need to ensure nobody
is streaming and if we cannot, we should cleanup after ourselves and return
-EBUSY. We cannot just use claim_stream() because:
1) That would cause a deadlock trying to re-acquire the context lock
2) We only need to ensure that nobody is streaming. We don't need to
actually acquire the stream.
Again, this is a kinda ugly patch. Feel free to improve.
V4L/DVB (5037): Pvrusb2: Implement multiple minor device number handling
This is the first patch in preparation of the V4L2/IVTV radio interface.
It does away with the assumption of only one minor per device. It also
adds a file to show the radio minor as well. This can be useful for a
program like pvr-radio.c (when it grows up), since this way it can search
for the minor of the /dev/radioX device it opened and use the video minor
of the same driver instance to get to the actual stream.
The implementation looks kinda ugly. Feel free to improve (that is the
reason behind separate patches anyway).