summaryrefslogtreecommitdiff
path: root/drivers/media/IR
AgeCommit message (Collapse)Author
2010-05-19V4L/DVB: media/IR/imon: potential double unlock on errorDan Carpenter
If there is an error here we should unlock in the caller (which is imon_init_intf1()). We can remove this stray unlock. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: media/IR/imon: testing the wrong variableDan Carpenter
There is a typo here. We meant to test "ir" instead of "props". The "props" variable was tested earlier. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: media/IR/imon: precendence issue: ! vs ==Dan Carpenter
The original condition is always false because ! has higher precedence than == and neither 0 nor 1 is equal to IMON_DISPLAY_TYPE_VGA. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: IR/imon: add proper auto-repeat supportJarod Wilson
Simplified from version 1, in that hacks heisted from ati_remote2.c aren't actually necessary, the real fix for too many repeats was from setting too long a timer release value (200ms) on repeats in mce mode -- this patch drops the release timeout to 33ms, matching the input subsystem default input_dev->rep[REP_PERIOD]. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: IR/imon: minor change_protocol fixupsJarod Wilson
This is a follow-up to my prior patch implementing ir-core's change_protocol functionality in the imon driver, which eliminates a false warning when change_protocol is called without a specific protocol selected yet (i.e., still IR_TYPE_UNKNOWN). It also removes some extraneous blank lines getting spewn into dmesg. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-core: remove IR_TYPE_PDDavid Härdeman
Pulse-distance is not a protocol, it is a line coding (used by some protocols, like NEC). Looking at the uses of IR_TYPE_PD, the real protocol seems to be NEC in all cases (drivers/media/video/cx88/cx88-input.c is the only user). So, remove IR_TYPE_PD while it is still easy to do so. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: IR/imon: convert to ir-core protocol change handlingJarod Wilson
Drop the imon driver's internal protocol definitions in favor of using those provided by ir-core. Should make ir-keytable Just Work for switching protocol on the fly on the imon devices that support both the native imon remotes and mce remotes. The imon-no-pad-stabilize pseudo-protocol was dropped as a protocol, and converted to a separate modprobe option (which it probably should have been in the first place). On the TODO list is to convert this to an as yet unwritten protocol-specific options framework. While the mce remotes obviously map to IR_TYPE_RC6, I've yet to look at what the actual ir signals from the native imon remotes are, so for the moment, imon native ir is mapped to IR_TYPE_OTHER. Nailing it down more accurately is also on the TODO list. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-core: fix some confusing commentsDavid Härdeman
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>
2010-05-19V4L/DVB: ir-core: fix table resize during keymap initMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: fix double spinlock init in drivers/media/IR/rc-map.cDavid Härdeman
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>
2010-05-19V4L/DVB: irmon: Cleanup some warning noiseMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: Add Sony support to ir-coreDavid Härdeman
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>
2010-05-19V4L/DVB: ir-core: Add JVC support to ir-coreDavid Härdeman
This patch adds a JVC decoder to ir-core. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-core-priv.h: Fix a few CodingStyle errorsMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: change duration to be coded as a u32 integerDavid Härdeman
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: add imon driverJarod Wilson
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>
2010-05-19V4L/DVB: ir-core: add imon pad and mce keymapsJarod Wilson
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>
2010-05-19V4L/DVB: ir-core: make ir_g_keycode_from_table a public functionJarod Wilson
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-19ir-core: Fix the delete logicMauro Carvalho Chehab
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>
2010-05-19ir-core: Remove the quotation mark from the uevent namesMauro Carvalho Chehab
There's no need to use quotation marks at the uevent names for the driver and table. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir Kconfig: better describe the optionsMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-core-priv: fix a typo for RC6 config optionMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: Add RC6 support to ir-coreDavid Härdeman
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>
2010-05-19V4L/DVB: Add NECx support to ir-coreDavid Härdeman
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>
2010-05-19V4L/DVB: Add RC5x support to ir-coreDavid Härdeman
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>
2010-05-19V4L/DVB: ir-core: Remove warining noise if decoders compiled builtinMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.hMauro Carvalho Chehab
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ärdeman
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: fix gcc warning noiseMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: properly present the supported and current protocolsMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decodersMauro Carvalho Chehab
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: rename sysfs remote controller devices from rcrcv to rcDavid Härdeman
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>
2010-05-19V4L/DVB: ir: Make sure that the spinlocks are properly initializedMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-rc5-decoder: fix state machineMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: re-add enable/disable check to the IR decodersMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: Add support for badly-implemented hardware decodersMauro Carvalho Chehab
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: remove the ancillary bufferMauro Carvalho Chehab
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 Chehab
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-nec-decoder: CleanupsMauro Carvalho Chehab
Remove dead code and properly name a few constants Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: ir-nec-decoder: Reimplement the entire decoderMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: improve keyup/keydown logicDavid Härdeman
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: ir-core: re-add some debug functions for keytable changesMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: drivers/media/IR - improve keytable codeDavid Härdeman
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 Chehab
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 Chehab
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 Chehab
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: Break Remote Controller keymaps into modulesMauro Carvalho Chehab
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>
2010-05-19V4L/DVB: ir-core: Add support for RC map code registerMauro Carvalho Chehab
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 Chehab
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-19V4L/DVB: ir-common: Use macros to define the keytablesMauro Carvalho Chehab
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>