summaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
AgeCommit message (Collapse)AuthorFilesLines
2010-10-22Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bklLinus Torvalds3-2/+8
* 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: vfs: make no_llseek the default vfs: don't use BKL in default_llseek llseek: automatically add .llseek fop libfs: use generic_file_llseek for simple_attr mac80211: disallow seeks in minstrel debug code lirc: make chardev nonseekable viotape: use noop_llseek raw: use explicit llseek file operations ibmasmfs: use generic_file_llseek spufs: use llseek in all file operations arm/omap: use generic_file_llseek in iommu_debug lkdtm: use generic_file_llseek in debugfs net/wireless: use generic_file_llseek in debugfs drm: use noop_llseek
2010-10-15llseek: automatically add .llseek fopArnd Bergmann2-2/+5
All file_operations should get a .llseek operation so we can make nonseekable_open the default for future file operations without a .llseek pointer. The three cases that we can automatically detect are no_llseek, seq_lseek and default_llseek. For cases where we can we can automatically prove that the file offset is always ignored, we use noop_llseek, which maintains the current behavior of not returning an error from a seek. New drivers should normally not use noop_llseek but instead use no_llseek and call nonseekable_open at open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file. The generated code is often incorrectly indented and right now contains comments that clarify for each added line why a specific variant was chosen. In the version that gets submitted upstream, the comments will be gone and I will manually fix the indentation, because there does not seem to be a way to do that using coccinelle. Some amount of new code is currently sitting in linux-next that should get the same modifications, which I will do at the end of the merge window. Many thanks to Julia Lawall for helping me learn to write a semantic patch that does all this. ===== begin semantic patch ===== // This adds an llseek= method to all file operations, // as a preparation for making no_llseek the default. // // The rules are // - use no_llseek explicitly if we do nonseekable_open // - use seq_lseek for sequential files // - use default_llseek if we know we access f_pos // - use noop_llseek if we know we don't access f_pos, // but we still want to allow users to call lseek // @ open1 exists @ identifier nested_open; @@ nested_open(...) { <+... nonseekable_open(...) ...+> } @ open exists@ identifier open_f; identifier i, f; identifier open1.nested_open; @@ int open_f(struct inode *i, struct file *f) { <+... ( nonseekable_open(...) | nested_open(...) ) ...+> } @ read disable optional_qualifier exists @ identifier read_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; expression E; identifier func; @@ ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) { <+... ( *off = E | *off += E | func(..., off, ...) | E = *off ) ...+> } @ read_no_fpos disable optional_qualifier exists @ identifier read_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; @@ ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) { ... when != off } @ write @ identifier write_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; expression E; identifier func; @@ ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) { <+... ( *off = E | *off += E | func(..., off, ...) | E = *off ) ...+> } @ write_no_fpos @ identifier write_f; identifier f, p, s, off; type ssize_t, size_t, loff_t; @@ ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) { ... when != off } @ fops0 @ identifier fops; @@ struct file_operations fops = { ... }; @ has_llseek depends on fops0 @ identifier fops0.fops; identifier llseek_f; @@ struct file_operations fops = { ... .llseek = llseek_f, ... }; @ has_read depends on fops0 @ identifier fops0.fops; identifier read_f; @@ struct file_operations fops = { ... .read = read_f, ... }; @ has_write depends on fops0 @ identifier fops0.fops; identifier write_f; @@ struct file_operations fops = { ... .write = write_f, ... }; @ has_open depends on fops0 @ identifier fops0.fops; identifier open_f; @@ struct file_operations fops = { ... .open = open_f, ... }; // use no_llseek if we call nonseekable_open //////////////////////////////////////////// @ nonseekable1 depends on !has_llseek && has_open @ identifier fops0.fops; identifier nso ~= "nonseekable_open"; @@ struct file_operations fops = { ... .open = nso, ... +.llseek = no_llseek, /* nonseekable */ }; @ nonseekable2 depends on !has_llseek @ identifier fops0.fops; identifier open.open_f; @@ struct file_operations fops = { ... .open = open_f, ... +.llseek = no_llseek, /* open uses nonseekable */ }; // use seq_lseek for sequential files ///////////////////////////////////// @ seq depends on !has_llseek @ identifier fops0.fops; identifier sr ~= "seq_read"; @@ struct file_operations fops = { ... .read = sr, ... +.llseek = seq_lseek, /* we have seq_read */ }; // use default_llseek if there is a readdir /////////////////////////////////////////// @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier readdir_e; @@ // any other fop is used that changes pos struct file_operations fops = { ... .readdir = readdir_e, ... +.llseek = default_llseek, /* readdir is present */ }; // use default_llseek if at least one of read/write touches f_pos ///////////////////////////////////////////////////////////////// @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read.read_f; @@ // read fops use offset struct file_operations fops = { ... .read = read_f, ... +.llseek = default_llseek, /* read accesses f_pos */ }; @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier write.write_f; @@ // write fops use offset struct file_operations fops = { ... .write = write_f, ... + .llseek = default_llseek, /* write accesses f_pos */ }; // Use noop_llseek if neither read nor write accesses f_pos /////////////////////////////////////////////////////////// @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read_no_fpos.read_f; identifier write_no_fpos.write_f; @@ // write fops use offset struct file_operations fops = { ... .write = write_f, .read = read_f, ... +.llseek = noop_llseek, /* read and write both use no f_pos */ }; @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier write_no_fpos.write_f; @@ struct file_operations fops = { ... .write = write_f, ... +.llseek = noop_llseek, /* write uses no f_pos */ }; @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; identifier read_no_fpos.read_f; @@ struct file_operations fops = { ... .read = read_f, ... +.llseek = noop_llseek, /* read uses no f_pos */ }; @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops; @@ struct file_operations fops = { ... +.llseek = noop_llseek, /* no read or write fn */ }; ===== End semantic patch ===== Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Julia Lawall <julia@diku.dk> Cc: Christoph Hellwig <hch@infradead.org>
2010-09-30V4L/DVB: ir-core: Fix null dereferences in the protocols sysfs interfaceBrian Rogers1-6/+11
For some cards, ir_dev->props and ir_dev->raw are both NULL. These cards are using built-in IR decoding instead of raw, and can't easily be made to switch protocols. So upon reading /sys/class/rc/rc?/protocols on such a card, return 'builtin' as the supported and enabled protocol. Return -EINVAL on any attempts to change the protocol. And most important of all, don't crash. Signed-off-by: Brian Rogers <brian@xyzw.org> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: IR: extend MCE keymapMaxim Levitsky1-0/+3
These keys are found on remote bundled with Toshiba Qosmio F50-10q. Found and tested by, Sami R <maesesami@gmail.com> Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: IR: fix keys beeing stuck down foreverMaxim Levitsky1-1/+1
The logic in ir_timer_keyup was inverted. In case that values aren't equal, the meaning of the time_is_after_eq_jiffies(ir->keyup_jiffies) is that ir->keyup_jiffies is after the the jiffies or equally that that jiffies are before the the ir->keyup_jiffies which is exactly the situation we want to avoid (that the timeout is in the future) Confusing Eh? Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Cc: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: IR: fix duty cycle capabilityMaxim Levitsky1-1/+1
Due to typo lirc bridge enabled wrong capability. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: rc-core: increase repeat timeMauro Carvalho Chehab1-0/+7
As reported by Anton Blanchard <anton@samba.org>, double IR events on 2.6.36-rc2 and a DViCO FusionHDTV DVB-T Dual Express are happening: [ 1351.032084] ir_keydown: i2c IR (FusionHDTV): key down event, key 0x0067, scancode 0x0051 [ 1351.281284] ir_keyup: keyup key 0x0067 ie one key down event and one key up event 250ms later. So, we need to increase the repeat timeout, to avoid this bug to hit. As we're doing it at core, this fix is not needed anymore at dib0700 driver. Thanks-to: Anton Blanchard <anton@samba.org> Cc: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: mceusb: add two new ASUS device IDsJarod Wilson1-0/+4
Reported in lirc sf.net tracker and on lirc mailing list Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-09-27V4L/DVB: IR: ir-raw-event: null pointer dereferenceDan Carpenter1-1/+3
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>
2010-09-16lirc: make chardev nonseekableArnd Bergmann2-0/+3
There does not seem to be a need for lirc to allow seeking on the file descriptor, so let's just disallow this before users start relying on it. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2010-08-12V4L/DVB: Fix IR_CORE dependenciesMauro Carvalho Chehab1-1/+8
As pointed by Randy Dunlap <randy.dunlap@oracle.com>: > ERROR: "ir_keydown" [drivers/media/video/ir-kbd-i2c.ko] undefined! > ERROR: "__ir_input_register" [drivers/media/video/ir-kbd-i2c.ko] undefined! > ERROR: "get_rc_map" [drivers/media/video/ir-kbd-i2c.ko] undefined! > ERROR: "ir_input_unregister" [drivers/media/video/ir-kbd-i2c.ko] undefined! > ERROR: "get_rc_map" [drivers/media/video/cx88/cx88xx.ko] undefined! > ERROR: "ir_repeat" [drivers/media/video/cx88/cx88xx.ko] undefined! > ERROR: "ir_input_unregister" [drivers/media/video/cx88/cx88xx.ko] undefined! > ERROR: "ir_keydown" [drivers/media/video/cx88/cx88xx.ko] undefined! > ERROR: "__ir_input_register" [drivers/media/video/cx88/cx88xx.ko] undefined! > ERROR: "get_rc_map" [drivers/media/video/bt8xx/bttv.ko] undefined! > ERROR: "ir_input_unregister" [drivers/media/video/bt8xx/bttv.ko] undefined! > ERROR: "__ir_input_register" [drivers/media/video/bt8xx/bttv.ko] undefined! > ERROR: "ir_g_keycode_from_table" [drivers/media/IR/ir-common.ko] undefined! > > > #5101: > (.text+0x8306e2): undefined reference to `ir_core_debug' > (.text+0x830729): undefined reference to `ir_core_debug' > ir-functions.c:(.text+0x830906): undefined reference to `ir_core_debug' > (.text+0x8309d8): undefined reference to `ir_g_keycode_from_table' > (.text+0x830acf): undefined reference to `ir_core_debug' > (.text+0x830b92): undefined reference to `ir_core_debug' > (.text+0x830bef): undefined reference to `ir_core_debug' > (.text+0x830c6a): undefined reference to `ir_core_debug' > (.text+0x830cf7): undefined reference to `ir_core_debug' > budget-ci.c:(.text+0x89f5c8): undefined reference to `ir_keydown' > budget-ci.c:(.text+0x8a0c58): undefined reference to `get_rc_map' > budget-ci.c:(.text+0x8a0c80): undefined reference to `__ir_input_register' > budget-ci.c:(.text+0x8a0ee0): undefined reference to `get_rc_map' > budget-ci.c:(.text+0x8a11cd): undefined reference to `ir_input_unregister' > (.text+0x8a8adb): undefined reference to `ir_input_unregister' > dvb-usb-remote.c:(.text+0x8a9188): undefined reference to `get_rc_map' > dvb-usb-remote.c:(.text+0x8a91b1): undefined reference to `__ir_input_register' > dvb-usb-remote.c:(.text+0x8a9238): undefined reference to `get_rc_map' > dib0700_core.c:(.text+0x8b04ca): undefined reference to `ir_keydown' > dib0700_devices.c:(.text+0x8b2ea8): undefined reference to `ir_keydown' > dib0700_devices.c:(.text+0x8b2ef0): undefined reference to `ir_keydown' Those breakages seem to be caused by two bad things at IR_CORE Kconfig: 1) cx23885 is using select for IR_CORE; 2) the dvb-usb and sms dependency for IR_CORE were missing. While here, allow users to un-select IR. Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: media: ir-keytable: null dereference in debug codeDan Carpenter1-1/+2
"ir_dev->props" can be NULL. We only use raw mode if "ir_dev->props" is non-NULL and "ir_dev->props->driver_type == RC_DRIVER_IR_RAW". Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR keymap: Add print button for HP OEM version of MCE remoteAndy Walls1-0/+2
This patch adds a defintion for the "Print" button found on HP OEM versions of the MCE remote. All of the other keys found on the HP OEM version of the remote match the other keys as already defined. Because, who doesn't need "remote printing", while one is sitting on the couch across from one's PC? ;) Signed-off-by: Andy Walls <awalls@md.metrocast.net> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: Port ene driver to new IR subsystem and enable itMaxim Levitsky4-401/+258
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: STAGING: remove lirc_ene0100 driverMaxim Levitsky2-0/+1416
Add latest unported version of this driver to media/IR. Next patch will port it to ir core. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: report unknown scancodes the in-kernel decoders foundMaxim Levitsky1-0/+8
This way it is possible to use evtest to create keymap for unknown remote. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: extend interfaces to support more device settingsMaxim Levitsky2-19/+94
LIRC: add new IOCTL that enables learning mode (wide band receiver) Still missing features: carrier report & timeout reports. Will need to pack these into ir_raw_event Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: add helper function for hardware with small o/b bufferMaxim Levitsky3-1/+86
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>
2010-08-08V4L/DVB: IR: Allow not to compile keymaps inMaxim Levitsky5-46/+27
Currently, ir device registration fails if keymap requested by driver is not found. Fix that by always compiling in the empty keymap, and using it as a failback. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: NECX: support repeatMaxim Levitsky2-2/+23
This adds support for repeat detecting for NECX variant Tested with uneversal remote Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: nec decoder: fix repeatMaxim Levitsky1-1/+1
Repeat space is 4 units, not 8. Current code would never trigger a repeat. However that isn't true for NECX, so repeat there must be handled differently. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Reviewed-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: JVC: make repeat workMaxim Levitsky1-1/+13
Currently, jvc decoder will attempt misdetect next press as a repeat of last keypress, therefore second keypress isn't detected. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: replace workqueue with kthreadMaxim Levitsky2-12/+32
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>
2010-08-08V4L/DVB: IR: replace spinlock with mutexMaxim Levitsky1-14/+14
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>
2010-08-08V4L/DVB: IR: minor fixesMaxim Levitsky3-9/+12
* 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>
2010-08-08V4L/DVB: IR: Kconfig fixesMaxim Levitsky1-3/+7
Move IR drives below separate menu. This allows to disable them. Also correct a typo. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR: put newly ported streamzap driver in proper homeJarod Wilson3-0/+754
Moves drivers/staging/lirc/lirc_streamzap.c to drivers/media/IR/streamzap.c, along with making the requisite Kconfig and Makefile changes. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: staging/lirc: port lirc_streamzap to ir-coreJarod Wilson2-0/+82
This ports lirc_streamzap.c over to ir-core in-place, to be followed by a patch moving the driver over to drivers/media/IR/streamzap.c and enabling the proper Kconfig bits. Presently, the in-kernel keymap doesn't work, as the stock Streamzap remote uses an RC-5-like, but not-quite-RC-5 protocol, which the in-kernel RC-5 decoder doesn't cope with. The remote can be used right now with the lirc bridge driver though, and other remotes (at least an RC-6(A) MCE remote) work perfectly with the driver. I'll take a look at making the existing RC-5 decoder cope with this odd duck, possibly implement another standalone decoder engine, or just throw up my hands and say "meh, use lirc"... But the driver itself should be perfectly sound. Remaining items on the streamzap TODO list: - add LIRC_SET_REC_TIMEOUT-alike support - add LIRC_GET_M{AX,IN}_TIMEOUT-alike support - add LIRC_GET_REC_RESOLUTION-alike support All of the above should be trivial to add. There are patches pending to add this support to ir-core from Maxim Levitsky, and I'll take care of these once his patches get integrated. None of them are currently essential though. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR/mceusb: less generic callback name and remove cruftJarod Wilson1-4/+2
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR/mceusb: remove bad ir_input_dev useJarod Wilson1-14/+1
The ir_input_dev gets filled in by __ir_input_register, the one allocated in mceusb_init_input_dev was being overwritten by the correct one shortly after it was initialized (ultimately resulting in a memory leak). This bug was inherited from imon.c, and was pointed out to me by Maxim Levitsky. v2: fix incorrect dev arg to dev_dbg Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR/imon: remove bad ir_input_dev useJarod Wilson1-15/+0
The ir_input_dev gets filled in by __ir_input_register, the one allocated in imon_init_idev was being overwritten by the correct one shortly after it was initialized (ultimately resulting in a memory leak). Additionally, there was an ill-advised memcpy into that extraneous ir_input_dev which gets fixed by this. Ill-advised memcpy pointed out by Dmitry Torokhov, bad usage of ir_input_dev pointed out by Maxim Levitsky. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: IR/imon: remove incorrect calls to input_free_deviceJarod Wilson1-4/+1
Per Dmitry Torokhov, following input_unregister_device with an input_free_device is forbidden, the former is sufficient alone. Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: sms: Convert IR support to use the Remote Controller coreMauro Carvalho Chehab1-2/+3
Rewrites the siano IR implementation. The previous implementation were non-standard. As such, it has issues if more than one device registers IR, as there used to have some static constants used during protocol decoding phase. Also, it used to implement its on RAW decoder, and only for RC5. The new code uses RC core subsystem for handling IR. This brings several new features to the driver, including: - Allow to dynamically replace the IR keycodes; - Supports all existing raw decoders (JVC, NEC, RC-5, RC-6, SONY); - Supports lirc dev; - Doesn't have race conditions when more than one sms IR is registered; - The code size for the IR implementation is very small; - it exports the IR features via /sys/class/rc. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: standardize names at rc-dib0700 tablesMauro Carvalho Chehab2-12/+12
Use a more standard way to name those tables, as they're currently used by the script that coverts those tables to be loaded via userspace. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: dib0700: break keytable into NEC and RC-5 variantsMauro Carvalho Chehab3-83/+129
Instead of having one big keytable with 2 protocols inside, break it into two separate tables, being one for NEC and another for RC-5 variants, and properly identify what variant should be used at the boards entries. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: Add a keymap file with dib0700 tableMauro Carvalho Chehab2-0/+315
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: media/IR: testing the wrong variableDan Carpenter1-1/+1
There is a typo here. We meant to test "rbuf" instead of "drv". We already tested "drv" 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-08-02V4L/DVB: IR/lirc: use memdup_user instead of copy_from_userJarod Wilson1-8/+3
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/lirc: make lirc userspace and staging modules buildableJarod Wilson3-227/+2
The lirc userspace needs all the current ioctls defined, and we need to put the header files in places out-of-tree and/or staging lirc drivers (which I plan to prep soon) can easily build with. I've actually tested this in a tree w/all the lirc drivers queued up to be submitted for staging. I'm also reasonably sure that Andy Walls is going to need most of the ioctls anyway for his cx23888 IR driver work. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: drivers/media: Remove unnecessary casts of private_dataJoe Perches1-3/+3
Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Jarod Wilson <jarod@redhat.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/mceusb: more streamlining of device initJarod Wilson1-16/+18
Spent a while last night getting device initialization packet captures under Windows for all generations of devices. There are a few places where we were doing things differently, and few things we were doing that we don't need to do, particularly on gen3 hardware, and I *think* one of those things is what was locking up my pinnacle hw from time to time -- at least, its been perfectly well behaved every time its been plugged in since making this change. First up, we're adding a bit more to the gen1 init routine here. Its not absolutely necessary, the hardware works the same both with and without it, but I'd like to be consistent w/Windows here. Second, DEVICE_RESET is never called when initializing either of my gen3 devices, its only called for gen1 and gen2. The bits in the gen3 init after removing that, are safe (and interesting) to run on all hardware, so there's no more gen3-specific init done, there's instead a generic mceusb_get_parameters() that is run for all hardware. Third, the gen3 flag isn't needed. We only care if hardware is gen3 during probe, so I've dropped that from the device flags struct. Successfully tested on all three generations of mceusb hardware. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/mceusb: remove unused vars from gen1 initMauro Carvalho Chehab1-2/+1
Prior init unification/simplification patch made these unused, forgot to remove them, so this silences: drivers/media/IR/mceusb.c: In function ‘mceusb_gen1_init’: drivers/media/IR/mceusb.c:769: warning: unused variable ‘partial’ drivers/media/IR/mceusb.c:768: warning: unused variable ‘i’ Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: lirc: use unlocked_ioctlArnd Bergmann3-12/+10
New code should not rely on the big kernel lock, so use the unlocked_ioctl file operation in lirc. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Jarod Wilson <jarod@redhat.com> Acked-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR: jvc-decoder needs BITREVERSERandy Dunlap1-0/+1
ir-jvc-decoder uses bitreverse interfaces, so it should select BITREVERSE. ir-jvc-decoder.c:(.text+0x550bc): undefined reference to `byte_rev_table' ir-jvc-decoder.c:(.text+0x550c6): undefined reference to `byte_rev_table' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/lirc_dev: fix locking in lirc_dev_fop_readJarod Wilson1-1/+4
On Wed, Jul 07, 2010 at 02:52:58PM +0200, Jiri Slaby wrote: > Hi, > > stanse found a locking error in lirc_dev_fop_read: > if (mutex_lock_interruptible(&ir->irctl_lock)) > return -ERESTARTSYS; > ... > while (written < length && ret == 0) { > if (mutex_lock_interruptible(&ir->irctl_lock)) { #1 > ret = -ERESTARTSYS; > break; > } > ... > } > > remove_wait_queue(&ir->buf->wait_poll, &wait); > set_current_state(TASK_RUNNING); > mutex_unlock(&ir->irctl_lock); #2 > > If lock at #1 fails, it beaks out of the loop, with the lock unlocked, > but there is another "unlock" at #2. This should do the trick. Completely untested beyond compiling, but its not exactly a complicated fix, and in practice, I'm not aware of anyone ever actually tripping that locking bug, so there's zero functional change in typical use here. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/mceusb: unify and simplify different gen device initJarod Wilson1-43/+7
Started out as an effort to try to tackle the last remaining issue I'm having with this damned pinnacle device getting wedged the first time its plugged in after an indeterminate length of not being plugged in. Didn't get that solved yet, but did streamline the init code a bit more and remove some superfluous gunk. Nukes a completely unneeded call to usb_device_init() and several lines of overly complex crap in the gen1 device init path. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR/imon: auto-configure another 0xffdc device variantJarod Wilson1-0/+1
Per Pieter Hoekstra: I have a Antec Fusion with a iMON Lcd and I get the following error: imon 6-1:1.0: Unknown 0xffdc device, defaulting to VFD and iMON IR (id 0x9e) The driver is functional if I load it like this: (I do not use a remote for it) modprobe imon display_type=1 (On Mythbuntu 10.04/2.6.32) This device is a lcd-type with support for a MCE remote. Looking at the source code, this device (0x9e) is the same as id 0x9f. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR: add empty lirc pseudo-keymapJarod Wilson2-0/+42
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: IR: add ir-core to lirc userspace decoder bridge driverJarod Wilson6-0/+310
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>
2010-08-02V4L/DVB: IR: add lirc device interfaceJarod Wilson4-0/+999
v2: currently unused ioctls are included, but #if 0'd out Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>