Commit graph

51 commits

Author SHA1 Message Date
Trent Piepho 171f48e254 V4L/DVB (11660): zoran: fix bug when enumerating format -1
If someone requests a format at fmt->index == (unsigned)-1 and the first
format in the array doesn't have the requested type then num will still be
-1 when it's compared to fmt->index and there will appear to be a match.

Restructure the loop so this can't happen.  It's simpler this way too.  The
unnecessary check for (unsigned)fmt->index < 0 found by Roel Kluin
<roel.kluin@gmail.com> is removed this way too.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-05-09 18:50:54 -03:00
Hans Verkuil 5325b4272a V4L/DVB (11380): v4l2-subdev: change s_routing prototype
It is no longer needed to use a struct pointer as argument, since v4l2_subdev
doesn't require that ioctl-like approach anymore. Instead just pass the input,
output and config (new!) arguments directly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:27 -03:00
Hans Verkuil 3ff4ad815c V4L/DVB (11377): v4l: increase version numbers of drivers converted to v4l2_subdev.
With all the v4l2_subdev changes that were made to these drivers it is a
good idea to increase the version number of each driver.

It's just the patch level that is increased, except for the zoran and saa7146
drivers where the minor number was increased due to the more substantial
changes that were made to those two drivers.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:26 -03:00
Hans Verkuil e6574f2fbe V4L/DVB (11373): v4l2-common: add explicit v4l2_device pointer as first arg to new_(probed)_subdev
The functions v4l2_i2c_new_subdev and v4l2_i2c_new_probed_subdev relied on
i2c_get_adapdata to return the v4l2_device. However, this is not always
possible on embedded platforms. So modify the API to pass the v4l2_device
pointer explicitly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:24 -03:00
Hans Verkuil f41737ece4 V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.
s_std didn't belong in the tuner ops. Stricly speaking it should be part of
the video ops, but it is used by audio and tuner devices as well, so it is
more efficient to make it part of the core ops.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:22 -03:00
Randy Dunlap 8737f66e64 V4L/DVB (11237): media/zoran: fix printk format
Fix printk format warning:

drivers/media/video/zoran/zoran_driver.c:345: warning: format '%lx'
expects type 'long unsigned int', but argument 5 has type 'phys_addr_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:42 -03:00
Hans Verkuil 33470423ab V4L/DVB (11048): zoran: fix incorrect return type of notify function.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:23 -03:00
Hans Verkuil 1cd3c0fa92 V4L/DVB (11022): zoran/bt819: use new notify functionality.
Bt819 needs the parent driver to drive a GPIO pin low and high in order to
reset its fifo. Use the new notify callback for this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:21 -03:00
Trent Piepho c61402bae8 V4L/DVB (10934): zoran: replace functions names in strings with __func__
It reduces the size of the driver over all, and the function names in
strings need to be manually kept up to date while __func__ doesn't.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:17 -03:00
Trent Piepho e5ee3f643d V4L/DVB (10933): zoran: Pass zoran_fh pointers instead of file pointers
Many functions had a struct file pointer argument, but all they wants is
the struct zoran_fh pointer from the file's private data.  Since every
caller of those functions already has the zoran_fh, just pass the that
instead.  This saves a dereference in each function change.

While I'm at it, change the code formatting of affected functions to be
kernel standard style.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:17 -03:00
Jean Delvare ee9a9d661d V4L/DVB (10932): zoran: Don't frighten users with failed buffer allocation
kmalloc() can fail for large video buffers. By default the kernel
complains loudly about allocation failures, but we don't want to
frighten the user, so ask kmalloc() to keep quiet on such failures.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:17 -03:00
Jean Delvare 4dbf46a048 V4L/DVB (10931): zoran: Drop the lock_norm module parameter
The lock_norm module parameter doesn't look terribly useful. If you
don't want to change the norm, just don't change it. As a matter of
fact, no other v4l driver has such a parameter.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:16 -03:00
Trent Piepho 1159b7f19f V4L/DVB (10930): zoran: Unify buffer descriptors
The zoran driver had two kinds of buffer descriptors, one for jpg buffers
and one for raw buffers.  They were mostly the same with only a couple

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:16 -03:00
Mauro Carvalho Chehab 7e0a16f611 V4L/DVB (10907): avoid loading the entire videodev.h header on V4L2 drivers
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:15 -03:00
Trent Piepho e276f7b5f9 V4L/DVB (10848): zoran: Change first argument to zoran_v4l2_buffer_status
It was a struct file *, but all that function wants is the struct zoran_fh
from the file's private data.  Since every caller already has this, just
pass the zoran_fh instead.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:08 -03:00
Trent Piepho 9cfb6a3f1b V4L/DVB (10794): v4l2: Move code to zero querybuf output struct to v4l2_ioctl
For VIDIOC_QUERYBUF only the first two fields, size and type, are used as
input.  The rest can be filled in by the driver as output.  Most drivers do
not actually use all the field and unused ones should be zeroed out.  Some
drivers have code to do this and some drivers should but don't.  So put
some zero out code in v4l2_ioctl so that all drivers using that system get
it.

