aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/ir-core.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-10-21[media] IR: extend ir_raw_event and do refactoringMaxim Levitsky1-6/+34
Add new event types for timeout & carrier report Move timeout handling from ir_raw_event_store_with_filter to ir-lirc-codec, where it is really needed. Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reports Note: all new ir_raw_event variables now should be initialized like that: DEFINE_IR_RAW_EVENT(ev); To clean an existing event, use init_ir_raw_event(&ev); Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21V4L/DVB: IR: export ir_keyup so imon driver can use it directlyJarod Wilson1-0/+1
The imon driver currently reimplements its own version of ir_keyup (along with key release timer functionality also already present in the core IR code). A follow-up imon patch will make use of ir_keyup and the IR stack's key release code. Trivial extraction from David Härdeman's pending rc-core merge and device interface abstraction patchset to facilitate merging a patch based on his imon input dev split patch ahead of the larger churn, which is slated for post-2.6.37-rc1 (after Dmitry's large keycode patches are merged in mainline). Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: extend interfaces to support more device settingsMaxim Levitsky1-1/+11
LIRC: add new IOCTL that enables learning mode (wide band receiver) Still missing features: carrier report & timeout reports. Will need to pack these into ir_raw_event Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: add helper function for hardware with small o/b bufferMaxim Levitsky1-3/+20
Some ir input devices have small buffer, and interrupt the host each time it is full (or half full) Add a helper that automaticly handles timeouts, and also automaticly merges samples of same time (space-space) Such samples might be placed by hardware because size of sample in the buffer is small (a byte for example). Also remove constness from ir_dev_props, because it now contains timeout settings that driver might want to change Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: Allow not to compile keymaps inMaxim Levitsky1-2/+6
Currently, ir device registration fails if keymap requested by driver is not found. Fix that by always compiling in the empty keymap, and using it as a failback. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR TX: incoming IR buffer now an int pointerJarod Wilson1-1/+1
incoming IR buffer now an int pointer, and not fed from userspace Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR: add tx callbacks to ir-coreJarod Wilson1-1/+7
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-core: change duration to be coded as a u32 integerDavid Härdeman1-2/+14
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>
2010-05-19V4L/DVB: ir-core: make ir_g_keycode_from_table a public functionJarod Wilson1-0/+1
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>
2010-05-19V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.hMauro Carvalho Chehab1-77/+10
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>
2010-05-19V4L/DVB: Teach drivers/media/IR/ir-raw-event.c to use durationsDavid Härdeman1-11/+36
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>
2010-05-19V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decodersMauro Carvalho Chehab1-6/+14
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>
2010-05-19V4L/DVB: ir-core: Add support for badly-implemented hardware decodersMauro Carvalho Chehab1-4/+20
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>
2010-05-19V4L/DVB: ir-core: move rc map code to rc-map.hMauro Carvalho Chehab1-34/+0
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. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L-DVB: ir-core: remove the ancillary bufferMauro Carvalho Chehab1-2/+1
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>
2010-05-19V4L-DVB: ir-rc5-decoder: Add a decoder for RC-5 IR protocolMauro Carvalho Chehab1-0/+7
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>
2010-05-19V4L/DVB: ir-core: improve keyup/keydown logicDavid Härdeman1-5/+10
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>
2010-05-19V4L/DVB: drivers/media/IR - improve keytable codeDavid Härdeman1-1/+3
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>
2010-05-19V4L/DVB: ir-common: remove keymap tables from the moduleMauro Carvalho Chehab1-18/+0
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>
2010-05-19V4L/DVB: ir-core: Make use of the new IR keymap modulesMauro Carvalho Chehab1-2/+19
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>
2010-05-19V4L/DVB: ir: prepare IR code for a parameter change at register functionMauro Carvalho Chehab1-6/+20
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>
2010-05-19V4L/DVB: ir-core: Add support for RC map code registerMauro Carvalho Chehab1-0/+11
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>
2010-05-19V4L/DVB: ir-common: move IR tables from ir-keymaps.c to a separate fileMauro Carvalho Chehab1-0/+18
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>
2010-05-18V4L/DVB: ir-core: Add callbacks for input/evdev open/close on IR coreMauro Carvalho Chehab1-0/+2
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>
2010-05-18V4L/DVB: ir-core: prepare to add more operations for ir decodersMauro Carvalho Chehab1-5/+2
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>
2010-05-18V4L/DVB: ir-core: dynamically load the compiled IR protocolsMauro Carvalho Chehab1-5/+24
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>
2010-05-18V4L/DVB: saa7134: don't wait too much to generate an IR event on raw_decodeMauro Carvalho Chehab1-0/+2
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>
2010-05-18V4L/DVB: ir-core/saa7134: Move ir keyup/keydown code to the ir-coreMauro Carvalho Chehab1-1/+2
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: ir-core: add two functions to report keyup/keydown eventsMauro Carvalho Chehab1-0/+4
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: ir-core: Add logic to decode IR protocols at the IR coreMauro Carvalho Chehab1-0/+32
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>
2010-05-18V4L/DVB: ir-core: export driver name used by IR via ueventMauro Carvalho Chehab1-1/+3
Now, both driver and keytable names are exported to userspace. This will help userspace to decide when a table need to be replaced by another one. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: ir-core: Add a macro to properly create IR tablesMauro Carvalho Chehab1-1/+2
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: ir: use a real device instead of a virtual classMauro Carvalho Chehab1-3/+1
Change the ir-sysfs approach to create irrcv0 as a device, instead of using class_dev. Also, change the way input is registered, in order to make its parent to be the irrcv device. Due to this change, now the event device is created under /sys/class/ir/irrcv class: /sys/class/irrcv/irrcv0/ |-- current_protocol |-- device -> ../../../1-3 |-- input9 | |-- capabilities | | |-- abs ... Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13833): ir-core: some functions can be staticMauro Carvalho Chehab1-4/+0
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13680): ir: use unsigned long instead of enumMauro Carvalho Chehab1-9/+7
When preparing the linux-next patches, I got those errors: include/media/ir-core.h:29: warning: left shift count >= width of type In file included from include/media/ir-common.h:29, from drivers/media/video/ir-kbd-i2c.c:50: drivers/media/video/ir-kbd-i2c.c: In function ‘ir_probe’: drivers/media/video/ir-kbd-i2c.c:324: warning: left shift count >= width of type Unfortunately, enum is 32 bits on i386. As we define IR_TYPE_OTHER as 1<<63, it won't work on non 64 bits arch. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13635): ir-core: Implement protocol table type readingMauro Carvalho Chehab1-1/+3
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13634): ir-core: allow passing IR device parameters to ir-coreMauro Carvalho Chehab1-5/+13
Adds an structure to ir_input_register to contain IR device characteristics, like supported protocols and a callback to handle protocol event changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26V4L/DVB (13633): ir-core: create a new class for remote controllersMauro Carvalho Chehab1-2/+10
Add sysfs skeleton to export remote controller information via /sys/class/irrcv. For now, the code doesn't do much. It just exports an attribute that is meant to report and control the IR protocol used by the keytable. However, the callbacks for this new attribute weren't set yet. Also, it lacks symlinks to the used event interface. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16V4L/DVB (13616): IR: rename ir_input_free as ir_input_unregisterMauro Carvalho Chehab1-1/+1
Now, ir_input_free does more than just freeing the keytab. Better to rename it as ir_input_unregister. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16V4L/DVB (13615): ir-core: create ir_input_registerMauro Carvalho Chehab1-2/+7
Move non-V4L specific stuff from ir-functions ir_input_init() into a new function to register ir devices: ir_input_register(). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16V4L/DVB (13613): IR: create ir-core moduleMauro Carvalho Chehab1-0/+57
Split the ir-common into two separate modules: - ir-core: it is the IR-independent functions; - ir-common: has the common part used by V4L drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>