Age | Commit message (Collapse) | Author |
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
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>
|
|
Unfortunelly (my fault) the kernel thread that now handles IR processing
has classical races in regard to wakeup and stop.
This patch hopefully closes them all.
Tested with module reload running in a loop, while receiver is blasted
with IR data for 10 minutes.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
The original code dereferenced ir->raw after freeing it and setting it
to NULL.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
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>
|
|
It is perfectly possible to have ir_raw_event_work
running concurently on two cpus, thus we must protect
it from that situation.
This stems from the fact that if hardware sends short packets of samples
we might end up queueing the work item more times that nessesary.
Such job isn't well suited for a workqueue, so use a kernel thread.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
Some handlers (lirc for example) allocates memory on initialization,
doing so in atomic context is cumbersome.
Fixes warning about sleeping function in atomic context.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
* lirc: Don't propagate reset event to userspace
* lirc: Remove strange logic from lirc that would make first sample always be pulse
* Make TO_US macro actualy print what it should.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
v2: copy of buffer data from userspace done inside this plugin/driver,
keeping the actual drivers minimal, and more flexible in what we can
deliver to them later on (they may be fed from within kernelspace later
on, by an in-kernel IR encoder).
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
This patch moves the state from each raw decoder into the
ir_raw_event_ctrl struct.
This allows the removal of code like this:
spin_lock(&decoder_lock);
list_for_each_entry(data, &decoder_list, list) {
if (data->ir_dev == ir_dev)
break;
}
spin_unlock(&decoder_lock);
return data;
which is currently run for each decoder on each event in order
to get the client-specific decoding state data.
In addition, ir decoding modules and ir driver module load
order is now independent. Centralizing the data also allows
for a nice code reduction of about 30% per raw decoder as
client lists and client registration callbacks are no longer
necessary (but still kept around for the benefit of the lirc
decoder).
Out-of-tree modules can still use a similar trick to what
the raw decoders did before this patch until they are merged.
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>
|
|
With the current logic, each raw decoder needs to add a copy of the exact
same sysfs code. This is both unnecessary and also means that (re)loading
an IR driver after raw decoder modules have been loaded won't work as
expected.
This patch moves that logic into ir-raw-event and adds a single sysfs
file per device.
Reading that file returns something like:
"rc5 [rc6] nec jvc [sony]"
(with enabled protocols in [] brackets)
Writing either "+protocol" or "-protocol" to that file will
enable or disable the according protocol decoder.
An additional benefit is that the disabling of a decoder will be
remembered across module removal/insertion so a previously
disabled decoder won't suddenly be activated again. The default
setting is to enable all decoders.
This is also necessary for the next patch which moves even more decoder
state into the central raw decoding structs.
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>
|
|
On Fri, May 28, 2010 at 3:59 PM, Jarod Wilson <jarod@redhat.com> wrote:
> The mceusb driver I'm about to submit handles just about any raw IR you
> can throw at it. The ir-core loads up all protocol decoders, starting
> with NEC, then RC5, then RC6. RUN_DECODER() was trying them in the same
> order, and exiting if any of the decoders didn't like the data. The
> default mceusb remote talks RC6(6A). Well, the RC6 decoder never gets a
> chance to run unless you move the RC6 decoder to the front of the list.
>
> What I believe to be correct is to have RUN_DECODER keep trying all of
> the decoders, even when one triggers an error. I don't think the errors
> matter so much as it matters that at least one was successful -- i.e.,
> that _sumrc is > 0. The following works for me w/my mceusb driver and
> the default decoder ordering -- NEC and RC5 still fail, but RC6 still
> gets a crack at it, and successfully does its job.
>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
>
> ---
> drivers/media/IR/ir-raw-event.c | 7 ++++---
>
> diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
> index ea68a3f..44162db 100644
> --- a/drivers/media/IR/ir-raw-event.c
> +++ b/drivers/media/IR/ir-raw-event.c
> @@ -36,14 +36,15 @@ static DEFINE_SPINLOCK(ir_raw_handler_lock);
> */
> #define RUN_DECODER(ops, ...) ({ \
> struct ir_raw_handler *_ir_raw_handler; \
> - int _sumrc = 0, _rc; \
> + int _sumrc = 0, _rc, _fail; \
> spin_lock(&ir_raw_handler_lock); \
> list_for_each_entry(_ir_raw_handler, &ir_raw_handler_list, list) { \
> if (_ir_raw_handler->ops) { \
> _rc = _ir_raw_handler->ops(__VA_ARGS__); \
> if (_rc < 0) \
> - break; \
> - _sumrc += _rc; \
> + _fail++; \
> + else \
> + _sumrc += _rc; \
Self-NAK. The only place we actually *care* about the retval from a
RUN_DECODER() call is in __ir_input_register(), and currently, its
looking for retval < 0, which is currently never possible. When we're
running the decoders, either they fail and return -EINVAL or they
succeed and return 0, and in the register case, we get either a
negative error (ex: -ENOMEM from rc6) or 0, so with the above, _sumrc
will *always* be 0 in the two cases I'm looking at. The third place
where RUN_DECODER gets called (decoder unregister) doesn't care about
the retval either. New patch below, including updated comments about
the macro.
Signed-off-by: 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>
|
|
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>
|
|
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 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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|