The drivers that have zeroing code get that code removed.

Some drivers checked that the type field was valid, but v4l2_ioctl already
does this so those checks can be removed as well.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:04 -03:00
Hans Verkuil e686e73ca7 V4L/DVB (10733): zoran: increase bufsize to a value suitable for 768x576.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:59 -03:00
Hans Verkuil 27f7952573 V4L/DVB (10732): zoran: s_jpegcomp should return a proper result, not 0.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:59 -03:00
Hans Verkuil 7f6adeaf2d V4L/DVB (10730): v4l-dvb: cleanup obsolete references to v4l1 headers.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[mchehab@redhat.com: fix compilation of tea575x-tuner.c]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:59 -03:00
Hans Verkuil 0ab6e1c38d V4L/DVB (10729): zoran: convert to v4l2_device/v4l2_subdev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:58 -03:00
Hans Verkuil 886fe23d1c V4L/DVB (10717): zoran: TRY_FMT and S_FMT now do the same parameter checks.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:57 -03:00
Hans Verkuil 497d7d0b92 V4L/DVB (10716): zoran: change buffer defaults to something that works with tvtime
By popular request increased the default number and size of the buffers
to something that tvtime likes.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:57 -03:00
Hans Verkuil 602dd48a35 V4L/DVB (10715): zoran: clean up some old V4L1 left-overs and remove the MAP_NR macro.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:57 -03:00
Hans Verkuil 107063c615 V4L/DVB (10714): zoran et al: convert zoran i2c modules to V4L2.
The zoran i2c modules were still using V4L1 internally. Replace this
with V4L2. Also deleted saa7111.c and saa7114.c, we use saa7115.c instead.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[mchehab@redhat.com: fix v4l2_ctrl_query_fill_std merge conflict]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:57 -03:00
Hans Verkuil 84c1b09495 V4L/DVB (10713): zoran: if reqbufs is called with count == 0, do a streamoff.
count == 0 has a special meaning, implement this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil 5ca75b00ff V4L/DVB (10712): zoran: fix G_FMT
Returned height was really height / 2.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil 0ba514d5d3 V4L/DVB (10711): zoran: fix TRY_FMT support
Actually try to turn the format into something usable rather than just
rejecting it if it isn't perfect.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil 7f37cc9bae V4L/DVB (10710): zoran: cleanups in an attempt to make the source a bit more readable.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil aff88bca73 V4L/DVB (10709): zoran: set correct parent of the video device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil dcbd83b177 V4L/DVB (10708): zoran: remove old V4L1 ioctls, use v4l1-compat instead.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:56 -03:00
Hans Verkuil 9f1b9efa67 V4L/DVB (10707): zoran: set bytesperline to 0 when using MJPEG.
Remove bogus check on bytesperline in the try_fmt_vid_out call.
Just set it to 0.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:55 -03:00
Hans Verkuil 3e66793b62 V4L/DVB (10706): zoran: fix field typo.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:55 -03:00
Hans Verkuil 869826a1cb V4L/DVB (10705): zoran: use slider flag with volume etc. controls.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:55 -03:00
Hans Verkuil b80696b700 V4L/DVB (10704): zoran: remove broken BIGPHYS_AREA and BUZ_HIMEM code, and allow for kmallocs > 128 kB
Remove memory allocation madness.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:55 -03:00
Hans Verkuil 96b8e145f0 V4L/DVB (10703): zoran: convert to video_ioctl2 and remove 'ready_to_be_freed' hack.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:55 -03:00
Randy Dunlap 995a65285b V4L/DVB (10631): zoran: fix printk format
Fix printk format warning:

drivers/media/video/zoran/zoran_driver.c:345: warning: format '%lx' expects type 'long unsigned int', but argument 5 has type 'phys_addr_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:49 -03:00
Mauro Carvalho Chehab e08e7b5f01 V4L/DVB (10834): zoran: auto-select bt866 for AverMedia 6 Eyes
AFAIK, the bt866 is only seen on AverMedia 6 Eyes. However, no module selects it.

