summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/nuvoton-cir.c
Commit message (Collapse)AuthorAgeFilesLines
* [media] rc: nuvoton-cir: fix potential double free in nvt_probe()Wei Yongjun2013-04-151-0/+1
| | | | | | | | | | 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>
* Merge branch 'v4l_for_linus' into staging/for_v3.9Mauro Carvalho Chehab2013-01-241-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * v4l_for_linus: (464 commits) [media] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures [media] uvcvideo: Cleanup leftovers of partial revert [media] uvcvideo: Return -EACCES when trying to set a read-only control Linux 3.8-rc3 mm: reinstante dropped pmd_trans_splitting() check cred: Remove tgcred pointer from struct cred drm/ttm: fix fence locking in ttm_buffer_object_transfer ARM: clps711x: Fix bad merge of clockevents setup ARM: highbank: save and restore L2 cache and GIC on suspend ARM: highbank: add a power request clear ARM: highbank: fix secondary boot and hotplug ARM: highbank: fix typos with hignbank in power request functions ARM: dts: fix highbank cpu mpidr values ARM: dts: add device_type prop to cpu nodes on Calxeda platforms drm/prime: drop reference on imported dma-buf come from gem xen/netfront: improve truesize tracking ARM: mx5: Fix MX53 flexcan2 clock ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array sctp: fix Kconfig bug in default cookie hmac selection EDAC: Cleanup device deregistering path ... Conflicts: drivers/media/pci/dm1105/dm1105.c drivers/media/platform/soc_camera/mx2_camera.c
| * Drivers: media: remove __dev* attributes.Greg Kroah-Hartman2013-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | [media] rc: Call rc_register_device before irq setupMatthijs Kooijman2012-12-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | [media] rc: Set rdev before irq setupMatthijs Kooijman2012-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem in fintek-cir and nuvoton-cir where the irq handler would trigger during module load before the rdev member was set, causing a NULL pointer crash. It seems this crash is very reproducible (just bombard the receiver with IR signals during module load), probably because when request_irq is called, any pending intterupt is handled immediately, before request_irq returns and rdev can be set. This same crash was supposed to be fixed by commit 9ef449c6b31bb6a8e6dedc24de475a3b8c79be20 ("[media] rc: Postpone ISR registration"), but the crash was still observed on the nuvoton-cir driver. This commit was tested on nuvoton-cir only. Cc: Jarod Wilson <jarod@redhat.com> Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* | [media] rc: Make probe cleanup goto labels more verboseMatthijs Kooijman2012-12-211-15/+15
|/ | | | | | | | | | | | | | | | | 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>
* [media] nuvoton-cir: carrier detect support is broken - remove itMauro Carvalho Chehab2012-10-271-5/+2Star
| | | | | | | | | | | | The carrier detect return value is never used on nuvoton driver: drivers/media/rc/nuvoton-cir.c: In function 'nvt_process_rx_ir_data': drivers/media/rc/nuvoton-cir.c:623:6: warning: variable 'carrier' set but not used [-Wunused-but-set-variable] Also, this would be called only if a boolean variable is enabled, but there's no condition that enables it inside the driver. So, comment the carrier detection code, as it might be useful later, and remove the unused glue code. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] nuvoton-cir: get rid of warning: no previous prototypeMauro Carvalho Chehab2012-10-271-2/+2
| | | | | | | drivers/media/rc/nuvoton-cir.c:1223:5: warning: no previous prototype for 'nvt_init' [-Wmissing-prototypes] drivers/media/rc/nuvoton-cir.c:1228:6: warning: no previous prototype for 'nvt_exit' [-Wmissing-prototypes] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc-core: add separate defines for protocol bitmaps and numbersDavid Härdeman2012-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [media] rc: divide by zero bugs in s_tx_carrier()Dan Carpenter2012-10-061-0/+3
| | | | | | | | | | | | "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>
* [media] media: Use pr_info not homegrown pr_reg macroJoe Perches2012-07-071-73/+72Star
| | | | | | | | | | No need to duplicate normal kernel logging capabilities. Add pr_fmt and convert pr_reg to pr_info. Remove pr_reg macros. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc: Fix invalid free_region and/or free_irq on probe failureBen Hutchings2012-05-201-14/+12Star
| | | | | | | | | | | | | fintek-cir, ite-cir and nuvoton-cir may try to free an I/O region and/or IRQ handler that was never allocated after a failure in their respective probe functions. Add and use separate labels on the failure path so they will do the right cleanup after each possible point of failure. Compile-tested only. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc: Postpone ISR registrationLuis Henriques2012-04-261-18/+18
| | | | | | | | | | | | | | | 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>
* [media] nuvoton-cir: simplify raw IR sample handlingJarod Wilson2011-09-111-37/+8Star
| | | | | | | | | | | | | | | | | The nuvoton-cir driver was storing up consecutive pulse-pulse and space-space samples internally, for no good reason, since ir_raw_event_store_with_filter() already merges back to back like samples types for us. This should also fix a regression introduced late in 3.0 that related to a timeout change, which actually becomes correct when coupled with this change. Tested with RC6 and RC5 on my own nuvoton-cir hardware atop vanilla 3.0.0, after verifying quirky behavior in 3.0 due to the timeout change. Reported-by: Stephan Raue <sraue@openelec.tv> CC: Stephan Raue <sraue@openelec.tv> CC: stable@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc-core: lirc use unsigned intDavid Härdeman2011-07-271-9/+3Star
| | | | | | | | | 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>
* [media] nuvoton-cir: make idle timeout more saneJarod Wilson2011-07-121-1/+1
| | | | | | | | The nuvoton-cir inherited an insanely low idle timeout value from the mceusb driver. We're fixing mceusb, should fix this driver too. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] nuvoton-cir: in_use isn't actually in use, remove itJarod Wilson2011-06-111-2/+0Star
| | | | | Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] nuvoton-cir: minor tweaks to rc dev initJarod Wilson2011-05-201-6/+7
| | | | | | | | | | | | - Set a default timeout (matching mceusb.c) and use ir_raw_event_store_with_filter, which leads to better behavior when using lirc userspace decoding with this hardware - Fill in rx_resolution with the value we're using here (50us) - Wire up input phys and device parent pointer - Use device_init_wakeup() instead of device_set_wakeup_*() Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc/nuvoton-cir: enable CIR on w83667hg chip variantJarod Wilson2011-05-201-6/+16
| | | | | | | | | | | | | Thanks to some excellent investigative work by Douglas Clowes, it was uncovered that the older w83667hg Nuvoton chip functions with this driver after actually enabling the CIR function via its multi-function chip config register. The CIR and CIR wide-band sensor enable bits are just in a different place on this hardware, so we only poke register 0x27 on 677 hardware now, and we poke register 0x2c on the 667 now. Reported-by: Douglas Clowes <dclowes1@optusnet.com.au> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc/nuvoton-cir: only warn about unknown chipsJarod Wilson2011-05-201-8/+32
| | | | | | | | | | | | | | | | | There are additional chip IDs that report a PNP ID of NTN0530, which we were refusing to load on. Instead, lets just warn if we encounter an unknown chip, as there's a chance it will work just fine. Also, expand the list of known hardware to include both an earlier and a later generation chip that this driver should function with. Douglas has an older w83667hg variant, that with a touch more work, will be supported by this driver, and Lutz has a newer w83677hg variant that works without any further modifications to the driver. Reported-by: Douglas Clowes <dclowes1@optusnet.com.au> Reported-by: Lutz Sammer <johns98@gmx.net> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] nuvoton-cir: fix wake from suspendJarod Wilson2011-03-021-2/+3
| | | | | | | | | | | | | | The CIR Wake FIFO is 67 bytes long, but the stock remote appears to only populate 65 of them. Limit comparison to 65 bytes, and wake from suspend works a whole lot better (it wasn't working at all for most folks). Fix based on comparison with the old lirc_wb677 driver from Nuvoton, debugging and testing done by Dave Treacy by way of the lirc mailing list. Reported-by: Dave Treacy <davetreacy@gmail.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc: use time unit conversion macros correctlyJarod Wilson2011-01-311-3/+3
| | | | | | | | | Due to my own stupidity, some of the wrong time unit conversion macros were being used inside some of the IR drivers I've been working on. Fix that, and convert over some additional places to also use the macros. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] drivers/media: nuvoton: fix chip id probe v2Nicolas Kaiser2010-12-291-2/+5
| | | | | | | | | | Make sure we have a matching chip id high and one or the other of the chip id low values. Print the values if the probe fails. Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] rc: Rename remote controller type to rc_type instead of ir_typeMauro Carvalho Chehab2010-12-291-1/+1
| | | | | | | 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>
* [media] rc: rename the remaining things to rc_coreMauro Carvalho Chehab2010-12-291-1/+1
| | | | | | | | | | | | | | | 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>
* [media] ir-core: make struct rc_dev the primary interfaceDavid Härdeman2010-12-291-48/+37Star
| | | | | | | | | | | | | | | | | | | | | | 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>
* [media] rename drivers/media/IR to drives/media/rcMauro Carvalho Chehab2010-12-291-0/+1252
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>