V4L/DVB: sh_mobile_ceu_camera.c: preserve output window on VIDIOC_S_CROP
Current version of sh_mobile_ceu_camera.c interprets the V4L2 API specification
of the VIDIOC_S_CROP ioctl as "change input (for capture devices) area,
preserve scaling factors, therefore change output window," whereas a more
intuitive interpretation of the API is "change input area, preserve output
window." Switch sh_mobile_ceu_camera.c to use this interpretation.
Hans Verkuil [Sat, 10 Apr 2010 07:13:53 +0000 (04:13 -0300)]
V4L/DVB: vivi: clean up and a major overhaul
- Clean up the code
- Use the kernel's built-in vga8x16 font instead of our own.
- Drop exclusive open: now multiple users can open the device as per the V4L2 spec.
- Move the format description to the vivi device instead of keeping it in the file
handle. Again as per the spec.
- Streamline and simplify the drawing code. It is now easy to add text on top of
the colorbar pattern.
- Upgrade the max resolution to 1920x1200.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: videobuf-dma-sg: Avoid using a wrong size
drivers/media/video/videobuf-dma-sg.c: In function ‘__videobuf_mmap_mapper’:
drivers/media/video/videobuf-dma-sg.c:557: warning: ‘size’ may be used uninitialized in this function
The condition where size is floating should never happen, due to the paranoia check,
but a future change at the logic might break it. So, let's just set size to zero and
use it for the paranoia check.
Hans Verkuil [Sun, 28 Mar 2010 12:09:05 +0000 (09:09 -0300)]
V4L/DVB: v4l videobuf: add videobuf_buffer *buf as argument to mmap_mapper
mmap_mapper should operate on a buffer, not on a complete queue. So let
the videobuf-core find the correct buffer instead of duplicating that
code in each mmap_mapper implementation.
The dma-sg implementation has backwards compatibility code for handling
the V4L1_COMPAT layer. This code is now under the v4L1_COMPAT config option.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 28 Mar 2010 12:22:53 +0000 (09:22 -0300)]
V4L/DVB: v4l videobuf: move video_copy_to_user and copy_stream to core
The video_copy_to_user and copy_stream ops are almost identical for all
videobuf memtype variants. All that is needed is to use the new vaddr
op and these functions can be moved into the core, ensuring we have just
one single implementation instead of three.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 28 Mar 2010 11:18:37 +0000 (08:18 -0300)]
V4L/DVB: v4l videobuf: rename .vmalloc to .vaddr
Rename the .vmalloc op in struct videobuf_qtype_ops to .vaddr. This op returns
the virtual kernel address of a buffer. vaddr is a lot less confusing than
vmalloc since this callback does do any allocations.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices
The enum fe_caps provides flags that allow an application to detect
whether a device is capable of handling various modulation types etc.
A flag for detecting PSK_8, however, is missing.
This patch adds the flag FE_CAN_PSK_8 to frontend.h and implements
it for the gp8psk-fe.c and cx24116.c driver (apparently the only ones
with PSK_8). Only the gp8psk-fe.c has been explicitly tested, though.
Signed-off-by: Klaus Schmidinger <Klaus.Schmidinger@tvdr.de> Tested-by: Derek Kelly <user.vdr@gmail.com> Acked-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Driver is not properly initializing u64 constants on 32 bit systems:
drivers/media/IR/imon.c:301: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:302: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:304: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:305: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:308: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:309: warning: integer constant is too large for ‘long’ type
drivers/media/IR/imon.c:310: warning: integer constant is too large for ‘long’ type
Fix also a few troubles at error printk handling:
drivers/media/IR/imon.c: In function ‘imon_init_intf0’:
drivers/media/IR/imon.c:1909: warning: ‘ret’ may be used uninitialized in this function
drivers/media/IR/imon.c: In function ‘imon_init_intf1’:
drivers/media/IR/imon.c:1989: warning: ‘ret’ may be used uninitialized in this function
Cc: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: ir-core-priv.h: Fix a few CodingStyle errors
As reported by checkpatch.pl:
ERROR: open brace '{' following function declarations go on the next line
+static inline bool geq_margin(unsigned d1, unsigned d2, unsigned margin) {
ERROR: open brace '{' following function declarations go on the next line
+static inline bool eq_margin(unsigned d1, unsigned d2, unsigned margin) {
ERROR: open brace '{' following function declarations go on the next line
+static inline bool is_transition(struct ir_raw_event *x, struct ir_raw_event *y) {
Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
David Härdeman [Thu, 15 Apr 2010 21:46:00 +0000 (18:46 -0300)]
V4L/DVB: ir-core: change duration to be coded as a u32 integer
This patch implements the agreed upon 1:31 integer encoded pulse/duration
struct for ir-core raw decoders. All decoders have been tested after the
change. Comments are welcome.
Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 16 Apr 2010 21:29:02 +0000 (18:29 -0300)]
V4L/DVB: ir-core: add imon driver
This is a new driver for the SoundGraph iMON and Antec Veris IR/display
devices commonly found in many home theater pc cases and as after-market
case additions.
[mchehab@redhat.com: add KERN_CONT on line 2098 to shutup checkpatc.pl]
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 16 Apr 2010 21:28:35 +0000 (18:28 -0300)]
V4L/DVB: ir-core: add imon pad and mce keymaps
This adds the keymaps for the hardware decode scancodes imon
devices create for their native imon pad (and mini) remotes,
and the hardware scancodes generated by the imon devices when
used with an rc6 windows media center ed. remote.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 16 Apr 2010 21:27:58 +0000 (18:27 -0300)]
V4L/DVB: ir-core: make ir_g_keycode_from_table a public function
The imon driver I've previously submitted and have been porting to
use ir-core needs to use ir_g_keycode_from_table, as ir_keydown is
not sufficient, due to these things having really oddball hardware
decoders in them. This just moves the function declaration from
ir-core-priv.h over to ir-core.h.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dean Anderson [Fri, 9 Apr 2010 22:54:26 +0000 (19:54 -0300)]
V4L/DVB: s2255drv: removes kref tracking and videodev parent
kref replaced as suggested in code review
uses atomic variable to track when it is ok to delete device
removes setting of video device parent, which is now
handled in v4l2_device.c
Signed-off-by: Dean Anderson <linux-dev@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Joe Perches [Mon, 5 Apr 2010 19:05:39 +0000 (16:05 -0300)]
V4L/DVB: pvrusb2-v4l2: Rename dev_info to pdi
There is a macro called dev_info that prints struct device specific
information. Having variables with the same name can be confusing and
prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation
to converting the dev_info macro to a function.
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: tm6000: fix compilation due to the lack of a semicolon
Add a missing semicolon to fix this error:
In file included from drivers/staging/tm6000/tm6000-cards.c:32:
drivers/staging/tm6000/tm6000.h:123: error: two or more data types in
declaration specifiers
Randy Dunlap [Tue, 30 Mar 2010 17:32:04 +0000 (14:32 -0300)]
V4L/DVB: [-next] gspca: fix build for INPUT=m or INPUT=n
Handle case of GSPCA=m, INPUT=m when building gspca core;
also handle case of INPUT=n by using stubs.
drivers/media/video/gspca/gspca.c:662: error: implicit declaration of function 'gspca_input_destroy_urb'
drivers/media/video/gspca/gspca.c:668: error: implicit declaration of function 'gspca_input_create_urb'
drivers/media/video/gspca/gspca.c:2284: error: implicit declaration of function 'gspca_input_connect'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dmitri Belimov [Tue, 30 Mar 2010 06:02:17 +0000 (03:02 -0300)]
V4L/DVB: Fix default state Beholder H6 tuner
The hybrid tuner FMD1216MEX_MK3 after cold start has disabled IF. This
tuner has internal I2C switch. This switch switch I2C bus between DVB-T
and IF part. Default state is DVB-T. When module saa7134 is load it
can't find IF tda9887 and disable analog TV mode.
Sets internal I2C switch of the tuner to IF by send special value to the
tuner as for receive analog TV from low band. It can be usefule for
other cards.
I didn't set configure a tuner by a tuner model because this tuner can
have different I2C address. May be we can do it later after discuss for
more robust support a tuners.
Dean Anderson [Fri, 9 Apr 2010 02:46:08 +0000 (23:46 -0300)]
V4L/DVB: s2255drv: removal of big kernel lock
big kernel lock removed from open function.
v4l2 code does not require locking the open function except
to check asynchronous firmware load state, which is protected
by a mutex
Signed-off-by: Dean Anderson <dean@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The following patch fixes code that checks for CX88_VMUX_TELEVISION,
but not CX88_VMUX_CABLE. This prevented for example the audio standard
from being set when using the cable input.
Nicolas Noirbent [Mon, 22 Mar 2010 17:54:43 +0000 (14:54 -0300)]
V4L/DVB: ds3000: fix divide-by-zero error in ds3000_read_snr()
Fix a divide-by-zero error in ds3000's ds3000_read_snr(), when getting
a very low signal reading (dvbs2_signal_reading >= 1). This prevents
some nasty EIPs when running szap-s2 with a very low signal strength.
Signed-off-by: Nicolas Noirbent <nicolas.noirbent@smartjog.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: ir-core: Remove warining noise if decoders compiled builtin
drivers/media/IR/ir-raw-event.c:55: warning: ‘wq_load’ defined but not used
drivers/media/IR/ir-raw-event.c:222: warning: ‘init_decoders’ defined but not used
drivers/media/IR/rc-map.c: In function ‘get_rc_map’:
drivers/media/IR/rc-map.c:40: warning: unused variable ‘rc’
Andreas Bombe [Sun, 21 Mar 2010 19:02:45 +0000 (16:02 -0300)]
V4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacks
Due to obvious copy and paste coding a number of video capture drivers
which implement a limit on the buffer memory decremented the user
supplied buffer count in a while loop until it reaches an acceptable
value.
This is a silly thing to do when the maximum value can be directly
computed.
Signed-off-by: Andreas Bombe <aeb@debian.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
On newer kernels, a saa7134 board stopped to display TV video output
properly. After a bisect, I found it as the commit causing the issue.
Turns out that v4l_bound_align_image isn't doing the same bounding
calculation as manually done previously in saa7134_try_fmt_vid_cap.
What isn't equal is the calculation done in clamp align, while
previously it did "f->fmt.pix.width &= ~0x03", clamp_align function
does "Round to nearest aligned value" as stated in the comment, which
yields a different result. If I comment the round calculation in
clamp_align like this: "x = (x /*+ (1 << (align - 1))*/) & mask",
I get it fixed too, because this way the calculation is the same then.
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Wolfram Sang [Mon, 5 Apr 2010 04:14:26 +0000 (01:14 -0300)]
V4L/DVB: dvb/dib8000: fix build warning
In file included from drivers/media/dvb/dvb-usb/dib0700_devices.c:14:
drivers/media/dvb/frontends/dib8000.h: In function 'dib8000_get_adc_power':
drivers/media/dvb/frontends/dib8000.h:112: warning: no return statement in function returning non-void
Fixed by adding a return to the dummy function.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Tue, 6 Apr 2010 18:56:08 +0000 (15:56 -0300)]
V4L/DVB: video_ioctl2: handle the v4l1 compat bit first and move VIDIOCGMBUF into the switch
Try to make a more sensible sequence of events in __video_do_ioctl: first
check for a valid ops pointer, then get the compat part done. The VIDIOCGMBUF
command is now part of the big switch.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Tue, 6 Apr 2010 14:36:39 +0000 (11:36 -0300)]
V4L/DVB: w9966: convert to V4L2
Note that I have not been able to find anyone with this hardware. I tried
contacting the author without success, searched on eBay and similar places
without luck either.
So this conversion is untested. That said, it was pretty straightforward
so it is time to have this driver join the V4L2 world at last.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Tue, 6 Apr 2010 11:20:56 +0000 (08:20 -0300)]
V4L/DVB: usbvision: remove non-working vbi device
The usbvision driver created vbi device nodes but the actual implementation
was just stubs and only returned errors to userspace.
In addition it used video_usercopy() and we want to remove that eventually.
So remove all the vbi code except for the vbi flag in the card definition
should someone ever be mad enough to work on a proper implementation for this
driver.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Wed, 7 Apr 2010 09:21:05 +0000 (06:21 -0300)]
V4L/DVB: davinci: don't return under lock on error path
If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit
with the lock held. I moved the mutex_lock() below the allocation
because it isn't protecting anything in that block and allocations are
allocations are sometimes slow.
V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.h
ir-core.h has the kABI to be used by the bridge drivers, when needing to register
IR protocols and pass IR events. However, the same file also contains IR subsystem
internal calls, meant to be used inside ir-core and between ir-core and the raw
decoders.
Better to move those functions to an internal header, for some reasons:
1) Header will be a little more cleaner;
2) It avoids the need of recompile everything (bridge/hardware drivers, etc),
just because a new decoder were added, or some other internal change were needed;
3) Better organize the ir-core API, splitting the functions that are internal to
IR core and the ancillary drivers (decoders, lirc_dev) from the features that
should be exported to IR subsystem clients.
David Härdeman [Thu, 8 Apr 2010 16:10:00 +0000 (13:10 -0300)]
V4L/DVB: Teach drivers/media/IR/ir-raw-event.c to use durations
drivers/media/IR/ir-raw-event.c is currently written with the assumption
that all "raw" hardware will generate events only on state change (i.e.
when a pulse or space starts).
However, some hardware (like mceusb, probably the most popular IR receiver
out there) only generates duration data (and that data is buffered so using
any kind of timing on the data is futile).
Furthermore, using signed int's to represent pulse/space durations is a
well-known approach when writing ir decoders.
With this patch:
- s64 int's are used to represent pulse/space durations in ns
- a workqueue is used to decode the ir protocols outside of interrupt context
- #defines are added to make decoders clearer
- decoder reset is implemented by passing a zero duration to the kfifo queue
and decoders are updated accordingly
Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/ir-sysfs.c: In function ‘store_protocol’:
drivers/media/IR/ir-sysfs.c:93: warning: suggest parentheses around assignment used as truth value
V4L/DVB: ir-core: properly present the supported and current protocols
Hardware decoders have a more limited set of decoders than software ones.
In general, they support just one protocol at a given time, but allow
changing between a few options.
Rename the previous badly named "current_protocol" as just "protocol",
meaning the current protocol(s) accepted by the driver, and
add a "support_protocols" to represent the entire universe of supported
protocols by that specific hardware.
As commented on http://lwn.net/Articles/378884/, the "one file, one value"
rule doesn't fit nor does make much sense for bitmap or enum values. So, the
supported_protocols will enum all supported protocols, and the protocol
will present all active protocols.
V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decoders
Some devices have in-hardware Remote Controller decoder, while others
need a software decoder to get the IR code. As each software decoder
can be enabled/disabled individually, allowing multiple protocol
decoding capability.
On the other hand, hardware decoders have a limited protocol
support, often being able of decoding just one protocol each time.
So, each type needs a different set of capabilities to control the
supported protocol(s).
David Härdeman [Sun, 28 Mar 2010 21:38:49 +0000 (18:38 -0300)]
V4L/DVB: rename sysfs remote controller devices from rcrcv to rc
When the remote controller class is anyway being renamed from ir to rc
this would be a good time to also rename the devices from rcrcvX to rcX.
I know we haven't reached any agreement on whether transmission will
eventually be handled by the same device, but this change will at
least make the device name non-receive-specific which will make it
possible in the future (and if a different approach is finally
agreed upon, the device name still works).
Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
So, use static initialization for the static spinlocks, instead of the
dynamic ones (currently used), as proposed by David Härdeman on one
of his RFC patches.
V4L/DVB: em28xx: fix a regression caused by the rc-map changes
The patch that adds the rc-map changes didn't take into account that an
a table with IR_TYPE_UNKNOWN would make change_protocol to return -EINVAL.
As this function is fundamental to initialize some data, including a
callback to the getkey function, this caused the driver to stop working,
hanging the machine most of the times.
The fix were simply to add a handler for the IR type, but, to avoid further
issues, explicitly call change_protocol and handle the error before
initializing the IR. Also, let input_dev to start/stop IR handling,
after the opening of the input device.
V4L/DVB: ir-core: Add support for badly-implemented hardware decoders
A few hardware Remote Controller decoders, even using a standard protocol,
aren't able to provide the entire scancode. Due to that, the capability
of using other IR's are limited on those hardware.
Adds a way to indicate to ir-core what are the bits that the hardware
provides, from a scancode, allowing the addition of a complete IR table
to the kernel and allowing a limited support for changing the Remote
Controller on those devices.
The keymaps don't need to be recompiled every time a change at ir-core.h
happens, since it only depends on rc-map defines. By moving those
definitions to the proper header, the code became cleaner, and avoids
needing to recompile all the RC maps every time a non-related change
is introduced.