This is a virtual device driver for testing the memory-to-memory framework.
This virtual device uses in-memory buffers for both its source and destination.
It is capable of multi-instance, multi-buffer-per-transaction operation
(via the mem2mem framework).
[mchehab@redhat.com: use videobuf_queue_to_vaddr instead of the removed videobuf_queue_to_vmalloc]
Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Vaibhav Hiremath <hvaibhav@ti.com>
Tested-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
A mem-to-mem device is a device that uses memory buffers passed by
userspace applications for both their source and destination data. This
is different from existing drivers, which utilize memory buffers for either
input or output, but not both.
In terms of V4L2 such a device would be both of OUTPUT and CAPTURE type.
Examples of such devices would be: image 'resizers', 'rotators',
'colorspace converters', etc.
This patch adds a separate Kconfig sub-menu for mem-to-mem devices as well.
Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Vaibhav Hiremath <hvaibhav@ti.com>
Tested-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Add support for more color effects (negative, sketch, emboss, etc) by
extending the v4l2_colorfx enum items.
Signed-off-by: Xiaolin Zhang <xiaolin.zhang@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
AK8814 only differs from AK8813 by included Macrovision Copy Protection
function. This patch adds a driver for AK8813 and AK8814 I2C PAL/NTSC TV
encoders.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
A number of SuperH Mobile SoCs, including sh7724, include a Video Output Unit.
This patch adds a video (V4L2) output driver for it. The driver uses v4l2-subdev
and mediabus APIs to interface to TV encoders.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
- 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>
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
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>
Ths function returns the virtual kernel address of the buffer and has
nothing to do with allocation.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
videobuf_alloc() returned a void *. Change to struct videobuf_buffer *
to get better type checking.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Remove the mmap_free callback from struct videobuf_qtype_ops.
All implementations of this callback do the same trivial check: return
-EBUSY if any buffer is mmapped. That can also be tested in the
videobuf core.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Patch reverted per Andreas Oberritter <obi@linuxtv.org> request. It is basically
not ready yet for upstream merge.
This reverts commit 77b2ad374a82e3d740cb1780ff4caedc3e051b37.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
Fix some confusing comments in drivers/media/IR/*
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/ir-keytable.c would alloc a suitably sized keymap table
only to have it resized as it is populated with the initial keymap.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Fix a double initialization of the same spinlock in drivers/media/IR/rc-map.c.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Convert drivers/media/dvb/dm1105/dm1105.c to not rely on
ir-functions.c.
Signed-off-by: David Härdeman <david@hardeman.nu>
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>
This patch adds a Sony12/15/20 decoder to ir-core.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
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>
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>
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>
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>
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>
usb_set_intfdata should not be used when using v4l2_device_register
and a non-NULL argument for the device.
Signed-off-by: Dean Anderson <linux-dev@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
Instead of removing an entry, the logic were doing both a deletion and
a key addition, as shown by the log:
[11517.323314] ir_getkeycode: unknown key for scancode 0x0050
[11517.326529] ir_do_setkeycode: #80: Deleting scan 0x0050
[11517.326529] ir_do_setkeycode: #80: New scan 0x0050 with key 0x0000
[11517.340598] ir_getkeycode: unknown key for scancode 0x0051
[11517.343811] ir_do_setkeycode: #81: Deleting scan 0x0051
[11517.343811] ir_do_setkeycode: #81: New scan 0x0051 with key 0x0000
[11517.357889] ir_getkeycode: unknown key for scancode 0x0052
[11517.361104] ir_do_setkeycode: #82: Deleting scan 0x0052
[11517.361104] ir_do_setkeycode: #82: New scan 0x0052 with key 0x0000
[11517.375453] ir_getkeycode: unknown key for scancode 0x0053
[11517.378474] ir_do_setkeycode: #83: Deleting scan 0x0053
[11517.378474] ir_do_setkeycode: #83: New scan 0x0053 with key 0x0000
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
As Adreas pointed, RC6 should use CONFIG_IR_RC6_DECODER_MODULE, instead
of the RC5 config option.
Thanks-to: Andreas Oberitter <obi@linuxtv.org>
Acked-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Return -EINVAL if we don't find the right query control id.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Return -EINVAL if we don't find the control id.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
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.
Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Return an error if the controller is not found.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The original code doesn't handle the situation where the controller is
not found.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Return an error if the controller is not found.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
"dev" is never NULL here so there is no need to check.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
adding v4l2_device structure.
if one video_register_device call fails, allows use of other devices
or channels.
Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
call to video_device_alloc was not being checked in probe function.
code simplified and uses video_device inside device structure.
Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The "AUVI_INPUT(tmp)" macro uses "tmp" as an index of an array with
AU0828_MAX_INPUT elements.
Signed-off-by: Dan Carpenter <error27@gmail.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.
Signed-off-by: Istvan Varga <istvanv@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
makes USB_PWC_INPUT_EVDEV to depend also on USB_PWC
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Never call dvb_frontend_detach if we failed to attach a frontend. This fixes
the following oops:
[ 8.172997] DVB: registering new adapter (TT-Budget S2-1600 PCI)
[ 8.209018] adapter has MAC addr = 00:d0:5c:cc:a7:29
[ 8.328665] Intel ICH 0000:00:1f.5: PCI INT B -> GSI 17 (level, low) -> IRQ 17
[ 8.328753] Intel ICH 0000:00:1f.5: setting latency timer to 64
[ 8.562047] DVB: Unable to find symbol stv090x_attach()
[ 8.562117] BUG: unable to handle kernel NULL pointer dereference at 000000ac
[ 8.562239] IP: [<e08b04a3>] dvb_frontend_detach+0x4/0x67 [dvb_core]
Ref http://bugs.debian.org/575207
Also clean up if we are unable to register the tuner and LNB drivers
[mchehab@redhat.com: add printk log level, to calm down chechpatch.pl]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Reported-by: Fladischer Michael <FladischerMichael@fladi.at>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch adds an RC6 decoder (modes 0 and 6A) to ir-core.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch adds NECx support to drivers/media/IR/ir-nec-decoder.c
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This patch adds RC5x support to drivers/media/IR/ir-rc5-decoder.c
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
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’
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
This reverts commit bc52d6eb44.
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>
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>
Now that video_ioctl2 no longer clobbers the argument for _IO() ioctls we
can move these into vidioc_default where they really belong.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
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>
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>
You want to be able to reach the debug code at the end of this function,
so don't use return, use break.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If the ioctl was defined without direction (e.g. _IO('o', 25)), then
the arg as passed to vidioc_default was NULL instead of the original
argument.
Several ioctls in e.g. include/linux/dvb/video.h and audio.h use this type
of ioctl to pass simple numerical values to the driver.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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).
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
Some spinlocks are not properly initialized on ir core:
[ 471.714132] BUG: spinlock bad magic on CPU#0, modprobe/1899
[ 471.719838] lock: f92a08ac, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[ 471.727301] Pid: 1899, comm: modprobe Not tainted 2.6.33 #36
[ 471.733062] Call Trace:
[ 471.735537] [<c1498793>] ? printk+0x1d/0x22
[ 471.739866] [<c12694e3>] spin_bug+0xa3/0xf0
[ 471.744224] [<c126962d>] do_raw_spin_lock+0x7d/0x160
[ 471.749364] [<f92a01ff>] ? ir_rc5_register+0x6f/0xf0 [ir_rc5_decoder]
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Reimplement the RC-5 decoder state machine. Code is now clear, and works
properly. It is also simpler than the previous implementations.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
A previous cleanup patch removed more than needed. Re-add the logic that
disable the decoders.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Now that the decoders are state machine, there's no need to create
an ancillary buffer while decoding the protocol. Just call the decoders
code directly, event by event.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This decoder is also based on a state machine, just like the NEC protocol
decoder. It is pedantic in the sense that accepts only 14 bits. As there
are some variants that outputs less bits, it needs to be improved to also
handle those.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his
code, that gave me some ideas to better implement it.
After some work with saa7134 bits, I found a way to catch both IRQ
edge pulses. By enabling it, the NEC decoder can now take both
pulse and spaces into account, making it more precise.
Instead of the old strategy of handling the events all at once,
this code implements a state machine. Due to that, it handles
individual pulse or space events, validating them against the
protocol, producing a much more reliable decoding.
With the new implementation, the protocol trailer bits are properly
handled, making possible for the repeat key to work.
Also, the code is now capable of handling both NEC and NEC extended
IR devices. With NEC, it produces a 16 bits code, while with NEC
extended, a 24 bits code is returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Converts drivers/media/dvb/ttpci/budget-ci.c to use ir-core rather than
rolling its own keydown timeout handler and reporting keys via
drivers/media/IR/ir-functions.c.
[mchehab@redhat.com: Drop the call to ir_input_init() as it is no longer needed]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Rewrites the keyup/keydown logic in drivers/media/IR/ir-keytable.c.
All knowledge of keystates etc is now internal to ir-keytable.c
and not scattered around ir-raw-event.c and ir-nec-decoder.c (where
it doesn't belong).
In addition, I've changed the API slightly so that ir_input_dev is
passed as the first argument rather than input_dev. If we're ever
going to support multiple keytables we need to move towards making
ir_input_dev the main interface from a driver POV and obscure away
the input_dev as an implementational detail in ir-core.
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The attached patch rewrites much of the keytable code in
drivers/media/IR/ir-keytable.c.
The scancodes are now inserted into the array in sorted
order which allows for a binary search on lookup.
The code has also been shrunk by about 150 lines.
In addition it fixes the following bugs:
Any use of ir_seek_table() was racy.
ir_dev->driver_name is leaked between ir_input_register() and
ir_input_unregister().
ir_setkeycode() unconditionally does clear_bit() on dev->keybit
when removing a mapping, but there might be another mapping with
a different scancode and the same keycode.
This version has been updated to incorporate patch feedback from
Mauro Carvalho Chehab.
[mchehab@redhat.com: Fix a conflict with RC keytable breakup patches and input changes]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The code that enables IRQ for the Remote Controller on saa7134 is a little
messy: it is outside saa7134-input, it checks if RC is GPIO based, and
it mixes both serial raw decode with parallel reads from a hardware-based
IR decoder.
Also, currently, it doesn't allow to trigger both transition edges at GPIO16
and GPIO18 lines. A rework on the code is needed to provide a better way
to specify what saa7134-input needs, maybe even moving part of the code from
saa7134-core and saa7134-cards into saa7134-input.
Yet, as a large rework is happening at RC core, it is better to wait until
the core changes stablize, in order to rework saa7134 RC internals.While
this don't happen, let's just change the logic a little bit to allow
enabling IRQ to be generated on both edge transitions, in order to better
support pulse/space raw decoders.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
There's an error at the IRQ2 bit map registers. Also, it doesn't
show what bits are needed for positive and for negative edge.
In the case of IR raw decoding, for some protocols, it is important
to detect both positive and negative edges. So, a latter patch
will need to use the other values.
Also, the code that detects problems on IRQ handling is incomplete,
as it disables only one of the IRQ bits for GPIO16 and GPIO18.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Now that the remote keymaps were broken into separate modules,
get rid of the keycode tables that were hardcoded into ir-common.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of using the ugly keymap sequences, use the new rc-*.ko keymap
files. For now, it is still needed to have one keymap loaded, for the
RC code to work. Later patches will remove this depenency.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
A latter patch will reuse the ir_input_register with a different meaning.
Before it, change all occurrences to a temporary name.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The original Remote Controller approach were very messy: a big file,
that were part of ir-common kernel module, containing 64 different
RC keymap tables, used by the V4L/DVB drivers.
Better to break each RC keymap table into a separate module,
registering them into rc core on a process similar to the fs/nls tables.
As an userspace program is now in charge of loading those tables,
adds an option to allow the complete removal of those tables from
kernelspace.
Yet, on embedded devices like Set Top Boxes and TV sets, maybe the
only available input device is the IR. So, we should keep allowing
the usage of in-kernel tables, but a latter patch should change
the default to 'n', after giving some time for distros to add
the v4l-utils with the ir-keytable program, to allow the table
load via userspace.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of having all RC tables hardcoded on one file with
all tables there, add infrastructure for registering and dynamically
load the table(s) when needed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of having one big file with lots of keytables, create one include
file for each IR keymap.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The usage of macros ensures that the proper namespace is being used
by all tables. It also makes easier to associate a keytable with
the name used inside the drivers.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Several DVB drivers use a different name convention. As we're moving
the keytables, we need to use the same convention on all places.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Replaces most of the occurences of IR keytables on V4L drivers by a macro
that evaluates to provide the name of the exported symbol.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
It seems impossible for ov to be NULL at this point.
The semantic match that finds the problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
expression E, E1;
identifier f;
statement S1,S3;
iterator iter;
@@
if ((E == NULL && ...) || ...)
{
... when != false ((E == NULL && ...) || ...)
when != true ((E != NULL && ...) || ...)
when != iter(E,...) S1
when != E = E1
(
sizeof(E->f)
|
* E->f
)
... when any
return ...;
}
else S3
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cap->driver is a 16 char buffer and dev->name is a 32 char buffer.
I don't see an actual problem, but we may as well make the static
checkers happy.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Especially when IR needs to do polling, it generates lots of wakeups per
second. This makes no sense, if the input event device is closed.
Adds a callback handler to the IR hardware driver, to allow registering
an open/close ops.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
With the help of raw_register/raw_unregister, adds a sysfs group
associated with the decoder, inside the corresponding irrcv node.
Writing 1 to nec_decoder/enabled enables the decoder, while
writing 0 disables it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Some decoders and a lirc_dev interface may need some other operations to work.
For example: IR device register/unregister and ir_keydown events may need to
be tracked.
As some operations can occur in interrupt time, and a lock is needed to prevent
un-registering a decode while decoding a key, the lock needed to be convert
into a spin lock.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of hardcoding the protocols into ir-core, add a register interface
for the IR protocol decoders, and convert ir-nec-decoder into a client of
ir-core.
With this approach, it is possible to dynamically load the needed IR protocols,
and to add a RAW IR interface module, registered as one IR raw protocol decoder.
This patch opens a way to register a lirc_dev interface to work as an userspace
IR protocol decoder.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
At raw_decode mode, the key is processed after the end of a timer. The
previous code resets the timer every time something is received at the IR
port. While this works fine with IR's that don't implement repeat, like
Avermedia RM-JX IR, it keeps waiting until keydown, on IR's that implement
NEC repeat command, like the Terratec yellow.
The solution is to change the behaviour to do the timeout after the first
received data.
The timeout is currently set to 15 ms, as it works fine with NEC protcocol.
It may need some adjustments to support other protocols and to better handle
spurious detections that may happen with some IR sensors.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Adds a method to pass IR raw pulse/code events into ir-core. This is
needed in order to support LIRC. It also helps to move common code
from the drivers into the core.
In order to allow testing, it implements a simple NEC protocol decoder
at ir-nec-decoder.c file. The logic is about the same used at saa7134
driver that handles Avermedia M135A and Encore FM53 boards.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The V4L2 specification requires drivers to use the write events in the
file operations poll handler for output devices. The uvcvideo driver
erroneously used read events for all devices. Fix this.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Those control, as their names imply, control the camera aperture
settings.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The camera requires the STREAM_NO_FID quirk. Add a corresponding entry
in the device IDs list.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The camera requires the PROBE_DEF quirk. Add a corresponding entry in
the device IDs list.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Some webcams handled by both sn9c102 or zc0301 and some gspca subdrivers
(sonixb, sonixj and zc3xx) were not handled when gspca was generated but
not the associated subdrivers.
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
For the sequence streamon -> streamoff and again s_input, it fails
to lock the signal, since streamoff puts TVP514x into power off state
which leads to failure in sub-sequent s_input.
So add powerup sequence in s_routing (if disabled), since it is
important to lock the signal at this stage.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Muralidharan Karicheri <mkaricheri@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
For the devices like AM3517, it is expected that driver clears the
interrupt in ISR. Since this is device spcific, callback function
added to the platform_data.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Muralidharan Karicheri <mkaricheri@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Converted this old V4L1 driver to V4L2.
I would like to thank Takeo Takahashi who very kindly tested this
driver for me. Much appreciated!
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Takeo Takahashi <takahashi.takeo@renesas.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>