rc-core: ir-core to rc-core conversion
Subsystems (5)
cover rc-core: ir-core to rc-core conversion
This is my current patch queue, the main change is to make struct rc_dev the primary interface for rc drivers and to abstract away the fact that there's an input device lurking in there somewhere. The patchset has been updated to apply on top of the staging/for_v2.6.37-rc1 branch of the media_tree git repo.
In addition, the cx88 and winbond-cir drivers are converted to use rc-core.
The first patch (which is not to be merged) just merges the large scancodes patches for the input subsystem to make sure that merging my patches upstream will be doable post -rc1 (the input patches are already merged upstream).
Given the changes, these patches touch every single driver. Obviously I haven't tested them all due to a lack of hardware (I have made sure that all drivers compile without any warnings and I have tested the end result on mceusb and winbond-cir hardware).
---
David Härdeman (7):
ir-core: dummy patch to base my work on top of Dmitry's large scancode work
ir-core: convert drivers/media/video/cx88 to ir-core
ir-core: remove remaining users of the ir-functions keyhandlers
ir-core: more cleanups of ir-functions.c
ir-core: merge and rename to rc-core
ir-core: make struct rc_dev the primary interface
rc-core: convert winbond-cir
drivers/char/keyboard.c | 31 - drivers/input/evdev.c | 100 +- drivers/input/input.c | 192 ++- drivers/input/misc/Kconfig | 18 drivers/input/misc/Makefile | 1 drivers/input/misc/winbond-cir.c | 1608 --------------------------- drivers/media/IR/Kconfig | 19 drivers/media/IR/Makefile | 7 drivers/media/IR/ene_ir.c | 129 +- drivers/media/IR/ene_ir.h | 3 drivers/media/IR/imon.c | 67 - drivers/media/IR/ir-core-priv.h | 26 drivers/media/IR/ir-functions.c | 254 ---- drivers/media/IR/ir-jvc-decoder.c | 13 drivers/media/IR/ir-keytable.c | 577 ---------- drivers/media/IR/ir-lirc-codec.c | 121 +- drivers/media/IR/ir-nec-decoder.c | 15 drivers/media/IR/ir-raw-event.c | 382 ------ drivers/media/IR/ir-rc5-decoder.c | 13 drivers/media/IR/ir-rc5-sz-decoder.c | 13 drivers/media/IR/ir-rc6-decoder.c | 17 drivers/media/IR/ir-sony-decoder.c | 11 drivers/media/IR/ir-sysfs.c | 362 ------ drivers/media/IR/mceusb.c | 105 +- drivers/media/IR/nuvoton-cir.c | 85 + drivers/media/IR/nuvoton-cir.h | 3 drivers/media/IR/rc-main.c | 1134 +++++++++++++++++++ drivers/media/IR/rc-map.c | 107 -- drivers/media/IR/rc-raw.c | 371 ++++++ drivers/media/IR/streamzap.c | 66 - drivers/media/IR/winbond-cir.c | 934 ++++++++++++++++ drivers/media/dvb/dm1105/Kconfig | 3 drivers/media/dvb/dm1105/dm1105.c | 42 - drivers/media/dvb/dvb-usb/af9015.c | 16 drivers/media/dvb/dvb-usb/anysee.c | 2 drivers/media/dvb/dvb-usb/dib0700.h | 2 drivers/media/dvb/dvb-usb/dib0700_core.c | 8 drivers/media/dvb/dvb-usb/dib0700_devices.c | 144 +- drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 77 + drivers/media/dvb/dvb-usb/dvb-usb.h | 12 drivers/media/dvb/dvb-usb/lmedm04.c | 42 - drivers/media/dvb/mantis/mantis_common.h | 4 drivers/media/dvb/mantis/mantis_input.c | 72 + drivers/media/dvb/siano/smscoreapi.c | 2 drivers/media/dvb/siano/smsir.c | 52 - drivers/media/dvb/siano/smsir.h | 3 drivers/media/dvb/ttpci/Kconfig | 3 drivers/media/dvb/ttpci/budget-ci.c | 49 - drivers/media/video/Kconfig | 2 drivers/media/video/bt8xx/Kconfig | 4 drivers/media/video/bt8xx/bttv-input.c | 73 - drivers/media/video/bt8xx/bttvp.h | 1 drivers/media/video/cx18/Kconfig | 3 drivers/media/video/cx231xx/Kconfig | 4 drivers/media/video/cx23885/cx23885-input.c | 64 + drivers/media/video/cx23885/cx23885.h | 3 drivers/media/video/cx88/Kconfig | 3 drivers/media/video/cx88/cx88-input.c | 233 +--- drivers/media/video/em28xx/Kconfig | 4 drivers/media/video/em28xx/em28xx-input.c | 72 + drivers/media/video/ir-kbd-i2c.c | 28 drivers/media/video/ivtv/Kconfig | 3 drivers/media/video/saa7134/Kconfig | 2 drivers/media/video/saa7134/saa7134-input.c | 121 +- drivers/media/video/tlg2300/Kconfig | 4 drivers/staging/cx25821/Kconfig | 4 drivers/staging/go7007/Kconfig | 4 drivers/staging/tm6000/tm6000-input.c | 98 +- include/linux/input.h | 55 + include/media/ir-common.h | 38 - include/media/ir-core.h | 201 ++- include/media/ir-kbd-i2c.h | 7 include/media/rc-map.h | 2 73 files changed, 3705 insertions(+), 4645 deletions(-) delete mode 100644 drivers/input/misc/winbond-cir.c delete mode 100644 drivers/media/IR/ir-keytable.c delete mode 100644 drivers/media/IR/ir-raw-event.c delete mode 100644 drivers/media/IR/ir-sysfs.c create mode 100644 drivers/media/IR/rc-main.c delete mode 100644 drivers/media/IR/rc-map.c create mode 100644 drivers/media/IR/rc-raw.c create mode 100644 drivers/media/IR/winbond-cir.c
Signature · 1 line
David Härdeman
PATCH 1/7 ir-core: dummy patch to base my work on top of Dmitry's large scancode work
This patch adds the changes from Dmitry's large scancode work for the input subsystem (the patches to the input core and to rc-core which were accepted upstream). Not to be applied :)
Not-signed-off-by: Anyone
--- drivers/char/keyboard.c | 31 ++- drivers/input/evdev.c | 100 ++++++++-- drivers/input/input.c | 192 +++++++++++++++----- drivers/media/IR/ir-keytable.c | 393 +++++++++++++++++++++++++++------------- include/linux/input.h | 55 ++++-- include/media/rc-map.h | 2 6 files changed, 555 insertions(+), 218 deletions(-)
drivers/char/keyboard.c +24 -7
@@ -175,8 +175,7 @@ EXPORT_SYMBOL_GPL(unregister_keyboard_notifier);*/ struct getset_keycode_data { -unsigned int scancode; -unsigned int keycode; +struct input_keymap_entry ke;int error; };
@@ -184,32 +183,50 @@ static int getkeycode_helper(struct input_handle *handle, void *data) {struct getset_keycode_data *d = data; - d->error =input_get_keycode (handle->dev, d->scancode, &d->keycode); + d->error =input_get_keycode (handle->dev, &d->ke);return d->error ==0 ;/* stop as soon as we successfully get one */ }int getkeycode (unsigned int scancode) { -struct getset_keycode_data d = { scancode,0 , -ENODEV }; +struct getset_keycode_data d = { + .ke = { + .flags =0 , + .len =sizeof (scancode), + .keycode =0 , + }, + .error = -ENODEV , + }; + +memcpy (d.ke.scancode, &scancode,sizeof (scancode));input_handler_for_each_handle (&kbd_handler, &d, getkeycode_helper); -return d.error ?: d.keycode; +return d.error ?: d.ke.keycode; }static int setkeycode_helper (struct input_handle *handle,void *data) {struct getset_keycode_data *d = data; - d->error =input_set_keycode (handle->dev, d->scancode, d->keycode); + d->error =input_set_keycode (handle->dev, &d->ke);return d->error ==0 ;/* stop as soon as we successfully set one */ }int setkeycode (unsigned int scancode,unsigned int keycode) { -struct getset_keycode_data d = { scancode, keycode, -ENODEV }; +struct getset_keycode_data d = { + .ke = { + .flags =0 , + .len =sizeof (scancode), + .keycode = keycode, + }, + .error = -ENODEV , + }; + +memcpy (d.ke.scancode, &scancode,sizeof (scancode));input_handler_for_each_handle (&kbd_handler, &d, setkeycode_helper);
drivers/input/evdev.c +80 -20
124 lines not on this page · raw message
drivers/input/input.c +144 -48
286 lines not on this page · raw message
drivers/media/IR/ir-keytable.c +262 -131
538 lines not on this page · raw message
include/linux/input.h +44 -11
104 lines not on this page · raw message
include/media/rc-map.h +1 -1
@@ -36,7 +36,7 @@ struct ir_scancode_table {unsigned int len;/* Used number of entries */ unsigned int alloc;/* Size of *scan in bytes */ u64 ir_type; -char *name; +const char *name;spinlock_t lock; };
PATCH 2/7 ir-core: convert drivers/media/video/cx88 to ir-core
In reply to David HärdemanThis patch converts the cx88 driver (for sampling hw) to use the decoders provided by ir-core instead of the separate ones provided by ir-functions (and gets rid of those).
The value for MO_DDS_IO had a comment saying it corresponded to a 4kHz samplerate. That comment was unfortunately misleading. The actual samplerate was something like 3250Hz.
The current value has been derived by analyzing the elapsed time between interrupts for different values (knowing that each interrupt corresponds to 32 samples).
Thanks to Mariusz Bialonczyk <[email protected]> for testing my patches (about one a day for two weeks!) on actual hardware.
--- drivers/media/IR/ir-functions.c | 134 --------------------------- drivers/media/video/cx88/Kconfig | 2 drivers/media/video/cx88/cx88-input.c | 163 +++++++-------------------------- include/media/ir-common.h | 3 - 4 files changed, 37 insertions(+), 265 deletions(-)
drivers/media/IR/ir-functions.c +0 -134
@@ -111,140 +111,6 @@ u32 ir_extract_bits(u32 data, u32 mask) }EXPORT_SYMBOL_GPL (ir_extract_bits); -static int inline getbit (u32 *samples,int bit) -{ -return (samples[bit/32 ] & (1 << (31 -(bit%32 )))) ?1 :0 ; -} - -/* sump raw samples for visual debugging ;) */ -int ir_dump_samples (u32 *samples,int count) -{ -int i, bit, start; - -printk (KERN_DEBUG "ir samples: " ); - start =0 ; -for (i =0 ; i < count *32 ; i++) { - bit =getbit (samples,i); -if (bit) - start =1 ; -if (0 == start) -continue ; -printk ("%s" , bit ?"#" :"_" ); - } -printk ("\n" ); -return 0 ; -} -EXPORT_SYMBOL_GPL (ir_dump_samples); - -/* decode raw samples, pulse distance coding used by NEC remotes */ -int ir_decode_pulsedistance (u32 *samples,int count,int low,int high) -{ -int i,last,bit,len; -u32 curBit; -u32 value; - -/* find start burst */ -for (i = len =0 ; i < count *32 ; i++) { - bit =getbit (samples,i); -if (bit) { - len++; - }else { -if (len >=29 ) -break ; - len =0 ; - } - } - -/* start burst to short */ -if (len <29 ) -return 0xffffffff ; - -/* find start silence */ -for (len =0 ; i < count *32 ; i++) { - bit =getbit (samples,i); -if (bit) { -break ; - }else { - len++; - } - } - -/* silence to short */ -if (len <7 ) -return 0xffffffff ; - -/* go decoding */ - len =0 ; - last =1 ; - value =0 ; curBit =1 ; -for (; i < count *32 ; i++) { - bit =getbit (samples,i); -if (last) { -if (bit) { -continue ; - }else { - len =1 ; - } - }else { -if (bit) { -if (len > (low + high) /2 ) - value |= curBit; - curBit <<=1 ; -if (curBit ==1 ) -break ; - }else { - len++; - } - } - last = bit; - } - -return value; -} -EXPORT_SYMBOL_GPL (ir_decode_pulsedistance); - -/* decode raw samples, biphase coding, used by rc5 for example */ -int ir_decode_biphase (u32 *samples,int count,int low,int high) -{ -int i,last,bit,len,flips; -u32 value; - -/* find start bit (1) */ -for (i =0 ; i <32 ; i++) { - bit =getbit (samples,i); -if (bit) -break ; - } - -/* go decoding */ - len =0 ; - flips =0 ; - value =1 ; -for (; i < count *32 ; i++) { -if (len > high) -break ; -if (flips >1 ) -break ; - last = bit; - bit =getbit (samples,i); -if (last == bit) { - len++; -continue ; - } -if (len < low) { - len++; - flips++; -continue ; - } - value <<=1 ; - value |= bit; - flips =0 ; - len =1 ; - } -return value; -} -EXPORT_SYMBOL_GPL (ir_decode_biphase); -/* RC5 decoding stuff, moved from bttv-input.c to share it with * saa7134 */
drivers/media/video/cx88/Kconfig +1 -1
@@ -1,6 +1,6 @@ config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && I2C && INPUT + depends on VIDEO_DEV && PCI && I2C && INPUT && IR_CORE select I2C_ALGOBIT select VIDEO_BTCX select VIDEOBUF_DMA_SG
drivers/media/video/cx88/cx88-input.c +36 -127
257 lines not on this page · raw message
include/media/ir-common.h +0 -3
@@ -96,9 +96,6 @@ void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);void ir_input_keydown (struct input_dev *dev,struct ir_input_state *ir,u32 ir_key);u32 ir_extract_bits (u32 data,u32 mask); -int ir_dump_samples (u32 *samples,int count); -int ir_decode_biphase (u32 *samples,int count,int low,int high); -int ir_decode_pulsedistance (u32 *samples,int count,int low,int high);u32 ir_rc5_decode (unsigned int code);void ir_rc5_timer_end (unsigned long data);
Re: [PATCH 2/7] ir-core: convert drivers/media/video/cx88 to ir-core
Quoted 8 lines · David Härdeman
This patch converts the cx88 driver (for sampling hw) to use the decoders provided by ir-core instead of the separate ones provided by ir-functions (and gets rid of those).
The value for
MO_DDS_IOhad a comment saying it corresponded to a 4kHz samplerate. That comment was unfortunately misleading. The actual samplerate was something like 3250Hz.
Quoted 8 lines
The current value has been derived by analyzing the elapsed time between interrupts for different values (knowing that each interrupt corresponds to 32 samples).
Thanks to Mariusz Bialonczyk <[email protected]> for testing my patches (about one a day for two weeks!) on actual hardware.
Signed-off-by David Härdeman <[email protected]>
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 3/7 ir-core: remove remaining users of the ir-functions keyhandlers
In reply to David HärdemanThis patch removes the remaining usages of the ir_input_nokey() and ir_input_keydown() functions provided by drivers/media/IR/ir-functions.c by using the corresponding functionality in ir-core instead.
--- drivers/media/IR/imon.c | 9 -- drivers/media/IR/ir-functions.c | 101 ++----------------------- drivers/media/IR/ir-keytable.c | 110 ++++++++++++++++++++------- drivers/media/video/bt8xx/bttv-input.c | 32 ++------ drivers/media/video/bt8xx/bttvp.h | 1 drivers/media/video/cx88/cx88-input.c | 11 ++- drivers/media/video/ir-kbd-i2c.c | 3 - drivers/media/video/saa7134/saa7134-input.c | 49 ++---------- drivers/staging/tm6000/tm6000-input.c | 15 +--- include/media/ir-common.h | 31 +------- include/media/ir-core.h | 3 - include/media/ir-kbd-i2c.h | 4 - 12 files changed, 133 insertions(+), 236 deletions(-)
drivers/media/IR/imon.c +2 -7
@@ -1477,17 +1477,12 @@ static void imon_incoming_packet(struct imon_context *ictx,bool norelease = false;int i;u64 scancode; -struct input_dev *rdev =NULL ; -struct ir_input_dev *irdev =NULL ;int press_type =0 ;int msec;struct timeval t;static struct timeval prev_time = {0 ,0 };u8 ktype; - rdev = ictx->rdev; - irdev =input_get_drvdata (rdev); -/* filter out junk data on the older 0xffdc imon devices */ if ((buf[0 ] ==0xff ) && (buf[1 ] ==0xff ) && (buf[2 ] ==0xff ))return ;
@@ -1568,9 +1563,9 @@ static void imon_incoming_packet(struct imon_context *ictx,if (ktype !=IMON_KEY_PANEL ) {if (press_type ==0 ) -ir_keyup (irdev); +ir_keyup (ictx->rdev);else { -ir_keydown (rdev, ictx->rc_scancode, ictx->rc_toggle); +ir_keydown (ictx->rdev, ictx->rc_scancode, ictx->rc_toggle);spin_lock_irqsave (&ictx->kc_lock, flags); ictx->last_keycode = ictx->kc;spin_unlock_irqrestore (&ictx->kc_lock, flags);
drivers/media/IR/ir-functions.c +9 -92
135 lines not on this page · raw message
drivers/media/IR/ir-keytable.c +83 -27
168 lines not on this page · raw message
drivers/media/video/bt8xx/bttv-input.c +9 -23
@@ -38,8 +38,6 @@ module_param(repeat_period, int, 0644);static int ir_rc5_remote_gap =885 ;module_param (ir_rc5_remote_gap, int,0644 ); -static int ir_rc5_key_timeout =200 ; -module_param (ir_rc5_key_timeout, int,0644 );#undef dprintk #define dprintk(arg...) do { \
@@ -74,18 +72,17 @@ static void ir_handle_key(struct bttv *btv) (gpio & ir->mask_keydown) ?" down" :"" , (gpio & ir->mask_keyup) ? " up" : ""); -if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || - (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { -ir_input_keydown (ir->dev, &ir->ir, data); +if ((ir->mask_keydown && (gpio & ir->mask_keydown)) || + (ir->mask_keyup && !(gpio & ir->mask_keyup))) { +ir_keydown_notimeout (ir->dev, data,0 ); }else {/* HACK: Probably, ir->mask_keydown is missing for this board */ if (btv->c.type ==BTTV_BOARD_WINFAST2000 ) -ir_input_keydown (ir->dev, &ir->ir, data); +ir_keydown_notimeout (ir->dev, data,0 ); -ir_input_nokey (ir->dev,&ir->ir); +ir_keyup (ir->dev); } - }static void ir_enltv_handle_key (struct bttv *btv)
@@ -107,9 +104,9 @@ static void ir_enltv_handle_key(struct bttv *btv) gpio, data, (gpio & ir->mask_keyup) ? " up" : "up/down"); -ir_input_keydown (ir->dev, &ir->ir, data); +ir_keydown_notimeout (ir->dev, data,0 );if (keyup) -ir_input_nokey (ir->dev, &ir->ir); +ir_keyup (ir->dev); }else {if ((ir->last_gpio &1 <<31 ) == keyup)return ;
@@ -119,9 +116,9 @@ static void ir_enltv_handle_key(struct bttv *btv) (gpio & ir->mask_keyup) ? " up" : "down");if (keyup) -ir_input_nokey (ir->dev, &ir->ir); +ir_keyup (ir->dev);else -ir_input_keydown (ir->dev, &ir->ir, data); +ir_keydown_notimeout (ir->dev, data,0 ); } ir->last_gpio = data | keyup;
@@ -215,14 +212,9 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir)init_timer (&ir->timer_end); ir->timer_end.function = ir_rc5_timer_end; ir->timer_end.data = (unsigned long )ir; - -init_timer (&ir->timer_keyup); - ir->timer_keyup.function = ir_rc5_timer_keyup; - ir->timer_keyup.data = (unsigned long )ir; ir->shift_by =1 ; ir->start =3 ; ir->addr =0x0 ; - ir->rc5_key_timeout = ir_rc5_key_timeout; ir->rc5_remote_gap = ir_rc5_remote_gap; } }
@@ -290,7 +282,6 @@ void __devinit init_bttv_i2c_ir(struct bttv *btv) btv->init_data.name ="PV951" ; btv->init_data.get_key = get_key_pv951; btv->init_data.ir_codes =RC_MAP_PV951 ; - btv->init_data.type =IR_TYPE_OTHER ; info.addr =0x4b ;break ;default :
@@ -327,7 +318,6 @@ int bttv_input_init(struct bttv *btv)struct card_ir *ir;char *ir_codes =NULL ;struct input_dev *input_dev; -u64 ir_type =IR_TYPE_OTHER ;int err = -ENOMEM ;if (!btv->has_remote)
@@ -448,10 +438,6 @@ int bttv_input_init(struct bttv *btv)snprintf (ir->phys,sizeof (ir->phys),"pci-%s/ir0" ,pci_name (btv->c.pci)); - err =ir_input_init (input_dev, &ir->ir, ir_type); -if (err <0 ) - goto err_out_free; - input_dev->name = ir->name; input_dev->phys = ir->phys; input_dev->id.bustype =BUS_PCI ;
drivers/media/video/bt8xx/bttvp.h +0 -1
@@ -305,7 +305,6 @@ struct bttv_pll_info {/* for gpio-connected remote control */ struct bttv_input {struct input_dev *dev; -struct ir_input_state ir;char name[32 ];char phys[32 ];u32 mask_keycode;
drivers/media/video/cx88/cx88-input.c +8 -3
@@ -131,16 +131,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) }else if (ir->mask_keydown) {/* bit set on keydown */ if (gpio & ir->mask_keydown) -ir_keydown (ir->input, data,0 ); +ir_keydown_notimeout (ir->input, data,0 ); +else +ir_keyup (ir->input); }else if (ir->mask_keyup) {/* bit cleared on keydown */ if (0 == (gpio & ir->mask_keyup)) -ir_keydown (ir->input, data,0 ); +ir_keydown_notimeout (ir->input, data,0 ); +else +ir_keyup (ir->input); }else {/* can't distinguish keydown/up :-/ */ -ir_keydown (ir->input, data,0 ); +ir_keydown_notimeout (ir->input, data,0 ); +ir_keyup (ir->input); } }
drivers/media/video/ir-kbd-i2c.c +1 -2
@@ -270,7 +270,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) {char *ir_codes =NULL ;const char *name =NULL ; -u64 ir_type =0 ; +u64 ir_type =IR_TYPE_UNKNOWN ;struct IR_i2c *ir;struct input_dev *input_dev;struct i2c_adapter *adap = client->adapter;
@@ -384,7 +384,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) dev_name(&client->dev));/* init + register input device */ - ir->ir_type = ir_type; input_dev->id.bustype =BUS_I2C ; input_dev->name = ir->name; input_dev->phys = ir->phys;
drivers/media/video/saa7134/saa7134-input.c +10 -39
116 lines not on this page · raw message
drivers/staging/tm6000/tm6000-input.c +4 -11
@@ -25,7 +25,6 @@#include <linux/usb.h> #include <media/ir-core.h> -#include <media/ir-common.h> #include "tm6000.h" #include "tm6000-regs.h"
@@ -52,7 +51,6 @@ struct tm6000_ir_poll_result {struct tm6000_IR {struct tm6000_core *dev;struct ir_input_dev *input; -struct ir_input_state ir;char name[32 ];char phys[32 ];
@@ -67,6 +65,7 @@ struct tm6000_IR {int (*get_key) (struct tm6000_IR *,struct tm6000_ir_poll_result *);/* IR device properties */ +u64 ir_type;struct ir_dev_props props; };
@@ -145,7 +144,7 @@ static int default_polling_getkey(struct tm6000_IR *ir,return 0 ;if (&dev->int_in) { -if (ir->ir.ir_type ==IR_TYPE_RC5 ) +if (ir->ir_type ==IR_TYPE_RC5 ) poll_result->rc_data = ir->urb_data[0 ];else poll_result->rc_data = ir->urb_data[0 ] | ir->urb_data[1 ] <<8 ;
@@ -155,7 +154,7 @@ static int default_polling_getkey(struct tm6000_IR *ir,tm6000_set_reg (dev,REQ_04_EN_DISABLE_MCU_INT ,2 ,1 );msleep (10 ); -if (ir->ir.ir_type ==IR_TYPE_RC5 ) { +if (ir->ir_type ==IR_TYPE_RC5 ) { rc =tm6000_read_write_usb (dev,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,REQ_02_GET_IR_CODE ,0 ,0 , buf,1 );
@@ -201,10 +200,7 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir)dprintk ("ir->get_key result data=%04x\n" , poll_result.rc_data);if (ir->key) { -ir_input_keydown (ir->input->input_dev, &ir->ir, - (u32 )poll_result.rc_data); - -ir_input_nokey (ir->input->input_dev, &ir->ir); +ir_keydown (ir->input->input_dev, poll_result.rc_data,0 ); ir->key =0 ; }return ;
@@ -291,9 +287,6 @@ int tm6000_ir_init(struct tm6000_core *dev)strlcat (ir->phys,"/input0" ,sizeof (ir->phys));tm6000_ir_change_protocol (ir,IR_TYPE_UNKNOWN ); - err =ir_input_init (ir_input_dev->input_dev, &ir->ir,IR_TYPE_OTHER ); -if (err <0 ) - goto err_out_free; ir_input_dev->input_dev->name = ir->name; ir_input_dev->input_dev->phys = ir->phys;
include/media/ir-common.h +3 -28
@@ -1,7 +1,7 @@/* -* -* some common structs and functions to handle infrared remotes via -* input layer ... +* some common functions to handle infrared remote protocol decoding for +* drivers which have not yet been (or can't be) converted to use the +* regular protocol decoders... * * (c) 2003 Gerd Knorr <[email protected]> [SuSE Labs] *
@@ -33,30 +33,17 @@#define RC5_ADDR (x) (((x)>>6)&31)#define RC5_INSTR (x) ((x)&63) -struct ir_input_state { -/* configuration */ -u64 ir_type; - -/* key info */ -u32 ir_key;/* ir scancode */ -u32 keycode;/* linux key code */ -int keypressed;/* current state */ -}; -/* this was saa7134_ir and bttv_ir, moved here for * rc5 decoding. */ struct card_ir {struct input_dev *dev; -struct ir_input_state ir;char name[32 ];char phys[32 ];int users; -u32 running:1 ;struct ir_dev_props props;/* Usual gpio signalling */ -u32 mask_keycode;u32 mask_keydown;u32 mask_keyup;
@@ -65,7 +52,6 @@ struct card_ir {int shift_by;int start;// What should RC5_START() be int addr;// What RC5_ADDR() should be. -int rc5_key_timeout;int rc5_remote_gap;struct work_struct work;struct timer_list timer;
@@ -73,8 +59,6 @@ struct card_ir {/* RC5 gpio */ u32 rc5_gpio;struct timer_list timer_end;/* timer_end for code completion */ -struct timer_list timer_keyup;/* timer_end for key release */ -u32 last_rc5;/* last good rc5 code */ u32 last_bit;/* last raw bit seen */ u32 code;/* raw code under construction */ struct timeval base_time;/* time of last seen code */
@@ -89,16 +73,7 @@ struct card_ir { };/* Routines from ir-functions.c */ - -int ir_input_init (struct input_dev *dev,struct ir_input_state *ir, -const u64 ir_type); -void ir_input_nokey (struct input_dev *dev,struct ir_input_state *ir); -void ir_input_keydown (struct input_dev *dev,struct ir_input_state *ir, -u32 ir_key);u32 ir_extract_bits (u32 data,u32 mask); -u32 ir_rc5_decode (unsigned int code); -void ir_rc5_timer_end (unsigned long data); -void ir_rc5_timer_keyup (unsigned long data);#endif
include/media/ir-core.h +2 -1
@@ -159,7 +159,8 @@ void ir_input_unregister(struct input_dev *input_dev);void ir_repeat (struct input_dev *dev);void ir_keydown (struct input_dev *dev,int scancode,u8 toggle); -void ir_keyup (struct ir_input_dev *ir); +void ir_keydown_notimeout (struct input_dev *dev,int scancode,u8 toggle); +void ir_keyup (struct input_dev *dev);u32 ir_g_keycode_from_table (struct input_dev *input_dev,u32 scancode);/* From ir-raw-event.c */
include/media/ir-kbd-i2c.h +2 -2
@@ -12,8 +12,7 @@ struct IR_i2c {struct i2c_client *c;struct input_dev *input; -struct ir_input_state ir; -u64 ir_type; +/* Used to avoid fast repeating */ unsigned char old;
@@ -41,6 +40,7 @@ struct IR_i2c_init_data {const char *name;u64 type;/* IR_TYPE_RC5, etc */ u32 polling_interval;/* 0 means DEFAULT_POLLING_INTERVAL */ +/* * Specify either a function pointer or a value indicating one of * ir_kbd_i2c's internal get_key functions
Re: [PATCH 3/7] ir-core: remove remaining users of the ir-functions keyhandlers
Quoted 5 lines · David Härdeman
This patch removes the remaining usages of the
ir_input_nokey()andir_input_keydown()functions provided bydrivers/media/IR/ir-functions.cby using the corresponding functionality in ir-core instead.Signed-off-by David Härdeman <[email protected]>
Also tested the imon bits, at least as part of the whole series.
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 4/7 ir-core: more cleanups of ir-functions.c
In reply to David Härdemancx88 only depends on VIDEO_IR because it needs ir_extract_bits(). Move that function to ir-core.h and make it inline.
Lots of drivers had dependencies on VIDEO_IR when they really wanted IR_CORE.
The only remaining drivers to depend on VIDEO_IR are bt8xx and saa7134 (ir_rc5_timer_end is the only function exported by ir-functions).
Rename VIDEO_IR -> IR_LEGACY to give a hint to anyone writing or converting drivers to IR_CORE that they do not want a dependency on IR_LEGACY.
--- drivers/media/IR/Kconfig | 2 +- drivers/media/IR/Makefile | 2 +- drivers/media/IR/ir-functions.c | 19 ------------------- drivers/media/dvb/dm1105/Kconfig | 3 +-- drivers/media/dvb/ttpci/Kconfig | 3 +-- drivers/media/video/Kconfig | 2 +- drivers/media/video/bt8xx/Kconfig | 4 ++-- drivers/media/video/cx18/Kconfig | 3 +-- drivers/media/video/cx231xx/Kconfig | 4 ++-- drivers/media/video/cx88/Kconfig | 3 +-- drivers/media/video/cx88/cx88-input.c | 1 - drivers/media/video/em28xx/Kconfig | 4 ++-- drivers/media/video/ivtv/Kconfig | 3 +-- drivers/media/video/saa7134/Kconfig | 2 +- drivers/media/video/tlg2300/Kconfig | 4 ++-- drivers/staging/cx25821/Kconfig | 4 ++-- drivers/staging/go7007/Kconfig | 4 ++-- include/media/ir-common.h | 1 - include/media/ir-core.h | 19 +++++++++++++++++++ 19 files changed, 40 insertions(+), 47 deletions(-)
drivers/media/IR/Kconfig +1 -1
@@ -10,7 +10,7 @@ menuconfig IR_CORE if you don't need IR, as otherwise, you may not be able to compile the driver for your adapter. -config VIDEO_IR +config IR_LEGACY tristate depends on IR_CORE default IR_CORE
drivers/media/IR/Makefile +1 -1
@@ -4,7 +4,7 @@ ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o obj-y += keymaps/ obj-$(CONFIG_IR_CORE) += ir-core.o -obj-$(CONFIG_VIDEO_IR) += ir-common.o +obj-$(CONFIG_IR_LEGACY) += ir-common.o obj-$(CONFIG_LIRC) += lirc_dev.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o
drivers/media/IR/ir-functions.c +0 -19
@@ -31,25 +31,6 @@MODULE_AUTHOR ("Gerd Knorr <[email protected]> [SuSE Labs]" );MODULE_LICENSE ("GPL" ); -/* -------------------------------------------------------------------------- */ -/* extract mask bits out of data and pack them into the result */ -u32 ir_extract_bits (u32 data,u32 mask) -{ -u32 vbit =1 , value =0 ; - -do { -if (mask&1 ) { -if (data&1 ) - value |= vbit; - vbit<<=1 ; - } - data>>=1 ; - }while (mask>>=1 ); - -return value; -} -EXPORT_SYMBOL_GPL (ir_extract_bits); -/* RC5 decoding stuff, moved from bttv-input.c to share it with * saa7134 */
drivers/media/dvb/dm1105/Kconfig +1 -2
@@ -1,7 +1,6 @@ config DVB_DM1105 tristate "SDMC DM1105 based PCI cards" depends on DVB_CORE && PCI && I2C - depends on INPUT select DVB_PLL if !DVB_FE_CUSTOMISE select DVB_STV0299 if !DVB_FE_CUSTOMISE select DVB_STV0288 if !DVB_FE_CUSTOMISE
@@ -9,7 +8,7 @@ config DVB_DM1105 select DVB_CX24116 if !DVB_FE_CUSTOMISE select DVB_SI21XX if !DVB_FE_CUSTOMISE select DVB_DS3000 if !DVB_FE_CUSTOMISE - depends on VIDEO_IR + depends on IR_CORE help Support for cards based on the SDMC DM1105 PCI chip like DvbWorld 2002
drivers/media/dvb/ttpci/Kconfig +1 -2
@@ -89,7 +89,6 @@ config DVB_BUDGET config DVB_BUDGET_CI tristate "Budget cards with onboard CI connector" depends on DVB_BUDGET_CORE && I2C - depends on INPUT # due to IR select DVB_STV0297 if !DVB_FE_CUSTOMISE select DVB_STV0299 if !DVB_FE_CUSTOMISE select DVB_TDA1004X if !DVB_FE_CUSTOMISE
@@ -98,7 +97,7 @@ config DVB_BUDGET_CI select DVB_LNBP21 if !DVB_FE_CUSTOMISE select DVB_TDA10023 if !DVB_FE_CUSTOMISE select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMISE - depends on VIDEO_IR + depends on IR_CORE help Support for simple SAA7146 based DVB cards (so called Budget- or Nova-PCI cards) without onboard
drivers/media/video/Kconfig +1 -1
@@ -96,7 +96,7 @@ config VIDEO_HELPER_CHIPS_AUTO config VIDEO_IR_I2C tristate "I2C module for IR" if !VIDEO_HELPER_CHIPS_AUTO - depends on I2C && VIDEO_IR + depends on I2C && IR_CORE default y ---help--- Most boards have an IR chip directly connected via GPIO. However,
drivers/media/video/bt8xx/Kconfig +2 -2
@@ -1,10 +1,10 @@ config VIDEO_BT848 tristate "BT848 Video For Linux" - depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 && INPUT + depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 select I2C_ALGOBIT select VIDEO_BTCX select VIDEOBUF_DMA_SG - depends on VIDEO_IR + depends on IR_LEGACY select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO
drivers/media/video/cx18/Kconfig +1 -2
@@ -1,9 +1,8 @@ config VIDEO_CX18 tristate "Conexant cx23418 MPEG encoder support" depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL - depends on INPUT # due to VIDEO_IR select I2C_ALGOBIT - depends on VIDEO_IR + depends on IR_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X
drivers/media/video/cx231xx/Kconfig +2 -2
@@ -1,9 +1,9 @@ config VIDEO_CX231XX tristate "Conexant cx231xx USB video capture support" - depends on VIDEO_DEV && I2C && INPUT + depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on VIDEO_IR + depends on IR_CORE select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X
drivers/media/video/cx88/Kconfig +1 -2
@@ -1,12 +1,11 @@ config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && I2C && INPUT && IR_CORE + depends on VIDEO_DEV && PCI && I2C && IR_CORE select I2C_ALGOBIT select VIDEO_BTCX select VIDEOBUF_DMA_SG select VIDEO_TUNER select VIDEO_TVEEPROM - depends on VIDEO_IR select VIDEO_WM8775 if VIDEO_HELPER_CHIPS_AUTO ---help--- This is a video4linux driver for Conexant 2388x based
drivers/media/video/cx88/cx88-input.c +0 -1
@@ -31,7 +31,6 @@#include "cx88.h" #include <media/ir-core.h> -#include <media/ir-common.h> #define MODULE_NAME "cx88xx"
drivers/media/video/em28xx/Kconfig +2 -2
@@ -1,9 +1,9 @@ config VIDEO_EM28XX tristate "Empia EM28xx USB video capture support" - depends on VIDEO_DEV && I2C && INPUT + depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on VIDEO_IR + depends on IR_CORE select VIDEOBUF_VMALLOC select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO
drivers/media/video/ivtv/Kconfig +1 -2
@@ -1,9 +1,8 @@ config VIDEO_IVTV tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" depends on VIDEO_V4L2 && PCI && I2C - depends on INPUT # due to VIDEO_IR select I2C_ALGOBIT - depends on VIDEO_IR + depends on IR_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X
drivers/media/video/saa7134/Kconfig +1 -1
@@ -26,7 +26,7 @@ config VIDEO_SAA7134_ALSA config VIDEO_SAA7134_RC bool "Philips SAA7134 Remote Controller support" - depends on VIDEO_IR + depends on IR_LEGACY depends on VIDEO_SAA7134 default y ---help---
drivers/media/video/tlg2300/Kconfig +2 -2
@@ -1,9 +1,9 @@ config VIDEO_TLG2300 tristate "Telegent TLG2300 USB video capture support" - depends on VIDEO_DEV && I2C && INPUT && SND && DVB_CORE + depends on VIDEO_DEV && I2C && SND && DVB_CORE select VIDEO_TUNER select VIDEO_TVEEPROM - depends on VIDEO_IR + depends on IR_CORE select VIDEOBUF_VMALLOC select SND_PCM select VIDEOBUF_DVB
drivers/staging/cx25821/Kconfig +2 -2
@@ -1,10 +1,10 @@ config VIDEO_CX25821 tristate "Conexant cx25821 support" - depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT + depends on DVB_CORE && VIDEO_DEV && PCI && I2C select I2C_ALGOBIT select VIDEO_BTCX select VIDEO_TVEEPROM - depends on VIDEO_IR + depends on IR_CORE select VIDEOBUF_DVB select VIDEOBUF_DMA_SG select VIDEO_CX25840
drivers/staging/go7007/Kconfig +2 -2
@@ -1,9 +1,9 @@ config VIDEO_GO7007 tristate "WIS GO7007 MPEG encoder support" - depends on VIDEO_DEV && PCI && I2C && INPUT + depends on VIDEO_DEV && PCI && I2C depends on SND select VIDEOBUF_DMA_SG - depends on VIDEO_IR + depends on IR_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select SND_PCM
include/media/ir-common.h +0 -1
@@ -73,7 +73,6 @@ struct card_ir { };/* Routines from ir-functions.c */ -u32 ir_extract_bits (u32 data,u32 mask);void ir_rc5_timer_end (unsigned long data);#endif
include/media/ir-core.h +19 -0
@@ -212,4 +212,23 @@ static inline void ir_raw_event_reset(struct input_dev *input_dev) ir_raw_event_handle(input_dev); } + +/* extract mask bits out of data and pack them into the result */ +static inline u32 ir_extract_bits (u32 data,u32 mask) +{ +u32 vbit =1 , value =0 ; + +do { +if (mask &1 ) { +if (data &1 ) + value |= vbit; + vbit <<=1 ; + } + data >>=1 ; + }while (mask >>=1 ); + +return value; +} + +#endif /* _IR_CORE */
Re: [PATCH 4/7] ir-core: more cleanups of ir-functions.c
Quoted 10 lines · David Härdeman
cx88 only depends on
VIDEO_IRbecause it needsir_extract_bits(). Move that function toir-core.hand make it inline.Lots of drivers had dependencies on
VIDEO_IRwhen they really wantedIR_CORE.The only remaining drivers to depend on
VIDEO_IRare bt8xx and saa7134 (ir_rc5_timer_endis the only function exported by ir-functions).
Quoted 5 lines
Rename
VIDEO_IR->IR_LEGACYto give a hint to anyone writing or converting drivers toIR_COREthat they do not want a dependency onIR_LEGACY.Signed-off-by David Härdeman <[email protected]>
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 5/7 ir-core: merge and rename to rc-core
In reply to David HärdemanThis patch merges the files which makes up ir-core and renames the resulting module to rc-core. ir-raw-event.c is still kept as a separate file (but renamed to rc-raw.c) as suggested by Mauro.
--- drivers/media/IR/Makefile | 4 drivers/media/IR/ir-core-priv.h | 10 drivers/media/IR/ir-keytable.c | 764 ------------------------- drivers/media/IR/ir-raw-event.c | 382 ------------ drivers/media/IR/ir-sysfs.c | 362 ------------ drivers/media/IR/rc-main.c | 1198 +++++++++++++++++++++++++++++++++++++++ drivers/media/IR/rc-map.c | 107 --- drivers/media/IR/rc-raw.c | 382 ++++++++++++ include/media/ir-core.h | 2 9 files changed, 1582 insertions(+), 1629 deletions(-) delete mode 100644 drivers/media/IR/ir-keytable.c delete mode 100644 drivers/media/IR/ir-raw-event.c delete mode 100644 drivers/media/IR/ir-sysfs.c create mode 100644 drivers/media/IR/rc-main.c delete mode 100644 drivers/media/IR/rc-map.c create mode 100644 drivers/media/IR/rc-raw.c
drivers/media/IR/Makefile +2 -2
@@ -1,9 +1,9 @@ ir-common-objs := ir-functions.o -ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o +rc-core-objs := rc-main.o rc-raw.o obj-y += keymaps/ -obj-$(CONFIG_IR_CORE) += ir-core.o +obj-$(CONFIG_IR_CORE) += rc-core.o obj-$(CONFIG_IR_LEGACY) += ir-common.o obj-$(CONFIG_LIRC) += lirc_dev.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o
drivers/media/IR/ir-core-priv.h +0 -10
@@ -129,14 +129,6 @@ static inline bool is_timing_event(struct ir_raw_event ev)#define TO_US (duration) DIV_ROUND_CLOSEST((duration), 1000)#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space") -/* -* Routines from ir-sysfs.c - Meant to be called only internally inside -* ir-core -*/ -int ir_register_input (struct input_dev *input_dev); - -int ir_register_class (struct input_dev *input_dev); -void ir_unregister_class (struct input_dev *input_dev);/* * Routines from ir-raw-event.c to be used internally and by decoders
@@ -148,8 +140,6 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);void ir_raw_handler_unregister (struct ir_raw_handler *ir_raw_handler);void ir_raw_init (void ); -int ir_rcmap_init (void ); -void ir_rcmap_cleanup (void );/* * Decoder initialization code *
drivers/media/IR/ir-keytable.c deleted +0 -764
764 lines not on this page · raw message
drivers/media/IR/ir-raw-event.c deleted +0 -382
382 lines not on this page · raw message
drivers/media/IR/ir-sysfs.c deleted +0 -362
362 lines not on this page · raw message
drivers/media/IR/rc-main.c new file +1198 -0
1,198 lines not on this page · raw message
drivers/media/IR/rc-map.c deleted +0 -107
107 lines not on this page · raw message
drivers/media/IR/rc-raw.c new file +382 -0
154 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Re: [PATCH 5/7] ir-core: merge and rename to rc-core
Quoted 5 lines · David Härdeman
This patch merges the files which makes up ir-core and renames the resulting module to rc-core.
ir-raw-event.cis still kept as a separate file (but renamed torc-raw.c) as suggested by Mauro.Signed-off-by David Härdeman <[email protected]>
This also gets a...
...as I've tested the merged core w/mceusb, streamzap, imon and nuvoton-cir.
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 6/7 ir-core: make struct rc_dev the primary interface
In reply to David HärdemanThis 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()
--- drivers/media/IR/ene_ir.c | 129 +++--- drivers/media/IR/ene_ir.h | 3 drivers/media/IR/imon.c | 58 +-- drivers/media/IR/ir-core-priv.h | 16 - drivers/media/IR/ir-jvc-decoder.c | 13 - drivers/media/IR/ir-lirc-codec.c | 121 ++--- drivers/media/IR/ir-nec-decoder.c | 15 - drivers/media/IR/ir-rc5-decoder.c | 13 - drivers/media/IR/ir-rc5-sz-decoder.c | 13 - drivers/media/IR/ir-rc6-decoder.c | 17 - drivers/media/IR/ir-sony-decoder.c | 11 drivers/media/IR/mceusb.c | 105 ++--- drivers/media/IR/nuvoton-cir.c | 85 ++-- drivers/media/IR/nuvoton-cir.h | 3 drivers/media/IR/rc-main.c | 612 ++++++++++++--------------- drivers/media/IR/rc-raw.c | 191 ++++---- drivers/media/IR/streamzap.c | 66 +-- drivers/media/dvb/dm1105/dm1105.c | 42 +- drivers/media/dvb/dvb-usb/af9015.c | 16 - drivers/media/dvb/dvb-usb/anysee.c | 2 drivers/media/dvb/dvb-usb/dib0700.h | 2 drivers/media/dvb/dvb-usb/dib0700_core.c | 8 drivers/media/dvb/dvb-usb/dib0700_devices.c | 144 +++--- drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 77 ++- drivers/media/dvb/dvb-usb/dvb-usb.h | 12 - drivers/media/dvb/dvb-usb/lmedm04.c | 42 +- drivers/media/dvb/mantis/mantis_common.h | 4 drivers/media/dvb/mantis/mantis_input.c | 72 ++- drivers/media/dvb/siano/smscoreapi.c | 2 drivers/media/dvb/siano/smsir.c | 52 +- drivers/media/dvb/siano/smsir.h | 3 drivers/media/dvb/ttpci/budget-ci.c | 49 +- drivers/media/video/bt8xx/bttv-input.c | 41 +- drivers/media/video/cx23885/cx23885-input.c | 64 +-- drivers/media/video/cx23885/cx23885.h | 3 drivers/media/video/cx88/cx88-input.c | 96 ++-- drivers/media/video/em28xx/em28xx-input.c | 72 +-- drivers/media/video/ir-kbd-i2c.c | 25 + drivers/media/video/saa7134/saa7134-input.c | 72 +-- drivers/staging/tm6000/tm6000-input.c | 85 ++-- include/media/ir-common.h | 3 include/media/ir-core.h | 181 ++++---- include/media/ir-kbd-i2c.h | 3 43 files changed, 1213 insertions(+), 1430 deletions(-)
drivers/media/IR/ene_ir.c +60 -69
@@ -37,9 +37,7 @@#include <linux/interrupt.h> #include <linux/sched.h> #include <linux/slab.h> -#include <linux/input.h> #include <media/ir-core.h> -#include <media/ir-common.h> #include "ene_ir.h" static int sample_period;
@@ -357,7 +355,7 @@ void ene_rx_sense_carrier(struct ene_device *dev) ev.carrier_report = true; ev.carrier = carrier; ev.duty_cycle = duty_cycle; -ir_raw_event_store (dev->idev, &ev); +ir_raw_event_store (dev->rdev, &ev); } }
@@ -448,32 +446,32 @@ static void ene_rx_setup(struct ene_device *dev) select_timeout:if (dev->rx_fan_input_inuse) { - dev->props->rx_resolution =MS_TO_NS (ENE_FW_SAMPLE_PERIOD_FAN ); + dev->rdev->rx_resolution =MS_TO_NS (ENE_FW_SAMPLE_PERIOD_FAN );/* Fan input doesn't support timeouts, it just ends the input with a maximum sample */ - dev->props->min_timeout = dev->props->max_timeout = + dev->rdev->min_timeout = dev->rdev->max_timeout =MS_TO_NS (ENE_FW_SMPL_BUF_FAN_MSK *ENE_FW_SAMPLE_PERIOD_FAN ); }else { - dev->props->rx_resolution =MS_TO_NS (sample_period); + dev->rdev->rx_resolution =MS_TO_NS (sample_period);/* Theoreticly timeout is unlimited, but we cap it * because it was seen that on one device, it * would stop sending spaces after around 250 msec. * Besides, this is close to 2^32 anyway and timeout is u32. */ - dev->props->min_timeout =MS_TO_NS (127 * sample_period); - dev->props->max_timeout =MS_TO_NS (200000 ); + dev->rdev->min_timeout =MS_TO_NS (127 * sample_period); + dev->rdev->max_timeout =MS_TO_NS (200000 ); }if (dev->hw_learning_and_tx_capable) - dev->props->tx_resolution =MS_TO_NS (sample_period); + dev->rdev->tx_resolution =MS_TO_NS (sample_period); -if (dev->props->timeout > dev->props->max_timeout) - dev->props->timeout = dev->props->max_timeout; -if (dev->props->timeout < dev->props->min_timeout) - dev->props->timeout = dev->props->min_timeout; +if (dev->rdev->timeout > dev->rdev->max_timeout) + dev->rdev->timeout = dev->rdev->max_timeout; +if (dev->rdev->timeout < dev->rdev->min_timeout) + dev->rdev->timeout = dev->rdev->min_timeout; }/* Enable the device for receive */
@@ -504,7 +502,7 @@ static void ene_rx_enable(struct ene_device *dev)ene_set_reg_mask (dev,ENE_FW1 ,ENE_FW1_ENABLE |ENE_FW1_IRQ );/* enter idle mode */ -ir_raw_event_set_idle (dev->idev, true); +ir_raw_event_set_idle (dev->rdev, true); dev->rx_enabled = true; }
@@ -518,7 +516,7 @@ static void ene_rx_disable(struct ene_device *dev)/* disable hardware IRQ and firmware flag */ ene_clear_reg_mask (dev,ENE_FW1 ,ENE_FW1_ENABLE |ENE_FW1_IRQ ); -ir_raw_event_set_idle (dev->idev, true); +ir_raw_event_set_idle (dev->rdev, true); dev->rx_enabled = false; }
@@ -805,10 +803,10 @@ static irqreturn_t ene_isr(int irq, void *data) ev.duration =MS_TO_NS (hw_sample); ev.pulse = pulse; -ir_raw_event_store_with_filter (dev->idev, &ev); +ir_raw_event_store_with_filter (dev->rdev, &ev); } -ir_raw_event_handle (dev->idev); +ir_raw_event_handle (dev->rdev); unlock:spin_unlock_irqrestore (&dev->hw_lock, flags);return retval;
@@ -823,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev) dev->learning_mode_enabled = learning_mode_force;/* Set reasonable default timeout */ - dev->props->timeout =MS_TO_NS (150000 ); + dev->rdev->timeout =MS_TO_NS (150000 ); }/* Upload all hardware settings at once. Used at load and resume time */
@@ -838,9 +836,9 @@ static void ene_setup_hw_settings(struct ene_device *dev) }/* outside interface: called on first open*/ -static int ene_open (void *data) +static int ene_open (struct rc_dev *rdev) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;unsigned long flags;spin_lock_irqsave (&dev->hw_lock, flags);
@@ -850,9 +848,9 @@ static int ene_open(void *data) }/* outside interface: called on device close*/ -static void ene_close (void *data) +static void ene_close (struct rc_dev *rdev) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;unsigned long flags;spin_lock_irqsave (&dev->hw_lock, flags);
@@ -861,9 +859,9 @@ static void ene_close(void *data) }/* outside interface: set transmitter mask */ -static int ene_set_tx_mask (void *data,u32 tx_mask) +static int ene_set_tx_mask (struct rc_dev *rdev,u32 tx_mask) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;dbg ("TX: attempt to set transmitter mask %02x" , tx_mask);/* invalid txmask */
@@ -879,9 +877,9 @@ static int ene_set_tx_mask(void *data, u32 tx_mask) }/* outside interface : set tx carrier */ -static int ene_set_tx_carrier (void *data,u32 carrier) +static int ene_set_tx_carrier (struct rc_dev *rdev,u32 carrier) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;u32 period =2000000 / carrier;dbg ("TX: attempt to set tx carrier to %d kHz" , carrier);
@@ -900,9 +898,9 @@ static int ene_set_tx_carrier(void *data, u32 carrier) }/*outside interface : set tx duty cycle */ -static int ene_set_tx_duty_cycle (void *data,u32 duty_cycle) +static int ene_set_tx_duty_cycle (struct rc_dev *rdev,u32 duty_cycle) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;dbg ("TX: setting duty cycle to %d%%" , duty_cycle); dev->tx_duty_cycle = duty_cycle;ene_tx_set_carrier (dev);
@@ -910,9 +908,9 @@ static int ene_set_tx_duty_cycle(void *data, u32 duty_cycle) }/* outside interface: enable learning mode */ -static int ene_set_learning_mode (void *data,int enable) +static int ene_set_learning_mode (struct rc_dev *rdev,int enable) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;unsigned long flags;if (enable == dev->learning_mode_enabled)return 0 ;
@@ -926,9 +924,9 @@ static int ene_set_learning_mode(void *data, int enable)return 0 ; } -static int ene_set_carrier_report (void *data,int enable) +static int ene_set_carrier_report (struct rc_dev *rdev,int enable) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;unsigned long flags;if (enable == dev->carrier_detect_enabled)
@@ -944,18 +942,20 @@ static int ene_set_carrier_report(void *data, int enable) }/* outside interface: enable or disable idle mode */ -static void ene_set_idle (void *data,bool idle) +static void ene_set_idle (struct rc_dev *rdev,bool idle) { +struct ene_device *dev = rdev->priv; +if (idle) { -ene_rx_reset ((struct ene_device *)data); +ene_rx_reset (dev);dbg ("RX: end of data" ); } }/* outside interface: transmit */ -static int ene_transmit (void *data,int *buf,u32 n) +static int ene_transmit (struct rc_dev *rdev,int *buf,u32 n) { -struct ene_device *dev = (struct ene_device *)data; +struct ene_device *dev = rdev->priv;unsigned long flags; dev->tx_buffer = buf;
@@ -992,16 +992,13 @@ static int ene_transmit(void *data, int *buf, u32 n)static int ene_probe (struct pnp_dev *pnp_dev,const struct pnp_device_id *id) {int error = -ENOMEM ; -struct ir_dev_props *ir_props; -struct input_dev *input_dev; +struct rc_dev *rdev;struct ene_device *dev;/* allocate memory */ - input_dev =input_allocate_device (); - ir_props =kzalloc (sizeof (struct ir_dev_props ),GFP_KERNEL ); dev =kzalloc (sizeof (struct ene_device ),GFP_KERNEL ); - -if (!input_dev || !ir_props || !dev) + rdev =rc_allocate_device (); +if (!dev || !rdev) goto error1;/* validate resources */
@@ -1054,24 +1051,25 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)if (!dev->hw_learning_and_tx_capable) learning_mode_force = false; - ir_props->driver_type =RC_DRIVER_IR_RAW ; - ir_props->allowed_protos =IR_TYPE_ALL ; - ir_props->priv = dev; - ir_props->open = ene_open; - ir_props->close = ene_close; - ir_props->s_idle = ene_set_idle; - - dev->props = ir_props; - dev->idev = input_dev; + rdev->driver_type =RC_DRIVER_IR_RAW ; + rdev->allowed_protos =IR_TYPE_ALL ; + rdev->priv = dev; + rdev->open = ene_open; + rdev->close = ene_close; + rdev->s_idle = ene_set_idle; + rdev->driver_name =ENE_DRIVER_NAME ; + rdev->map_name =RC_MAP_RC6_MCE ; + rdev->input_name ="ENE eHome Infrared Remote Receiver" ;if (dev->hw_learning_and_tx_capable) { - ir_props->s_learning_mode = ene_set_learning_mode; + rdev->s_learning_mode = ene_set_learning_mode;init_completion (&dev->tx_complete); - ir_props->tx_ir = ene_transmit; - ir_props->s_tx_mask = ene_set_tx_mask; - ir_props->s_tx_carrier = ene_set_tx_carrier; - ir_props->s_tx_duty_cycle = ene_set_tx_duty_cycle; - ir_props->s_carrier_report = ene_set_carrier_report; + rdev->tx_ir = ene_transmit; + rdev->s_tx_mask = ene_set_tx_mask; + rdev->s_tx_carrier = ene_set_tx_carrier; + rdev->s_tx_duty_cycle = ene_set_tx_duty_cycle; + rdev->s_carrier_report = ene_set_carrier_report; + rdev->input_name ="ENE eHome Infrared Remote Transceiver" ; }ene_rx_setup_hw_buffer (dev);
@@ -1081,16 +1079,11 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)device_set_wakeup_capable (&pnp_dev->dev, true);device_set_wakeup_enable (&pnp_dev->dev, true); -if (dev->hw_learning_and_tx_capable) - input_dev->name ="ENE eHome Infrared Remote Transceiver" ; -else - input_dev->name ="ENE eHome Infrared Remote Receiver" ; - - error = -ENODEV ; -if (ir_input_register (input_dev,RC_MAP_RC6_MCE , ir_props, -ENE_DRIVER_NAME )) + error =rc_register_device (rdev); +if (error <0 ) goto error; + dev->rdev = rdev;ene_notice ("driver has been succesfully loaded" );return 0 ; error:
@@ -1099,8 +1092,7 @@ error:if (dev && dev->hw_io >=0 )release_region (dev->hw_io,ENE_IO_SIZE ); error1: -input_free_device (input_dev); -kfree (ir_props); +rc_free_device (rdev);kfree (dev);return error; }
@@ -1118,8 +1110,7 @@ static void ene_remove(struct pnp_dev *pnp_dev)free_irq (dev->irq, dev);release_region (dev->hw_io,ENE_IO_SIZE ); -ir_input_unregister (dev->idev); -kfree (dev->props); +rc_unregister_device (dev->rdev);kfree (dev); }
drivers/media/IR/ene_ir.h +1 -2
@@ -205,8 +205,7 @@struct ene_device {struct pnp_dev *pnp_dev; -struct input_dev *idev; -struct ir_dev_props *props; +struct rc_dev *rdev;/* hw IO settings */ long hw_io;
drivers/media/IR/imon.c +25 -33
132 lines not on this page · raw message
drivers/media/IR/ir-core-priv.h +8 -8
@@ -24,11 +24,11 @@ struct ir_raw_handler {struct list_head list;u64 protocols;/* which are handled by this handler */ -int (*decode)(struct input_dev *input_dev,struct ir_raw_event event); +int (*decode)(struct rc_dev *dev,struct ir_raw_event event);/* These two should only be used by the lirc decoder */ -int (*raw_register)(struct input_dev *input_dev); -int (*raw_unregister)(struct input_dev *input_dev); +int (*raw_register)(struct rc_dev *dev); +int (*raw_unregister)(struct rc_dev *dev); };struct ir_raw_event_ctrl {
@@ -38,7 +38,7 @@ struct ir_raw_event_ctrl {struct kfifo kfifo;/* fifo for the pulse/space durations */ ktime_t last_event;/* when last event occurred */ enum raw_event_type last_type;/* last event type */ -struct input_dev *input_dev;/* pointer to the parent input_dev */ +struct rc_dev *dev;/* pointer to the parent rc_dev */ u64 enabled_protocols;/* enabled raw protocol decoders */ /* raw decoder state follows */
@@ -85,7 +85,7 @@ struct ir_raw_event_ctrl {unsigned wanted_bits; } rc5_sz;struct lirc_codec { -struct ir_input_dev *ir_dev; +struct rc_dev *dev;struct lirc_driver *drv;int carrier_low;
@@ -131,11 +131,11 @@ static inline bool is_timing_event(struct ir_raw_event ev)#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space")/* -* Routines from ir-raw-event.c to be used internally and by decoders +* Routines from rc-raw.c to be used internally and by decoders */ u64 ir_raw_get_allowed_protocols (void ); -int ir_raw_event_register (struct input_dev *input_dev); -void ir_raw_event_unregister (struct input_dev *input_dev); +int ir_raw_event_register (struct rc_dev *dev); +void ir_raw_event_unregister (struct rc_dev *dev);int ir_raw_handler_register (struct ir_raw_handler *ir_raw_handler);void ir_raw_handler_unregister (struct ir_raw_handler *ir_raw_handler);void ir_raw_init (void );
drivers/media/IR/ir-jvc-decoder.c +6 -7
@@ -37,17 +37,16 @@ enum jvc_state {/** * ir_jvc_decode() - Decode one JVC pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @duration: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_jvc_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_jvc_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct jvc_dec *data = &ir_dev->raw->jvc; +struct jvc_dec *data = &dev->raw->jvc; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_JVC )) +if (!(dev->raw->enabled_protocols &IR_TYPE_JVC ))return 0 ;if (!is_timing_event (ev)) {
@@ -140,12 +139,12 @@ again: scancode = (bitrev8 ((data->bits >>8 ) &0xff ) <<8 ) | (bitrev8 ((data->bits >>0 ) &0xff ) <<0 );IR_dprintk (1 ,"JVC scancode 0x%04x\n" , scancode); -ir_keydown (input_dev, scancode, data->toggle); +ir_keydown (dev, scancode, data->toggle); data->first = false; data->old_bits = data->bits; }else if (data->bits == data->old_bits) {IR_dprintk (1 ,"JVC repeat\n" ); -ir_repeat (input_dev); +ir_repeat (dev); }else {IR_dprintk (1 ,"JVC invalid repeat msg\n" );break ;
drivers/media/IR/ir-lirc-codec.c +56 -65
290 lines not on this page · raw message
drivers/media/IR/ir-nec-decoder.c +7 -8
@@ -39,19 +39,18 @@ enum nec_state {/** * ir_nec_decode() - Decode one NEC pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @duration: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_nec_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_nec_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct nec_dec *data = &ir_dev->raw->nec; +struct nec_dec *data = &dev->raw->nec;u32 scancode;u8 address, not_address, command, not_command; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_NEC )) +if (!(dev->raw->enabled_protocols &IR_TYPE_NEC ))return 0 ;if (!is_timing_event (ev)) {
@@ -89,7 +88,7 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) data->state =STATE_BIT_PULSE ;return 0 ; }else if (eq_margin (ev.duration,NEC_REPEAT_SPACE ,NEC_UNIT /2 )) { -ir_repeat (input_dev); +ir_repeat (dev);IR_dprintk (1 ,"Repeat last key\n" ); data->state =STATE_TRAILER_PULSE ;return 0 ;
@@ -115,7 +114,7 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) geq_margin(ev.duration, NEC_TRAILER_SPACE, NEC_UNIT / 2)) {IR_dprintk (1 ,"Repeat last key\n" ); -ir_repeat (input_dev); +ir_repeat (dev); data->state =STATE_INACTIVE ;return 0 ;
@@ -179,7 +178,7 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (data->is_nec_x) data->necx_repeat = true; -ir_keydown (input_dev, scancode,0 ); +ir_keydown (dev, scancode,0 ); data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-rc5-decoder.c +6 -7
@@ -40,19 +40,18 @@ enum rc5_state {/** * ir_rc5_decode() - Decode one RC-5 pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_rc5_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_rc5_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct rc5_dec *data = &ir_dev->raw->rc5; +struct rc5_dec *data = &dev->raw->rc5;u8 toggle;u32 scancode; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC5 )) +if (!(dev->raw->enabled_protocols &IR_TYPE_RC5 ))return 0 ;if (!is_timing_event (ev)) {
@@ -96,7 +95,7 @@ again:return 0 ;case STATE_BIT_END : -if (!is_transition (&ev, &ir_dev->raw->prev_ev)) +if (!is_transition (&ev, &dev->raw->prev_ev))break ;if (data->count == data->wanted_bits)
@@ -151,7 +150,7 @@ again: scancode, toggle); } -ir_keydown (input_dev, scancode, toggle); +ir_keydown (dev, scancode, toggle); data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-rc5-sz-decoder.c +6 -7
@@ -36,19 +36,18 @@ enum rc5_sz_state {/** * ir_rc5_sz_decode() - Decode one RC-5 Streamzap pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_rc5_sz_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_rc5_sz_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct rc5_sz_dec *data = &ir_dev->raw->rc5_sz; +struct rc5_sz_dec *data = &dev->raw->rc5_sz;u8 toggle, command, system;u32 scancode; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC5_SZ )) +if (!(dev->raw->enabled_protocols &IR_TYPE_RC5_SZ ))return 0 ;if (!is_timing_event (ev)) {
@@ -91,7 +90,7 @@ again:return 0 ;case STATE_BIT_END : -if (!is_transition (&ev, &ir_dev->raw->prev_ev)) +if (!is_transition (&ev, &dev->raw->prev_ev))break ;if (data->count == data->wanted_bits)
@@ -115,7 +114,7 @@ again:IR_dprintk (1 ,"RC5-sz scancode 0x%04x (toggle: %u)\n" , scancode, toggle); -ir_keydown (input_dev, scancode, toggle); +ir_keydown (dev, scancode, toggle); data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-rc6-decoder.c +8 -9
@@ -70,19 +70,18 @@ static enum rc6_mode rc6_mode(struct rc6_dec *data)/** * ir_rc6_decode() - Decode one RC6 pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_rc6_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_rc6_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct rc6_dec *data = &ir_dev->raw->rc6; +struct rc6_dec *data = &dev->raw->rc6;u32 scancode;u8 toggle; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC6 )) +if (!(dev->raw->enabled_protocols &IR_TYPE_RC6 ))return 0 ;if (!is_timing_event (ev)) {
@@ -139,7 +138,7 @@ again:return 0 ;case STATE_HEADER_BIT_END : -if (!is_transition (&ev, &ir_dev->raw->prev_ev)) +if (!is_transition (&ev, &dev->raw->prev_ev))break ;if (data->count ==RC6_HEADER_NBITS )
@@ -159,7 +158,7 @@ again:return 0 ;case STATE_TOGGLE_END : -if (!is_transition (&ev, &ir_dev->raw->prev_ev) || +if (!is_transition (&ev, &dev->raw->prev_ev) || !geq_margin (ev.duration,RC6_TOGGLE_END ,RC6_UNIT /2 ))break ;
@@ -204,7 +203,7 @@ again:return 0 ;case STATE_BODY_BIT_END : -if (!is_transition (&ev, &ir_dev->raw->prev_ev)) +if (!is_transition (&ev, &dev->raw->prev_ev))break ;if (data->count == data->wanted_bits)
@@ -243,7 +242,7 @@ again: goto out; } -ir_keydown (input_dev, scancode, toggle); +ir_keydown (dev, scancode, toggle); data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-sony-decoder.c +5 -6
@@ -33,19 +33,18 @@ enum sony_state {/** * ir_sony_decode() - Decode one Sony pulse or space -* @input_dev: the struct input_dev descriptor of the device +* @dev: the struct rc_dev descriptor of the device * @ev: the struct ir_raw_event descriptor of the pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_sony_decode (struct input_dev *input_dev,struct ir_raw_event ev) +static int ir_sony_decode (struct rc_dev *dev,struct ir_raw_event ev) { -struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); -struct sony_dec *data = &ir_dev->raw->sony; +struct sony_dec *data = &dev->raw->sony;u32 scancode;u8 device, subdevice, function; -if (!(ir_dev->raw->enabled_protocols &IR_TYPE_SONY )) +if (!(dev->raw->enabled_protocols &IR_TYPE_SONY ))return 0 ;if (!is_timing_event (ev)) {
@@ -144,7 +143,7 @@ static int ir_sony_decode(struct input_dev *input_dev, struct ir_raw_event ev) scancode = device <<16 | subdevice <<8 | function;IR_dprintk (1 ,"Sony(%u) scancode 0x%05x\n" , data->count, scancode); -ir_keydown (input_dev, scancode,0 ); +ir_keydown (dev, scancode,0 ); data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/mceusb.c +43 -62
201 lines not on this page · raw message
drivers/media/IR/nuvoton-cir.c +37 -48
159 lines not on this page · raw message
drivers/media/IR/nuvoton-cir.h +1 -2
@@ -66,8 +66,7 @@ static int debug;struct nvt_dev {struct pnp_dev *pdev; -struct input_dev *rdev; -struct ir_dev_props *props; +struct rc_dev *rdev;struct ir_raw_event rawir;spinlock_t nvt_lock;
drivers/media/IR/rc-main.c +274 -338
996 lines not on this page · raw message
drivers/media/IR/rc-raw.c +90 -101
345 lines not on this page · raw message
drivers/media/IR/streamzap.c +26 -40
137 lines not on this page · raw message
drivers/media/dvb/dm1105/dm1105.c +21 -21
88 lines not on this page · raw message
drivers/media/dvb/dvb-usb/af9015.c +5 -11
@@ -1041,13 +1041,13 @@ static int af9015_rc_query(struct dvb_usb_device *d) priv->rc_keycode = buf[12 ] <<16 | buf[13 ] <<8 | buf[14 ]; } -ir_keydown (d->rc_input_dev, priv->rc_keycode,0 ); +ir_keydown (d->rc_dev, priv->rc_keycode,0 ); }else { priv->rc_keycode =0 ;/* clear just for sure */ } }else if (priv->rc_repeat != buf[6 ] || buf[0 ]) {deb_rc ("%s: key repeated\n" , __func__); -ir_keydown (d->rc_input_dev, priv->rc_keycode,0 ); +ir_keydown (d->rc_dev, priv->rc_keycode,0 ); }else {deb_rc ("%s: no key press\n" , __func__); }
@@ -1348,9 +1348,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .rc_props = { - .allowed_protos = IR_TYPE_NEC, - }, + .allowed_protos = IR_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo,
@@ -1478,9 +1476,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .rc_props = { - .allowed_protos = IR_TYPE_NEC, - }, + .allowed_protos = IR_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo,
@@ -1592,9 +1588,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .rc_props = { - .allowed_protos = IR_TYPE_NEC, - }, + .allowed_protos = IR_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo,
drivers/media/dvb/dvb-usb/anysee.c +1 -1
@@ -394,7 +394,7 @@ static int anysee_rc_query(struct dvb_usb_device *d)if (ircode[0 ]) {deb_rc ("%s: key pressed %02x\n" , __func__, ircode[1 ]); -ir_keydown (d->rc_input_dev,0x08 <<8 | ircode[1 ],0 ); +ir_keydown (d->rc_dev,0x08 <<8 | ircode[1 ],0 ); }
Lines of this file are not shown. View the raw message.
drivers/media/dvb/dvb-usb/dib0700_core.c +4 -4
Lines of this file are not shown. View the raw message.
drivers/media/dvb/dvb-usb/dib0700_devices.c +58 -86
144 lines not on this page · raw message
drivers/media/dvb/dvb-usb/dvb-usb-remote.c +46 -31
77 lines not on this page · raw message
drivers/media/dvb/dvb-usb/lmedm04.c +20 -22
42 lines not on this page · raw message
drivers/media/dvb/mantis/mantis_common.h +3 -1
Lines of this file are not shown. View the raw message.
drivers/media/dvb/mantis/mantis_input.c +42 -30
72 lines not on this page · raw message
drivers/media/dvb/siano/smsir.c +27 -25
52 lines not on this page · raw message
drivers/media/dvb/ttpci/budget-ci.c +22 -27
49 lines not on this page · raw message
drivers/media/video/bt8xx/bttv-input.c +18 -23
41 lines not on this page · raw message
drivers/media/video/cx23885/cx23885-input.c +30 -34
64 lines not on this page · raw message
drivers/media/video/cx88/cx88-input.c +47 -49
96 lines not on this page · raw message
drivers/media/video/em28xx/em28xx-input.c +33 -39
72 lines not on this page · raw message
drivers/media/video/saa7134/saa7134-input.c +30 -42
72 lines not on this page · raw message
drivers/staging/tm6000/tm6000-input.c +39 -46
85 lines not on this page · raw message
include/media/ir-core.h +80 -101
181 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Re: [PATCH 6/7] ir-core: make struct rc_dev the primary interface
Quoted 8 lines · David Härdeman
This patch merges the
ir_input_devandir_dev_propsstructs into a single struct calledrc_dev. The drivers and various functions in rc-core used by the drivers are also changed to userc_devas the primary interface when dealing with rc-core.This means that the
input_devis abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device.
Quoted 7 lines
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()Signed-off-by David Härdeman <[email protected]>
Tested mceusb, streamzap, imon and nuvonton-cir.
Signature · 2 lines
Jarod Wilson [email protected]
Re: [PATCH 6/7] ir-core: make struct rc_dev the primary interface
In reply to David HärdemanEm 29-10-2010 17:08, David Härdeman escreveu:
Quoted 5 lines
This patch merges the
ir_input_devandir_dev_propsstructs into a single struct calledrc_dev. The drivers and various functions in rc-core used by the drivers are also changed to userc_devas the primary interface when dealing with rc-core.
Quoted 9 lines
This means that the
input_devis 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()
David,
Quoted 1 line
(quoted diff) +1
-0+ struct rc_dev *rdev;
...
drivers/media/IR/ir-core-priv.h struct ir_raw_event_ctrl {
Quoted 3 lines
drivers/media/IR/ir-core-priv.h +2
-0+struct rc_dev *dev;/* pointer to the parent rc_dev */ +struct rc_dev *rc;
A quick comment: try to call this struct with the same name on all places, avoiding to call it as just "dev". It makes harder to understand the code, especially on complex devices that have several types of dev's. The better is to always call it as "rc_dev".
Cheers,
Mauro
Re: [PATCH 6/7] ir-core: make struct rc_dev the primary interface
Quoted 2 lines · Mauro Carvalho Chehab
Em 29-10-2010 17:08, David Härdeman escreveu:
Quoted 1 line
This patch merges the
ir_input_devandir_dev_propsstructs into a
single
Quoted 18 lines
Quoted 8 lines
struct called
rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to userc_devas the primary interface when dealing with rc-core.This means that the
input_devis abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device.Quoted 6 lines
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()David,
Quoted 8 lines
Quoted 1 line
(quoted diff) +1
-0+ struct rc_dev *rdev;...
drivers/media/IR/ir-core-priv.h struct ir_raw_event_ctrl {
Quoted 3 lines
drivers/media/IR/ir-core-priv.h +2
-0+struct rc_dev *dev;/* pointer to the parent rc_dev */ +struct rc_dev *rc;A quick comment: try to call this struct with the same name on all
places,
Quoted 1 line
avoiding to call it as just "dev". It makes harder to understand the
code,
Quoted 1 line
especially on complex devices that have several types of dev's. The
better
Quoted 1 line
is to always call it as "
rc_dev".
Fair enough. I can fix that in a separate patch, or in a respin of my original patch. But first I need to know what I should base a new patch on...I'm confused by now
Signature · 1 line
David Härdeman
PATCH 7/7 rc-core: convert winbond-cir
In reply to David HärdemanMove winbond-cir from drivers/input/misc/ into drivers/media/IR/ and convert it to use rc-core.
--- drivers/input/misc/Kconfig | 18 drivers/input/misc/Makefile | 1 drivers/input/misc/winbond-cir.c | 1608 -------------------------------------- drivers/media/IR/Kconfig | 17 drivers/media/IR/Makefile | 1 drivers/media/IR/winbond-cir.c | 934 ++++++++++++++++++++++ 6 files changed, 952 insertions(+), 1627 deletions(-) delete mode 100644 drivers/input/misc/winbond-cir.c create mode 100644 drivers/media/IR/winbond-cir.c
drivers/input/misc/Kconfig +0 -18
@@ -284,24 +284,6 @@ config INPUT_SGI_BTNS To compile this driver as a module, choose M here: the module will be called sgi_btns. -config INPUT_WINBOND_CIR - tristate "Winbond IR remote control" - depends on X86 && PNP - select NEW_LEDS - select LEDS_CLASS - select LEDS_TRIGGERS - select BITREVERSE - help - Say Y here if you want to use the IR remote functionality found - in some Winbond SuperI/O chips. Currently only the WPCD376I - chip is supported (included in some Intel Media series motherboards). - - IR Receive and wake-on-IR from suspend and power-off is currently - supported. - - To compile this driver as a module, choose M here: the module will be - called winbond_cir. - config HP_SDC_RTC tristate "HP SDC Real Time Clock" depends on (GSC || HP300) && SERIO
drivers/input/misc/Makefile +0 -1
@@ -37,7 +37,6 @@ obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o -obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o
drivers/input/misc/winbond-cir.c deleted +0 -1608
1,608 lines not on this page · raw message
drivers/media/IR/Kconfig +17 -0
@@ -164,4 +164,21 @@ config IR_STREAMZAP To compile this driver as a module, choose M here: the module will be called streamzap. +config IR_WINBOND_CIR + tristate "Winbond IR remote control" + depends on X86 && PNP + depends on IR_CORE + select NEW_LEDS + select LEDS_CLASS + select LEDS_TRIGGERS + select BITREVERSE + ---help--- + Say Y here if you want to use the IR remote functionality found + in some Winbond SuperI/O chips. Currently only the WPCD376I + chip is supported (included in some Intel Media series + motherboards). + + To compile this driver as a module, choose M here: the module will + be called winbond_cir. + endif #IR_CORE
drivers/media/IR/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_IR_MCEUSB) += mceusb.o obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o obj-$(CONFIG_IR_ENE) += ene_ir.o obj-$(CONFIG_IR_STREAMZAP) += streamzap.o +obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o
drivers/media/IR/winbond-cir.c new file +934 -0
934 lines not on this page · raw message
Re: [PATCH 7/7] rc-core: convert winbond-cir
Quoted 4 lines · David Härdeman
Move winbond-cir from
drivers/input/misc/intodrivers/media/IR/and convert it to use rc-core.Signed-off-by David Härdeman <[email protected]>
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 8 lines · David Härdeman
This is my current patch queue, the main change is to make struct
rc_devthe primary interface for rc drivers and to abstract away the fact that there's an input device lurking in there somewhere. The patchset has been updated to apply on top of the staging/for_v2.6.37-rc1 branch of themedia_treegit repo.In addition, the cx88 and winbond-cir drivers are converted to use rc-core.
Quoted 8 lines
The first patch (which is not to be merged) just merges the large scancodes patches for the input subsystem to make sure that merging my patches upstream will be doable post -rc1 (the input patches are already merged upstream).
Given the changes, these patches touch every single driver. Obviously I haven't tested them all due to a lack of hardware (I have made sure that all drivers compile without any warnings and I have tested the end result on mceusb and winbond-cir hardware).
You can definitely sign me up for imon, streamzap and nuvoton-cir testing, and for sanity's sake, I can also verify multiple generations of mceusb devices. I'll see what I can get done on that front this weekend...
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 5 lines · David Härdeman
This is my current patch queue, the main change is to make struct
rc_devthe primary interface for rc drivers and to abstract away the fact that there's an input device lurking in there somewhere. The patchset has been updated to apply on top of the staging/for_v2.6.37-rc1 branch of themedia_treegit repo.
And 2.6.37-rc1 is now released with the large scancode support as well as two bugfixes to that code. Could I please get some indication on the status of my patches? Last time I heard anything it was that they should go in after 2.6.37-rc1. Having to keep on rebasing them is a pain in the ass.
Signature · 1 line
David Härdeman