aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-core-priv.h
AgeCommit message (Collapse)Author
2016-01-25[media] media: rc: raw: improve FIFO handlingHeiner Kallweit
The FIFO is used for ir_raw_event records, however for some historic reason the FIFO is used on a per byte basis. IMHO this adds unneeded complexity. Therefore set up the FIFO for ir_raw_event records. This also allows to define the FIFO statically as part of ir_raw_event_ctrl instead of having to allocate the FIFO dynamically. In addition: - When writing into the FIFO and it's full return ENOSPC instead of ENOMEM thus making it easier to tell between "FIFO full" and "Dynamic memory allocation failed" when the error is propagated to a higher level. Also add an error message. - When reading from the FIFO check whether it's empty. This is not strictly needed here but kfifo_out is annotated "must check" anyway. Successfully tested it with the nuvoton-cir driver. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03[media] media: rc: remove unneeded codeHeiner Kallweit
Now that that the decoder modules are loaded on-demand we can move loading the lirc module to rc_register_device directly and remove unneeded functions and comments. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
2015-11-19[media] media: rc: load decoder modules on-demandHeiner Kallweit
Remove code for unconditional decoder module loading (except lirc). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19Revert "[media] rc: rc-ir-raw: Add scancode encoder callback"David Härdeman
This reverts commit 9869da5bacc5c9b865a183bd36c04be76cdd325d. The current code is not mature enough, the API should allow a single protocol to be specified. Also, the current code contains heuristics that will depend on module load order. Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19Revert "[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper"David Härdeman
This reverts commit 1d971d927efa2e10194c96ed0475b6d6054342d8. The current code is not mature enough, the API should allow a single protocol to be specified. Also, the current code contains heuristics that will depend on module load order. Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19Revert "[media] rc: rc-core: Add support for encode_wakeup drivers"David Härdeman
This reverts commit 0d830b2d1295fee82546d57185da5a6604f11ae2. The current code is not mature enough, the API should allow a single protocol to be specified. Also, the current code contains heuristics that will depend on module load order. Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14[media] rc: rc-core: Add support for encode_wakeup driversJames Hogan
Add support in rc-core for drivers which implement the wakeup scancode filter by encoding the scancode using the raw IR encoders. This is by way of rc_dev::encode_wakeup which should be set to true to make the allowed wakeup protocols the same as the set of raw IR encoders. As well as updating the sysfs interface to know which wakeup protocols are allowed for encode_wakeup drivers, also ensure that the IR decoders/encoders are loaded when an encode_wakeup driver is registered. Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helperAntti Seppälä
Adding a simple Manchester encoder to rc-core. Manchester coding is used by at least RC-5 and RC-6 protocols and their variants. Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: James Hogan <james@albanarts.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14[media] rc: rc-ir-raw: Add scancode encoder callbackJames Hogan
Add a callback to raw ir handlers for encoding and modulating a scancode to a set of raw events. This could be used for transmit, or for converting a wakeup scancode filter to a form that is more suitable for raw hardware wake up filters. Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-07-26[media] rc: Add support for decoding XMP protocolMarcel J.E. Mol
This protocol is found on Dreambox remotes [m.chehab@samsung.com: CodingStyle fixes and conflict fix] Signed-off-by: Marcel Mol <marcel@mesa.nl> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25[media] rc-core: merge rc5 and streamzap decodersDavid Härdeman
Now that the protocol is part of the scancode, it is pretty easy to merge the rc5 and streamzap decoders. An additional advantage is that the decoder is now stricter as it waits for the trailing silence before determining that a command is a valid rc5/streamzap command (which avoids collisions that I've seen with e.g. Sony protocols). Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-07[media, edac] Change my email addressMauro Carvalho Chehab
There are several left overs with my old email address. Remove their occurrences and add myself at CREDITS, to allow people to be able to reach me on my new addresses. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-06[media] rc: ir-raw: Load ir-sharp-decoder module at initJames Hogan
Commit 1d184b0bc13d ([media] media: rc: add raw decoder for Sharp protocol) added a new raw IR decoder for the sharp protocol, but didn't add the code to load the module at init as is done for other raw decoders, so add that code now. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04[media] media: rc: add raw decoder for Sharp protocolJames Hogan
Add a raw decoder for the Sharp protocol. It uses a pulse distance modulation with a pulse of 320us and a bit period of 2ms for a logical 1 and 1ms for a logical 0. The first part of the message consists of a 5-bit address, an 8-bit command, and two other bits, followed by a 40ms gap before the echo message which is an inverted version of the main message except for the address bits. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com> Cc: linux-media@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-03-23[media] rc-core: don't treat dev->rc_map.rc_type as a bitmapDavid Härdeman
store_protocols() treats dev->rc_map.rc_type as a bitmap which is wrong for two reasons. First of all, it is pretty bogus to change the protocol type of the keymap just because the hardware has been asked to decode a different protocol. Second, dev->rc_map.rc_type is an enum (i.e. a single protocol) as pointed out by James Hogan <james.hogan@imgtec.com>. Fix both issues by introducing a separate enabled_protocols member to struct rc_dev. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27[media] media/rc: fix oops on unloading module rc-coreKonstantin Khlebnikov
During modiles initialization rc-core schedules work which calls request_module() several times to load ir-*-decoder modules, but it does not wait or cancel this work on module unloading. rc-core should use request_module_nowait() instead, because it anyway cannot load modules synchronously or cancel/wait pending work on unloading, because this leads to deadlock on modules_mutex between several "modprobe" processes. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-03-08[media] rc/ir-raw: use kfifo_rec_ptr_1 instead of kfifoJames Hogan
Raw IR events are passed to the raw event thread through a kfifo. The size of the event struct is 12 bytes, and space for 512 events is reserved in the kfifo (6144 bytes), however this is rounded down to 4096 bytes (the next power of 2) by __kfifo_alloc(). 4096 bytes is not divisible by 12 therefore if the fifo fills up a third of a record will be written in the end of the kfifo by ir_raw_event_store() because the recsize of the fifo is 0 (it doesn't have records). When this is read by ir_raw_event_thread() a corrupted or partial record will be read, and in the case of a partial record the BUG_ON(retval != sizeof(ev)) gets hit too. According to samples/kfifo/record-example.c struct kfifo_rec_ptr_1 can handle records of a length between 0 and 255 bytes, so change struct ir_raw_event_ctrl to use that instead of struct kfifo. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-11-23[media] rc: Add support for decoding Sanyo protocolMauro Carvalho Chehab
This protocol is found on Sanyo/Aiwa remotes. Tested with an Aiwa RC-7AS06 remote control. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-09-23[media] media, rc: Use static inline functions to kill warningsPekka Enberg
This patch converts some ifdef'd wrapper functions from macros to static inline functions to kill the following warnings issued by GCC: CC [M] drivers/media/rc/ir-raw.o drivers/media/rc/ir-raw.c: In function ‘init_decoders’: drivers/media/rc/ir-raw.c:353:2: warning: statement with no effect [-Wunused-value] drivers/media/rc/ir-raw.c:354:2: warning: statement with no effect [-Wunused-value] drivers/media/rc/ir-raw.c:355:2: warning: statement with no effect [-Wunused-value] drivers/media/rc/ir-raw.c:356:2: warning: statement with no effect [-Wunused-value] drivers/media/rc/ir-raw.c:357:2: warning: statement with no effect [-Wunused-value] drivers/media/rc/ir-raw.c:359:2: warning: statement with no effect [-Wunused-value] Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: "David Härdeman" <david@hardeman.nu> Cc: Jarod Wilson <jarod@redhat.com> Cc: <linux-media@vger.kernel.org> Signed-off-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-07-27[media] rc-core support for Microsoft IR keyboard/mouseJarod Wilson
This is a custom IR protocol decoder, for the RC-6-ish protocol used by the Microsoft Remote Keyboard, apparently developed internally at Microsoft, and officially dubbed MCIR-2, per their March 2011 remote and transceiver requirements and specifications document, which also touches on this IR keyboard/mouse device. Its a standard keyboard with embedded thumb stick mouse pointer and mouse buttons, along with a number of media keys. The media keys are standard RC-6, identical to the signals from the stock MCE remotes, and will be handled as such. The keyboard and mouse signals will be decoded and delivered to the system by an input device registered specifically by this driver. Successfully tested with multiple mceusb-driven transceivers, as well as with fintek-cir and redrat3 hardware. Essentially, any raw IR hardware with enough sampling resolution should be able to use this decoder, nothing about it is at all receiver-hardware-specific. This work is inspired by lirc_mod_mce: The documentation there and code aided in understanding and decoding the protocol, but the bulk of the code is actually borrowed more from the existing in-kernel decoders than anything. I did recycle the keyboard keycode table, a few defines, and some of the keyboard and mouse data parsing bits from lirc_mod_mce though. Special thanks to James Meyer for providing the hardware, and being patient with me as I took forever to get around to writing this. callback routine to ensure we don't get any stuck keys, and used symbolic names for the keytable. Also cc'ing Florian this time, who I believe is the original mod-mce author... CC: Florian Demski <fdemski@users.sourceforge.net> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29[media] rc-core: fix some leftovers from the renaming patchesDavid Härdeman
Fix some minor comments etc which are leftover from the old naming scheme. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29[media] rc: rename the remaining things to rc_coreMauro Carvalho Chehab
The Remote Controller subsystem is meant to be used not only by Infra Red but also for similar types of Remote Controllers. The core is not specific to Infra Red. As such, rename: - ir-core.h to rc-core.h - IR_CORE to RC_CORE - namespace inside rc-core.c/rc-core.h To be consistent with the other changes. No functional change on this patch. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29[media] ir-core: make struct rc_dev the primary interfaceDavid Härdeman
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29[media] rc-core: Code cleanup after merging rc-sysfs and rc-map into rc-mainDavid Härdeman
[mchehab@redhat.com: this patch were originally bundled with some renaming stuff and with the file merges, as seen at: https://patchwork.kernel.org/patch/291092/. Instead of using the original approach, I wrote the rename patches and the code merge as separate changes, then applied the difference on this patch. This way, it is easier to see the real changes at the code, and will be easier to merge upstream, especially if some conflict rises on the renaming patches] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29[media] Rename rc-core files from ir- to rc-Mauro Carvalho Chehab
As protocol decoders are specific to InfraRed, keep their names as-is. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>