History log of /drivers/media/rc/ene_ir.c
Revision Date Author Comments
2816cc31e06b9d04ac0a92ae6a8311b5ab873fed 03-Sep-2014 Mauro Carvalho Chehab <m.chehab@samsung.com> [media] ene_ir: use true/false for boolean vars

Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
c5540fbb9de39ceec108a889133664a887c2f55a 04-Apr-2014 David Härdeman <david@hardeman.nu> [media] rc-core: remove protocol arrays

The basic API of rc-core used to be:

dev = rc_allocate_device();
dev->x = a;
dev->y = b;
dev->z = c;
rc_register_device();

which is a pretty common pattern in the kernel, after the introduction of
protocol arrays the API looks something like:

dev = rc_allocate_device();
dev->x = a;
rc_set_allowed_protocols(dev, RC_BIT_X);
dev->z = c;
rc_register_device();

There's no real need for the protocols to be an array, so change it
back to be consistent (and in preparation for the following patches).

[m.chehab@samsung.com: added missing changes at some files]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
1a1934fab0c920f0d3bceeb60c9fe2dae8a56be9 01-Mar-2014 James Hogan <james.hogan@imgtec.com> [media] rc: abstract access to allowed/enabled protocols

The allowed and enabled protocol masks need to be expanded to be per
filter type in order to support wakeup filter protocol selection. To
ease that process abstract access to the rc_dev::allowed_protos and
rc_dev::enabled_protocols members with inline functions.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
b5daad2f13c90ef3175d201450543fd0a1627bdd 08-Jul-2013 Maxim Levitsky <maximlevitsky@gmail.com> [media] ene_ir: disable the device if wake is disabled

It doesn't hurt and on my notebook despite clearing the
wake flag the remote still wakes up the system.

This way it doesn't.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
1de6ebba2c2759da4d8ccb167336a4d136d08471 08-Jul-2013 Maxim Levitsky <maximlevitsky@gmail.com> [media] ene_ir: Fix interrupt line passthrough to hardware

While we can delay IRQ intialization, we need the interrupt number
right away because unusually hardware have programable interrupt number,
and thus we give it the number that was allocated by BIOS

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
dbcd371b46a16a81a9975b57a11b61bbc2ba81e4 09-Apr-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn> [media] rc: ene_ir: fix potential double free in ene_probe()

Since rc_unregister_device() frees its argument, the subsequently
call to rc_free_device() on the same variable will cause a double
free bug. Fix by set argument to NULL, thus when fall through to
rc_free_device(), nothing will be done there.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4c62e9764ab403d42f9b8871b1241fe7812f19d4 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Drivers: media: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9fa35204dd19eb0e96ee870b7128a8f5da51dbfa 02-Nov-2012 Matthijs Kooijman <matthijs@stdin.nl> [media] rc: Call rc_register_device before irq setup

This should fix a potential race condition, when the irq handler
triggers while rc_register_device is still setting up the rdev->raw
device.
This crash has not been observed in practice, but there should be a very
small window where it could occur. Since ir_raw_event_store_with_filter
checks if rdev->raw is not NULL before using it, this bug is not
triggered if the request_irq triggers a pending irq directly (since
rdev->raw will still be NULL then).
This commit was tested on nuvoton-cir only.

Cc: Jarod Wilson <jarod@redhat.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
70ef69915b1fba4ad85aebe530caf156a144c2e5 02-Nov-2012 Matthijs Kooijman <matthijs@stdin.nl> [media] rc: Make probe cleanup goto labels more verbose

Before, labels were simply numbered. Now, the labels are named after the
cleanup action they'll perform (first), based on how the winbond-cir
driver does it. This makes the code a bit more clear and makes changes
in the ordering of labels easier to review.
This change is applied only to the rc drivers that do significant
cleanup in their probe functions: ati-remote, ene-ir, fintek-cir,
gpio-ir-recv, ite-cir, nuvoton-cir.
This commit should not change any code, it just renames goto labels.

[mchehab@redhat.com: removed changes at gpio-ir-recv.c, due to
merge conflicts]

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
56411c0f1eec7495bcf1fd6b83a51bb57be608d4 15-Oct-2012 Matthijs Kooijman <matthijs@stdin.nl> [media] ene-ir: Fix cleanup on probe failure