Adds a proper select for this driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-05 20:33:37 -03:00
Trent Piepho fc96ab7302 V4L/DVB (10226): zoran: Get rid of extra module ref count
The zoran driver does a module_get/put of THIS_MODULE on device open/close.
This isn't necessary as the kernel does this automatically.

Clean up the failure path of zoran_open() somewhat.

Make the dprintk()s on open/close a higher debug level and make the user
count printed take the current open/close into account.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:38 -02:00
Trent Piepho 5e098b6689 V4L/DVB (10225): zoran: Remove zr36057_adr field
The driver should only use the kernel mapped io address, zr36057_mem, and
not the PCI bus address, zr36057_adr.  Since the latter is only printed out
once, there is no need to save it in the driver data structure.

There was some old code that looked like it was for the Alpha architecture
which would use the PCI bus address.  It probably no longer applies to
modern kernels.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:38 -02:00
Trent Piepho 17faeb2091 V4L/DVB (10224): zoran: Use pci device table to get card type
Instead of using custom code, just let the device layer look it up for us
from the pci device table.  This requires extending the pci device table to
list each known card, plus a catch-all entry for the cards that don't have
sub-system vendor/device data.

Improve some of the info and error messages too.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:38 -02:00
Trent Piepho 601139e083 V4L/DVB (10223): zoran: Remove global device array
The driver was keeping a global array with an entry for each zoran device
probed.  It was a leftover from when the driver didn't dynamically allocate
the driver data for each device.

There was only one use left, in the video device's ->open() method, looking
up the struct zoran for the opened device from the minor number.  This can
be done better with video_get_drvdata().

Since zoran_num is now only used in the pci driver's ->probe() method, it
doesn't need to be an atomic_t and be static.  There is a race if multiple
zoran cards could be probed at the same time, but currently the probe
method for a given driver is single threaded.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:38 -02:00
Trent Piepho 45bdcefea2 V4L/DVB (10222): zoran: Better syntax for initializing array module params
When initializing a module parameter that is a per-card array, use
"{ [0 ... (BUZ_MAX-1)] = -1 }" instead of "{ -1, -1, -1, -1 }".  This way
all of the entries will be correctly set to -1 if someone changes BUZ_MAX
to a value other than 4.

Adjust some of the parameter help text too.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:38 -02:00
Trent Piepho 66aa66ea31 V4L/DVB (10212): Convert to be a pci driver
This is a really old and crufty driver that wasn't using the long
established pci driver framework.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
[mchehab@redhat.com: Cleaned up a few CodingStyle issues]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:37 -02:00
Mauro Carvalho Chehab dbdf03b48b V4L/DVB (10208): zoran: Re-adds udev entry removed by changeset 60b4bde4
Changeset 60b4bde48b removed an unused
struct on zoran driver, when compiled with "Y".

However, as pointed by Jean Delvare <khali@linux-fr.org>, this is
neeeded when the driver is compiled as a module, since udev relies on it
to auto-load the module.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29 08:35:37 -02:00
Hans Verkuil 069b747931 V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl.
Since internal to v4l2 the ioctl prototype is the same regardless of it
being called through .ioctl or .unlocked_ioctl, we need to convert it all
to the long return type of unlocked_ioctl.

Thanks to Jean-Francois Moine for posting an initial patch for this and
thus bringing it to our attention.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:34 -02:00
Hans Verkuil bec43661b1 V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:12 -02:00
Mauro Carvalho Chehab 60b4bde48b V4L/DVB (10118): zoran: fix warning for a variable not used
Fix this warning:

drivers/media/video/zoran/zoran_card.c:156: warning: ‘zr36067_pci_tbl’ defined but not used

Currently, zoran driver relies on a find routine that doesn't use the
pci table.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:40:35 -02:00
Hans Verkuil f473bf76c7 V4L/DVB (9503): v4l: remove inode argument from video_usercopy
The inode argument was never used. Removing it from video_usercopy
brings the function pointer type of video_usercopy in line with similar
v4l2 functions, thus simplifying several drivers.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29 17:53:26 -02:00
Jean Delvare d54c17e435 V4L/DVB (9234): zoran: Drop redundant printk
There's no point in logging two messages for the same error.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-17 17:24:49 -03:00
Jean Delvare 54c776a5bc V4L/DVB (9197): zoran: set adapter class to I2C_CLASS_TV_ANALOG
The adapter class of the zoran driver was never set. However, converting
i2c drivers used by zoran to the new i2c API requires this field to be
correct.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-17 17:15:49 -03:00