This makes the cleanup on probe failure more consistent with other
drivers. This is similar to what commit
f27b853ea24a9b70585f9251384d97929e6551c3 ("[media] rc: Fix invalid
free_region and/or free_irq on probe failure") did for some other
drivers.
In addition to making the cleanup more consistent, this also fixes a
case where (on a ene_hw_detect failure) free_region would be called on a
region that was not requested yet.
This last problem was probably introduced by the moving of code in
commit b31b021988fed9e3741a46918f14ba9b063811db ("[media] ene_ir: Fix
driver initialisation") and commit
9ef449c6b31bb6a8e6dedc24de475a3b8c79be20 ("[media] rc: Postpone ISR
registration").

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e03cd645dfecb27746c6d488c73605fef6ae635f 27-Oct-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] ene_cir: get rid of warning: no previous prototype

drivers/media/rc/ene_ir.c:332:6: warning: no previous prototype for 'ene_rx_sense_carrier' [-Wmissing-prototypes]

Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c003ab1bedf028db15b0185b683d5c387204e8f5 12-Oct-2012 David Härdeman <david@hardeman.nu> [media] rc-core: add separate defines for protocol bitmaps and numbers

The RC_TYPE_* defines are currently used both where a single protocol is
expected and where a bitmap of protocols is expected.

Functions like rc_keydown() and functions which add/remove entries to the
keytable want a single protocol. Future userspace APIs would also
benefit from numeric protocols (rather than bitmap ones). Keytables are
smaller if they can use a small(ish) integer rather than a bitmap.

Other functions or struct members (e.g. allowed_protos,
enabled_protocols, etc) accept multiple protocols and need a bitmap.

Using different types reduces the risk of programmer error. Using a
protocol enum whereever possible also makes for a more future-proof
user-space API as we don't need to worry about a sufficient number of
bits being available (e.g. in structs used for ioctl() calls).

The use of both a number and a corresponding bit is dalso one in e.g.
the input subsystem as well (see all the references to set/clear bit when
changing keytables for example).

This patch separate the different usages in preparation for
upcoming patches.

Where a single protocol is expected, enum rc_type is used; where one or more
protocol(s) are expected, something like u64 is used.

The patch has been rewritten so that the format of the sysfs "protocols"
file is no longer altered (at the loss of some detail). The file itself
should probably be deprecated in the future though.

Signed-off-by: David Härdeman <david@hardeman.nu>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
48cafec9a941c2dfe94d76642662bc20bf87fe08 11-Sep-2012 Dan Carpenter <dan.carpenter@oracle.com> [media] rc: divide by zero bugs in s_tx_carrier()

"carrier" comes from a get_user() in ir_lirc_ioctl(). We need to test
that it's not zero before using it as a divisor. It might have been
nice to test for this ir_lirc_ioctl() but the mceusb driver uses zero to
disable carrier modulation.
The bug in redrat3 is a little more subtle. The ->carrier is passed to
mod_freq_to_val() which uses it as a divisor.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b31b021988fed9e3741a46918f14ba9b063811db 19-Jun-2012 Luis Henriques <luis.henriques@canonical.com> [media] ene_ir: Fix driver initialisation

commit 9ef449c6b31bb6a8e6dedc24de475a3b8c79be20 ("[media] rc: Postpone ISR
registration") fixed an early ISR registration on several drivers. It did
however also introduced a bug by moving the invocation of pnp_port_start()
to the end of the probe function.

This patch fixes this issue by moving the invocation of pnp_port_start() to
an earlier stage in the probe function.

Cc: stable@vger.kernel.org
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9ef449c6b31bb6a8e6dedc24de475a3b8c79be20 21-Apr-2012 Luis Henriques <luis.henriques@canonical.com> [media] rc: Postpone ISR registration

An early registration of an ISR was causing a crash to several users (for
example, with the ite-cir driver: http://bugs.launchpad.net/bugs/972723).
The reason was that IRQs were being triggered before a driver
initialisation was completed.

This patch fixes this by moving the invocation to request_irq() and to
request_region() to a later stage on the driver probe function.

Cc: <stable@vger.kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
90802ed9c3dbab2e067bd9fc67a30e66e6774e8f 05-Dec-2011 Paul Bolle <pebolle@tiscali.nl> treewide: Fix comment and string typo 'bufer'

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
7de3461c93a6d65355113cca333723eb8a1a0225 22-Aug-2011 Joe Perches <joe@perches.com> [media] ene_ir: Use current logging styles

Add pr_fmt.
Convert ene_warn and ene_notice to pr_<level>.
Use pr_debug in __dbg macro and a little neatening.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5588dc2b025fd8b2188142b8d59efe562bd57d80 28-Apr-2011 David Härdeman <david@hardeman.nu> [media] rc-core: lirc use unsigned int

Durations can never be negative, so it makes sense to consistently use
unsigned int for LIRC transmission. Contrary to the initial impression,
this shouldn't actually change the userspace API.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
5aad724280b9f8ffff3a55311ef0ba35ebb4099a 06-Jan-2011 Jarod Wilson <jarod@redhat.com> [media] rc: fix up and genericize some time unit conversions

The ene_ir driver was using a private define of MS_TO_NS, which is meant
to be microseconds to nanoseconds. The mceusb driver copied it,
intending to use is a milliseconds to microseconds. Lets move the
defines to a common location, expand and standardize them a touch, so
that we now have:

MS_TO_NS - milliseconds to nanoseconds
MS_TO_US - milliseconds to microseconds
US_TO_NS - microseconds to nanoseconds

Reported-by: David Härdeman <david@hardeman.nu>
CC: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2e4c55626a0c30b5b2bc9469c025a563a81c3785 06-Jan-2011 Kyle McMartin <kmcmartin@redhat.com> [media] rc/ene_ir: fix oops on module load

dev->rdev is accessed in ene_setup_hw_settings, so it needs to be wired
up before then.

[Jarod Wilson]: Also fix a possible improper resource freeing bug while
we're looking at possible probe issues here.

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>
CC: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
52b661449aecc47e652a164c0d8078b31e10aca0 17-Nov-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] rc: Rename remote controller type to rc_type instead of ir_type

for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,IR_TYPE,RC_TYPE,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_type,rc_type,g <$i >a && mv a $i; done

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6bda96447cef24fbf97a798b1ea664224d5fdc25 17-Nov-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] rc: rename the remaining things to rc_core

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>
d8b4b5822f51e2142b731b42c81e3f03eec475b2 29-Oct-2010 David Härdeman <david@hardeman.nu> [media] ir-core: make struct rc_dev the primary interface

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>
32cf86f6d16367db5a10039c1dd938a2427d697c 10-Nov-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] rename drivers/media/IR to drives/media/rc

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>