From 00df055ae315c9c8792dc4d012e6ad9c4d527e87 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Fri, 29 Oct 2010 11:31:39 -0300 Subject: [media] radio-si4713: Add regulator framework support Convert the driver to use regulator framework instead of set_power callback. This with gpio_reset platform data provide cleaner way to manage chip VIO, VDD and reset signal inside the driver. Signed-off-by: Jarkko Nikula Cc: Eduardo Valentin Signed-off-by: Mauro Carvalho Chehab --- include/media/si4713.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/si4713.h b/include/media/si4713.h index 99850a54ed09..ed7353e8a982 100644 --- a/include/media/si4713.h +++ b/include/media/si4713.h @@ -23,8 +23,7 @@ * Platform dependent definition */ struct si4713_platform_data { - /* Set power state, zero is off, non-zero is on. */ - int (*set_power)(int power); + int gpio_reset; /* < 0 if not used */ }; /* -- cgit v1.2.3 From 2997137be8eba5bf9c07a24d5fda1f4225f9ca7d Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 29 Oct 2010 16:08:02 -0300 Subject: [media] ir-core: convert drivers/media/video/cx88 to ir-core 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_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 for testing my patches (about one a day for two weeks!) on actual hardware. Signed-off-by: David Härdeman Acked-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- 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(-) (limited to 'include') diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c index db591e421887..f4c411535f3d 100644 --- a/drivers/media/IR/ir-functions.c +++ b/drivers/media/IR/ir-functions.c @@ -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 */ diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 0fa85cbefbb1..bcfd1ac48cc6 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -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 diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index fc777bc6e716..436ace8196a5 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -41,7 +41,6 @@ struct cx88_IR { struct cx88_core *core; struct input_dev *input; struct ir_dev_props props; - u64 ir_type; int users; @@ -50,8 +49,6 @@ struct cx88_IR { /* sample from gpio pin 16 */ u32 sampling; - u32 samples[16]; - int scount; /* poll external decoder */ int polling; @@ -63,6 +60,10 @@ struct cx88_IR { u32 mask_keyup; }; +static unsigned ir_samplerate = 4; +module_param(ir_samplerate, uint, 0444); +MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4"); + static int ir_debug; module_param(ir_debug, int, 0644); /* debug level [IR] */ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); @@ -176,8 +177,8 @@ static int __cx88_ir_start(void *priv) } if (ir->sampling) { core->pci_irqmask |= PCI_INT_IR_SMPINT; - cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ - cx_write(MO_DDSCFG_IO, 0x5); /* enable */ + cx_write(MO_DDS_IO, 0x33F286 * ir_samplerate); /* samplerate */ + cx_write(MO_DDSCFG_IO, 0x5); /* enable */ } return 0; } @@ -264,7 +265,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: ir_codes = RC_MAP_CINERGY_1400; - ir_type = IR_TYPE_NEC; ir->sampling = 0xeb04; /* address */ break; case CX88_BOARD_HAUPPAUGE: @@ -279,7 +279,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PCHDTV_HD5500: case CX88_BOARD_HAUPPAUGE_IRONLY: ir_codes = RC_MAP_HAUPPAUGE_NEW; - ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_WINFAST_DTV2000H: @@ -367,18 +366,15 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PROF_7301: case CX88_BOARD_PROF_6200: ir_codes = RC_MAP_TBS_NEC; - ir_type = IR_TYPE_NEC; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_TEVII_S460: case CX88_BOARD_TEVII_S420: ir_codes = RC_MAP_TEVII_NEC; - ir_type = IR_TYPE_NEC; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: ir_codes = RC_MAP_DNTV_LIVE_DVBT_PRO; - ir_type = IR_TYPE_NEC; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_NORWOOD_MICRO: @@ -396,7 +392,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PINNACLE_PCTV_HD_800i: ir_codes = RC_MAP_PINNACLE_PCTV_HD; - ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_POWERCOLOR_REAL_ANGEL: @@ -412,7 +407,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; } - if (NULL == ir_codes) { + if (!ir_codes) { err = -ENODEV; goto err_out_free; } @@ -436,8 +431,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); - ir->ir_type = ir_type; - input_dev->name = ir->name; input_dev->phys = ir->phys; input_dev->id.bustype = BUS_PCI; @@ -454,10 +447,18 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->core = core; core->ir = ir; + if (ir->sampling) { + ir_type = IR_TYPE_ALL; + ir->props.driver_type = RC_DRIVER_IR_RAW; + ir->props.timeout = 10 * 1000 * 1000; /* 10 ms */ + } else + ir->props.driver_type = RC_DRIVER_SCANCODE; + ir->props.priv = core; ir->props.open = cx88_ir_open; ir->props.close = cx88_ir_close; ir->props.scanmask = hardware_mask; + ir->props.allowed_protos = ir_type; /* all done */ err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); @@ -494,128 +495,36 @@ int cx88_ir_fini(struct cx88_core *core) void cx88_ir_irq(struct cx88_core *core) { struct cx88_IR *ir = core->ir; - u32 samples, ircode; - int i, start, range, toggle, dev, code; + u32 samples; + unsigned todo, bits; + struct ir_raw_event ev; + struct ir_input_dev *irdev; - if (NULL == ir) - return; - if (!ir->sampling) + if (!ir || !ir->sampling) return; + /* + * Samples are stored in a 32 bit register, oldest sample in + * the msb. A set bit represents space and an unset bit + * represents a pulse. + */ samples = cx_read(MO_SAMPLE_IO); - if (0 != samples && 0xffffffff != samples) { - /* record sample data */ - if (ir->scount < ARRAY_SIZE(ir->samples)) - ir->samples[ir->scount++] = samples; - return; - } - if (!ir->scount) { - /* nothing to sample */ - return; - } - - /* have a complete sample */ - if (ir->scount < ARRAY_SIZE(ir->samples)) - ir->samples[ir->scount++] = samples; - for (i = 0; i < ir->scount; i++) - ir->samples[i] = ~ir->samples[i]; - if (ir_debug) - ir_dump_samples(ir->samples, ir->scount); - - /* decode it */ - switch (core->boardnr) { - case CX88_BOARD_TEVII_S460: - case CX88_BOARD_TEVII_S420: - case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: - case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: - case CX88_BOARD_OMICOM_SS4_PCI: - case CX88_BOARD_SATTRADE_ST4200: - case CX88_BOARD_TBS_8920: - case CX88_BOARD_TBS_8910: - case CX88_BOARD_PROF_7300: - case CX88_BOARD_PROF_7301: - case CX88_BOARD_PROF_6200: - case CX88_BOARD_TWINHAN_VP1027_DVBS: - ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); - - if (ircode == 0xffffffff) { /* decoding error */ - ir_dprintk("pulse distance decoding error\n"); - break; - } - - ir_dprintk("pulse distance decoded: %x\n", ircode); + irdev = input_get_drvdata(ir->input); - if (ircode == 0) { /* key still pressed */ - ir_dprintk("pulse distance decoded repeat code\n"); - ir_repeat(ir->input); - break; - } - - if ((ircode & 0xffff) != (ir->sampling & 0xffff)) { /* wrong address */ - ir_dprintk("pulse distance decoded wrong address\n"); - break; - } - - if (((~ircode >> 24) & 0xff) != ((ircode >> 16) & 0xff)) { /* wrong checksum */ - ir_dprintk("pulse distance decoded wrong check sum\n"); - break; - } + if (samples == 0xff && irdev->idle) + return; - ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0xff); - ir_keydown(ir->input, (ircode >> 16) & 0xff, 0); - break; - case CX88_BOARD_HAUPPAUGE: - case CX88_BOARD_HAUPPAUGE_DVB_T1: - case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: - case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: - case CX88_BOARD_HAUPPAUGE_HVR1100: - case CX88_BOARD_HAUPPAUGE_HVR3000: - case CX88_BOARD_HAUPPAUGE_HVR4000: - case CX88_BOARD_HAUPPAUGE_HVR4000LITE: - case CX88_BOARD_PCHDTV_HD3000: - case CX88_BOARD_PCHDTV_HD5500: - case CX88_BOARD_HAUPPAUGE_IRONLY: - ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); - ir_dprintk("biphase decoded: %x\n", ircode); - /* - * RC5 has an extension bit which adds a new range - * of available codes, this is detected here. Also - * hauppauge remotes (black/silver) always use - * specific device ids. If we do not filter the - * device ids then messages destined for devices - * such as TVs (id=0) will get through to the - * device causing mis-fired events. - */ - /* split rc5 data block ... */ - start = (ircode & 0x2000) >> 13; - range = (ircode & 0x1000) >> 12; - toggle= (ircode & 0x0800) >> 11; - dev = (ircode & 0x07c0) >> 6; - code = (ircode & 0x003f) | ((range << 6) ^ 0x0040); - if( start != 1) - /* no key pressed */ - break; - if ( dev != 0x1e && dev != 0x1f ) - /* not a hauppauge remote */ - break; - ir_keydown(ir->input, code, toggle); - break; - case CX88_BOARD_PINNACLE_PCTV_HD_800i: - ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); - ir_dprintk("biphase decoded: %x\n", ircode); - if ((ircode & 0xfffff000) != 0x3000) - break; - /* Note: bit 0x800 being the toggle is assumed, not checked - with real hardware */ - ir_keydown(ir->input, ircode & 0x3f, ircode & 0x0800 ? 1 : 0); - break; + init_ir_raw_event(&ev); + for (todo = 32; todo > 0; todo -= bits) { + ev.pulse = samples & 0x80000000 ? false : true; + bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); + ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); + ir_raw_event_store_with_filter(ir->input, &ev); + samples <<= bits; } - - ir->scount = 0; - return; + ir_raw_event_handle(ir->input); } - void cx88_i2c_init_ir(struct cx88_core *core) { struct i2c_board_info info; diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 528050e39ad9..415242047b6a 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -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); -- cgit v1.2.3 From 62c6503125389763a74911408d984c5dd09eeb97 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 29 Oct 2010 16:08:07 -0300 Subject: [media] ir-core: remove remaining users of the ir-functions keyhandlers This 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. Signed-off-by: David Härdeman Acked-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- 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(-) (limited to 'include') diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c index bc118066bc38..79f4f58c2ea4 100644 --- a/drivers/media/IR/imon.c +++ b/drivers/media/IR/imon.c @@ -1479,17 +1479,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; @@ -1570,9 +1565,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); diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c index f4c411535f3d..fca734c43e8d 100644 --- a/drivers/media/IR/ir-functions.c +++ b/drivers/media/IR/ir-functions.c @@ -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 [SuSE Labs] * @@ -31,67 +31,6 @@ MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); -static int repeat = 1; -module_param(repeat, int, 0444); -MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)"); - -/* -------------------------------------------------------------------------- */ - -static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) -{ - if (KEY_RESERVED == ir->keycode) { - printk(KERN_INFO "%s: unknown key: key=0x%02x down=%d\n", - dev->name, ir->ir_key, ir->keypressed); - return; - } - IR_dprintk(1,"%s: key event code=%d down=%d\n", - dev->name,ir->keycode,ir->keypressed); - input_report_key(dev,ir->keycode,ir->keypressed); - input_sync(dev); -} - -/* -------------------------------------------------------------------------- */ - -int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, - const u64 ir_type) -{ - ir->ir_type = ir_type; - - if (repeat) - set_bit(EV_REP, dev->evbit); - - return 0; -} -EXPORT_SYMBOL_GPL(ir_input_init); - - -void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir) -{ - if (ir->keypressed) { - ir->keypressed = 0; - ir_input_key_event(dev,ir); - } -} -EXPORT_SYMBOL_GPL(ir_input_nokey); - -void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, - u32 ir_key) -{ - u32 keycode = ir_g_keycode_from_table(dev, ir_key); - - if (ir->keypressed && ir->keycode != keycode) { - ir->keypressed = 0; - ir_input_key_event(dev,ir); - } - if (!ir->keypressed) { - ir->ir_key = ir_key; - ir->keycode = keycode; - ir->keypressed = 1; - ir_input_key_event(dev,ir); - } -} -EXPORT_SYMBOL_GPL(ir_input_keydown); - /* -------------------------------------------------------------------------- */ /* extract mask bits out of data and pack them into the result */ u32 ir_extract_bits(u32 data, u32 mask) @@ -115,7 +54,7 @@ EXPORT_SYMBOL_GPL(ir_extract_bits); * saa7134 */ /* decode raw bit pattern to RC5 code */ -u32 ir_rc5_decode(unsigned int code) +static u32 ir_rc5_decode(unsigned int code) { unsigned int org_code = code; unsigned int pair; @@ -144,13 +83,12 @@ u32 ir_rc5_decode(unsigned int code) RC5_TOGGLE(rc5), RC5_ADDR(rc5), RC5_INSTR(rc5)); return rc5; } -EXPORT_SYMBOL_GPL(ir_rc5_decode); void ir_rc5_timer_end(unsigned long data) { struct card_ir *ir = (struct card_ir *)data; struct timeval tv; - unsigned long current_jiffies, timeout; + unsigned long current_jiffies; u32 gap; u32 rc5 = 0; @@ -191,32 +129,11 @@ void ir_rc5_timer_end(unsigned long data) u32 toggle = RC5_TOGGLE(rc5); u32 instr = RC5_INSTR(rc5); - /* Good code, decide if repeat/repress */ - if (toggle != RC5_TOGGLE(ir->last_rc5) || - instr != RC5_INSTR(ir->last_rc5)) { - IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr, - toggle); - ir_input_nokey(ir->dev, &ir->ir); - ir_input_keydown(ir->dev, &ir->ir, instr); - } - - /* Set/reset key-up timer */ - timeout = current_jiffies + - msecs_to_jiffies(ir->rc5_key_timeout); - mod_timer(&ir->timer_keyup, timeout); - - /* Save code for repeat test */ - ir->last_rc5 = rc5; + /* Good code */ + ir_keydown(ir->dev, instr, toggle); + IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", + instr, toggle); } } } EXPORT_SYMBOL_GPL(ir_rc5_timer_end); - -void ir_rc5_timer_keyup(unsigned long data) -{ - struct card_ir *ir = (struct card_ir *)data; - - IR_dprintk(1, "ir-common: key released\n"); - ir_input_nokey(ir->dev, &ir->ir); -} -EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup); diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index f60107c3b091..8039110350d3 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -431,13 +431,13 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); /** - * ir_keyup() - generates input event to cleanup a key press + * ir_do_keyup() - internal function to signal the release of a keypress * @ir: the struct ir_input_dev descriptor of the device * - * This routine is used to signal that a key has been released on the - * remote control. It reports a keyup input event via input_report_key(). + * This function is used internally to release a keypress, it must be + * called with keylock held. */ -void ir_keyup(struct ir_input_dev *ir) +static void ir_do_keyup(struct ir_input_dev *ir) { if (!ir->keypressed) return; @@ -447,6 +447,23 @@ void ir_keyup(struct ir_input_dev *ir) input_sync(ir->input_dev); ir->keypressed = false; } + +/** + * ir_keyup() - generates input event to signal the release of a keypress + * @dev: the struct input_dev descriptor of the device + * + * This routine is used to signal that a key has been released on the + * remote control. + */ +void ir_keyup(struct input_dev *dev) +{ + unsigned long flags; + struct ir_input_dev *ir = input_get_drvdata(dev); + + spin_lock_irqsave(&ir->keylock, flags); + ir_do_keyup(ir); + spin_unlock_irqrestore(&ir->keylock, flags); +} EXPORT_SYMBOL_GPL(ir_keyup); /** @@ -473,7 +490,7 @@ static void ir_timer_keyup(unsigned long cookie) */ spin_lock_irqsave(&ir->keylock, flags); if (time_is_before_eq_jiffies(ir->keyup_jiffies)) - ir_keyup(ir); + ir_do_keyup(ir); spin_unlock_irqrestore(&ir->keylock, flags); } @@ -506,44 +523,37 @@ out: EXPORT_SYMBOL_GPL(ir_repeat); /** - * ir_keydown() - generates input event for a key press + * ir_do_keydown() - internal function to process a keypress * @dev: the struct input_dev descriptor of the device - * @scancode: the scancode that we're seeking - * @toggle: the toggle value (protocol dependent, if the protocol doesn't - * support toggle values, this should be set to zero) + * @scancode: the scancode of the keypress + * @keycode: the keycode of the keypress + * @toggle: the toggle value of the keypress * - * This routine is used by the input routines when a key is pressed at the - * IR. It gets the keycode for a scancode and reports an input event via - * input_report_key(). + * This function is used internally to register a keypress, it must be + * called with keylock held. */ -void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) +static void ir_do_keydown(struct input_dev *dev, int scancode, + u32 keycode, u8 toggle) { - unsigned long flags; struct ir_input_dev *ir = input_get_drvdata(dev); - u32 keycode = ir_g_keycode_from_table(dev, scancode); - - spin_lock_irqsave(&ir->keylock, flags); - input_event(dev, EV_MSC, MSC_SCAN, scancode); /* Repeat event? */ if (ir->keypressed && ir->last_scancode == scancode && ir->last_toggle == toggle) - goto set_timer; + return; /* Release old keypress */ - ir_keyup(ir); + ir_do_keyup(ir); ir->last_scancode = scancode; ir->last_toggle = toggle; ir->last_keycode = keycode; - if (keycode == KEY_RESERVED) - goto out; - + return; /* Register a keypress */ ir->keypressed = true; @@ -551,15 +561,61 @@ void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) dev->name, keycode, scancode); input_report_key(dev, ir->last_keycode, 1); input_sync(dev); +} -set_timer: - ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); - mod_timer(&ir->timer_keyup, ir->keyup_jiffies); -out: +/** + * ir_keydown() - generates input event for a key press + * @dev: the struct input_dev descriptor of the device + * @scancode: the scancode that we're seeking + * @toggle: the toggle value (protocol dependent, if the protocol doesn't + * support toggle values, this should be set to zero) + * + * This routine is used by the input routines when a key is pressed at the + * IR. It gets the keycode for a scancode and reports an input event via + * input_report_key(). + */ +void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) +{ + unsigned long flags; + struct ir_input_dev *ir = input_get_drvdata(dev); + u32 keycode = ir_g_keycode_from_table(dev, scancode); + + spin_lock_irqsave(&ir->keylock, flags); + ir_do_keydown(dev, scancode, keycode, toggle); + + if (ir->keypressed) { + ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + mod_timer(&ir->timer_keyup, ir->keyup_jiffies); + } spin_unlock_irqrestore(&ir->keylock, flags); } EXPORT_SYMBOL_GPL(ir_keydown); +/** + * ir_keydown_notimeout() - generates input event for a key press without + * an automatic keyup event at a later time + * @dev: the struct input_dev descriptor of the device + * @scancode: the scancode that we're seeking + * @toggle: the toggle value (protocol dependent, if the protocol doesn't + * support toggle values, this should be set to zero) + * + * This routine is used by the input routines when a key is pressed at the + * IR. It gets the keycode for a scancode and reports an input event via + * input_report_key(). The driver must manually call ir_keyup() at a later + * stage. + */ +void ir_keydown_notimeout(struct input_dev *dev, int scancode, u8 toggle) +{ + unsigned long flags; + struct ir_input_dev *ir = input_get_drvdata(dev); + u32 keycode = ir_g_keycode_from_table(dev, scancode); + + spin_lock_irqsave(&ir->keylock, flags); + ir_do_keydown(dev, scancode, keycode, toggle); + spin_unlock_irqrestore(&ir->keylock, flags); +} +EXPORT_SYMBOL_GPL(ir_keydown_notimeout); + static int ir_open(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 6bf05a7dc5f9..eb71c3ae36de 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -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; diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index d1e26a448ed2..157285b434c9 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -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; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 436ace8196a5..564e3cb29c4d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -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); } } diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index ce4a75375909..a78883a6e0e7 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -269,7 +269,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; @@ -383,7 +383,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; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index b6c682f0acec..3e37593a328f 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -44,8 +44,6 @@ MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=g static int ir_rc5_remote_gap = 885; module_param(ir_rc5_remote_gap, int, 0644); -static int ir_rc5_key_timeout = 115; -module_param(ir_rc5_key_timeout, int, 0644); static int repeat_delay = 500; module_param(repeat_delay, int, 0644); @@ -70,7 +68,6 @@ static int saa7134_rc5_irq(struct saa7134_dev *dev); static int saa7134_nec_irq(struct saa7134_dev *dev); static int saa7134_raw_decode_irq(struct saa7134_dev *dev); static void nec_task(unsigned long data); -static void saa7134_nec_timer(unsigned long data); /* -------------------- GPIO generic keycode builder -------------------- */ @@ -104,25 +101,25 @@ static int build_key(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: if (data == ir->mask_keycode) - 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); return 0; } if (ir->polling) { 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); + ir_keydown_notimeout(ir->dev, data, 0); } else { - ir_input_nokey(ir->dev, &ir->ir); + ir_keyup(ir->dev); } } else { /* IRQ driven mode - handle key press and release in one go */ 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); - ir_input_nokey(ir->dev, &ir->ir); + ir_keydown_notimeout(ir->dev, data, 0); + ir_keyup(ir->dev); } } @@ -465,17 +462,11 @@ static int __saa7134_ir_start(void *priv) 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 = 2; ir->start = 0x2; ir->addr = 0x17; - ir->rc5_key_timeout = ir_rc5_key_timeout; ir->rc5_remote_gap = ir_rc5_remote_gap; } else if (ir->nec_gpio) { - setup_timer(&ir->timer_keyup, saa7134_nec_timer, - (unsigned long)dev); tasklet_init(&ir->tlet, nec_task, (unsigned long)dev); } else if (ir->raw_decode) { /* set timer_end for code completion */ @@ -596,7 +587,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) int nec_gpio = 0; int raw_decode = 0; int allow_protocol_change = 0; - u64 ir_type = IR_TYPE_OTHER; int err; if (dev->has_remote != SAA7134_REMOTE_GPIO) @@ -871,10 +861,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->props.change_protocol = saa7134_ir_change_protocol; } - 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; @@ -1092,20 +1078,6 @@ static int saa7134_rc5_irq(struct saa7134_dev *dev) return 1; } -/* On NEC protocol, One has 2.25 ms, and zero has 1.125 ms - The first pulse (start) has 9 + 4.5 ms - */ - -static void saa7134_nec_timer(unsigned long data) -{ - struct saa7134_dev *dev = (struct saa7134_dev *) data; - struct card_ir *ir = dev->remote; - - dprintk("Cancel key repeat\n"); - - ir_input_nokey(ir->dev, &ir->ir); -} - static void nec_task(unsigned long data) { struct saa7134_dev *dev = (struct saa7134_dev *) data; @@ -1194,12 +1166,11 @@ static void nec_task(unsigned long data) dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n", ir->code, ircode, not_code); - ir_input_keydown(ir->dev, &ir->ir, ir->code); - } else + ir_keydown(ir->dev, ir->code, 0); + } else { dprintk("Repeat last key\n"); - - /* Keep repeating the last key */ - mod_timer(&ir->timer_keyup, jiffies + msecs_to_jiffies(150)); + ir_repeat(ir->dev); + } saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P); } diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 6022caaa739b..3e74884da251 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -25,7 +25,6 @@ #include #include -#include #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; diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 415242047b6a..4a32e89a3cfe 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -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 [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 diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 6dc37fae6606..bff75f258fbc 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -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 */ diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 557c676ab7dc..8c37b5ec0cf6 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -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 -- cgit v1.2.3 From 3ffea4988be3f3fa65f2104ba31eff2b5e0e82a0 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 29 Oct 2010 16:08:12 -0300 Subject: [media] ir-core: more cleanups of ir-functions.c cx88 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. Signed-off-by: David Härdeman Acked-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- 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(-) (limited to 'include') diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig index aa4163eb7a83..20e02a0a5e48 100644 --- a/drivers/media/IR/Kconfig +++ b/drivers/media/IR/Kconfig @@ -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 diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index f9574adab82a..38873cff3429 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -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 diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c index fca734c43e8d..ec021c92527a 100644 --- a/drivers/media/IR/ir-functions.c +++ b/drivers/media/IR/ir-functions.c @@ -31,25 +31,6 @@ MODULE_AUTHOR("Gerd Knorr [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 */ diff --git a/drivers/media/dvb/dm1105/Kconfig b/drivers/media/dvb/dm1105/Kconfig index a6ceb08f1183..576f3b70d792 100644 --- a/drivers/media/dvb/dm1105/Kconfig +++ b/drivers/media/dvb/dm1105/Kconfig @@ -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 diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index debea8d1d31c..0ffd6943da83 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig @@ -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 diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 6830d2848bd7..22feac4d1e8f 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -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, diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index 1a4a89fdf767..659e44873440 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig @@ -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 diff --git a/drivers/media/video/cx18/Kconfig b/drivers/media/video/cx18/Kconfig index 76c054d1eef9..f3c3ccb491fe 100644 --- a/drivers/media/video/cx18/Kconfig +++ b/drivers/media/video/cx18/Kconfig @@ -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 diff --git a/drivers/media/video/cx231xx/Kconfig b/drivers/media/video/cx231xx/Kconfig index c37eac114024..ab7d5df50f55 100644 --- a/drivers/media/video/cx231xx/Kconfig +++ b/drivers/media/video/cx231xx/Kconfig @@ -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 diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index bcfd1ac48cc6..dbae62935e1f 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -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 diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 564e3cb29c4d..8c41124befbd 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -31,7 +31,6 @@ #include "cx88.h" #include -#include #define MODULE_NAME "cx88xx" diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 8d38c5fdece0..72ea2baba790 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig @@ -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 diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig index be4af1fa557e..c4f19801c73b 100644 --- a/drivers/media/video/ivtv/Kconfig +++ b/drivers/media/video/ivtv/Kconfig @@ -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 diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index 3fe71be41a1f..32a95a2d66a1 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -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--- diff --git a/drivers/media/video/tlg2300/Kconfig b/drivers/media/video/tlg2300/Kconfig index 1686ebfa6951..580580ec9362 100644 --- a/drivers/media/video/tlg2300/Kconfig +++ b/drivers/media/video/tlg2300/Kconfig @@ -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 diff --git a/drivers/staging/cx25821/Kconfig b/drivers/staging/cx25821/Kconfig index 1d73334d2a44..f8f2bb01055f 100644 --- a/drivers/staging/cx25821/Kconfig +++ b/drivers/staging/cx25821/Kconfig @@ -1,11 +1,11 @@ config VIDEO_CX25821 tristate "Conexant cx25821 support" - depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT + depends on DVB_CORE && VIDEO_DEV && PCI && I2C depends on BKL # please fix 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 diff --git a/drivers/staging/go7007/Kconfig b/drivers/staging/go7007/Kconfig index 3aecd30f0d1e..edc90919f3c6 100644 --- a/drivers/staging/go7007/Kconfig +++ b/drivers/staging/go7007/Kconfig @@ -1,10 +1,10 @@ config VIDEO_GO7007 tristate "WIS GO7007 MPEG encoder support" - depends on VIDEO_DEV && PCI && I2C && INPUT + depends on VIDEO_DEV && PCI && I2C depends on BKL # please fix depends on SND select VIDEOBUF_DMA_SG - depends on VIDEO_IR + depends on IR_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select SND_PCM diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 4a32e89a3cfe..d1ae869f962c 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -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 diff --git a/include/media/ir-core.h b/include/media/ir-core.h index bff75f258fbc..53048a2eefb9 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -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 */ -- cgit v1.2.3 From 4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 10 Nov 2010 11:04:19 -0300 Subject: [media] rc-core: Code cleanup after merging rc-sysfs and rc-map into rc-main [mchehab@redhat.com: this patch were originally bundled with some renaming stuff and with the file merges, as seen at: https://patchwork.kernel.org/patch/291092/. Instead of using the original approach, I wrote the rename patches and the code merge as separate changes, then applied the difference on this patch. This way, it is easier to see the real changes at the code, and will be easier to merge upstream, especially if some conflict rises on the renaming patches] Signed-off-by: David Härdeman Acked-by: Jarod Wilson Tested-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/rc-core-priv.h | 10 ---------- drivers/media/rc/rc-main.c | 30 +++++++++++++----------------- include/media/ir-core.h | 2 -- 3 files changed, 13 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 81c936bd793f..4be075780ad0 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -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 * diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index afcf0a88464d..67a6bd5d9497 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -32,10 +32,16 @@ static unsigned long ir_core_dev_number; /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */ #define IR_KEYPRESS_TIMEOUT 250 -/* Used to handle IR raw handler extensions */ +/* Used to keep track of known keymaps */ static LIST_HEAD(rc_map_list); static DEFINE_SPINLOCK(rc_map_lock); +/* Forward declarations */ +static int ir_register_class(struct input_dev *input_dev); +static void ir_unregister_class(struct input_dev *input_dev); +static int ir_register_input(struct input_dev *input_dev); + + static struct rc_keymap *seek_rc_map(const char *name) { struct rc_keymap *map = NULL; @@ -112,16 +118,6 @@ static struct rc_keymap empty_map = { } }; -int ir_rcmap_init(void) -{ - return ir_register_map(&empty_map); -} - -void ir_rcmap_cleanup(void) -{ - ir_unregister_map(&empty_map); -} - /** * ir_create_table() - initializes a scancode table * @rc_tab: the ir_scancode_table to initialize @@ -265,7 +261,7 @@ static unsigned int ir_update_mapping(struct input_dev *dev, } /** - * ir_locate_scancode() - set a keycode in the scancode->keycode table + * ir_establish_scancode() - set a keycode in the scancode->keycode table * @ir_dev: the struct ir_input_dev device descriptor * @rc_tab: scancode table to be searched * @scancode: the desired scancode @@ -1097,7 +1093,7 @@ static struct device_type rc_dev_type = { * * This routine is used to register the syfs code for IR class */ -int ir_register_class(struct input_dev *input_dev) +static int ir_register_class(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); int devno = find_first_zero_bit(&ir_core_dev_number, @@ -1122,7 +1118,7 @@ int ir_register_class(struct input_dev *input_dev) * @input_dev: the struct input_dev descriptor of the device */ -int ir_register_input(struct input_dev *input_dev) +static int ir_register_input(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); int rc; @@ -1155,7 +1151,7 @@ int ir_register_input(struct input_dev *input_dev) * * This routine is used to unregister the syfs code for IR class */ -void ir_unregister_class(struct input_dev *input_dev) +static void ir_unregister_class(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); @@ -1181,7 +1177,7 @@ static int __init ir_core_init(void) /* Initialize/load the decoders/keymap code that will be used */ ir_raw_init(); - ir_rcmap_init(); + ir_register_map(&empty_map); return 0; } @@ -1189,7 +1185,7 @@ static int __init ir_core_init(void) static void __exit ir_core_exit(void) { class_unregister(&ir_input_class); - ir_rcmap_cleanup(); + ir_unregister_map(&empty_map); } module_init(ir_core_init); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 53048a2eefb9..d41502d9919c 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -117,7 +117,6 @@ enum raw_event_type { #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -/* From ir-keytable.c */ int __ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, struct ir_dev_props *props, @@ -164,7 +163,6 @@ 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 */ - struct ir_raw_event { union { u32 duration; -- cgit v1.2.3 From d8b4b5822f51e2142b731b42c81e3f03eec475b2 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 29 Oct 2010 16:08:23 -0300 Subject: [media] ir-core: make struct rc_dev the primary interface This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman Acked-by: Jarod Wilson Tested-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- 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 | 41 +- 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/rc/ene_ir.c | 129 +++--- drivers/media/rc/ene_ir.h | 3 +- drivers/media/rc/imon.c | 58 ++- drivers/media/rc/ir-jvc-decoder.c | 13 +- drivers/media/rc/ir-lirc-codec.c | 121 +++--- drivers/media/rc/ir-nec-decoder.c | 15 +- drivers/media/rc/ir-rc5-decoder.c | 13 +- drivers/media/rc/ir-rc5-sz-decoder.c | 13 +- drivers/media/rc/ir-rc6-decoder.c | 17 +- drivers/media/rc/ir-sony-decoder.c | 11 +- drivers/media/rc/mceusb.c | 112 +++-- drivers/media/rc/nuvoton-cir.c | 85 ++-- drivers/media/rc/nuvoton-cir.h | 3 +- drivers/media/rc/rc-core-priv.h | 16 +- drivers/media/rc/rc-main.c | 612 +++++++++++++--------------- drivers/media/rc/rc-raw.c | 191 ++++----- drivers/media/rc/streamzap.c | 73 ++-- drivers/media/video/bt8xx/bttv-input.c | 41 +- drivers/media/video/cx231xx/cx231xx.h | 8 + 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 +- 44 files changed, 1225 insertions(+), 1439 deletions(-) (limited to 'include') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 5d404f1bf036..d1a43858f29c 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -266,7 +265,7 @@ static void dm1105_card_list(struct pci_dev *pci) /* infrared remote control */ struct infrared { - struct input_dev *input_dev; + struct rc_dev *dev; char input_phys[32]; struct work_struct work; u32 ir_command; @@ -532,7 +531,7 @@ static void dm1105_emit_key(struct work_struct *work) data = (ircom >> 8) & 0x7f; - ir_keydown(ir->input_dev, data, 0); + ir_keydown(ir->dev, data, 0); } /* work handler */ @@ -593,46 +592,47 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { - struct input_dev *input_dev; - char *ir_codes = RC_MAP_DM1105_NEC; + struct rc_dev *dev; int err = -ENOMEM; - input_dev = input_allocate_device(); - if (!input_dev) + dev = rc_allocate_device(); + if (!dev) return -ENOMEM; - dm1105->ir.input_dev = input_dev; snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), "pci-%s/ir0", pci_name(dm1105->pdev)); - input_dev->name = "DVB on-card IR receiver"; - input_dev->phys = dm1105->ir.input_phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + dev->driver_name = MODULE_NAME; + dev->map_name = RC_MAP_DM1105_NEC; + dev->driver_type = RC_DRIVER_SCANCODE; + dev->input_name = "DVB on-card IR receiver"; + dev->input_phys = dm1105->ir.input_phys; + dev->input_id.bustype = BUS_PCI; + dev->input_id.version = 1; if (dm1105->pdev->subsystem_vendor) { - input_dev->id.vendor = dm1105->pdev->subsystem_vendor; - input_dev->id.product = dm1105->pdev->subsystem_device; + dev->input_id.vendor = dm1105->pdev->subsystem_vendor; + dev->input_id.product = dm1105->pdev->subsystem_device; } else { - input_dev->id.vendor = dm1105->pdev->vendor; - input_dev->id.product = dm1105->pdev->device; + dev->input_id.vendor = dm1105->pdev->vendor; + dev->input_id.product = dm1105->pdev->device; } - - input_dev->dev.parent = &dm1105->pdev->dev; + dev->dev.parent = &dm1105->pdev->dev; INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + err = rc_register_device(dev); if (err < 0) { - input_free_device(input_dev); + rc_free_device(dev); return err; } + dm1105->ir.dev = dev; return 0; } void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) { - ir_input_unregister(dm1105->ir.input_dev); + rc_unregister_device(dm1105->ir.dev); } static int __devinit dm1105_hw_init(struct dm1105_dev *dev) diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 31c0a0ed39f5..8b9ab3002e11 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -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, diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 1759d26bca42..c6e4ba53ad61 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -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); } return 0; diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index c2c9d236ec7e..1e7d780332b5 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h @@ -60,7 +60,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); extern struct i2c_algorithm dib0700_i2c_algo; extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, int *cold); -extern int dib0700_change_protocol(void *priv, u64 ir_type); +extern int dib0700_change_protocol(struct rc_dev *dev, u64 ir_type); extern int dib0700_device_count; extern int dvb_usb_dib0700_ir_proto; diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 48397f103d32..3b58f4575689 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -471,9 +471,9 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) return dib0700_ctrl_wr(adap->dev, b, 4); } -int dib0700_change_protocol(void *priv, u64 ir_type) +int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type) { - struct dvb_usb_device *d = priv; + struct dvb_usb_device *d = rc->priv; struct dib0700_state *st = d->priv; u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 }; int new_proto, ret; @@ -535,7 +535,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) if (d == NULL) return; - if (d->rc_input_dev == NULL) { + if (d->rc_dev == NULL) { /* This will occur if disable_rc_polling=1 */ usb_free_urb(purb); return; @@ -600,7 +600,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) goto resubmit; } - ir_keydown(d->rc_input_dev, keycode, toggle); + ir_keydown(d->rc_dev, keycode, toggle); resubmit: /* Clean the buffer before we requeue */ diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index e06acd1fecb6..be167f2bea33 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -520,13 +520,13 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) d->last_event = keycode; } - ir_keydown(d->rc_input_dev, keycode, 0); + ir_keydown(d->rc_dev, keycode, 0); break; default: /* RC-5 protocol changes toggle bit on new keypress */ keycode = key[3-2] << 8 | key[3-3]; toggle = key[3-1]; - ir_keydown(d->rc_input_dev, keycode, toggle); + ir_keydown(d->rc_dev, keycode, toggle); break; } @@ -1924,12 +1924,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -1960,12 +1958,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2021,12 +2017,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2065,12 +2059,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2143,12 +2135,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2189,12 +2179,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2259,12 +2247,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2308,12 +2294,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_NEC_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2379,12 +2363,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2417,12 +2399,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2487,12 +2467,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2533,12 +2511,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_NEC_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 2, @@ -2584,12 +2560,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2623,12 +2597,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .rc_props = { - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, - .change_protocol = dib0700_change_protocol, - }, + .allowed_protos = IR_TYPE_RC5 | + IR_TYPE_RC6 | + IR_TYPE_NEC, + .change_protocol = dib0700_change_protocol, }, }, }; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index b579fed3ab3f..bbba149a2ceb 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -106,10 +106,10 @@ static void legacy_dvb_usb_read_remote_control(struct work_struct *work) d->last_event = event; case REMOTE_KEY_REPEAT: deb_rc("key repeated\n"); - input_event(d->rc_input_dev, EV_KEY, event, 1); - input_sync(d->rc_input_dev); - input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); - input_sync(d->rc_input_dev); + input_event(d->input_dev, EV_KEY, event, 1); + input_sync(d->input_dev); + input_event(d->input_dev, EV_KEY, d->last_event, 0); + input_sync(d->input_dev); break; default: break; @@ -154,10 +154,22 @@ schedule: schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval)); } -static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d, - struct input_dev *input_dev) +static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d) { int i, err, rc_interval; + struct input_dev *input_dev; + + input_dev = input_allocate_device(); + if (!input_dev) + return -ENOMEM; + + input_dev->evbit[0] = BIT_MASK(EV_KEY); + input_dev->name = "IR-receiver inside an USB DVB receiver"; + input_dev->phys = d->rc_phys; + usb_to_input_id(d->udev, &input_dev->id); + input_dev->dev.parent = &d->udev->dev; + d->input_dev = input_dev; + d->rc_dev = NULL; input_dev->getkeycode = legacy_dvb_usb_getkeycode; input_dev->setkeycode = legacy_dvb_usb_setkeycode; @@ -221,18 +233,34 @@ static void dvb_usb_read_remote_control(struct work_struct *work) msecs_to_jiffies(d->props.rc.core.rc_interval)); } -static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, - struct input_dev *input_dev) +static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d) { int err, rc_interval; + struct rc_dev *dev; + + dev = rc_allocate_device(); + if (!dev) + return -ENOMEM; - d->props.rc.core.rc_props.priv = d; - err = ir_input_register(input_dev, - d->props.rc.core.rc_codes, - &d->props.rc.core.rc_props, - d->props.rc.core.module_name); - if (err < 0) + dev->driver_name = d->props.rc.core.module_name; + dev->map_name = d->props.rc.core.rc_codes; + dev->change_protocol = d->props.rc.core.change_protocol; + dev->allowed_protos = d->props.rc.core.allowed_protos; + dev->driver_type = RC_DRIVER_SCANCODE; + usb_to_input_id(d->udev, &dev->input_id); + dev->input_name = "IR-receiver inside an USB DVB receiver"; + dev->input_phys = d->rc_phys; + dev->dev.parent = &d->udev->dev; + dev->priv = d; + + err = rc_register_device(dev); + if (err < 0) { + rc_free_device(dev); return err; + } + + d->input_dev = NULL; + d->rc_dev = dev; if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode) return 0; @@ -251,7 +279,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, int dvb_usb_remote_init(struct dvb_usb_device *d) { - struct input_dev *input_dev; int err; if (dvb_usb_disable_rc_polling) @@ -267,26 +294,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); - input_dev = input_allocate_device(); - if (!input_dev) - return -ENOMEM; - - input_dev->evbit[0] = BIT_MASK(EV_KEY); - input_dev->name = "IR-receiver inside an USB DVB receiver"; - input_dev->phys = d->rc_phys; - usb_to_input_id(d->udev, &input_dev->id); - input_dev->dev.parent = &d->udev->dev; - /* Start the remote-control polling. */ if (d->props.rc.legacy.rc_interval < 40) d->props.rc.legacy.rc_interval = 100; /* default */ - d->rc_input_dev = input_dev; - if (d->props.rc.mode == DVB_RC_LEGACY) - err = legacy_dvb_usb_remote_init(d, input_dev); + err = legacy_dvb_usb_remote_init(d); else - err = rc_core_dvb_usb_remote_init(d, input_dev); + err = rc_core_dvb_usb_remote_init(d); if (err) return err; @@ -301,9 +316,9 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d) cancel_rearming_delayed_work(&d->rc_query_work); flush_scheduled_work(); if (d->props.rc.mode == DVB_RC_LEGACY) - input_unregister_device(d->rc_input_dev); + input_unregister_device(d->input_dev); else - ir_input_unregister(d->rc_input_dev); + rc_unregister_device(d->rc_dev); } d->state &= ~DVB_USB_STATE_REMOTE; return 0; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 34f7b3ba8cc7..83aa9826560f 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -180,18 +180,20 @@ struct dvb_rc_legacy { * struct dvb_rc properties of remote controller, using rc-core * @rc_codes: name of rc codes table * @protocol: type of protocol(s) currently used by the driver + * @allowed_protos: protocol(s) supported by the driver + * @change_protocol: callback to change protocol * @rc_query: called to query an event event. * @rc_interval: time in ms between two queries. - * @rc_props: remote controller properties * @bulk_mode: device supports bulk mode for RC (disable polling mode) */ struct dvb_rc { char *rc_codes; u64 protocol; + u64 allowed_protos; + int (*change_protocol)(struct rc_dev *dev, u64 ir_type); char *module_name; int (*rc_query) (struct dvb_usb_device *d); int rc_interval; - struct ir_dev_props rc_props; bool bulk_mode; /* uses bulk mode */ }; @@ -385,7 +387,8 @@ struct dvb_usb_adapter { * * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB * - * @rc_input_dev: input device for the remote control. + * @rc_dev: rc device for the remote control (rc-core mode) + * @input_dev: input device for the remote control (legacy mode) * @rc_query_work: struct work_struct frequent rc queries * @last_event: last triggered event * @last_state: last state (no, pressed, repeat) @@ -418,7 +421,8 @@ struct dvb_usb_device { struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; /* remote control */ - struct input_dev *rc_input_dev; + struct rc_dev *rc_dev; + struct input_dev *input_dev; char rc_phys[64]; struct delayed_work rc_query_work; u32 last_event; diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index de7f1fbec92e..d8f1b150e1cb 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -198,7 +198,7 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u16 keypress) deb_info(1, "INT Key Keypress =%04x", keypress); if (keypress > 0) - ir_keydown(d->rc_input_dev, keypress, 0); + ir_keydown(d->rc_dev, keypress, 0); return 0; } @@ -555,42 +555,39 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) static int lme2510_int_service(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap->dev; - struct input_dev *input_dev; - char *ir_codes = RC_MAP_LME2510; - int ret = 0; + struct rc_dev *rc; + int ret; info("STA Configuring Remote"); - usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); - - strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); - - input_dev = input_allocate_device(); - if (!input_dev) + rc = rc_allocate_device(); + if (!rc) return -ENOMEM; - input_dev->name = "LME2510 Remote Control"; - input_dev->phys = d->rc_phys; - - usb_to_input_id(d->udev, &input_dev->id); + usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); + strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); - ret |= ir_input_register(input_dev, ir_codes, NULL, "LME 2510"); + rc->input_name = "LME2510 Remote Control"; + rc->input_phys = d->rc_phys; + rc->map_name = RC_MAP_LME2510; + rc->driver_name = "LME 2510"; + usb_to_input_id(d->udev, &rc->input_id); + ret = rc_register_device(rc); if (ret) { - input_free_device(input_dev); + rc_free_device(rc); return ret; } + d->rc_dev = rc; - d->rc_input_dev = input_dev; /* Start the Interupt */ ret = lme2510_int_read(adap); - if (ret < 0) { - ir_input_unregister(input_dev); - input_free_device(input_dev); + rc_unregister_device(rc); + return -ENODEV; } - return (ret < 0) ? -ENODEV : 0; + return 0; } static u8 check_sum(u8 *p, u8 len) @@ -1025,7 +1022,7 @@ void *lme2510_exit_int(struct dvb_usb_device *d) usb_free_coherent(d->udev, 5000, st->buffer, st->lme_urb->transfer_dma); info("Interupt Service Stopped"); - ir_input_unregister(d->rc_input_dev); + rc_unregister_device(d->rc_dev); info("Remote Stopped"); } return buffer; diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h index d0b645a483c9..bd400d21b81f 100644 --- a/drivers/media/dvb/mantis/mantis_common.h +++ b/drivers/media/dvb/mantis/mantis_common.h @@ -171,7 +171,9 @@ struct mantis_pci { struct work_struct uart_work; spinlock_t uart_lock; - struct input_dev *rc; + struct rc_dev *rc; + char input_name[80]; + char input_phys[80]; }; #define MANTIS_HIF_STATUS (mantis->gpio_status) diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index a99489b8418b..209f2110e20c 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include @@ -33,6 +32,7 @@ #include "mantis_uart.h" #define MODULE_NAME "mantis_core" +#define RC_MAP_MANTIS "rc-mantis" static struct ir_scancode mantis_ir_table[] = { { 0x29, KEY_POWER }, @@ -95,53 +95,65 @@ static struct ir_scancode mantis_ir_table[] = { { 0x00, KEY_BLUE }, }; -struct ir_scancode_table ir_mantis = { - .scan = mantis_ir_table, - .size = ARRAY_SIZE(mantis_ir_table), +static struct rc_keymap ir_mantis_map = { + .map = { + .scan = mantis_ir_table, + .size = ARRAY_SIZE(mantis_ir_table), + .ir_type = IR_TYPE_UNKNOWN, + .name = RC_MAP_MANTIS, + } }; -EXPORT_SYMBOL_GPL(ir_mantis); int mantis_input_init(struct mantis_pci *mantis) { - struct input_dev *rc; - char name[80], dev[80]; + struct rc_dev *dev; int err; - rc = input_allocate_device(); - if (!rc) { - dprintk(MANTIS_ERROR, 1, "Input device allocate failed"); - return -ENOMEM; - } + err = ir_register_map(&ir_mantis_map); + if (err) + goto out; - sprintf(name, "Mantis %s IR receiver", mantis->hwconfig->model_name); - sprintf(dev, "pci-%s/ir0", pci_name(mantis->pdev)); + dev = rc_allocate_device(); + if (!dev) { + dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); + err = -ENOMEM; + goto out_map; + } - rc->name = name; - rc->phys = dev; + sprintf(mantis->input_name, "Mantis %s IR receiver", mantis->hwconfig->model_name); + sprintf(mantis->input_phys, "pci-%s/ir0", pci_name(mantis->pdev)); - rc->id.bustype = BUS_PCI; - rc->id.vendor = mantis->vendor_id; - rc->id.product = mantis->device_id; - rc->id.version = 1; - rc->dev = mantis->pdev->dev; + dev->input_name = mantis->input_name; + dev->input_phys = mantis->input_phys; + dev->input_id.bustype = BUS_PCI; + dev->input_id.vendor = mantis->vendor_id; + dev->input_id.product = mantis->device_id; + dev->input_id.version = 1; + dev->driver_name = MODULE_NAME; + dev->map_name = RC_MAP_MANTIS; + dev->dev.parent = &mantis->pdev->dev; - err = __ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); + err = rc_register_device(dev); if (err) { dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); - input_free_device(rc); - return -ENODEV; + goto out_dev; } - mantis->rc = rc; - + mantis->rc = dev; return 0; + +out_dev: + rc_free_device(dev); +out_map: + ir_unregister_map(&ir_mantis_map); +out: + return err; } int mantis_exit(struct mantis_pci *mantis) { - struct input_dev *rc = mantis->rc; - - ir_input_unregister(rc); - + rc_unregister_device(mantis->rc); + ir_unregister_map(&ir_mantis_map); return 0; } + diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 135e45bd00c7..78765ed28063 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c @@ -438,7 +438,7 @@ static int smscore_init_ir(struct smscore_device_t *coredev) int rc; void *buffer; - coredev->ir.input_dev = NULL; + coredev->ir.dev = NULL; ir_io = sms_get_board(smscore_get_board_id(coredev))->board_cfg.ir; if (ir_io) {/* only if IR port exist we use IR sub-module */ sms_info("IR loading"); diff --git a/drivers/media/dvb/siano/smsir.c b/drivers/media/dvb/siano/smsir.c index a27c44a8af5a..ebd73059b518 100644 --- a/drivers/media/dvb/siano/smsir.c +++ b/drivers/media/dvb/siano/smsir.c @@ -45,25 +45,24 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len) ev.duration = abs(samples[i]) * 1000; /* Convert to ns */ ev.pulse = (samples[i] > 0) ? false : true; - ir_raw_event_store(coredev->ir.input_dev, &ev); + ir_raw_event_store(coredev->ir.dev, &ev); } - ir_raw_event_handle(coredev->ir.input_dev); + ir_raw_event_handle(coredev->ir.dev); } int sms_ir_init(struct smscore_device_t *coredev) { - struct input_dev *input_dev; + int err; int board_id = smscore_get_board_id(coredev); + struct rc_dev *dev; - sms_log("Allocating input device"); - input_dev = input_allocate_device(); - if (!input_dev) { + sms_log("Allocating rc device"); + dev = rc_allocate_device(); + if (!dev) { sms_err("Not enough memory"); return -ENOMEM; } - coredev->ir.input_dev = input_dev; - coredev->ir.controller = 0; /* Todo: vega/nova SPI number */ coredev->ir.timeout = IR_DEFAULT_TIMEOUT; sms_log("IR port %d, timeout %d ms", @@ -75,38 +74,41 @@ int sms_ir_init(struct smscore_device_t *coredev) strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys)); strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys)); - input_dev->name = coredev->ir.name; - input_dev->phys = coredev->ir.phys; - input_dev->dev.parent = coredev->device; + dev->input_name = coredev->ir.name; + dev->input_phys = coredev->ir.phys; + dev->dev.parent = coredev->device; #if 0 /* TODO: properly initialize the parameters bellow */ - input_dev->id.bustype = BUS_USB; - input_dev->id.version = 1; - input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); - input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); + dev->input_id.bustype = BUS_USB; + dev->input_id.version = 1; + dev->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); + dev->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct); #endif - coredev->ir.props.priv = coredev; - coredev->ir.props.driver_type = RC_DRIVER_IR_RAW; - coredev->ir.props.allowed_protos = IR_TYPE_ALL; + dev->priv = coredev; + dev->driver_type = RC_DRIVER_IR_RAW; + dev->allowed_protos = IR_TYPE_ALL; + dev->map_name = sms_get_board(board_id)->rc_codes; + dev->driver_name = MODULE_NAME; - sms_log("Input device (IR) %s is set for key events", input_dev->name); + sms_log("Input device (IR) %s is set for key events", dev->input_name); - if (ir_input_register(input_dev, sms_get_board(board_id)->rc_codes, - &coredev->ir.props, MODULE_NAME)) { + err = rc_register_device(dev); + if (err < 0) { sms_err("Failed to register device"); - input_free_device(input_dev); - return -EACCES; + rc_free_device(dev); + return err; } + coredev->ir.dev = dev; return 0; } void sms_ir_exit(struct smscore_device_t *coredev) { - if (coredev->ir.input_dev) - ir_input_unregister(coredev->ir.input_dev); + if (coredev->ir.dev) + rc_unregister_device(coredev->ir.dev); sms_log(""); } diff --git a/drivers/media/dvb/siano/smsir.h b/drivers/media/dvb/siano/smsir.h index 926e247523bd..c2f68a460ee1 100644 --- a/drivers/media/dvb/siano/smsir.h +++ b/drivers/media/dvb/siano/smsir.h @@ -35,13 +35,12 @@ along with this program. If not, see . struct smscore_device_t; struct ir_t { - struct input_dev *input_dev; + struct rc_dev *dev; char name[40]; char phys[32]; char *rc_codes; u64 protocol; - struct ir_dev_props props; u32 timeout; u32 controller; diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index a9c2c326df4b..9aca0f37993b 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -96,7 +95,7 @@ MODULE_PARM_DESC(ir_debug, "enable debugging information for IR decoding"); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct budget_ci_ir { - struct input_dev *dev; + struct rc_dev *dev; struct tasklet_struct msp430_irq_tasklet; char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ char phys[32]; @@ -118,7 +117,7 @@ struct budget_ci { static void msp430_ir_interrupt(unsigned long data) { struct budget_ci *budget_ci = (struct budget_ci *) data; - struct input_dev *dev = budget_ci->ir.dev; + struct rc_dev *dev = budget_ci->ir.dev; u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; /* @@ -166,13 +165,11 @@ static void msp430_ir_interrupt(unsigned long data) static int msp430_ir_init(struct budget_ci *budget_ci) { struct saa7146_dev *saa = budget_ci->budget.dev; - struct input_dev *input_dev = budget_ci->ir.dev; + struct rc_dev *dev; int error; - char *ir_codes = NULL; - - budget_ci->ir.dev = input_dev = input_allocate_device(); - if (!input_dev) { + dev = rc_allocate_device(); + if (!dev) { printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); return -ENOMEM; } @@ -182,19 +179,19 @@ static int msp430_ir_init(struct budget_ci *budget_ci) snprintf(budget_ci->ir.phys, sizeof(budget_ci->ir.phys), "pci-%s/ir0", pci_name(saa->pci)); - input_dev->name = budget_ci->ir.name; - - input_dev->phys = budget_ci->ir.phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + dev->driver_name = MODULE_NAME; + dev->input_name = budget_ci->ir.name; + dev->input_phys = budget_ci->ir.phys; + dev->input_id.bustype = BUS_PCI; + dev->input_id.version = 1; if (saa->pci->subsystem_vendor) { - input_dev->id.vendor = saa->pci->subsystem_vendor; - input_dev->id.product = saa->pci->subsystem_device; + dev->input_id.vendor = saa->pci->subsystem_vendor; + dev->input_id.product = saa->pci->subsystem_device; } else { - input_dev->id.vendor = saa->pci->vendor; - input_dev->id.product = saa->pci->device; + dev->input_id.vendor = saa->pci->vendor; + dev->input_id.product = saa->pci->device; } - input_dev->dev.parent = &saa->pci->dev; + dev->dev.parent = &saa->pci->dev; if (rc5_device < 0) budget_ci->ir.rc5_device = IR_DEVICE_ANY; @@ -208,7 +205,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = RC_MAP_HAUPPAUGE_NEW; + dev->map_name = RC_MAP_HAUPPAUGE_NEW; if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -218,23 +215,22 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1019: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = RC_MAP_TT_1500; + dev->map_name = RC_MAP_TT_1500; break; default: /* unknown remote */ - ir_codes = RC_MAP_BUDGET_CI_OLD; + dev->map_name = RC_MAP_BUDGET_CI_OLD; break; } - error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = rc_register_device(dev); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); + rc_free_device(dev); return error; } - /* note: these must be after input_register_device */ - input_dev->rep[REP_DELAY] = 400; - input_dev->rep[REP_PERIOD] = 250; + budget_ci->ir.dev = dev; tasklet_init(&budget_ci->ir.msp430_irq_tasklet, msp430_ir_interrupt, (unsigned long) budget_ci); @@ -248,13 +244,12 @@ static int msp430_ir_init(struct budget_ci *budget_ci) static void msp430_ir_deinit(struct budget_ci *budget_ci) { struct saa7146_dev *saa = budget_ci->budget.dev; - struct input_dev *dev = budget_ci->ir.dev; SAA7146_IER_DISABLE(saa, MASK_06); saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); - ir_input_unregister(dev); + rc_unregister_device(budget_ci->ir.dev); } static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 7637babcd262..0a4151f03c7e 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -37,9 +37,7 @@ #include #include #include -#include #include -#include #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); } diff --git a/drivers/media/rc/ene_ir.h b/drivers/media/rc/ene_ir.h index f5870667a433..c179baf34cb4 100644 --- a/drivers/media/rc/ene_ir.h +++ b/drivers/media/rc/ene_ir.h @@ -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; diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 79f4f58c2ea4..8d4b35d1ae56 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -88,7 +88,6 @@ static ssize_t lcd_write(struct file *file, const char *buf, struct imon_context { struct device *dev; - struct ir_dev_props *props; /* Newer devices have two interfaces */ struct usb_device *usbdev_intf0; struct usb_device *usbdev_intf1; @@ -123,7 +122,7 @@ struct imon_context { u16 vendor; /* usb vendor ID */ u16 product; /* usb product ID */ - struct input_dev *rdev; /* input device for remote */ + struct rc_dev *rdev; /* rc-core device for remote */ struct input_dev *idev; /* input device for panel & IR mouse */ struct input_dev *touch; /* input device for touchscreen */ @@ -984,16 +983,16 @@ static void imon_touch_display_timeout(unsigned long data) * really just RC-6), but only one or the other at a time, as the signals * are decoded onboard the receiver. */ -int imon_ir_change_protocol(void *priv, u64 ir_type) +static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) { int retval; - struct imon_context *ictx = priv; + struct imon_context *ictx = rc->priv; struct device *dev = ictx->dev; bool pad_mouse; unsigned char ir_proto_packet[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; - if (ir_type && !(ir_type & ictx->props->allowed_protos)) + if (ir_type && !(ir_type & rc->allowed_protos)) dev_warn(dev, "Looks like you're trying to use an IR protocol " "this device does not support\n"); @@ -1757,7 +1756,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); ictx->display_type = detected_display_type; - ictx->props->allowed_protos = allowed_protos; + ictx->rdev->allowed_protos = allowed_protos; ictx->ir_type = allowed_protos; } @@ -1811,18 +1810,15 @@ static void imon_set_display_type(struct imon_context *ictx) ictx->display_type = configured_display_type; } -static struct input_dev *imon_init_rdev(struct imon_context *ictx) +static struct rc_dev *imon_init_rdev(struct imon_context *ictx) { - struct input_dev *rdev; - struct ir_dev_props *props; + struct rc_dev *rdev; int ret; - char *ir_codes = NULL; const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88 }; - rdev = input_allocate_device(); - props = kzalloc(sizeof(*props), GFP_KERNEL); - if (!rdev || !props) { + rdev = rc_allocate_device(); + if (!rdev) { dev_err(ictx->dev, "remote control dev allocation failed\n"); goto out; } @@ -1833,18 +1829,20 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx) sizeof(ictx->phys_rdev)); strlcat(ictx->phys_rdev, "/input0", sizeof(ictx->phys_rdev)); - rdev->name = ictx->name_rdev; - rdev->phys = ictx->phys_rdev; - usb_to_input_id(ictx->usbdev_intf0, &rdev->id); + rdev->input_name = ictx->name_rdev; + rdev->input_phys = ictx->phys_rdev; + usb_to_input_id(ictx->usbdev_intf0, &rdev->input_id); rdev->dev.parent = ictx->dev; - rdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); - input_set_drvdata(rdev, ictx); - props->priv = ictx; - props->driver_type = RC_DRIVER_SCANCODE; - props->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */ - props->change_protocol = imon_ir_change_protocol; - ictx->props = props; + rdev->priv = ictx; + rdev->driver_type = RC_DRIVER_SCANCODE; + rdev->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */ + rdev->change_protocol = imon_ir_change_protocol; + rdev->driver_name = MOD_NAME; + if (ictx->ir_type == IR_TYPE_RC6) + rdev->map_name = RC_MAP_IMON_MCE; + else + rdev->map_name = RC_MAP_IMON_PAD; /* Enable front-panel buttons and/or knobs */ memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); @@ -1858,12 +1856,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx) imon_set_display_type(ictx); - if (ictx->ir_type == IR_TYPE_RC6) - ir_codes = RC_MAP_IMON_MCE; - else - ir_codes = RC_MAP_IMON_PAD; - - ret = ir_input_register(rdev, ir_codes, props, MOD_NAME); + ret = rc_register_device(rdev); if (ret < 0) { dev_err(ictx->dev, "remote input dev register failed\n"); goto out; @@ -1872,8 +1865,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx) return rdev; out: - kfree(props); - input_free_device(rdev); + rc_free_device(rdev); return NULL; } @@ -2144,7 +2136,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) return ictx; urb_submit_failed: - ir_input_unregister(ictx->rdev); + rc_unregister_device(ictx->rdev); rdev_setup_failed: input_unregister_device(ictx->idev); idev_setup_failed: @@ -2371,7 +2363,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface) ictx->dev_present_intf0 = false; usb_kill_urb(ictx->rx_urb_intf0); input_unregister_device(ictx->idev); - ir_input_unregister(ictx->rdev); + rc_unregister_device(ictx->rdev); if (ictx->display_supported) { if (ictx->display_type == IMON_DISPLAY_TYPE_LCD) usb_deregister_dev(interface, &imon_lcd_class); diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index d83a5f64bfe4..cfe0e70440a5 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c @@ -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; diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 9345995dbf14..ceabea6053de 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -24,21 +24,20 @@ /** * ir_lirc_decode() - Send raw IR data to lirc_dev to be relayed to the * lircd userspace daemon for decoding. - * @input_dev: the struct input_dev descriptor of the device + * @input_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 lirc interfaces aren't wired up. */ -static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) +static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - struct lirc_codec *lirc = &ir_dev->raw->lirc; + struct lirc_codec *lirc = &dev->raw->lirc; int sample; - if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC)) + if (!(dev->raw->enabled_protocols & IR_TYPE_LIRC)) return 0; - if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf) + if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) return -EINVAL; /* Packet start */ @@ -79,7 +78,7 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) (u64)LIRC_VALUE_MASK); gap_sample = LIRC_SPACE(lirc->gap_duration); - lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf, + lirc_buffer_write(dev->raw->lirc.drv->rbuf, (unsigned char *) &gap_sample); lirc->gap = false; } @@ -88,9 +87,9 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) LIRC_SPACE(ev.duration / 1000); } - lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf, + lirc_buffer_write(dev->raw->lirc.drv->rbuf, (unsigned char *) &sample); - wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll); + wake_up(&dev->raw->lirc.drv->rbuf->wait_poll); return 0; } @@ -99,7 +98,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, size_t n, loff_t *ppos) { struct lirc_codec *lirc; - struct ir_input_dev *ir_dev; + struct rc_dev *dev; int *txbuf; /* buffer with values to transmit */ int ret = 0, count; @@ -118,14 +117,14 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, if (IS_ERR(txbuf)) return PTR_ERR(txbuf); - ir_dev = lirc->ir_dev; - if (!ir_dev) { + dev = lirc->dev; + if (!dev) { ret = -EFAULT; goto out; } - if (ir_dev->props && ir_dev->props->tx_ir) - ret = ir_dev->props->tx_ir(ir_dev->props->priv, txbuf, (u32)n); + if (dev->tx_ir) + ret = dev->tx_ir(dev, txbuf, (u32)n); out: kfree(txbuf); @@ -136,21 +135,18 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long __user arg) { struct lirc_codec *lirc; - struct ir_input_dev *ir_dev; + struct rc_dev *dev; int ret = 0; - void *drv_data; __u32 val = 0, tmp; lirc = lirc_get_pdata(filep); if (!lirc) return -EFAULT; - ir_dev = lirc->ir_dev; - if (!ir_dev || !ir_dev->props || !ir_dev->props->priv) + dev = lirc->dev; + if (!dev) return -EFAULT; - drv_data = ir_dev->props->priv; - if (_IOC_DIR(cmd) & _IOC_WRITE) { ret = get_user(val, (__u32 *)arg); if (ret) @@ -171,84 +167,85 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, /* TX settings */ case LIRC_SET_TRANSMITTER_MASK: - if (!ir_dev->props->s_tx_mask) + if (!dev->s_tx_mask) return -EINVAL; - return ir_dev->props->s_tx_mask(drv_data, val); + return dev->s_tx_mask(dev, val); case LIRC_SET_SEND_CARRIER: - if (!ir_dev->props->s_tx_carrier) + if (!dev->s_tx_carrier) return -EINVAL; - return ir_dev->props->s_tx_carrier(drv_data, val); + return dev->s_tx_carrier(dev, val); case LIRC_SET_SEND_DUTY_CYCLE: - if (!ir_dev->props->s_tx_duty_cycle) + if (!dev->s_tx_duty_cycle) return -ENOSYS; if (val <= 0 || val >= 100) return -EINVAL; - return ir_dev->props->s_tx_duty_cycle(drv_data, val); + return dev->s_tx_duty_cycle(dev, val); /* RX settings */ case LIRC_SET_REC_CARRIER: - if (!ir_dev->props->s_rx_carrier_range) + if (!dev->s_rx_carrier_range) return -ENOSYS; if (val <= 0) return -EINVAL; - return ir_dev->props->s_rx_carrier_range(drv_data, - ir_dev->raw->lirc.carrier_low, val); + return dev->s_rx_carrier_range(dev, + dev->raw->lirc.carrier_low, + val); case LIRC_SET_REC_CARRIER_RANGE: if (val <= 0) return -EINVAL; - ir_dev->raw->lirc.carrier_low = val; + dev->raw->lirc.carrier_low = val; return 0; case LIRC_GET_REC_RESOLUTION: - val = ir_dev->props->rx_resolution; + val = dev->rx_resolution; break; case LIRC_SET_WIDEBAND_RECEIVER: - if (!ir_dev->props->s_learning_mode) + if (!dev->s_learning_mode) return -ENOSYS; - return ir_dev->props->s_learning_mode(drv_data, !!val); + return dev->s_learning_mode(dev, !!val); case LIRC_SET_MEASURE_CARRIER_MODE: - if (!ir_dev->props->s_carrier_report) + if (!dev->s_carrier_report) return -ENOSYS; - return ir_dev->props->s_carrier_report(drv_data, !!val); + return dev->s_carrier_report(dev, !!val); /* Generic timeout support */ case LIRC_GET_MIN_TIMEOUT: - if (!ir_dev->props->max_timeout) + if (!dev->max_timeout) return -ENOSYS; - val = ir_dev->props->min_timeout / 1000; + val = dev->min_timeout / 1000; break; case LIRC_GET_MAX_TIMEOUT: - if (!ir_dev->props->max_timeout) + if (!dev->max_timeout) return -ENOSYS; - val = ir_dev->props->max_timeout / 1000; + val = dev->max_timeout / 1000; break; case LIRC_SET_REC_TIMEOUT: - if (!ir_dev->props->max_timeout) + if (!dev->max_timeout) return -ENOSYS; tmp = val * 1000; - if (tmp < ir_dev->props->min_timeout || - tmp > ir_dev->props->max_timeout) + if (tmp < dev->min_timeout || + tmp > dev->max_timeout) return -EINVAL; - ir_dev->props->timeout = tmp; + dev->timeout = tmp; break; case LIRC_SET_REC_TIMEOUT_REPORTS: @@ -289,9 +286,8 @@ static struct file_operations lirc_fops = { .llseek = no_llseek, }; -static int ir_lirc_register(struct input_dev *input_dev) +static int ir_lirc_register(struct rc_dev *dev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); struct lirc_driver *drv; struct lirc_buffer *rbuf; int rc = -ENOMEM; @@ -310,44 +306,40 @@ static int ir_lirc_register(struct input_dev *input_dev) goto rbuf_init_failed; features = LIRC_CAN_REC_MODE2; - if (ir_dev->props->tx_ir) { - + if (dev->tx_ir) { features |= LIRC_CAN_SEND_PULSE; - if (ir_dev->props->s_tx_mask) + if (dev->s_tx_mask) features |= LIRC_CAN_SET_TRANSMITTER_MASK; - if (ir_dev->props->s_tx_carrier) + if (dev->s_tx_carrier) features |= LIRC_CAN_SET_SEND_CARRIER; - - if (ir_dev->props->s_tx_duty_cycle) + if (dev->s_tx_duty_cycle) features |= LIRC_CAN_SET_SEND_DUTY_CYCLE; } - if (ir_dev->props->s_rx_carrier_range) + if (dev->s_rx_carrier_range) features |= LIRC_CAN_SET_REC_CARRIER | LIRC_CAN_SET_REC_CARRIER_RANGE; - if (ir_dev->props->s_learning_mode) + if (dev->s_learning_mode) features |= LIRC_CAN_USE_WIDEBAND_RECEIVER; - if (ir_dev->props->s_carrier_report) + if (dev->s_carrier_report) features |= LIRC_CAN_MEASURE_CARRIER; - - if (ir_dev->props->max_timeout) + if (dev->max_timeout) features |= LIRC_CAN_SET_REC_TIMEOUT; - snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)", - ir_dev->driver_name); + dev->driver_name); drv->minor = -1; drv->features = features; - drv->data = &ir_dev->raw->lirc; + drv->data = &dev->raw->lirc; drv->rbuf = rbuf; drv->set_use_inc = &ir_lirc_open; drv->set_use_dec = &ir_lirc_close; drv->code_length = sizeof(struct ir_raw_event) * 8; drv->fops = &lirc_fops; - drv->dev = &ir_dev->dev; + drv->dev = &dev->dev; drv->owner = THIS_MODULE; drv->minor = lirc_register_driver(drv); @@ -356,8 +348,8 @@ static int ir_lirc_register(struct input_dev *input_dev) goto lirc_register_failed; } - ir_dev->raw->lirc.drv = drv; - ir_dev->raw->lirc.ir_dev = ir_dev; + dev->raw->lirc.drv = drv; + dev->raw->lirc.dev = dev; return 0; lirc_register_failed: @@ -369,10 +361,9 @@ rbuf_alloc_failed: return rc; } -static int ir_lirc_unregister(struct input_dev *input_dev) +static int ir_lirc_unregister(struct rc_dev *dev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - struct lirc_codec *lirc = &ir_dev->raw->lirc; + struct lirc_codec *lirc = &dev->raw->lirc; lirc_unregister_driver(lirc->drv->minor); lirc_buffer_free(lirc->drv->rbuf); diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index cad4e994aa78..8ff157a140ca 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -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; } diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index c07f6e0bb962..dae6f9a9b662 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c @@ -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; } diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c index 0c3b6eb4ccd6..d8a53c02c1e4 100644 --- a/drivers/media/rc/ir-rc5-sz-decoder.c +++ b/drivers/media/rc/ir-rc5-sz-decoder.c @@ -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; } diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 48e82be5e01e..2435bbd1dbcc 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -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; } diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index 0a5cadbf9bfb..3138520fb9e7 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c @@ -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; } diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 392ca24132da..539bec2974b7 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -317,7 +316,7 @@ static struct usb_device_id mceusb_dev_table[] = { /* data structure for each usb transceiver */ struct mceusb_dev { /* ir-core bits */ - struct ir_dev_props *props; + struct rc_dev *rc; /* optional features we can enable */ bool carrier_report_enabled; @@ -325,7 +324,6 @@ struct mceusb_dev { /* core device bits */ struct device *dev; - struct input_dev *idev; /* usb */ struct usb_device *usbdev; @@ -663,9 +661,9 @@ static void mce_sync_in(struct mceusb_dev *ir, unsigned char *data, int size) } /* Send data out the IR blaster port(s) */ -static int mceusb_tx_ir(void *priv, int *txbuf, u32 n) +static int mceusb_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) { - struct mceusb_dev *ir = priv; + struct mceusb_dev *ir = dev->priv; int i, ret = 0; int count, cmdcount = 0; unsigned char *cmdbuf; /* MCE command buffer */ @@ -749,9 +747,9 @@ out: } /* Sets active IR outputs -- mce devices typically have two */ -static int mceusb_set_tx_mask(void *priv, u32 mask) +static int mceusb_set_tx_mask(struct rc_dev *dev, u32 mask) { - struct mceusb_dev *ir = priv; + struct mceusb_dev *ir = dev->priv; if (ir->flags.tx_mask_normal) ir->tx_mask = mask; @@ -763,9 +761,9 @@ static int mceusb_set_tx_mask(void *priv, u32 mask) } /* Sets the send carrier frequency and mode */ -static int mceusb_set_tx_carrier(void *priv, u32 carrier) +static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier) { - struct mceusb_dev *ir = priv; + struct mceusb_dev *ir = dev->priv; int clk = 10000000; int prescaler = 0, divisor = 0; unsigned char cmdbuf[4] = { MCE_COMMAND_HEADER, @@ -819,7 +817,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index) switch (ir->buf_in[index]) { /* 2-byte return value commands */ case MCE_CMD_S_TIMEOUT: - ir->props->timeout = MS_TO_NS((hi << 8 | lo) / 2); + ir->rc->timeout = MS_TO_NS((hi << 8 | lo) / 2); break; /* 1-byte return value commands */ @@ -866,7 +864,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) rawir.pulse ? "pulse" : "space", rawir.duration); - ir_raw_event_store_with_filter(ir->idev, &rawir); + ir_raw_event_store_with_filter(ir->rc, &rawir); break; case CMD_DATA: ir->rem--; @@ -893,7 +891,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) ir->parser_state = CMD_HEADER; } dev_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n"); - ir_raw_event_handle(ir->idev); + ir_raw_event_handle(ir->rc); } static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs) @@ -1035,72 +1033,54 @@ static void mceusb_get_parameters(struct mceusb_dev *ir) mce_sync_in(ir, NULL, maxp); } -static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) +static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) { - struct input_dev *idev; - struct ir_dev_props *props; struct device *dev = ir->dev; - const char *rc_map = RC_MAP_RC6_MCE; - const char *name = "Media Center Ed. eHome Infrared Remote Transceiver"; - int ret = -ENODEV; - - idev = input_allocate_device(); - if (!idev) { - dev_err(dev, "remote input dev allocation failed\n"); - goto idev_alloc_failed; - } + struct rc_dev *rc; + int ret; - ret = -ENOMEM; - props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); - if (!props) { - dev_err(dev, "remote ir dev props allocation failed\n"); - goto props_alloc_failed; + rc = rc_allocate_device(); + if (!rc) { + dev_err(dev, "remote dev allocation failed\n"); + goto out; } - if (mceusb_model[ir->model].name) - name = mceusb_model[ir->model].name; - snprintf(ir->name, sizeof(ir->name), "%s (%04x:%04x)", - name, + mceusb_model[ir->model].name ? + mceusb_model[ir->model].name : + "Media Center Ed. eHome Infrared Remote Transceiver", le16_to_cpu(ir->usbdev->descriptor.idVendor), le16_to_cpu(ir->usbdev->descriptor.idProduct)); - idev->name = ir->name; usb_make_path(ir->usbdev, ir->phys, sizeof(ir->phys)); - strlcat(ir->phys, "/input0", sizeof(ir->phys)); - idev->phys = ir->phys; - props->priv = ir; - props->driver_type = RC_DRIVER_IR_RAW; - props->allowed_protos = IR_TYPE_ALL; - props->timeout = MS_TO_NS(1000); + rc->input_name = ir->name; + rc->input_phys = ir->phys; + usb_to_input_id(ir->usbdev, &rc->input_id); + rc->dev.parent = dev; + rc->priv = ir; + rc->driver_type = RC_DRIVER_IR_RAW; + rc->allowed_protos = IR_TYPE_ALL; + rc->timeout = MS_TO_NS(1000); if (!ir->flags.no_tx) { - props->s_tx_mask = mceusb_set_tx_mask; - props->s_tx_carrier = mceusb_set_tx_carrier; - props->tx_ir = mceusb_tx_ir; + rc->s_tx_mask = mceusb_set_tx_mask; + rc->s_tx_carrier = mceusb_set_tx_carrier; + rc->tx_ir = mceusb_tx_ir; } + rc->driver_name = DRIVER_NAME; + rc->map_name = mceusb_model[ir->model].rc_map ? + mceusb_model[ir->model].rc_map : RC_MAP_RC6_MCE; - ir->props = props; - - usb_to_input_id(ir->usbdev, &idev->id); - idev->dev.parent = ir->dev; - - if (mceusb_model[ir->model].rc_map) - rc_map = mceusb_model[ir->model].rc_map; - - ret = ir_input_register(idev, rc_map, props, DRIVER_NAME); + ret = rc_register_device(rc); if (ret < 0) { - dev_err(dev, "remote input device register failed\n"); - goto irdev_failed; + dev_err(dev, "remote dev registration failed\n"); + goto out; } - return idev; + return rc; -irdev_failed: - kfree(props); -props_alloc_failed: - input_free_device(idev); -idev_alloc_failed: +out: + rc_free_device(rc); return NULL; } @@ -1212,9 +1192,9 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, snprintf(name + strlen(name), sizeof(name) - strlen(name), " %s", buf); - ir->idev = mceusb_init_input_dev(ir); - if (!ir->idev) - goto input_dev_fail; + ir->rc = mceusb_init_rc_dev(ir); + if (!ir->rc) + goto rc_dev_fail; /* flush buffers on the device */ mce_sync_in(ir, NULL, maxp); @@ -1235,7 +1215,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, mceusb_get_parameters(ir); if (!ir->flags.no_tx) - mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); + mceusb_set_tx_mask(ir->rc, MCE_DEFAULT_TX_MASK); usb_set_intfdata(intf, ir); @@ -1245,7 +1225,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, return 0; /* Error-handling path */ -input_dev_fail: +rc_dev_fail: usb_free_urb(ir->urb_in); urb_in_alloc_fail: usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in); @@ -1269,7 +1249,7 @@ static void __devexit mceusb_dev_disconnect(struct usb_interface *intf) return; ir->usbdev = NULL; - ir_input_unregister(ir->idev); + rc_unregister_device(ir->rc); usb_kill_urb(ir->urb_in); usb_free_urb(ir->urb_in); usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index acc729c79cec..0ce328f9dacf 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -476,9 +475,9 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) * always set CP as 0x81 * set CC by SPEC, CC = 3MHz/carrier - 1 */ -static int nvt_set_tx_carrier(void *data, u32 carrier) +static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier) { - struct nvt_dev *nvt = data; + struct nvt_dev *nvt = dev->priv; u16 val; nvt_cir_reg_write(nvt, 1, CIR_CP); @@ -509,9 +508,9 @@ static int nvt_set_tx_carrier(void *data, u32 carrier) * number may larger than TXFCONT (0xff). So in interrupt_handler, it has to * set TXFCONT as 0xff, until buf_count less than 0xff. */ -static int nvt_tx_ir(void *priv, int *txbuf, u32 n) +static int nvt_tx_ir(struct rc_dev *dev, int *txbuf, u32 n) { - struct nvt_dev *nvt = priv; + struct nvt_dev *nvt = dev->priv; unsigned long flags; size_t cur_count; unsigned int i; @@ -948,9 +947,9 @@ static void nvt_disable_cir(struct nvt_dev *nvt) nvt_efm_disable(nvt); } -static int nvt_open(void *data) +static int nvt_open(struct rc_dev *dev) { - struct nvt_dev *nvt = (struct nvt_dev *)data; + struct nvt_dev *nvt = dev->priv; unsigned long flags; spin_lock_irqsave(&nvt->nvt_lock, flags); @@ -961,9 +960,9 @@ static int nvt_open(void *data) return 0; } -static void nvt_close(void *data) +static void nvt_close(struct rc_dev *dev) { - struct nvt_dev *nvt = (struct nvt_dev *)data; + struct nvt_dev *nvt = dev->priv; unsigned long flags; spin_lock_irqsave(&nvt->nvt_lock, flags); @@ -975,21 +974,16 @@ static void nvt_close(void *data) /* Allocate memory, probe hardware, and initialize everything */ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) { - struct nvt_dev *nvt = NULL; - struct input_dev *rdev = NULL; - struct ir_dev_props *props = NULL; + struct nvt_dev *nvt; + struct rc_dev *rdev; int ret = -ENOMEM; nvt = kzalloc(sizeof(struct nvt_dev), GFP_KERNEL); if (!nvt) return ret; - props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); - if (!props) - goto failure; - /* input device for IR remote (and tx) */ - rdev = input_allocate_device(); + rdev = rc_allocate_device(); if (!rdev) goto failure; @@ -1063,41 +1057,38 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) nvt_cir_regs_init(nvt); nvt_cir_wake_regs_init(nvt); - /* Set up ir-core props */ - props->priv = nvt; - props->driver_type = RC_DRIVER_IR_RAW; - props->allowed_protos = IR_TYPE_ALL; - props->open = nvt_open; - props->close = nvt_close; + /* Set up the rc device */ + rdev->priv = nvt; + rdev->driver_type = RC_DRIVER_IR_RAW; + rdev->allowed_protos = IR_TYPE_ALL; + rdev->open = nvt_open; + rdev->close = nvt_close; + rdev->tx_ir = nvt_tx_ir; + rdev->s_tx_carrier = nvt_set_tx_carrier; + rdev->input_name = "Nuvoton w836x7hg Infrared Remote Transceiver"; + rdev->input_id.bustype = BUS_HOST; + rdev->input_id.vendor = PCI_VENDOR_ID_WINBOND2; + rdev->input_id.product = nvt->chip_major; + rdev->input_id.version = nvt->chip_minor; + rdev->driver_name = NVT_DRIVER_NAME; + rdev->map_name = RC_MAP_RC6_MCE; #if 0 - props->min_timeout = XYZ; - props->max_timeout = XYZ; - props->timeout = XYZ; + rdev->min_timeout = XYZ; + rdev->max_timeout = XYZ; + rdev->timeout = XYZ; /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ - props->rx_resolution = XYZ; - + rdev->rx_resolution = XYZ; /* tx bits */ - props->tx_resolution = XYZ; + rdev->tx_resolution = XYZ; #endif - props->tx_ir = nvt_tx_ir; - props->s_tx_carrier = nvt_set_tx_carrier; - - rdev->name = "Nuvoton w836x7hg Infrared Remote Transceiver"; - rdev->id.bustype = BUS_HOST; - rdev->id.vendor = PCI_VENDOR_ID_WINBOND2; - rdev->id.product = nvt->chip_major; - rdev->id.version = nvt->chip_minor; - - nvt->props = props; - nvt->rdev = rdev; - device_set_wakeup_capable(&pdev->dev, 1); - device_set_wakeup_enable(&pdev->dev, 1); - - ret = ir_input_register(rdev, RC_MAP_RC6_MCE, props, NVT_DRIVER_NAME); + ret = rc_register_device(rdev); if (ret) goto failure; + device_set_wakeup_capable(&pdev->dev, 1); + device_set_wakeup_enable(&pdev->dev, 1); + nvt->rdev = rdev; nvt_pr(KERN_NOTICE, "driver has been successfully loaded\n"); if (debug) { cir_dump_regs(nvt); @@ -1117,8 +1108,7 @@ failure: if (nvt->cir_wake_addr) release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); - input_free_device(rdev); - kfree(props); + rc_free_device(rdev); kfree(nvt); return ret; @@ -1143,9 +1133,8 @@ static void __devexit nvt_remove(struct pnp_dev *pdev) release_region(nvt->cir_addr, CIR_IOREG_LENGTH); release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH); - ir_input_unregister(nvt->rdev); + rc_unregister_device(nvt->rdev); - kfree(nvt->props); kfree(nvt); } diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 62dc53017c8e..1df82351cb03 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h @@ -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; diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 4be075780ad0..3616c32d3f87 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -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); diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 67a6bd5d9497..5b67eea96ebb 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -20,11 +20,6 @@ #include #include "rc-core-priv.h" -#define IRRCV_NUM_DEVICES 256 - -/* bit array to represent IR sysfs device number */ -static unsigned long ir_core_dev_number; - /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ #define IR_TAB_MIN_SIZE 256 #define IR_TAB_MAX_SIZE 8192 @@ -36,12 +31,6 @@ static unsigned long ir_core_dev_number; static LIST_HEAD(rc_map_list); static DEFINE_SPINLOCK(rc_map_lock); -/* Forward declarations */ -static int ir_register_class(struct input_dev *input_dev); -static void ir_unregister_class(struct input_dev *input_dev); -static int ir_register_input(struct input_dev *input_dev); - - static struct rc_keymap *seek_rc_map(const char *name) { struct rc_keymap *map = NULL; @@ -127,7 +116,7 @@ static struct rc_keymap empty_map = { * @return: zero on success or a negative error code * * This routine will initialize the ir_scancode_table and will allocate - * memory to hold at least the specified number elements. + * memory to hold at least the specified number of elements. */ static int ir_create_table(struct ir_scancode_table *rc_tab, const char *name, u64 ir_type, size_t size) @@ -209,16 +198,16 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab, gfp_t gfp_flags) /** * ir_update_mapping() - set a keycode in the scancode->keycode table - * @dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @rc_tab: scancode table to be adjusted * @index: index of the mapping that needs to be updated * @keycode: the desired keycode * @return: previous keycode assigned to the mapping * - * This routine is used to update scancode->keycopde mapping at given + * This routine is used to update scancode->keycode mapping at given * position. */ -static unsigned int ir_update_mapping(struct input_dev *dev, +static unsigned int ir_update_mapping(struct rc_dev *dev, struct ir_scancode_table *rc_tab, unsigned int index, unsigned int new_keycode) @@ -239,16 +228,16 @@ static unsigned int ir_update_mapping(struct input_dev *dev, old_keycode == KEY_RESERVED ? "New" : "Replacing", rc_tab->scan[index].scancode, new_keycode); rc_tab->scan[index].keycode = new_keycode; - __set_bit(new_keycode, dev->keybit); + __set_bit(new_keycode, dev->input_dev->keybit); } if (old_keycode != KEY_RESERVED) { /* A previous mapping was updated... */ - __clear_bit(old_keycode, dev->keybit); + __clear_bit(old_keycode, dev->input_dev->keybit); /* ... but another scancode might use the same keycode */ for (i = 0; i < rc_tab->len; i++) { if (rc_tab->scan[i].keycode == old_keycode) { - __set_bit(old_keycode, dev->keybit); + __set_bit(old_keycode, dev->input_dev->keybit); break; } } @@ -262,7 +251,7 @@ static unsigned int ir_update_mapping(struct input_dev *dev, /** * ir_establish_scancode() - set a keycode in the scancode->keycode table - * @ir_dev: the struct ir_input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @rc_tab: scancode table to be searched * @scancode: the desired scancode * @resize: controls whether we allowed to resize the table to @@ -274,7 +263,7 @@ static unsigned int ir_update_mapping(struct input_dev *dev, * If scancode is not yet present the routine will allocate a new slot * for it. */ -static unsigned int ir_establish_scancode(struct ir_input_dev *ir_dev, +static unsigned int ir_establish_scancode(struct rc_dev *dev, struct ir_scancode_table *rc_tab, unsigned int scancode, bool resize) @@ -286,10 +275,11 @@ static unsigned int ir_establish_scancode(struct ir_input_dev *ir_dev, * all bits for the complete IR code. In general, they provide only * the command part of the IR code. Yet, as it is possible to replace * the provided IR with another one, it is needed to allow loading - * IR tables from other remotes. So, + * IR tables from other remotes. So, we support specifying a mask to + * indicate the valid bits of the scancodes. */ - if (ir_dev->props && ir_dev->props->scanmask) - scancode &= ir_dev->props->scanmask; + if (dev->scanmask) + scancode &= dev->scanmask; /* First check if we already have a mapping for this ir command */ for (i = 0; i < rc_tab->len; i++) { @@ -320,19 +310,19 @@ static unsigned int ir_establish_scancode(struct ir_input_dev *ir_dev, /** * ir_setkeycode() - set a keycode in the scancode->keycode table - * @dev: the struct input_dev device descriptor + * @idev: the struct input_dev device descriptor * @scancode: the desired scancode * @keycode: result * @return: -EINVAL if the keycode could not be inserted, otherwise zero. * * This routine is used to handle evdev EVIOCSKEY ioctl. */ -static int ir_setkeycode(struct input_dev *dev, +static int ir_setkeycode(struct input_dev *idev, const struct input_keymap_entry *ke, unsigned int *old_keycode) { - struct ir_input_dev *ir_dev = input_get_drvdata(dev); - struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; + struct rc_dev *rdev = input_get_drvdata(idev); + struct ir_scancode_table *rc_tab = &rdev->rc_tab; unsigned int index; unsigned int scancode; int retval; @@ -351,14 +341,14 @@ static int ir_setkeycode(struct input_dev *dev, if (retval) goto out; - index = ir_establish_scancode(ir_dev, rc_tab, scancode, true); + index = ir_establish_scancode(rdev, rc_tab, scancode, true); if (index >= rc_tab->len) { retval = -ENOMEM; goto out; } } - *old_keycode = ir_update_mapping(dev, rc_tab, index, ke->keycode); + *old_keycode = ir_update_mapping(rdev, rc_tab, index, ke->keycode); out: spin_unlock_irqrestore(&rc_tab->lock, flags); @@ -367,22 +357,22 @@ out: /** * ir_setkeytable() - sets several entries in the scancode->keycode table - * @dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @to: the struct ir_scancode_table to copy entries to * @from: the struct ir_scancode_table to copy entries from * @return: -ENOMEM if all keycodes could not be inserted, otherwise zero. * * This routine is used to handle table initialization. */ -static int ir_setkeytable(struct ir_input_dev *ir_dev, +static int ir_setkeytable(struct rc_dev *dev, const struct ir_scancode_table *from) { - struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; + struct ir_scancode_table *rc_tab = &dev->rc_tab; unsigned int i, index; int rc; - rc = ir_create_table(&ir_dev->rc_tab, - from->name, from->ir_type, from->size); + rc = ir_create_table(rc_tab, from->name, + from->ir_type, from->size); if (rc) return rc; @@ -390,14 +380,14 @@ static int ir_setkeytable(struct ir_input_dev *ir_dev, rc_tab->size, rc_tab->alloc); for (i = 0; i < from->size; i++) { - index = ir_establish_scancode(ir_dev, rc_tab, + index = ir_establish_scancode(dev, rc_tab, from->scan[i].scancode, false); if (index >= rc_tab->len) { rc = -ENOMEM; break; } - ir_update_mapping(ir_dev->input_dev, rc_tab, index, + ir_update_mapping(dev, rc_tab, index, from->scan[i].keycode); } @@ -409,7 +399,7 @@ static int ir_setkeytable(struct ir_input_dev *ir_dev, /** * ir_lookup_by_scancode() - locate mapping by scancode - * @rc_tab: the &struct ir_scancode_table to search + * @rc_tab: the struct ir_scancode_table to search * @scancode: scancode to look for in the table * @return: index in the table, -1U if not found * @@ -438,18 +428,18 @@ static unsigned int ir_lookup_by_scancode(const struct ir_scancode_table *rc_tab /** * ir_getkeycode() - get a keycode from the scancode->keycode table - * @dev: the struct input_dev device descriptor + * @idev: the struct input_dev device descriptor * @scancode: the desired scancode * @keycode: used to return the keycode, if found, or KEY_RESERVED * @return: always returns zero. * * This routine is used to handle evdev EVIOCGKEY ioctl. */ -static int ir_getkeycode(struct input_dev *dev, +static int ir_getkeycode(struct input_dev *idev, struct input_keymap_entry *ke) { - struct ir_input_dev *ir_dev = input_get_drvdata(dev); - struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; + struct rc_dev *rdev = input_get_drvdata(idev); + struct ir_scancode_table *rc_tab = &rdev->rc_tab; struct ir_scancode *entry; unsigned long flags; unsigned int index; @@ -492,18 +482,17 @@ out: /** * ir_g_keycode_from_table() - gets the keycode that corresponds to a scancode - * @input_dev: the struct input_dev descriptor of the device - * @scancode: the scancode that we're seeking + * @dev: the struct rc_dev descriptor of the device + * @scancode: the scancode to look for + * @return: the corresponding keycode, or KEY_RESERVED * - * This routine is used by the input routines when a key is pressed at the - * IR. The scancode is received and needs to be converted into a keycode. - * If the key is not found, it returns KEY_RESERVED. Otherwise, returns the - * corresponding keycode from the table. + * This routine is used by drivers which need to convert a scancode to a + * keycode. Normally it should not be used since drivers should have no + * interest in keycodes. */ -u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) +u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode) { - struct ir_input_dev *ir_dev = input_get_drvdata(dev); - struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; + struct ir_scancode_table *rc_tab = &dev->rc_tab; unsigned int keycode; unsigned int index; unsigned long flags; @@ -518,7 +507,7 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) if (keycode != KEY_RESERVED) IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", - dev->name, scancode, keycode); + dev->input_name, scancode, keycode); return keycode; } @@ -526,50 +515,49 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); /** * ir_do_keyup() - internal function to signal the release of a keypress - * @ir: the struct ir_input_dev descriptor of the device + * @dev: the struct rc_dev descriptor of the device * * This function is used internally to release a keypress, it must be * called with keylock held. */ -static void ir_do_keyup(struct ir_input_dev *ir) +static void ir_do_keyup(struct rc_dev *dev) { - if (!ir->keypressed) + if (!dev->keypressed) return; - IR_dprintk(1, "keyup key 0x%04x\n", ir->last_keycode); - input_report_key(ir->input_dev, ir->last_keycode, 0); - input_sync(ir->input_dev); - ir->keypressed = false; + IR_dprintk(1, "keyup key 0x%04x\n", dev->last_keycode); + input_report_key(dev->input_dev, dev->last_keycode, 0); + input_sync(dev->input_dev); + dev->keypressed = false; } /** - * ir_keyup() - generates input event to signal the release of a keypress - * @dev: the struct input_dev descriptor of the device + * ir_keyup() - signals the release of a keypress + * @dev: the struct rc_dev descriptor of the device * * This routine is used to signal that a key has been released on the * remote control. */ -void ir_keyup(struct input_dev *dev) +void ir_keyup(struct rc_dev *dev) { unsigned long flags; - struct ir_input_dev *ir = input_get_drvdata(dev); - spin_lock_irqsave(&ir->keylock, flags); - ir_do_keyup(ir); - spin_unlock_irqrestore(&ir->keylock, flags); + spin_lock_irqsave(&dev->keylock, flags); + ir_do_keyup(dev); + spin_unlock_irqrestore(&dev->keylock, flags); } EXPORT_SYMBOL_GPL(ir_keyup); /** * ir_timer_keyup() - generates a keyup event after a timeout - * @cookie: a pointer to struct ir_input_dev passed to setup_timer() + * @cookie: a pointer to the struct rc_dev for the device * * This routine will generate a keyup event some time after a keydown event * is generated when no further activity has been detected. */ static void ir_timer_keyup(unsigned long cookie) { - struct ir_input_dev *ir = (struct ir_input_dev *)cookie; + struct rc_dev *dev = (struct rc_dev *)cookie; unsigned long flags; /* @@ -582,43 +570,42 @@ static void ir_timer_keyup(unsigned long cookie) * to allow the input subsystem to do its auto-repeat magic or * a keyup event might follow immediately after the keydown. */ - spin_lock_irqsave(&ir->keylock, flags); - if (time_is_before_eq_jiffies(ir->keyup_jiffies)) - ir_do_keyup(ir); - spin_unlock_irqrestore(&ir->keylock, flags); + spin_lock_irqsave(&dev->keylock, flags); + if (time_is_before_eq_jiffies(dev->keyup_jiffies)) + ir_do_keyup(dev); + spin_unlock_irqrestore(&dev->keylock, flags); } /** - * ir_repeat() - notifies the IR core that a key is still pressed - * @dev: the struct input_dev descriptor of the device + * ir_repeat() - signals that a key is still pressed + * @dev: the struct rc_dev descriptor of the device * * This routine is used by IR decoders when a repeat message which does * not include the necessary bits to reproduce the scancode has been * received. */ -void ir_repeat(struct input_dev *dev) +void ir_repeat(struct rc_dev *dev) { unsigned long flags; - struct ir_input_dev *ir = input_get_drvdata(dev); - spin_lock_irqsave(&ir->keylock, flags); + spin_lock_irqsave(&dev->keylock, flags); - input_event(dev, EV_MSC, MSC_SCAN, ir->last_scancode); + input_event(dev->input_dev, EV_MSC, MSC_SCAN, dev->last_scancode); - if (!ir->keypressed) + if (!dev->keypressed) goto out; - ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); - mod_timer(&ir->timer_keyup, ir->keyup_jiffies); + dev->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + mod_timer(&dev->timer_keyup, dev->keyup_jiffies); out: - spin_unlock_irqrestore(&ir->keylock, flags); + spin_unlock_irqrestore(&dev->keylock, flags); } EXPORT_SYMBOL_GPL(ir_repeat); /** * ir_do_keydown() - internal function to process a keypress - * @dev: the struct input_dev descriptor of the device + * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode of the keypress * @keycode: the keycode of the keypress * @toggle: the toggle value of the keypress @@ -626,231 +613,96 @@ EXPORT_SYMBOL_GPL(ir_repeat); * This function is used internally to register a keypress, it must be * called with keylock held. */ -static void ir_do_keydown(struct input_dev *dev, int scancode, +static void ir_do_keydown(struct rc_dev *dev, int scancode, u32 keycode, u8 toggle) { - struct ir_input_dev *ir = input_get_drvdata(dev); - - input_event(dev, EV_MSC, MSC_SCAN, scancode); + input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); /* Repeat event? */ - if (ir->keypressed && - ir->last_scancode == scancode && - ir->last_toggle == toggle) + if (dev->keypressed && + dev->last_scancode == scancode && + dev->last_toggle == toggle) return; /* Release old keypress */ - ir_do_keyup(ir); + ir_do_keyup(dev); - ir->last_scancode = scancode; - ir->last_toggle = toggle; - ir->last_keycode = keycode; + dev->last_scancode = scancode; + dev->last_toggle = toggle; + dev->last_keycode = keycode; if (keycode == KEY_RESERVED) return; /* Register a keypress */ - ir->keypressed = true; + dev->keypressed = true; IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n", - dev->name, keycode, scancode); - input_report_key(dev, ir->last_keycode, 1); - input_sync(dev); + dev->input_name, keycode, scancode); + input_report_key(dev->input_dev, dev->last_keycode, 1); + input_sync(dev->input_dev); } /** * ir_keydown() - generates input event for a key press - * @dev: the struct input_dev descriptor of the device + * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode that we're seeking * @toggle: the toggle value (protocol dependent, if the protocol doesn't * support toggle values, this should be set to zero) * - * This routine is used by the input routines when a key is pressed at the - * IR. It gets the keycode for a scancode and reports an input event via - * input_report_key(). + * This routine is used to signal that a key has been pressed on the + * remote control. */ -void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) +void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle) { unsigned long flags; - struct ir_input_dev *ir = input_get_drvdata(dev); u32 keycode = ir_g_keycode_from_table(dev, scancode); - spin_lock_irqsave(&ir->keylock, flags); + spin_lock_irqsave(&dev->keylock, flags); ir_do_keydown(dev, scancode, keycode, toggle); - if (ir->keypressed) { - ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); - mod_timer(&ir->timer_keyup, ir->keyup_jiffies); + if (dev->keypressed) { + dev->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + mod_timer(&dev->timer_keyup, dev->keyup_jiffies); } - spin_unlock_irqrestore(&ir->keylock, flags); + spin_unlock_irqrestore(&dev->keylock, flags); } EXPORT_SYMBOL_GPL(ir_keydown); /** * ir_keydown_notimeout() - generates input event for a key press without * an automatic keyup event at a later time - * @dev: the struct input_dev descriptor of the device + * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode that we're seeking * @toggle: the toggle value (protocol dependent, if the protocol doesn't * support toggle values, this should be set to zero) * - * This routine is used by the input routines when a key is pressed at the - * IR. It gets the keycode for a scancode and reports an input event via - * input_report_key(). The driver must manually call ir_keyup() at a later - * stage. + * This routine is used to signal that a key has been pressed on the + * remote control. The driver must manually call ir_keyup() at a later stage. */ -void ir_keydown_notimeout(struct input_dev *dev, int scancode, u8 toggle) +void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle) { unsigned long flags; - struct ir_input_dev *ir = input_get_drvdata(dev); u32 keycode = ir_g_keycode_from_table(dev, scancode); - spin_lock_irqsave(&ir->keylock, flags); + spin_lock_irqsave(&dev->keylock, flags); ir_do_keydown(dev, scancode, keycode, toggle); - spin_unlock_irqrestore(&ir->keylock, flags); + spin_unlock_irqrestore(&dev->keylock, flags); } EXPORT_SYMBOL_GPL(ir_keydown_notimeout); -static int ir_open(struct input_dev *input_dev) -{ - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - - return ir_dev->props->open(ir_dev->props->priv); -} - -static void ir_close(struct input_dev *input_dev) -{ - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - - ir_dev->props->close(ir_dev->props->priv); -} - -/** - * __ir_input_register() - sets the IR keycode table and add the handlers - * for keymap table get/set - * @input_dev: the struct input_dev descriptor of the device - * @rc_tab: the struct ir_scancode_table table of scancode/keymap - * - * This routine is used to initialize the input infrastructure - * to work with an IR. - * It will register the input/evdev interface for the device and - * register the syfs code for IR class - */ -int __ir_input_register(struct input_dev *input_dev, - const struct ir_scancode_table *rc_tab, - struct ir_dev_props *props, - const char *driver_name) +static int ir_open(struct input_dev *idev) { - struct ir_input_dev *ir_dev; - int rc; - - if (rc_tab->scan == NULL || !rc_tab->size) - return -EINVAL; - - ir_dev = kzalloc(sizeof(*ir_dev), GFP_KERNEL); - if (!ir_dev) - return -ENOMEM; - - ir_dev->driver_name = kasprintf(GFP_KERNEL, "%s", driver_name); - if (!ir_dev->driver_name) { - rc = -ENOMEM; - goto out_dev; - } - - input_dev->getkeycode_new = ir_getkeycode; - input_dev->setkeycode_new = ir_setkeycode; - input_set_drvdata(input_dev, ir_dev); - ir_dev->input_dev = input_dev; - - spin_lock_init(&ir_dev->rc_tab.lock); - spin_lock_init(&ir_dev->keylock); - setup_timer(&ir_dev->timer_keyup, ir_timer_keyup, (unsigned long)ir_dev); - - if (props) { - ir_dev->props = props; - if (props->open) - input_dev->open = ir_open; - if (props->close) - input_dev->close = ir_close; - } - - set_bit(EV_KEY, input_dev->evbit); - set_bit(EV_REP, input_dev->evbit); - set_bit(EV_MSC, input_dev->evbit); - set_bit(MSC_SCAN, input_dev->mscbit); - - rc = ir_setkeytable(ir_dev, rc_tab); - if (rc) - goto out_name; + struct rc_dev *rdev = input_get_drvdata(idev); - rc = ir_register_class(input_dev); - if (rc < 0) - goto out_table; - - if (ir_dev->props) - if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) { - rc = ir_raw_event_register(input_dev); - if (rc < 0) - goto out_event; - } - - rc = ir_register_input(input_dev); - if (rc < 0) - goto out_event; - - IR_dprintk(1, "Registered input device on %s for %s remote%s.\n", - driver_name, rc_tab->name, - (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? - " in raw mode" : ""); - - /* - * Default delay of 250ms is too short for some protocols, expecially - * since the timeout is currently set to 250ms. Increase it to 500ms, - * to avoid wrong repetition of the keycodes. - */ - input_dev->rep[REP_DELAY] = 500; - - return 0; - -out_event: - ir_unregister_class(input_dev); -out_table: - ir_free_table(&ir_dev->rc_tab); -out_name: - kfree(ir_dev->driver_name); -out_dev: - kfree(ir_dev); - return rc; + return rdev->open(rdev); } -EXPORT_SYMBOL_GPL(__ir_input_register); - -/** - * ir_input_unregister() - unregisters IR and frees resources - * @input_dev: the struct input_dev descriptor of the device - * This routine is used to free memory and de-register interfaces. - */ -void ir_input_unregister(struct input_dev *input_dev) +static void ir_close(struct input_dev *idev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - - if (!ir_dev) - return; - - IR_dprintk(1, "Freed keycode table\n"); + struct rc_dev *rdev = input_get_drvdata(idev); - del_timer_sync(&ir_dev->timer_keyup); - if (ir_dev->props) - if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) - ir_raw_event_unregister(input_dev); - - ir_free_table(&ir_dev->rc_tab); - - ir_unregister_class(input_dev); - - kfree(ir_dev->driver_name); - kfree(ir_dev); + rdev->close(rdev); } -EXPORT_SYMBOL_GPL(ir_input_unregister); /* class for /sys/class/rc */ static char *ir_devnode(struct device *dev, mode_t *mode) @@ -881,7 +733,7 @@ static struct { /** * show_protocols() - shows the current IR protocol(s) - * @d: the device descriptor + * @device: the device descriptor * @mattr: the device attribute struct (unused) * @buf: a pointer to the output buffer * @@ -890,26 +742,25 @@ static struct { * It returns the protocol names of supported protocols. * Enabled protocols are printed in brackets. */ -static ssize_t show_protocols(struct device *d, +static ssize_t show_protocols(struct device *device, struct device_attribute *mattr, char *buf) { - struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct rc_dev *dev = to_rc_dev(device); u64 allowed, enabled; char *tmp = buf; int i; /* Device is being removed */ - if (!ir_dev) + if (!dev) return -EINVAL; - if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { - enabled = ir_dev->rc_tab.ir_type; - allowed = ir_dev->props->allowed_protos; - } else if (ir_dev->raw) { - enabled = ir_dev->raw->enabled_protocols; + if (dev->driver_type == RC_DRIVER_SCANCODE) { + enabled = dev->rc_tab.ir_type; + allowed = dev->allowed_protos; + } else { + enabled = dev->raw->enabled_protocols; allowed = ir_raw_get_allowed_protocols(); - } else - return sprintf(tmp, "[builtin]\n"); + } IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", (long long)allowed, @@ -930,12 +781,12 @@ static ssize_t show_protocols(struct device *d, /** * store_protocols() - changes the current IR protocol(s) - * @d: the device descriptor + * @device: the device descriptor * @mattr: the device attribute struct (unused) * @buf: a pointer to the input buffer * @len: length of the input buffer * - * This routine is a callback routine for changing the IR protocol type. + * This routine is for changing the IR protocol type. * It is trigged by writing to /sys/class/rc/rc?/protocols. * Writing "+proto" will add a protocol to the list of enabled protocols. * Writing "-proto" will remove a protocol from the list of enabled protocols. @@ -944,12 +795,12 @@ static ssize_t show_protocols(struct device *d, * Returns -EINVAL if an invalid protocol combination or unknown protocol name * is used, otherwise @len. */ -static ssize_t store_protocols(struct device *d, +static ssize_t store_protocols(struct device *device, struct device_attribute *mattr, const char *data, size_t len) { - struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct rc_dev *dev = to_rc_dev(device); bool enable, disable; const char *tmp; u64 type; @@ -958,13 +809,13 @@ static ssize_t store_protocols(struct device *d, unsigned long flags; /* Device is being removed */ - if (!ir_dev) + if (!dev) return -EINVAL; - if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) - type = ir_dev->rc_tab.ir_type; - else if (ir_dev->raw) - type = ir_dev->raw->enabled_protocols; + if (dev->driver_type == RC_DRIVER_SCANCODE) + type = dev->rc_tab.ir_type; + else if (dev->raw) + type = dev->raw->enabled_protocols; else { IR_dprintk(1, "Protocol switching not supported\n"); return -EINVAL; @@ -1019,9 +870,8 @@ static ssize_t store_protocols(struct device *d, return -EINVAL; } - if (ir_dev->props && ir_dev->props->change_protocol) { - rc = ir_dev->props->change_protocol(ir_dev->props->priv, - type); + if (dev->change_protocol) { + rc = dev->change_protocol(dev, type); if (rc < 0) { IR_dprintk(1, "Error setting protocols to 0x%llx\n", (long long)type); @@ -1029,12 +879,12 @@ static ssize_t store_protocols(struct device *d, } } - if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { - spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); - ir_dev->rc_tab.ir_type = type; - spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); + if (dev->driver_type == RC_DRIVER_SCANCODE) { + spin_lock_irqsave(&dev->rc_tab.lock, flags); + dev->rc_tab.ir_type = type; + spin_unlock_irqrestore(&dev->rc_tab.lock, flags); } else { - ir_dev->raw->enabled_protocols = type; + dev->raw->enabled_protocols = type; } IR_dprintk(1, "Current protocol(s): 0x%llx\n", @@ -1043,6 +893,14 @@ static ssize_t store_protocols(struct device *d, return len; } +static void rc_dev_release(struct device *device) +{ + struct rc_dev *dev = to_rc_dev(device); + + kfree(dev); + module_put(THIS_MODULE); +} + #define ADD_HOTPLUG_VAR(fmt, val...) \ do { \ int err = add_uevent_var(env, fmt, val); \ @@ -1052,12 +910,12 @@ static ssize_t store_protocols(struct device *d, static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) { - struct ir_input_dev *ir_dev = dev_get_drvdata(device); + struct rc_dev *dev = to_rc_dev(device); - if (ir_dev->rc_tab.name) - ADD_HOTPLUG_VAR("NAME=%s", ir_dev->rc_tab.name); - if (ir_dev->driver_name) - ADD_HOTPLUG_VAR("DRV_NAME=%s", ir_dev->driver_name); + if (dev->rc_tab.name) + ADD_HOTPLUG_VAR("NAME=%s", dev->rc_tab.name); + if (dev->driver_name) + ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name); return 0; } @@ -1084,84 +942,162 @@ static const struct attribute_group *rc_dev_attr_groups[] = { static struct device_type rc_dev_type = { .groups = rc_dev_attr_groups, + .release = rc_dev_release, .uevent = rc_dev_uevent, }; -/** - * ir_register_class() - creates the sysfs for /sys/class/rc/rc? - * @input_dev: the struct input_dev descriptor of the device - * - * This routine is used to register the syfs code for IR class - */ -static int ir_register_class(struct input_dev *input_dev) +struct rc_dev *rc_allocate_device(void) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - int devno = find_first_zero_bit(&ir_core_dev_number, - IRRCV_NUM_DEVICES); - - if (unlikely(devno < 0)) - return devno; - - ir_dev->dev.type = &rc_dev_type; - ir_dev->devno = devno; - - ir_dev->dev.class = &ir_input_class; - ir_dev->dev.parent = input_dev->dev.parent; - input_dev->dev.parent = &ir_dev->dev; - dev_set_name(&ir_dev->dev, "rc%d", devno); - dev_set_drvdata(&ir_dev->dev, ir_dev); - return device_register(&ir_dev->dev); -}; + struct rc_dev *dev; -/** - * ir_register_input - registers ir input device with input subsystem - * @input_dev: the struct input_dev descriptor of the device - */ + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return NULL; + + dev->input_dev = input_allocate_device(); + if (!dev->input_dev) { + kfree(dev); + return NULL; + } + + dev->input_dev->getkeycode_new = ir_getkeycode; + dev->input_dev->setkeycode_new = ir_setkeycode; + input_set_drvdata(dev->input_dev, dev); + + spin_lock_init(&dev->rc_tab.lock); + spin_lock_init(&dev->keylock); + setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev); -static int ir_register_input(struct input_dev *input_dev) + dev->dev.type = &rc_dev_type; + dev->dev.class = &ir_input_class; + device_initialize(&dev->dev); + + __module_get(THIS_MODULE); + return dev; +} +EXPORT_SYMBOL_GPL(rc_allocate_device); + +void rc_free_device(struct rc_dev *dev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - int rc; + if (dev) { + input_free_device(dev->input_dev); + put_device(&dev->dev); + } +} +EXPORT_SYMBOL_GPL(rc_free_device); + +int rc_register_device(struct rc_dev *dev) +{ + static atomic_t devno = ATOMIC_INIT(0); + struct ir_scancode_table *rc_tab; const char *path; + int rc; + if (!dev || !dev->map_name) + return -EINVAL; - rc = input_register_device(input_dev); - if (rc < 0) { - device_del(&ir_dev->dev); + rc_tab = get_rc_map(dev->map_name); + if (!rc_tab) + rc_tab = get_rc_map(RC_MAP_EMPTY); + if (!rc_tab || !rc_tab->scan || rc_tab->size == 0) + return -EINVAL; + + set_bit(EV_KEY, dev->input_dev->evbit); + set_bit(EV_REP, dev->input_dev->evbit); + set_bit(EV_MSC, dev->input_dev->evbit); + set_bit(MSC_SCAN, dev->input_dev->mscbit); + if (dev->open) + dev->input_dev->open = ir_open; + if (dev->close) + dev->input_dev->close = ir_close; + + dev->devno = (unsigned long)(atomic_inc_return(&devno) - 1); + dev_set_name(&dev->dev, "rc%ld", dev->devno); + dev_set_drvdata(&dev->dev, dev); + rc = device_add(&dev->dev); + if (rc) return rc; - } - __module_get(THIS_MODULE); + rc = ir_setkeytable(dev, rc_tab); + if (rc) + goto out_dev; + + dev->input_dev->dev.parent = &dev->dev; + memcpy(&dev->input_dev->id, &dev->input_id, sizeof(dev->input_id)); + dev->input_dev->phys = dev->input_phys; + dev->input_dev->name = dev->input_name; + rc = input_register_device(dev->input_dev); + if (rc) + goto out_table; - path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL); + /* + * Default delay of 250ms is too short for some protocols, expecially + * since the timeout is currently set to 250ms. Increase it to 500ms, + * to avoid wrong repetition of the keycodes. Note that this must be + * set after the call to input_register_device(). + */ + dev->input_dev->rep[REP_DELAY] = 500; + + path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); printk(KERN_INFO "%s: %s as %s\n", - dev_name(&ir_dev->dev), - input_dev->name ? input_dev->name : "Unspecified device", + dev_name(&dev->dev), + dev->input_name ? dev->input_name : "Unspecified device", path ? path : "N/A"); kfree(path); - set_bit(ir_dev->devno, &ir_core_dev_number); + if (dev->driver_type == RC_DRIVER_IR_RAW) { + rc = ir_raw_event_register(dev); + if (rc < 0) + goto out_input; + } + + if (dev->change_protocol) { + rc = dev->change_protocol(dev, rc_tab->ir_type); + if (rc < 0) + goto out_raw; + } + + IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n", + dev->devno, + dev->driver_name ? dev->driver_name : "unknown", + rc_tab->name ? rc_tab->name : "unknown", + dev->driver_type == RC_DRIVER_IR_RAW ? "raw" : "cooked"); + return 0; + +out_raw: + if (dev->driver_type == RC_DRIVER_IR_RAW) + ir_raw_event_unregister(dev); +out_input: + input_unregister_device(dev->input_dev); + dev->input_dev = NULL; +out_table: + ir_free_table(&dev->rc_tab); +out_dev: + device_del(&dev->dev); + return rc; } +EXPORT_SYMBOL_GPL(rc_register_device); -/** - * ir_unregister_class() - removes the sysfs for sysfs for - * /sys/class/rc/rc? - * @input_dev: the struct input_dev descriptor of the device - * - * This routine is used to unregister the syfs code for IR class - */ -static void ir_unregister_class(struct input_dev *input_dev) +void rc_unregister_device(struct rc_dev *dev) { - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + if (!dev) + return; - input_set_drvdata(input_dev, NULL); - clear_bit(ir_dev->devno, &ir_core_dev_number); - input_unregister_device(input_dev); - device_del(&ir_dev->dev); + del_timer_sync(&dev->timer_keyup); - module_put(THIS_MODULE); + if (dev->driver_type == RC_DRIVER_IR_RAW) + ir_raw_event_unregister(dev); + + input_unregister_device(dev->input_dev); + dev->input_dev = NULL; + + ir_free_table(&dev->rc_tab); + IR_dprintk(1, "Freed keycode table\n"); + + device_unregister(&dev->dev); } +EXPORT_SYMBOL_GPL(rc_unregister_device); /* * Init/exit code for the module. Basically, creates/removes /sys/class/rc diff --git a/drivers/media/rc/rc-raw.c b/drivers/media/rc/rc-raw.c index d6c556e3f0d8..ab9b1e4071c0 100644 --- a/drivers/media/rc/rc-raw.c +++ b/drivers/media/rc/rc-raw.c @@ -64,7 +64,7 @@ static int ir_raw_event_thread(void *data) mutex_lock(&ir_raw_handler_lock); list_for_each_entry(handler, &ir_raw_handler_list, list) - handler->decode(raw->input_dev, ev); + handler->decode(raw->dev, ev); raw->prev_ev = ev; mutex_unlock(&ir_raw_handler_lock); } @@ -74,7 +74,7 @@ static int ir_raw_event_thread(void *data) /** * ir_raw_event_store() - pass a pulse/space duration to the raw ir decoders - * @input_dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @ev: the struct ir_raw_event descriptor of the pulse/space * * This routine (which may be called from an interrupt context) stores a @@ -82,17 +82,15 @@ static int ir_raw_event_thread(void *data) * signalled as positive values and spaces as negative values. A zero value * will reset the decoding state machines. */ -int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev) +int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); - - if (!ir->raw) + if (!dev->raw) return -EINVAL; IR_dprintk(2, "sample: (%05dus %s)\n", - TO_US(ev->duration), TO_STR(ev->pulse)); + TO_US(ev->duration), TO_STR(ev->pulse)); - if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev)) + if (kfifo_in(&dev->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev)) return -ENOMEM; return 0; @@ -101,7 +99,7 @@ EXPORT_SYMBOL_GPL(ir_raw_event_store); /** * ir_raw_event_store_edge() - notify raw ir decoders of the start of a pulse/space - * @input_dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @type: the type of the event that has occurred * * This routine (which may be called from an interrupt context) is used to @@ -110,50 +108,49 @@ EXPORT_SYMBOL_GPL(ir_raw_event_store); * hardware which does not provide durations directly but only interrupts * (or similar events) on state change. */ -int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type) +int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); ktime_t now; s64 delta; /* ns */ struct ir_raw_event ev; int rc = 0; - if (!ir->raw) + if (!dev->raw) return -EINVAL; now = ktime_get(); - delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event)); + delta = ktime_to_ns(ktime_sub(now, dev->raw->last_event)); /* Check for a long duration since last event or if we're * being called for the first time, note that delta can't * possibly be negative. */ ev.duration = 0; - if (delta > IR_MAX_DURATION || !ir->raw->last_type) + if (delta > IR_MAX_DURATION || !dev->raw->last_type) type |= IR_START_EVENT; else ev.duration = delta; if (type & IR_START_EVENT) - ir_raw_event_reset(input_dev); - else if (ir->raw->last_type & IR_SPACE) { + ir_raw_event_reset(dev); + else if (dev->raw->last_type & IR_SPACE) { ev.pulse = false; - rc = ir_raw_event_store(input_dev, &ev); - } else if (ir->raw->last_type & IR_PULSE) { + rc = ir_raw_event_store(dev, &ev); + } else if (dev->raw->last_type & IR_PULSE) { ev.pulse = true; - rc = ir_raw_event_store(input_dev, &ev); + rc = ir_raw_event_store(dev, &ev); } else return 0; - ir->raw->last_event = now; - ir->raw->last_type = type; + dev->raw->last_event = now; + dev->raw->last_type = type; return rc; } EXPORT_SYMBOL_GPL(ir_raw_event_store_edge); /** * ir_raw_event_store_with_filter() - pass next pulse/space to decoders with some processing - * @input_dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * @type: the type of the event that has occurred * * This routine (which may be called from an interrupt context) works @@ -161,84 +158,76 @@ EXPORT_SYMBOL_GPL(ir_raw_event_store_edge); * This routine is intended for devices with limited internal buffer * It automerges samples of same type, and handles timeouts */ -int ir_raw_event_store_with_filter(struct input_dev *input_dev, - struct ir_raw_event *ev) +int ir_raw_event_store_with_filter(struct rc_dev *dev, struct ir_raw_event *ev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); - struct ir_raw_event_ctrl *raw = ir->raw; - - if (!raw || !ir->props) + if (!dev->raw) return -EINVAL; /* Ignore spaces in idle mode */ - if (ir->idle && !ev->pulse) + if (dev->idle && !ev->pulse) return 0; - else if (ir->idle) - ir_raw_event_set_idle(input_dev, false); - - if (!raw->this_ev.duration) { - raw->this_ev = *ev; - } else if (ev->pulse == raw->this_ev.pulse) { - raw->this_ev.duration += ev->duration; - } else { - ir_raw_event_store(input_dev, &raw->this_ev); - raw->this_ev = *ev; + else if (dev->idle) + ir_raw_event_set_idle(dev, false); + + if (!dev->raw->this_ev.duration) + dev->raw->this_ev = *ev; + else if (ev->pulse == dev->raw->this_ev.pulse) + dev->raw->this_ev.duration += ev->duration; + else { + ir_raw_event_store(dev, &dev->raw->this_ev); + dev->raw->this_ev = *ev; } /* Enter idle mode if nessesary */ - if (!ev->pulse && ir->props->timeout && - raw->this_ev.duration >= ir->props->timeout) { - ir_raw_event_set_idle(input_dev, true); - } + if (!ev->pulse && dev->timeout && + dev->raw->this_ev.duration >= dev->timeout) + ir_raw_event_set_idle(dev, true); + return 0; } EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter); /** - * ir_raw_event_set_idle() - hint the ir core if device is receiving - * IR data or not - * @input_dev: the struct input_dev device descriptor - * @idle: the hint value + * ir_raw_event_set_idle() - provide hint to rc-core when the device is idle or not + * @dev: the struct rc_dev device descriptor + * @idle: whether the device is idle or not */ -void ir_raw_event_set_idle(struct input_dev *input_dev, bool idle) +void ir_raw_event_set_idle(struct rc_dev *dev, bool idle) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); - struct ir_raw_event_ctrl *raw = ir->raw; - - if (!ir->props || !ir->raw) + if (!dev->raw) return; IR_dprintk(2, "%s idle mode\n", idle ? "enter" : "leave"); if (idle) { - raw->this_ev.timeout = true; - ir_raw_event_store(input_dev, &raw->this_ev); - init_ir_raw_event(&raw->this_ev); + dev->raw->this_ev.timeout = true; + ir_raw_event_store(dev, &dev->raw->this_ev); + init_ir_raw_event(&dev->raw->this_ev); } - if (ir->props->s_idle) - ir->props->s_idle(ir->props->priv, idle); - ir->idle = idle; + if (dev->s_idle) + dev->s_idle(dev, idle); + + dev->idle = idle; } EXPORT_SYMBOL_GPL(ir_raw_event_set_idle); /** * ir_raw_event_handle() - schedules the decoding of stored ir data - * @input_dev: the struct input_dev device descriptor + * @dev: the struct rc_dev device descriptor * - * This routine will signal the workqueue to start decoding stored ir data. + * This routine will tell rc-core to start decoding stored ir data. */ -void ir_raw_event_handle(struct input_dev *input_dev) +void ir_raw_event_handle(struct rc_dev *dev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); unsigned long flags; - if (!ir->raw) + if (!dev->raw) return; - spin_lock_irqsave(&ir->raw->lock, flags); - wake_up_process(ir->raw->thread); - spin_unlock_irqrestore(&ir->raw->lock, flags); + spin_lock_irqsave(&dev->raw->lock, flags); + wake_up_process(dev->raw->thread); + spin_unlock_irqrestore(&dev->raw->lock, flags); } EXPORT_SYMBOL_GPL(ir_raw_event_handle); @@ -256,69 +245,69 @@ ir_raw_get_allowed_protocols() /* * Used to (un)register raw event clients */ -int ir_raw_event_register(struct input_dev *input_dev) +int ir_raw_event_register(struct rc_dev *dev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); int rc; struct ir_raw_handler *handler; - ir->raw = kzalloc(sizeof(*ir->raw), GFP_KERNEL); - if (!ir->raw) - return -ENOMEM; + if (!dev) + return -EINVAL; - ir->raw->input_dev = input_dev; + dev->raw = kzalloc(sizeof(*dev->raw), GFP_KERNEL); + if (!dev->raw) + return -ENOMEM; - ir->raw->enabled_protocols = ~0; - rc = kfifo_alloc(&ir->raw->kfifo, sizeof(s64) * MAX_IR_EVENT_SIZE, + dev->raw->dev = dev; + dev->raw->enabled_protocols = ~0; + rc = kfifo_alloc(&dev->raw->kfifo, + sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE, GFP_KERNEL); - if (rc < 0) { - kfree(ir->raw); - ir->raw = NULL; - return rc; - } + if (rc < 0) + goto out; - spin_lock_init(&ir->raw->lock); - ir->raw->thread = kthread_run(ir_raw_event_thread, ir->raw, - "rc%u", (unsigned int)ir->devno); + spin_lock_init(&dev->raw->lock); + dev->raw->thread = kthread_run(ir_raw_event_thread, dev->raw, + "rc%ld", dev->devno); - if (IS_ERR(ir->raw->thread)) { - int ret = PTR_ERR(ir->raw->thread); - - kfree(ir->raw); - ir->raw = NULL; - return ret; + if (IS_ERR(dev->raw->thread)) { + rc = PTR_ERR(dev->raw->thread); + goto out; } mutex_lock(&ir_raw_handler_lock); - list_add_tail(&ir->raw->list, &ir_raw_client_list); + list_add_tail(&dev->raw->list, &ir_raw_client_list); list_for_each_entry(handler, &ir_raw_handler_list, list) if (handler->raw_register) - handler->raw_register(ir->raw->input_dev); + handler->raw_register(dev); mutex_unlock(&ir_raw_handler_lock); return 0; + +out: + kfree(dev->raw); + dev->raw = NULL; + return rc; } -void ir_raw_event_unregister(struct input_dev *input_dev) +void ir_raw_event_unregister(struct rc_dev *dev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); struct ir_raw_handler *handler; - if (!ir->raw) + if (!dev || !dev->raw) return; - kthread_stop(ir->raw->thread); + kthread_stop(dev->raw->thread); mutex_lock(&ir_raw_handler_lock); - list_del(&ir->raw->list); + list_del(&dev->raw->list); list_for_each_entry(handler, &ir_raw_handler_list, list) if (handler->raw_unregister) - handler->raw_unregister(ir->raw->input_dev); + handler->raw_unregister(dev); mutex_unlock(&ir_raw_handler_lock); - kfifo_free(&ir->raw->kfifo); - kfree(ir->raw); - ir->raw = NULL; + kfifo_free(&dev->raw->kfifo); + kfree(dev->raw); + dev->raw = NULL; } /* @@ -333,7 +322,7 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list); if (ir_raw_handler->raw_register) list_for_each_entry(raw, &ir_raw_client_list, list) - ir_raw_handler->raw_register(raw->input_dev); + ir_raw_handler->raw_register(raw->dev); available_protocols |= ir_raw_handler->protocols; mutex_unlock(&ir_raw_handler_lock); @@ -349,7 +338,7 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) list_del(&ir_raw_handler->list); if (ir_raw_handler->raw_unregister) list_for_each_entry(raw, &ir_raw_client_list, list) - ir_raw_handler->raw_unregister(raw->input_dev); + ir_raw_handler->raw_unregister(raw->dev); available_protocols &= ~ir_raw_handler->protocols; mutex_unlock(&ir_raw_handler_lock); } diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 3a20aef67d08..f05f5c173fdf 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -86,13 +85,11 @@ enum StreamzapDecoderState { /* structure to hold our device specific stuff */ struct streamzap_ir { - /* ir-core */ - struct ir_dev_props *props; + struct rc_dev *rdev; /* core device info */ struct device *dev; - struct input_dev *idev; /* usb */ struct usb_device *usbdev; @@ -143,7 +140,7 @@ static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) { dev_dbg(sz->dev, "Storing %s with duration %u us\n", (rawir.pulse ? "pulse" : "space"), rawir.duration); - ir_raw_event_store_with_filter(sz->idev, &rawir); + ir_raw_event_store_with_filter(sz->rdev, &rawir); } static void sz_push_full_pulse(struct streamzap_ir *sz, @@ -271,11 +268,11 @@ static void streamzap_callback(struct urb *urb) DEFINE_IR_RAW_EVENT(rawir); rawir.pulse = false; - rawir.duration = sz->props->timeout; + rawir.duration = sz->rdev->timeout; sz->idle = true; if (sz->timeout_enabled) sz_push(sz, rawir); - ir_raw_event_handle(sz->idev); + ir_raw_event_handle(sz->rdev); } else { sz_push_full_space(sz, sz->buf_in[i]); } @@ -298,57 +295,43 @@ static void streamzap_callback(struct urb *urb) return; } -static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz) +static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) { - struct input_dev *idev; - struct ir_dev_props *props; + struct rc_dev *rdev; struct device *dev = sz->dev; int ret; - idev = input_allocate_device(); - if (!idev) { - dev_err(dev, "remote input dev allocation failed\n"); - goto idev_alloc_failed; - } - - props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); - if (!props) { - dev_err(dev, "remote ir dev props allocation failed\n"); - goto props_alloc_failed; + rdev = rc_allocate_device(); + if (!rdev) { + dev_err(dev, "remote dev allocation failed\n"); + goto out; } snprintf(sz->name, sizeof(sz->name), "Streamzap PC Remote Infrared " "Receiver (%04x:%04x)", le16_to_cpu(sz->usbdev->descriptor.idVendor), le16_to_cpu(sz->usbdev->descriptor.idProduct)); - - idev->name = sz->name; usb_make_path(sz->usbdev, sz->phys, sizeof(sz->phys)); strlcat(sz->phys, "/input0", sizeof(sz->phys)); - idev->phys = sz->phys; - - props->priv = sz; - props->driver_type = RC_DRIVER_IR_RAW; - props->allowed_protos = IR_TYPE_ALL; - - sz->props = props; - usb_to_input_id(sz->usbdev, &idev->id); - idev->dev.parent = sz->dev; + rdev->input_name = sz->name; + rdev->input_phys = sz->phys; + rdev->priv = sz; + rdev->driver_type = RC_DRIVER_IR_RAW; + rdev->allowed_protos = IR_TYPE_ALL; + rdev->driver_name = DRIVER_NAME; + rdev->map_name = RC_MAP_STREAMZAP; - ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); + ret = rc_register_device(rdev); if (ret < 0) { dev_err(dev, "remote input device register failed\n"); - goto irdev_failed; + goto out; } - return idev; + return rdev; -irdev_failed: - kfree(props); -props_alloc_failed: - input_free_device(idev); -idev_alloc_failed: +out: + rc_free_device(rdev); return NULL; } @@ -437,15 +420,15 @@ static int __devinit streamzap_probe(struct usb_interface *intf, snprintf(name + strlen(name), sizeof(name) - strlen(name), " %s", buf); - sz->idev = streamzap_init_input_dev(sz); - if (!sz->idev) - goto input_dev_fail; + sz->rdev = streamzap_init_rc_dev(sz); + if (!sz->rdev) + goto rc_dev_fail; sz->idle = true; sz->decoder_state = PulseSpace; /* FIXME: don't yet have a way to set this */ sz->timeout_enabled = true; - sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & + sz->rdev->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & IR_MAX_DURATION) | 0x03000000); #if 0 /* not yet supported, depends on patches from maxim */ @@ -476,7 +459,7 @@ static int __devinit streamzap_probe(struct usb_interface *intf, return 0; -input_dev_fail: +rc_dev_fail: usb_free_urb(sz->urb_in); free_buf_in: usb_free_coherent(usbdev, maxp, sz->buf_in, sz->dma_in); @@ -507,7 +490,7 @@ static void streamzap_disconnect(struct usb_interface *interface) return; sz->usbdev = NULL; - ir_input_unregister(sz->idev); + rc_unregister_device(sz->rdev); usb_kill_urb(sz->urb_in); usb_free_urb(sz->urb_in); usb_free_coherent(usbdev, sz->buf_in_len, sz->buf_in, sz->dma_in); diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index eb71c3ae36de..4b4f6137c6c5 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -31,10 +31,6 @@ static int ir_debug; module_param(ir_debug, int, 0644); -static int repeat_delay = 500; -module_param(repeat_delay, int, 0644); -static int repeat_period = 33; -module_param(repeat_period, int, 0644); static int ir_rc5_remote_gap = 885; module_param(ir_rc5_remote_gap, int, 0644); @@ -317,15 +313,15 @@ int bttv_input_init(struct bttv *btv) { struct card_ir *ir; char *ir_codes = NULL; - struct input_dev *input_dev; + struct rc_dev *rc; int err = -ENOMEM; if (!btv->has_remote) return -ENODEV; ir = kzalloc(sizeof(*ir),GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) + rc = rc_allocate_device(); + if (!ir || !rc) goto err_out_free; /* detect & configure */ @@ -431,44 +427,43 @@ int bttv_input_init(struct bttv *btv) } /* init input device */ - ir->dev = input_dev; + ir->dev = rc; snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)", btv->c.type); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(btv->c.pci)); - input_dev->name = ir->name; - input_dev->phys = ir->phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->input_id.bustype = BUS_PCI; + rc->input_id.version = 1; if (btv->c.pci->subsystem_vendor) { - input_dev->id.vendor = btv->c.pci->subsystem_vendor; - input_dev->id.product = btv->c.pci->subsystem_device; + rc->input_id.vendor = btv->c.pci->subsystem_vendor; + rc->input_id.product = btv->c.pci->subsystem_device; } else { - input_dev->id.vendor = btv->c.pci->vendor; - input_dev->id.product = btv->c.pci->device; + rc->input_id.vendor = btv->c.pci->vendor; + rc->input_id.product = btv->c.pci->device; } - input_dev->dev.parent = &btv->c.pci->dev; + rc->dev.parent = &btv->c.pci->dev; + rc->map_name = ir_codes; + rc->driver_name = MODULE_NAME; btv->remote = ir; bttv_ir_start(btv, ir); /* all done */ - err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); + err = rc_register_device(rc); if (err) goto err_out_stop; - /* the remote isn't as bouncy as a keyboard */ - ir->dev->rep[REP_DELAY] = repeat_delay; - ir->dev->rep[REP_PERIOD] = repeat_period; - return 0; err_out_stop: bttv_ir_stop(btv); btv->remote = NULL; err_out_free: + rc_free_device(rc); kfree(ir); return err; } @@ -479,7 +474,7 @@ void bttv_input_fini(struct bttv *btv) return; bttv_ir_stop(btv); - ir_input_unregister(btv->remote->dev); + rc_unregister_device(btv->remote->dev); kfree(btv->remote); btv->remote = NULL; } diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index a09cef43d98d..c439e778c4b1 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -607,7 +607,15 @@ struct cx231xx_ir_t { char name[40]; char phys[32]; +#if 0 + /* + * Due to a Kconfig change, cx231xx-input is not being compiled. + * This structure disappeared, but other fixes are also needed. + * So, as a workaround, let's just comment this struct and let a + * latter patch fix it. + */ struct ir_dev_props props; +#endif /* I2C keyboard data */ struct IR_i2c_init_data init_data; diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index bb61870b8d6e..f1bb3a8683c1 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -35,7 +35,6 @@ * 02110-1301, USA. */ -#include #include #include #include @@ -62,16 +61,16 @@ static void cx23885_input_process_measurements(struct cx23885_dev *dev, count = num / sizeof(struct ir_raw_event); for (i = 0; i < count; i++) { - ir_raw_event_store(kernel_ir->inp_dev, + ir_raw_event_store(kernel_ir->rc, &ir_core_event[i]); handle = true; } } while (num != 0); if (overrun) - ir_raw_event_reset(kernel_ir->inp_dev); + ir_raw_event_reset(kernel_ir->rc); else if (handle) - ir_raw_event_handle(kernel_ir->inp_dev); + ir_raw_event_handle(kernel_ir->rc); } void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events) @@ -197,9 +196,9 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev) return 0; } -static int cx23885_input_ir_open(void *priv) +static int cx23885_input_ir_open(struct rc_dev *rc) { - struct cx23885_kernel_ir *kernel_ir = priv; + struct cx23885_kernel_ir *kernel_ir = rc->priv; if (kernel_ir->cx == NULL) return -ENODEV; @@ -234,9 +233,9 @@ static void cx23885_input_ir_stop(struct cx23885_dev *dev) flush_scheduled_work(); } -static void cx23885_input_ir_close(void *priv) +static void cx23885_input_ir_close(struct rc_dev *rc) { - struct cx23885_kernel_ir *kernel_ir = priv; + struct cx23885_kernel_ir *kernel_ir = rc->priv; if (kernel_ir->cx != NULL) cx23885_input_ir_stop(kernel_ir->cx); @@ -245,9 +244,7 @@ static void cx23885_input_ir_close(void *priv) int cx23885_input_init(struct cx23885_dev *dev) { struct cx23885_kernel_ir *kernel_ir; - struct input_dev *inp_dev; - struct ir_dev_props *props; - + struct rc_dev *rc; char *rc_map; enum rc_driver_type driver_type; unsigned long allowed_protos; @@ -294,37 +291,36 @@ int cx23885_input_init(struct cx23885_dev *dev) pci_name(dev->pci)); /* input device */ - inp_dev = input_allocate_device(); - if (inp_dev == NULL) { + rc = rc_allocate_device(); + if (!rc) { ret = -ENOMEM; goto err_out_free; } - kernel_ir->inp_dev = inp_dev; - inp_dev->name = kernel_ir->name; - inp_dev->phys = kernel_ir->phys; - inp_dev->id.bustype = BUS_PCI; - inp_dev->id.version = 1; + kernel_ir->rc = rc; + rc->input_name = kernel_ir->name; + rc->input_phys = kernel_ir->phys; + rc->input_id.bustype = BUS_PCI; + rc->input_id.version = 1; if (dev->pci->subsystem_vendor) { - inp_dev->id.vendor = dev->pci->subsystem_vendor; - inp_dev->id.product = dev->pci->subsystem_device; + rc->input_id.vendor = dev->pci->subsystem_vendor; + rc->input_id.product = dev->pci->subsystem_device; } else { - inp_dev->id.vendor = dev->pci->vendor; - inp_dev->id.product = dev->pci->device; + rc->input_id.vendor = dev->pci->vendor; + rc->input_id.product = dev->pci->device; } - inp_dev->dev.parent = &dev->pci->dev; - - /* kernel ir device properties */ - props = &kernel_ir->props; - props->driver_type = driver_type; - props->allowed_protos = allowed_protos; - props->priv = kernel_ir; - props->open = cx23885_input_ir_open; - props->close = cx23885_input_ir_close; + rc->dev.parent = &dev->pci->dev; + rc->driver_type = driver_type; + rc->allowed_protos = allowed_protos; + rc->priv = kernel_ir; + rc->open = cx23885_input_ir_open; + rc->close = cx23885_input_ir_close; + rc->map_name = rc_map; + rc->driver_name = MODULE_NAME; /* Go */ dev->kernel_ir = kernel_ir; - ret = ir_input_register(inp_dev, rc_map, props, MODULE_NAME); + ret = rc_register_device(rc); if (ret) goto err_out_stop; @@ -333,7 +329,7 @@ int cx23885_input_init(struct cx23885_dev *dev) err_out_stop: cx23885_input_ir_stop(dev); dev->kernel_ir = NULL; - /* TODO: double check clean-up of kernel_ir->inp_dev */ + rc_free_device(rc); err_out_free: kfree(kernel_ir->phys); kfree(kernel_ir->name); @@ -348,7 +344,7 @@ void cx23885_input_fini(struct cx23885_dev *dev) if (dev->kernel_ir == NULL) return; - ir_input_unregister(dev->kernel_ir->inp_dev); + rc_unregister_device(dev->kernel_ir->rc); kfree(dev->kernel_ir->phys); kfree(dev->kernel_ir->name); kfree(dev->kernel_ir); diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index ed94b17dd8a5..f350d88944e8 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h @@ -310,8 +310,7 @@ struct cx23885_kernel_ir { char *name; char *phys; - struct input_dev *inp_dev; - struct ir_dev_props props; + struct rc_dev *rc; }; struct cx23885_dev { diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 8c41124befbd..3b2ef45d6348 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -38,8 +37,7 @@ struct cx88_IR { struct cx88_core *core; - struct input_dev *input; - struct ir_dev_props props; + struct rc_dev *dev; int users; @@ -125,26 +123,26 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) data = (data << 4) | ((gpio_key & 0xf0) >> 4); - ir_keydown(ir->input, data, 0); + ir_keydown(ir->dev, data, 0); } else if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) - ir_keydown_notimeout(ir->input, data, 0); + ir_keydown_notimeout(ir->dev, data, 0); else - ir_keyup(ir->input); + ir_keyup(ir->dev); } else if (ir->mask_keyup) { /* bit cleared on keydown */ if (0 == (gpio & ir->mask_keyup)) - ir_keydown_notimeout(ir->input, data, 0); + ir_keydown_notimeout(ir->dev, data, 0); else - ir_keyup(ir->input); + ir_keyup(ir->dev); } else { /* can't distinguish keydown/up :-/ */ - ir_keydown_notimeout(ir->input, data, 0); - ir_keyup(ir->input); + ir_keydown_notimeout(ir->dev, data, 0); + ir_keyup(ir->dev); } } @@ -219,17 +217,17 @@ void cx88_ir_stop(struct cx88_core *core) __cx88_ir_stop(core); } -static int cx88_ir_open(void *priv) +static int cx88_ir_open(struct rc_dev *rc) { - struct cx88_core *core = priv; + struct cx88_core *core = rc->priv; core->ir->users++; return __cx88_ir_start(core); } -static void cx88_ir_close(void *priv) +static void cx88_ir_close(struct rc_dev *rc) { - struct cx88_core *core = priv; + struct cx88_core *core = rc->priv; core->ir->users--; if (!core->ir->users) @@ -241,7 +239,7 @@ static void cx88_ir_close(void *priv) int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) { struct cx88_IR *ir; - struct input_dev *input_dev; + struct rc_dev *dev; char *ir_codes = NULL; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; @@ -250,11 +248,11 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) */ ir = kzalloc(sizeof(*ir), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) + dev = rc_allocate_device(); + if (!ir || !dev) goto err_out_free; - ir->input = input_dev; + ir->dev = dev; /* detect & configure */ switch (core->boardnr) { @@ -435,43 +433,45 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); - input_dev->name = ir->name; - input_dev->phys = ir->phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + dev->input_name = ir->name; + dev->input_phys = ir->phys; + dev->input_id.bustype = BUS_PCI; + dev->input_id.version = 1; if (pci->subsystem_vendor) { - input_dev->id.vendor = pci->subsystem_vendor; - input_dev->id.product = pci->subsystem_device; + dev->input_id.vendor = pci->subsystem_vendor; + dev->input_id.product = pci->subsystem_device; } else { - input_dev->id.vendor = pci->vendor; - input_dev->id.product = pci->device; + dev->input_id.vendor = pci->vendor; + dev->input_id.product = pci->device; } - input_dev->dev.parent = &pci->dev; - /* record handles to ourself */ - ir->core = core; - core->ir = ir; + dev->dev.parent = &pci->dev; + dev->map_name = ir_codes; + dev->driver_name = MODULE_NAME; + dev->priv = core; + dev->open = cx88_ir_open; + dev->close = cx88_ir_close; + dev->scanmask = hardware_mask; if (ir->sampling) { - ir_type = IR_TYPE_ALL; - ir->props.driver_type = RC_DRIVER_IR_RAW; - ir->props.timeout = 10 * 1000 * 1000; /* 10 ms */ - } else - ir->props.driver_type = RC_DRIVER_SCANCODE; - - ir->props.priv = core; - ir->props.open = cx88_ir_open; - ir->props.close = cx88_ir_close; - ir->props.scanmask = hardware_mask; - ir->props.allowed_protos = ir_type; + dev->driver_type = RC_DRIVER_IR_RAW; + dev->timeout = 10 * 1000 * 1000; /* 10 ms */ + } else { + dev->driver_type = RC_DRIVER_SCANCODE; + dev->allowed_protos = ir_type; + } + + ir->core = core; + core->ir = ir; /* all done */ - err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); + err = rc_register_device(dev); if (err) goto err_out_free; return 0; - err_out_free: +err_out_free: + rc_free_device(dev); core->ir = NULL; kfree(ir); return err; @@ -486,7 +486,7 @@ int cx88_ir_fini(struct cx88_core *core) return 0; cx88_ir_stop(core); - ir_input_unregister(ir->input); + rc_unregister_device(ir->dev); kfree(ir); /* done */ @@ -502,7 +502,6 @@ void cx88_ir_irq(struct cx88_core *core) u32 samples; unsigned todo, bits; struct ir_raw_event ev; - struct ir_input_dev *irdev; if (!ir || !ir->sampling) return; @@ -513,9 +512,8 @@ void cx88_ir_irq(struct cx88_core *core) * represents a pulse. */ samples = cx_read(MO_SAMPLE_IO); - irdev = input_get_drvdata(ir->input); - if (samples == 0xff && irdev->idle) + if (samples == 0xff && ir->dev->idle) return; init_ir_raw_event(&ev); @@ -523,10 +521,10 @@ void cx88_ir_irq(struct cx88_core *core) ev.pulse = samples & 0x80000000 ? false : true; bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); - ir_raw_event_store_with_filter(ir->input, &ev); + ir_raw_event_store_with_filter(ir->dev, &ev); samples <<= bits; } - ir_raw_event_handle(ir->input); + ir_raw_event_handle(ir->dev); } void cx88_i2c_init_ir(struct cx88_core *core) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 6759cd5570dd..b7d3999f0417 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -64,7 +63,7 @@ struct em28xx_ir_poll_result { struct em28xx_IR { struct em28xx *dev; - struct input_dev *input; + struct rc_dev *rc; char name[32]; char phys[32]; @@ -75,10 +74,6 @@ struct em28xx_IR { unsigned int last_readcount; int (*get_key)(struct em28xx_IR *, struct em28xx_ir_poll_result *); - - /* IR device properties */ - - struct ir_dev_props props; }; /********************************************************** @@ -302,12 +297,12 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) poll_result.toggle_bit, poll_result.read_count, poll_result.rc_address, poll_result.rc_data[0]); if (ir->full_code) - ir_keydown(ir->input, + ir_keydown(ir->rc, poll_result.rc_address << 8 | poll_result.rc_data[0], poll_result.toggle_bit); else - ir_keydown(ir->input, + ir_keydown(ir->rc, poll_result.rc_data[0], poll_result.toggle_bit); @@ -331,9 +326,9 @@ static void em28xx_ir_work(struct work_struct *work) schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); } -static int em28xx_ir_start(void *priv) +static int em28xx_ir_start(struct rc_dev *rc) { - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc->priv; INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); schedule_delayed_work(&ir->work, 0); @@ -341,17 +336,17 @@ static int em28xx_ir_start(void *priv) return 0; } -static void em28xx_ir_stop(void *priv) +static void em28xx_ir_stop(struct rc_dev *rc) { - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc->priv; cancel_delayed_work_sync(&ir->work); } -int em28xx_ir_change_protocol(void *priv, u64 ir_type) +int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 ir_type) { int rc = 0; - struct em28xx_IR *ir = priv; + struct em28xx_IR *ir = rc_dev->priv; struct em28xx *dev = ir->dev; u8 ir_config = EM2874_IR_RC5; @@ -391,7 +386,7 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) int em28xx_ir_init(struct em28xx *dev) { struct em28xx_IR *ir; - struct input_dev *input_dev; + struct rc_dev *rc; int err = -ENOMEM; if (dev->board.ir_codes == NULL) { @@ -400,28 +395,27 @@ int em28xx_ir_init(struct em28xx *dev) } ir = kzalloc(sizeof(*ir), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) + rc = rc_allocate_device(); + if (!ir || !rc) goto err_out_free; /* record handles to ourself */ ir->dev = dev; dev->ir = ir; - - ir->input = input_dev; + ir->rc = rc; /* * em2874 supports more protocols. For now, let's just announce * the two protocols that were already tested */ - ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; - ir->props.priv = ir; - ir->props.change_protocol = em28xx_ir_change_protocol; - ir->props.open = em28xx_ir_start; - ir->props.close = em28xx_ir_stop; + rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + rc->priv = ir; + rc->change_protocol = em28xx_ir_change_protocol; + rc->open = em28xx_ir_start; + rc->close = em28xx_ir_stop; /* By default, keep protocol field untouched */ - err = em28xx_ir_change_protocol(ir, IR_TYPE_UNKNOWN); + err = em28xx_ir_change_protocol(rc, IR_TYPE_UNKNOWN); if (err) goto err_out_free; @@ -435,27 +429,27 @@ int em28xx_ir_init(struct em28xx *dev) usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys)); - input_dev->name = ir->name; - input_dev->phys = ir->phys; - input_dev->id.bustype = BUS_USB; - input_dev->id.version = 1; - input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); - input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); - - input_dev->dev.parent = &dev->udev->dev; - - + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->input_id.bustype = BUS_USB; + rc->input_id.version = 1; + rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); + rc->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct); + rc->dev.parent = &dev->udev->dev; + rc->map_name = dev->board.ir_codes; + rc->driver_name = MODULE_NAME; /* all done */ - err = ir_input_register(ir->input, dev->board.ir_codes, - &ir->props, MODULE_NAME); + err = rc_register_device(rc); if (err) goto err_out_stop; return 0; + err_out_stop: dev->ir = NULL; err_out_free: + rc_free_device(rc); kfree(ir); return err; } @@ -468,8 +462,8 @@ int em28xx_ir_fini(struct em28xx *dev) if (!ir) return 0; - em28xx_ir_stop(ir); - ir_input_unregister(ir->input); + em28xx_ir_stop(ir->rc); + rc_unregister_device(ir->rc); kfree(ir); /* done */ diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index a78883a6e0e7..83b59a195230 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -252,7 +252,7 @@ static void ir_key_poll(struct IR_i2c *ir) } if (rc) - ir_keydown(ir->input, ir_key, 0); + ir_keydown(ir->rc, ir_key, 0); } static void ir_work(struct work_struct *work) @@ -271,20 +271,20 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) const char *name = NULL; u64 ir_type = IR_TYPE_UNKNOWN; struct IR_i2c *ir; - struct input_dev *input_dev; + struct rc_dev *rc; struct i2c_adapter *adap = client->adapter; unsigned short addr = client->addr; int err; ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) { + rc = rc_allocate_device(); + if (!ir || !rc) { err = -ENOMEM; goto err_out_free; } ir->c = client; - ir->input = input_dev; + ir->rc = rc; ir->polling_interval = DEFAULT_POLLING_INTERVAL; i2c_set_clientdata(client, ir); @@ -383,16 +383,18 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) dev_name(&client->dev)); /* init + register input device */ - input_dev->id.bustype = BUS_I2C; - input_dev->name = ir->name; - input_dev->phys = ir->phys; + rc->input_id.bustype = BUS_I2C; + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->map_name = ir->ir_codes; + rc->driver_name = MODULE_NAME; - err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); + err = rc_register_device(rc); if (err) goto err_out_free; printk(MODULE_NAME ": %s detected at %s [%s]\n", - ir->input->name, ir->input->phys, adap->name); + ir->name, ir->phys, adap->name); /* start polling via eventd */ INIT_DELAYED_WORK(&ir->work, ir_work); @@ -401,6 +403,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) return 0; err_out_free: + rc_free_device(rc); kfree(ir); return err; } @@ -413,7 +416,7 @@ static int ir_remove(struct i2c_client *client) cancel_delayed_work_sync(&ir->work); /* unregister device */ - ir_input_unregister(ir->input); + rc_unregister_device(ir->rc); /* free memory */ kfree(ir); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 3e37593a328f..fbb2ff171008 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "saa7134-reg.h" @@ -45,14 +44,6 @@ MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=g static int ir_rc5_remote_gap = 885; module_param(ir_rc5_remote_gap, int, 0644); -static int repeat_delay = 500; -module_param(repeat_delay, int, 0644); -MODULE_PARM_DESC(repeat_delay, "delay before key repeat started"); -static int repeat_period = 33; -module_param(repeat_period, int, 0644); -MODULE_PARM_DESC(repeat_period, "repeat period between " - "keypresses when key is down"); - static unsigned int disable_other_ir; module_param(disable_other_ir, int, 0644); MODULE_PARM_DESC(disable_other_ir, "disable full codes of " @@ -523,17 +514,17 @@ void saa7134_ir_stop(struct saa7134_dev *dev) __saa7134_ir_stop(dev); } -static int saa7134_ir_open(void *priv) +static int saa7134_ir_open(struct rc_dev *rc) { - struct saa7134_dev *dev = priv; + struct saa7134_dev *dev = rc->priv; dev->remote->users++; return __saa7134_ir_start(dev); } -static void saa7134_ir_close(void *priv) +static void saa7134_ir_close(struct rc_dev *rc) { - struct saa7134_dev *dev = priv; + struct saa7134_dev *dev = rc->priv; dev->remote->users--; if (!dev->remote->users) @@ -541,9 +532,9 @@ static void saa7134_ir_close(void *priv) } -static int saa7134_ir_change_protocol(void *priv, u64 ir_type) +static int saa7134_ir_change_protocol(struct rc_dev *rc, u64 ir_type) { - struct saa7134_dev *dev = priv; + struct saa7134_dev *dev = rc->priv; struct card_ir *ir = dev->remote; u32 nec_gpio, rc5_gpio; @@ -577,7 +568,7 @@ static int saa7134_ir_change_protocol(void *priv, u64 ir_type) int saa7134_input_init1(struct saa7134_dev *dev) { struct card_ir *ir; - struct input_dev *input_dev; + struct rc_dev *rc; char *ir_codes = NULL; u32 mask_keycode = 0; u32 mask_keydown = 0; @@ -822,13 +813,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) } ir = kzalloc(sizeof(*ir), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ir || !input_dev) { + rc = rc_allocate_device(); + if (!ir || !rc) { err = -ENOMEM; goto err_out_free; } - ir->dev = input_dev; + ir->dev = rc; dev->remote = ir; ir->running = 0; @@ -848,43 +839,40 @@ int saa7134_input_init1(struct saa7134_dev *dev) snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); - - ir->props.priv = dev; - ir->props.open = saa7134_ir_open; - ir->props.close = saa7134_ir_close; - + rc->priv = dev; + rc->open = saa7134_ir_open; + rc->close = saa7134_ir_close; if (raw_decode) - ir->props.driver_type = RC_DRIVER_IR_RAW; + rc->driver_type = RC_DRIVER_IR_RAW; if (!raw_decode && allow_protocol_change) { - ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; - ir->props.change_protocol = saa7134_ir_change_protocol; + rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + rc->change_protocol = saa7134_ir_change_protocol; } - input_dev->name = ir->name; - input_dev->phys = ir->phys; - input_dev->id.bustype = BUS_PCI; - input_dev->id.version = 1; + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->input_id.bustype = BUS_PCI; + rc->input_id.version = 1; if (dev->pci->subsystem_vendor) { - input_dev->id.vendor = dev->pci->subsystem_vendor; - input_dev->id.product = dev->pci->subsystem_device; + rc->input_id.vendor = dev->pci->subsystem_vendor; + rc->input_id.product = dev->pci->subsystem_device; } else { - input_dev->id.vendor = dev->pci->vendor; - input_dev->id.product = dev->pci->device; + rc->input_id.vendor = dev->pci->vendor; + rc->input_id.product = dev->pci->device; } - input_dev->dev.parent = &dev->pci->dev; + rc->dev.parent = &dev->pci->dev; + rc->map_name = ir_codes; + rc->driver_name = MODULE_NAME; - err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); + err = rc_register_device(rc); if (err) goto err_out_free; - /* the remote isn't as bouncy as a keyboard */ - ir->dev->rep[REP_DELAY] = repeat_delay; - ir->dev->rep[REP_PERIOD] = repeat_period; - return 0; err_out_free: + rc_free_device(rc); dev->remote = NULL; kfree(ir); return err; @@ -896,7 +884,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) return; saa7134_ir_stop(dev); - ir_input_unregister(dev->remote->dev); + rc_unregister_device(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; } diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 3e74884da251..3517d20c1310 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -50,7 +50,7 @@ struct tm6000_ir_poll_result { struct tm6000_IR { struct tm6000_core *dev; - struct ir_input_dev *input; + struct rc_dev *rc; char name[32]; char phys[32]; @@ -66,7 +66,6 @@ struct tm6000_IR { /* IR device properties */ u64 ir_type; - struct ir_dev_props props; }; @@ -200,7 +199,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_keydown(ir->input->input_dev, poll_result.rc_data, 0); + ir_keydown(ir->rc, poll_result.rc_data, 0); ir->key = 0; } return; @@ -214,9 +213,9 @@ static void tm6000_ir_work(struct work_struct *work) schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); } -static int tm6000_ir_start(void *priv) +static int tm6000_ir_start(struct rc_dev *rc) { - struct tm6000_IR *ir = priv; + struct tm6000_IR *ir = rc->priv; INIT_DELAYED_WORK(&ir->work, tm6000_ir_work); schedule_delayed_work(&ir->work, 0); @@ -224,16 +223,16 @@ static int tm6000_ir_start(void *priv) return 0; } -static void tm6000_ir_stop(void *priv) +static void tm6000_ir_stop(struct rc_dev *rc) { - struct tm6000_IR *ir = priv; + struct tm6000_IR *ir = rc->priv; cancel_delayed_work_sync(&ir->work); } -int tm6000_ir_change_protocol(void *priv, u64 ir_type) +int tm6000_ir_change_protocol(struct rc_dev *rc, u64 ir_type) { - struct tm6000_IR *ir = priv; + struct tm6000_IR *ir = rc->priv; ir->get_key = default_polling_getkey; @@ -245,9 +244,9 @@ int tm6000_ir_change_protocol(void *priv, u64 ir_type) int tm6000_ir_init(struct tm6000_core *dev) { struct tm6000_IR *ir; - struct ir_input_dev *ir_input_dev; + struct rc_dev *rc; int err = -ENOMEM; - int pipe, size, rc; + int pipe, size; if (!enable_ir) return -ENODEV; @@ -259,24 +258,22 @@ int tm6000_ir_init(struct tm6000_core *dev) return 0; ir = kzalloc(sizeof(*ir), GFP_KERNEL); - ir_input_dev = kzalloc(sizeof(*ir_input_dev), GFP_KERNEL); - ir_input_dev->input_dev = input_allocate_device(); - if (!ir || !ir_input_dev || !ir_input_dev->input_dev) - goto err_out_free; + rc = rc_allocate_device(); + if (!ir | !rc) + goto out; /* record handles to ourself */ ir->dev = dev; dev->ir = ir; - - ir->input = ir_input_dev; + ir->rc = rc; /* input einrichten */ - ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; - ir->props.priv = ir; - ir->props.change_protocol = tm6000_ir_change_protocol; - ir->props.open = tm6000_ir_start; - ir->props.close = tm6000_ir_stop; - ir->props.driver_type = RC_DRIVER_SCANCODE; + rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + rc->priv = ir; + rc->change_protocol = tm6000_ir_change_protocol; + rc->open = tm6000_ir_start; + rc->close = tm6000_ir_stop; + rc->driver_type = RC_DRIVER_SCANCODE; ir->polling = 50; @@ -286,16 +283,17 @@ int tm6000_ir_init(struct tm6000_core *dev) usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys)); - tm6000_ir_change_protocol(ir, IR_TYPE_UNKNOWN); - - ir_input_dev->input_dev->name = ir->name; - ir_input_dev->input_dev->phys = ir->phys; - ir_input_dev->input_dev->id.bustype = BUS_USB; - ir_input_dev->input_dev->id.version = 1; - ir_input_dev->input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); - ir_input_dev->input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); + tm6000_ir_change_protocol(rc, IR_TYPE_UNKNOWN); - ir_input_dev->input_dev->dev.parent = &dev->udev->dev; + rc->input_name = ir->name; + rc->input_phys = ir->phys; + rc->input_id.bustype = BUS_USB; + rc->input_id.version = 1; + rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); + rc->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct); + rc->map_name = dev->ir_codes; + rc->driver_name = "tm6000"; + rc->dev.parent = &dev->udev->dev; if (&dev->int_in) { dprintk("IR over int\n"); @@ -312,35 +310,32 @@ int tm6000_ir_init(struct tm6000_core *dev) ir->int_urb->transfer_buffer = kzalloc(size, GFP_KERNEL); if (ir->int_urb->transfer_buffer == NULL) { usb_free_urb(ir->int_urb); - goto err_out_stop; + goto out; } dprintk("int interval: %d\n", dev->int_in.endp->desc.bInterval); usb_fill_int_urb(ir->int_urb, dev->udev, pipe, ir->int_urb->transfer_buffer, size, tm6000_ir_urb_received, dev, dev->int_in.endp->desc.bInterval); - rc = usb_submit_urb(ir->int_urb, GFP_KERNEL); - if (rc) { + err = usb_submit_urb(ir->int_urb, GFP_KERNEL); + if (err) { kfree(ir->int_urb->transfer_buffer); usb_free_urb(ir->int_urb); - err = rc; - goto err_out_stop; + goto out; } ir->urb_data = kzalloc(size, GFP_KERNEL); } /* ir register */ - err = ir_input_register(ir->input->input_dev, dev->ir_codes, - &ir->props, "tm6000"); + err = rc_register_device(rc); if (err) - goto err_out_stop; + goto out; return 0; -err_out_stop: +out: dev->ir = NULL; -err_out_free: - kfree(ir_input_dev); + rc_free_device(rc); kfree(ir); return err; } @@ -354,7 +349,7 @@ int tm6000_ir_fini(struct tm6000_core *dev) if (!ir) return 0; - ir_input_unregister(ir->input->input_dev); + rc_unregister_device(ir->rc); if (ir->int_urb) { usb_kill_urb(ir->int_urb); @@ -365,8 +360,6 @@ int tm6000_ir_fini(struct tm6000_core *dev) ir->urb_data = NULL; } - kfree(ir->input); - ir->input = NULL; kfree(ir); dev->ir = NULL; diff --git a/include/media/ir-common.h b/include/media/ir-common.h index d1ae869f962c..41fefd9816ea 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -36,12 +36,11 @@ /* this was saa7134_ir and bttv_ir, moved here for * rc5 decoding. */ struct card_ir { - struct input_dev *dev; + struct rc_dev *dev; char name[32]; char phys[32]; int users; u32 running:1; - struct ir_dev_props props; /* Usual gpio signalling */ u32 mask_keycode; diff --git a/include/media/ir-core.h b/include/media/ir-core.h index d41502d9919c..c5909981b075 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -32,21 +32,38 @@ enum rc_driver_type { }; /** - * struct ir_dev_props - Allow caller drivers to set special properties - * @driver_type: specifies if the driver or hardware have already a decoder, - * or if it needs to use the IR raw event decoders to produce a scancode + * struct rc_dev - represents a remote control device + * @dev: driver model's view of this device + * @input_name: name of the input child device + * @input_phys: physical path to the input child device + * @input_id: id of the input child device (struct input_id) + * @driver_name: name of the hardware driver which registered this device + * @map_name: name of the default keymap + * @rc_tab: current scan/key table + * @devno: unique remote control device number + * @raw: additional data for raw pulse/space devices + * @input_dev: the input child device used to communicate events to userspace + * @driver_type: specifies if protocol decoding is done in hardware or software + * @idle: used to keep track of RX state * @allowed_protos: bitmask with the supported IR_TYPE_* protocols * @scanmask: some hardware decoders are not capable of providing the full * scancode to the application. As this is a hardware limit, we can't do * anything with it. Yet, as the same keycode table can be used with other * devices, a mask is provided to allow its usage. Drivers should generally * leave this field in blank + * @priv: driver-specific data + * @keylock: protects the remaining members of the struct + * @keypressed: whether a key is currently pressed + * @keyup_jiffies: time (in jiffies) when the current keypress should be released + * @timer_keyup: timer for releasing a keypress + * @last_keycode: keycode of last keypress + * @last_scancode: scancode of last keypress + * @last_toggle: toggle value of last command * @timeout: optional time after which device stops sending data * @min_timeout: minimum timeout supported by device * @max_timeout: maximum timeout supported by device * @rx_resolution : resolution (in ns) of input sampler * @tx_resolution: resolution (in ns) of output sampler - * @priv: driver-specific data, to be used on the callbacks * @change_protocol: allow changing the protocol used on hardware decoders * @open: callback to allow drivers to enable polling/irq when IR input device * is opened. @@ -57,55 +74,50 @@ enum rc_driver_type { * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) * @s_rx_carrier: inform driver about carrier it is expected to handle * @tx_ir: transmit IR - * @s_idle: optional: enable/disable hardware idle mode, upon which, - device doesn't interrupt host until it sees IR pulses + * @s_idle: enable/disable hardware idle mode, upon which, + * device doesn't interrupt host until it sees IR pulses * @s_learning_mode: enable wide band receiver used for learning * @s_carrier_report: enable carrier reports */ -struct ir_dev_props { - enum rc_driver_type driver_type; - unsigned long allowed_protos; - u32 scanmask; - - u32 timeout; - u32 min_timeout; - u32 max_timeout; - - u32 rx_resolution; - u32 tx_resolution; - - void *priv; - int (*change_protocol)(void *priv, u64 ir_type); - int (*open)(void *priv); - void (*close)(void *priv); - int (*s_tx_mask)(void *priv, u32 mask); - int (*s_tx_carrier)(void *priv, u32 carrier); - int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle); - int (*s_rx_carrier_range)(void *priv, u32 min, u32 max); - int (*tx_ir)(void *priv, int *txbuf, u32 n); - void (*s_idle)(void *priv, bool enable); - int (*s_learning_mode)(void *priv, int enable); - int (*s_carrier_report) (void *priv, int enable); -}; - -struct ir_input_dev { - struct device dev; /* device */ - char *driver_name; /* Name of the driver module */ - struct ir_scancode_table rc_tab; /* scan/key table */ - unsigned long devno; /* device number */ - struct ir_dev_props *props; /* Device properties */ - struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ - struct input_dev *input_dev; /* the input device associated with this device */ +struct rc_dev { + struct device dev; + const char *input_name; + const char *input_phys; + struct input_id input_id; + char *driver_name; + const char *map_name; + struct ir_scancode_table rc_tab; + unsigned long devno; + struct ir_raw_event_ctrl *raw; + struct input_dev *input_dev; + enum rc_driver_type driver_type; bool idle; - - /* key info - needed by IR keycode handlers */ - spinlock_t keylock; /* protects the below members */ - bool keypressed; /* current state */ - unsigned long keyup_jiffies; /* when should the current keypress be released? */ - struct timer_list timer_keyup; /* timer for releasing a keypress */ - u32 last_keycode; /* keycode of last command */ - u32 last_scancode; /* scancode of last command */ - u8 last_toggle; /* toggle of last command */ + u64 allowed_protos; + u32 scanmask; + void *priv; + spinlock_t keylock; + bool keypressed; + unsigned long keyup_jiffies; + struct timer_list timer_keyup; + u32 last_keycode; + u32 last_scancode; + u8 last_toggle; + u32 timeout; + u32 min_timeout; + u32 max_timeout; + u32 rx_resolution; + u32 tx_resolution; + int (*change_protocol)(struct rc_dev *dev, u64 ir_type); + int (*open)(struct rc_dev *dev); + void (*close)(struct rc_dev *dev); + int (*s_tx_mask)(struct rc_dev *dev, u32 mask); + int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); + int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); + int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); + int (*tx_ir)(struct rc_dev *dev, int *txbuf, u32 n); + void (*s_idle)(struct rc_dev *dev, bool enable); + int (*s_learning_mode)(struct rc_dev *dev, int enable); + int (*s_carrier_report) (struct rc_dev *dev, int enable); }; enum raw_event_type { @@ -115,52 +127,14 @@ enum raw_event_type { IR_STOP_EVENT = (1 << 3), }; -#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) - -int __ir_input_register(struct input_dev *dev, - const struct ir_scancode_table *ir_codes, - struct ir_dev_props *props, - const char *driver_name); - -static inline int ir_input_register(struct input_dev *dev, - const char *map_name, - struct ir_dev_props *props, - const char *driver_name) { - struct ir_scancode_table *ir_codes; - struct ir_input_dev *ir_dev; - int rc; - - if (!map_name) - return -EINVAL; - - ir_codes = get_rc_map(map_name); - if (!ir_codes) { - ir_codes = get_rc_map(RC_MAP_EMPTY); +#define to_rc_dev(d) container_of(d, struct rc_dev, dev) - if (!ir_codes) - return -EINVAL; - } - rc = __ir_input_register(dev, ir_codes, props, driver_name); - if (rc < 0) - return -EINVAL; - - ir_dev = input_get_drvdata(dev); - - if (!rc && ir_dev->props && ir_dev->props->change_protocol) - rc = ir_dev->props->change_protocol(ir_dev->props->priv, - ir_codes->ir_type); - - return rc; -} - -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_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); +void ir_repeat(struct rc_dev *dev); +void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle); +void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); +void ir_keyup(struct rc_dev *dev); +u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode); /* From ir-raw-event.c */ struct ir_raw_event { @@ -194,20 +168,25 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev) #define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ -void ir_raw_event_handle(struct input_dev *input_dev); -int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); -int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); -int ir_raw_event_store_with_filter(struct input_dev *input_dev, +struct rc_dev *rc_allocate_device(void); +void rc_free_device(struct rc_dev *dev); +int rc_register_device(struct rc_dev *dev); +void rc_unregister_device(struct rc_dev *dev); + +void ir_raw_event_handle(struct rc_dev *dev); +int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); +int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type); +int ir_raw_event_store_with_filter(struct rc_dev *dev, struct ir_raw_event *ev); -void ir_raw_event_set_idle(struct input_dev *input_dev, bool idle); +void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); -static inline void ir_raw_event_reset(struct input_dev *input_dev) +static inline void ir_raw_event_reset(struct rc_dev *dev) { DEFINE_IR_RAW_EVENT(ev); ev.reset = true; - ir_raw_event_store(input_dev, &ev); - ir_raw_event_handle(input_dev); + ir_raw_event_store(dev, &ev); + ir_raw_event_handle(dev); } diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 8c37b5ec0cf6..4ee9b42cbf72 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -9,9 +9,8 @@ struct IR_i2c; struct IR_i2c { char *ir_codes; - struct i2c_client *c; - struct input_dev *input; + struct rc_dev *rc; /* Used to avoid fast repeating */ unsigned char old; -- cgit v1.2.3 From 2eb258327722de3ed4d84ce1b9add2bad21a0ec4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Nov 2010 09:02:40 -0300 Subject: [media] ir-kbd-i2c: add rc_dev as a parameter to the driver There are several fields on rc_dev that drivers can benefit. Allow drivers to pass it as a parameter to the driver. For now, the rc_dev parameter is optional. If drivers don't pass it, create them internally. However, the best is to create rc_dev inside the drivers, in order to fill other fields, like open(), close(), driver_name, etc. So, a latter patch making it mandatory and changing the caller drivers is welcome. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ir-kbd-i2c.c | 45 +++++++++++++++++++++++++++++----------- include/media/ir-kbd-i2c.h | 2 ++ 2 files changed, 35 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 83b59a195230..de0060fa33f1 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -271,20 +271,16 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) const char *name = NULL; u64 ir_type = IR_TYPE_UNKNOWN; struct IR_i2c *ir; - struct rc_dev *rc; + struct rc_dev *rc = NULL; struct i2c_adapter *adap = client->adapter; unsigned short addr = client->addr; int err; - ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); - rc = rc_allocate_device(); - if (!ir || !rc) { - err = -ENOMEM; - goto err_out_free; - } + ir = kzalloc(sizeof(struct IR_i2c), GFP_KERNEL); + if (!ir) + return -ENOMEM; ir->c = client; - ir->rc = rc; ir->polling_interval = DEFAULT_POLLING_INTERVAL; i2c_set_clientdata(client, ir); @@ -333,6 +329,8 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) client->dev.platform_data; ir_codes = init_data->ir_codes; + rc = init_data->rc_dev; + name = init_data->name; if (init_data->type) ir_type = init_data->type; @@ -366,6 +364,19 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) } } + if (!rc) { + /* + * If platform_data doesn't specify rc_dev, initilize it + * internally + */ + rc = rc_allocate_device(); + if (!rc) { + err = -ENOMEM; + goto err_out_free; + } + } + ir->rc = rc; + /* Make sure we are all setup before going on */ if (!name || !ir->get_key || !ir_type || !ir_codes) { dprintk(1, ": Unsupported device at address 0x%02x\n", @@ -382,12 +393,21 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) dev_name(&adap->dev), dev_name(&client->dev)); - /* init + register input device */ + /* + * Initialize input_dev fields + * It doesn't make sense to allow overriding them via platform_data + */ rc->input_id.bustype = BUS_I2C; - rc->input_name = ir->name; rc->input_phys = ir->phys; - rc->map_name = ir->ir_codes; - rc->driver_name = MODULE_NAME; + rc->input_name = ir->name; + + /* + * Initialize the other fields of rc_dev + */ + rc->map_name = ir->ir_codes; + rc->allowed_protos = ir_type; + if (!rc->driver_name) + rc->driver_name = MODULE_NAME; err = rc_register_device(rc); if (err) @@ -403,6 +423,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) return 0; err_out_free: + /* Only frees rc if it were allocated internally */ rc_free_device(rc); kfree(ir); return err; diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 4ee9b42cbf72..aca015e04f17 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -46,5 +46,7 @@ struct IR_i2c_init_data { */ int (*get_key)(struct IR_i2c*, u32*, u32*); enum ir_kbd_get_key_fn internal_get_key_func; + + struct rc_dev *rc_dev; }; #endif -- cgit v1.2.3 From 9eae42e5a216059a146b3fbbe24b4fdc0b10c723 Mon Sep 17 00:00:00 2001 From: Richard Röjfors Date: Mon, 8 Nov 2010 10:45:44 -0300 Subject: [media] media: Add timberdale video-in driver This patch adds the timberdale video-in driver. The video IP of timberdale delivers the video data via DMA. The driver uses the DMA api to handle DMA transfers, and make use of the V4L2 video buffers to handle buffers against user space. If available the driver uses an encoder to get/set the video standard Signed-off-by: Richard Röjfors Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Kconfig | 9 + drivers/media/video/Makefile | 1 + drivers/media/video/timblogiw.c | 894 ++++++++++++++++++++++++++++++++++++++++ drivers/mfd/timberdale.c | 2 - include/media/timb_radio.h | 1 - include/media/timb_video.h | 33 ++ 6 files changed, 937 insertions(+), 3 deletions(-) create mode 100644 drivers/media/video/timblogiw.c create mode 100644 include/media/timb_video.h (limited to 'include') diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 22feac4d1e8f..73962d601bf3 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -666,6 +666,15 @@ config VIDEO_HEXIUM_GEMINI To compile this driver as a module, choose M here: the module will be called hexium_gemini. +config VIDEO_TIMBERDALE + tristate "Support for timberdale Video In/LogiWIN" + depends on VIDEO_V4L2 && I2C + select TIMB_DMA + select VIDEO_ADV7180 + select VIDEOBUF_DMA_CONTIG + ---help--- + Add support for the Video In peripherial of the timberdale FPGA. + source "drivers/media/video/cx88/Kconfig" source "drivers/media/video/cx23885/Kconfig" diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index af79d476a4c8..482f14b3ff84 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -106,6 +106,7 @@ obj-$(CONFIG_VIDEO_CPIA2) += cpia2/ obj-$(CONFIG_VIDEO_MXB) += mxb.o obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o +obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c new file mode 100644 index 000000000000..bddcdb6ffef5 --- /dev/null +++ b/drivers/media/video/timblogiw.c @@ -0,0 +1,894 @@ +/* + * timblogiw.c timberdale FPGA LogiWin Video In driver + * Copyright (c) 2009-2010 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Supports: + * Timberdale FPGA LogiWin Video In + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "timb-video" + +#define TIMBLOGIWIN_NAME "Timberdale Video-In" +#define TIMBLOGIW_VERSION_CODE 0x04 + +#define TIMBLOGIW_LINES_PER_DESC 44 +#define TIMBLOGIW_MAX_VIDEO_MEM 16 + +#define TIMBLOGIW_HAS_DECODER(lw) (lw->pdata.encoder.module_name) + + +struct timblogiw { + struct video_device video_dev; + struct v4l2_device v4l2_dev; /* mutual exclusion */ + struct mutex lock; + struct device *dev; + struct timb_video_platform_data pdata; + struct v4l2_subdev *sd_enc; /* encoder */ + bool opened; +}; + +struct timblogiw_tvnorm { + v4l2_std_id std; + u16 width; + u16 height; + u8 fps; +}; + +struct timblogiw_fh { + struct videobuf_queue vb_vidq; + struct timblogiw_tvnorm const *cur_norm; + struct list_head capture; + struct dma_chan *chan; + spinlock_t queue_lock; /* mutual exclusion */ + unsigned int frame_count; +}; + +struct timblogiw_buffer { + /* common v4l buffer stuff -- must be first */ + struct videobuf_buffer vb; + struct scatterlist sg[16]; + dma_cookie_t cookie; + struct timblogiw_fh *fh; +}; + +const struct timblogiw_tvnorm timblogiw_tvnorms[] = { + { + .std = V4L2_STD_PAL, + .width = 720, + .height = 576, + .fps = 25 + }, + { + .std = V4L2_STD_NTSC, + .width = 720, + .height = 480, + .fps = 30 + } +}; + +static int timblogiw_bytes_per_line(const struct timblogiw_tvnorm *norm) +{ + return norm->width * 2; +} + + +static int timblogiw_frame_size(const struct timblogiw_tvnorm *norm) +{ + return norm->height * timblogiw_bytes_per_line(norm); +} + +static const struct timblogiw_tvnorm *timblogiw_get_norm(const v4l2_std_id std) +{ + int i; + for (i = 0; i < ARRAY_SIZE(timblogiw_tvnorms); i++) + if (timblogiw_tvnorms[i].std & std) + return timblogiw_tvnorms + i; + + /* default to first element */ + return timblogiw_tvnorms; +} + +static void timblogiw_dma_cb(void *data) +{ + struct timblogiw_buffer *buf = data; + struct timblogiw_fh *fh = buf->fh; + struct videobuf_buffer *vb = &buf->vb; + + spin_lock(&fh->queue_lock); + + /* mark the transfer done */ + buf->cookie = -1; + + fh->frame_count++; + + if (vb->state != VIDEOBUF_ERROR) { + list_del(&vb->queue); + do_gettimeofday(&vb->ts); + vb->field_count = fh->frame_count * 2; + vb->state = VIDEOBUF_DONE; + + wake_up(&vb->done); + } + + if (!list_empty(&fh->capture)) { + vb = list_entry(fh->capture.next, struct videobuf_buffer, + queue); + vb->state = VIDEOBUF_ACTIVE; + } + + spin_unlock(&fh->queue_lock); +} + +static bool timblogiw_dma_filter_fn(struct dma_chan *chan, void *filter_param) +{ + return chan->chan_id == (int)filter_param; +} + +/* IOCTL functions */ + +static int timblogiw_g_fmt(struct file *file, void *priv, + struct v4l2_format *format) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s entry\n", __func__); + + if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + mutex_lock(&lw->lock); + + format->fmt.pix.width = fh->cur_norm->width; + format->fmt.pix.height = fh->cur_norm->height; + format->fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY; + format->fmt.pix.bytesperline = timblogiw_bytes_per_line(fh->cur_norm); + format->fmt.pix.sizeimage = timblogiw_frame_size(fh->cur_norm); + format->fmt.pix.field = V4L2_FIELD_NONE; + + mutex_unlock(&lw->lock); + + return 0; +} + +static int timblogiw_try_fmt(struct file *file, void *priv, + struct v4l2_format *format) +{ + struct video_device *vdev = video_devdata(file); + struct v4l2_pix_format *pix = &format->fmt.pix; + + dev_dbg(&vdev->dev, + "%s - width=%d, height=%d, pixelformat=%d, field=%d\n" + "bytes per line %d, size image: %d, colorspace: %d\n", + __func__, + pix->width, pix->height, pix->pixelformat, pix->field, + pix->bytesperline, pix->sizeimage, pix->colorspace); + + if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + if (pix->field != V4L2_FIELD_NONE) + return -EINVAL; + + if (pix->pixelformat != V4L2_PIX_FMT_UYVY) + return -EINVAL; + + return 0; +} + +static int timblogiw_s_fmt(struct file *file, void *priv, + struct v4l2_format *format) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh = priv; + struct v4l2_pix_format *pix = &format->fmt.pix; + int err; + + mutex_lock(&lw->lock); + + err = timblogiw_try_fmt(file, priv, format); + if (err) + goto out; + + if (videobuf_queue_is_busy(&fh->vb_vidq)) { + dev_err(&vdev->dev, "%s queue busy\n", __func__); + err = -EBUSY; + goto out; + } + + pix->width = fh->cur_norm->width; + pix->height = fh->cur_norm->height; + +out: + mutex_unlock(&lw->lock); + return err; +} + +static int timblogiw_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct video_device *vdev = video_devdata(file); + + dev_dbg(&vdev->dev, "%s: Entry\n", __func__); + memset(cap, 0, sizeof(*cap)); + strncpy(cap->card, TIMBLOGIWIN_NAME, sizeof(cap->card)-1); + strncpy(cap->driver, DRIVER_NAME, sizeof(cap->card)-1); + strlcpy(cap->bus_info, vdev->name, sizeof(cap->bus_info)); + cap->version = TIMBLOGIW_VERSION_CODE; + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | + V4L2_CAP_READWRITE; + + return 0; +} + +static int timblogiw_enum_fmt(struct file *file, void *priv, + struct v4l2_fmtdesc *fmt) +{ + struct video_device *vdev = video_devdata(file); + + dev_dbg(&vdev->dev, "%s, index: %d\n", __func__, fmt->index); + + if (fmt->index != 0) + return -EINVAL; + memset(fmt, 0, sizeof(*fmt)); + fmt->index = 0; + fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + strncpy(fmt->description, "4:2:2, packed, YUYV", + sizeof(fmt->description)-1); + fmt->pixelformat = V4L2_PIX_FMT_UYVY; + + return 0; +} + +static int timblogiw_g_parm(struct file *file, void *priv, + struct v4l2_streamparm *sp) +{ + struct timblogiw_fh *fh = priv; + struct v4l2_captureparm *cp = &sp->parm.capture; + + cp->capability = V4L2_CAP_TIMEPERFRAME; + cp->timeperframe.numerator = 1; + cp->timeperframe.denominator = fh->cur_norm->fps; + + return 0; +} + +static int timblogiw_reqbufs(struct file *file, void *priv, + struct v4l2_requestbuffers *rb) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_reqbufs(&fh->vb_vidq, rb); +} + +static int timblogiw_querybuf(struct file *file, void *priv, + struct v4l2_buffer *b) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_querybuf(&fh->vb_vidq, b); +} + +static int timblogiw_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_qbuf(&fh->vb_vidq, b); +} + +static int timblogiw_dqbuf(struct file *file, void *priv, + struct v4l2_buffer *b) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); +} + +static int timblogiw_g_std(struct file *file, void *priv, v4l2_std_id *std) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + *std = fh->cur_norm->std; + return 0; +} + +static int timblogiw_s_std(struct file *file, void *priv, v4l2_std_id *std) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh = priv; + int err = 0; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + mutex_lock(&lw->lock); + + if (TIMBLOGIW_HAS_DECODER(lw)) + err = v4l2_subdev_call(lw->sd_enc, core, s_std, *std); + + if (!err) + fh->cur_norm = timblogiw_get_norm(*std); + + mutex_unlock(&lw->lock); + + return err; +} + +static int timblogiw_enuminput(struct file *file, void *priv, + struct v4l2_input *inp) +{ + struct video_device *vdev = video_devdata(file); + int i; + + dev_dbg(&vdev->dev, "%s: Entry\n", __func__); + + if (inp->index != 0) + return -EINVAL; + + memset(inp, 0, sizeof(*inp)); + inp->index = 0; + + strncpy(inp->name, "Timb input 1", sizeof(inp->name) - 1); + inp->type = V4L2_INPUT_TYPE_CAMERA; + + inp->std = 0; + for (i = 0; i < ARRAY_SIZE(timblogiw_tvnorms); i++) + inp->std |= timblogiw_tvnorms[i].std; + + return 0; +} + +static int timblogiw_g_input(struct file *file, void *priv, + unsigned int *input) +{ + struct video_device *vdev = video_devdata(file); + + dev_dbg(&vdev->dev, "%s: Entry\n", __func__); + + *input = 0; + + return 0; +} + +static int timblogiw_s_input(struct file *file, void *priv, unsigned int input) +{ + struct video_device *vdev = video_devdata(file); + + dev_dbg(&vdev->dev, "%s: Entry\n", __func__); + + if (input != 0) + return -EINVAL; + return 0; +} + +static int timblogiw_streamon(struct file *file, void *priv, unsigned int type) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + dev_dbg(&vdev->dev, "%s - No capture device\n", __func__); + return -EINVAL; + } + + fh->frame_count = 0; + return videobuf_streamon(&fh->vb_vidq); +} + +static int timblogiw_streamoff(struct file *file, void *priv, + unsigned int type) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s entry\n", __func__); + + if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + return videobuf_streamoff(&fh->vb_vidq); +} + +static int timblogiw_querystd(struct file *file, void *priv, v4l2_std_id *std) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s entry\n", __func__); + + if (TIMBLOGIW_HAS_DECODER(lw)) + return v4l2_subdev_call(lw->sd_enc, video, querystd, std); + else { + *std = fh->cur_norm->std; + return 0; + } +} + +static int timblogiw_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *fsize) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = priv; + + dev_dbg(&vdev->dev, "%s - index: %d, format: %d\n", __func__, + fsize->index, fsize->pixel_format); + + if ((fsize->index != 0) || + (fsize->pixel_format != V4L2_PIX_FMT_UYVY)) + return -EINVAL; + + fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; + fsize->discrete.width = fh->cur_norm->width; + fsize->discrete.height = fh->cur_norm->height; + + return 0; +} + +/* Video buffer functions */ + +static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, + unsigned int *size) +{ + struct timblogiw_fh *fh = vq->priv_data; + + *size = timblogiw_frame_size(fh->cur_norm); + + if (!*count) + *count = 32; + + while (*size * *count > TIMBLOGIW_MAX_VIDEO_MEM * 1024 * 1024) + (*count)--; + + return 0; +} + +static int buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, + enum v4l2_field field) +{ + struct timblogiw_fh *fh = vq->priv_data; + struct timblogiw_buffer *buf = container_of(vb, struct timblogiw_buffer, + vb); + unsigned int data_size = timblogiw_frame_size(fh->cur_norm); + int err = 0; + + if (vb->baddr && vb->bsize < data_size) + /* User provided buffer, but it is too small */ + return -ENOMEM; + + vb->size = data_size; + vb->width = fh->cur_norm->width; + vb->height = fh->cur_norm->height; + vb->field = field; + + if (vb->state == VIDEOBUF_NEEDS_INIT) { + int i; + unsigned int size; + unsigned int bytes_per_desc = TIMBLOGIW_LINES_PER_DESC * + timblogiw_bytes_per_line(fh->cur_norm); + dma_addr_t addr; + + sg_init_table(buf->sg, ARRAY_SIZE(buf->sg)); + + err = videobuf_iolock(vq, vb, NULL); + if (err) + goto err; + + addr = videobuf_to_dma_contig(vb); + for (i = 0, size = 0; size < data_size; i++) { + sg_dma_address(buf->sg + i) = addr + size; + size += bytes_per_desc; + sg_dma_len(buf->sg + i) = (size > data_size) ? + (bytes_per_desc - (size - data_size)) : + bytes_per_desc; + } + + vb->state = VIDEOBUF_PREPARED; + buf->cookie = -1; + buf->fh = fh; + } + + return 0; + +err: + videobuf_dma_contig_free(vq, vb); + vb->state = VIDEOBUF_NEEDS_INIT; + return err; +} + +static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) +{ + struct timblogiw_fh *fh = vq->priv_data; + struct timblogiw_buffer *buf = container_of(vb, struct timblogiw_buffer, + vb); + struct dma_async_tx_descriptor *desc; + int sg_elems; + int bytes_per_desc = TIMBLOGIW_LINES_PER_DESC * + timblogiw_bytes_per_line(fh->cur_norm); + + sg_elems = timblogiw_frame_size(fh->cur_norm) / bytes_per_desc; + sg_elems += + (timblogiw_frame_size(fh->cur_norm) % bytes_per_desc) ? 1 : 0; + + if (list_empty(&fh->capture)) + vb->state = VIDEOBUF_ACTIVE; + else + vb->state = VIDEOBUF_QUEUED; + + list_add_tail(&vb->queue, &fh->capture); + + spin_unlock_irq(&fh->queue_lock); + + desc = fh->chan->device->device_prep_slave_sg(fh->chan, + buf->sg, sg_elems, DMA_FROM_DEVICE, + DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP); + if (!desc) { + spin_lock_irq(&fh->queue_lock); + list_del_init(&vb->queue); + vb->state = VIDEOBUF_PREPARED; + return; + } + + desc->callback_param = buf; + desc->callback = timblogiw_dma_cb; + + buf->cookie = desc->tx_submit(desc); + + spin_lock_irq(&fh->queue_lock); +} + +static void buffer_release(struct videobuf_queue *vq, + struct videobuf_buffer *vb) +{ + struct timblogiw_fh *fh = vq->priv_data; + struct timblogiw_buffer *buf = container_of(vb, struct timblogiw_buffer, + vb); + + videobuf_waiton(vq, vb, 0, 0); + if (buf->cookie >= 0) + dma_sync_wait(fh->chan, buf->cookie); + + videobuf_dma_contig_free(vq, vb); + vb->state = VIDEOBUF_NEEDS_INIT; +} + +static struct videobuf_queue_ops timblogiw_video_qops = { + .buf_setup = buffer_setup, + .buf_prepare = buffer_prepare, + .buf_queue = buffer_queue, + .buf_release = buffer_release, +}; + +/* Device Operations functions */ + +static int timblogiw_open(struct file *file) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh; + v4l2_std_id std; + dma_cap_mask_t mask; + int err = 0; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + mutex_lock(&lw->lock); + if (lw->opened) { + err = -EBUSY; + goto out; + } + + if (TIMBLOGIW_HAS_DECODER(lw) && !lw->sd_enc) { + struct i2c_adapter *adapt; + + /* find the video decoder */ + adapt = i2c_get_adapter(lw->pdata.i2c_adapter); + if (!adapt) { + dev_err(&vdev->dev, "No I2C bus #%d\n", + lw->pdata.i2c_adapter); + err = -ENODEV; + goto out; + } + + /* now find the encoder */ + lw->sd_enc = v4l2_i2c_new_subdev_board(&lw->v4l2_dev, adapt, + lw->pdata.encoder.info, NULL); + + i2c_put_adapter(adapt); + + if (!lw->sd_enc) { + dev_err(&vdev->dev, "Failed to get encoder: %s\n", + lw->pdata.encoder.module_name); + err = -ENODEV; + goto out; + } + } + + fh = kzalloc(sizeof(*fh), GFP_KERNEL); + if (!fh) { + err = -ENOMEM; + goto out; + } + + fh->cur_norm = timblogiw_tvnorms; + timblogiw_querystd(file, fh, &std); + fh->cur_norm = timblogiw_get_norm(std); + + INIT_LIST_HEAD(&fh->capture); + spin_lock_init(&fh->queue_lock); + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + dma_cap_set(DMA_PRIVATE, mask); + + /* find the DMA channel */ + fh->chan = dma_request_channel(mask, timblogiw_dma_filter_fn, + (void *)lw->pdata.dma_channel); + if (!fh->chan) { + dev_err(&vdev->dev, "Failed to get DMA channel\n"); + kfree(fh); + err = -ENODEV; + goto out; + } + + file->private_data = fh; + videobuf_queue_dma_contig_init(&fh->vb_vidq, + &timblogiw_video_qops, lw->dev, &fh->queue_lock, + V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, + sizeof(struct timblogiw_buffer), fh, NULL); + + lw->opened = true; +out: + mutex_unlock(&lw->lock); + + return err; +} + +static int timblogiw_close(struct file *file) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw *lw = video_get_drvdata(vdev); + struct timblogiw_fh *fh = file->private_data; + + dev_dbg(&vdev->dev, "%s: Entry\n", __func__); + + videobuf_stop(&fh->vb_vidq); + videobuf_mmap_free(&fh->vb_vidq); + + dma_release_channel(fh->chan); + + kfree(fh); + + mutex_lock(&lw->lock); + lw->opened = false; + mutex_unlock(&lw->lock); + return 0; +} + +static ssize_t timblogiw_read(struct file *file, char __user *data, + size_t count, loff_t *ppos) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = file->private_data; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_read_stream(&fh->vb_vidq, data, count, ppos, 0, + file->f_flags & O_NONBLOCK); +} + +static unsigned int timblogiw_poll(struct file *file, + struct poll_table_struct *wait) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = file->private_data; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_poll_stream(file, &fh->vb_vidq, wait); +} + +static int timblogiw_mmap(struct file *file, struct vm_area_struct *vma) +{ + struct video_device *vdev = video_devdata(file); + struct timblogiw_fh *fh = file->private_data; + + dev_dbg(&vdev->dev, "%s: entry\n", __func__); + + return videobuf_mmap_mapper(&fh->vb_vidq, vma); +} + +/* Platform device functions */ + +static const __devinitdata struct v4l2_ioctl_ops timblogiw_ioctl_ops = { + .vidioc_querycap = timblogiw_querycap, + .vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt, + .vidioc_g_fmt_vid_cap = timblogiw_g_fmt, + .vidioc_try_fmt_vid_cap = timblogiw_try_fmt, + .vidioc_s_fmt_vid_cap = timblogiw_s_fmt, + .vidioc_g_parm = timblogiw_g_parm, + .vidioc_reqbufs = timblogiw_reqbufs, + .vidioc_querybuf = timblogiw_querybuf, + .vidioc_qbuf = timblogiw_qbuf, + .vidioc_dqbuf = timblogiw_dqbuf, + .vidioc_g_std = timblogiw_g_std, + .vidioc_s_std = timblogiw_s_std, + .vidioc_enum_input = timblogiw_enuminput, + .vidioc_g_input = timblogiw_g_input, + .vidioc_s_input = timblogiw_s_input, + .vidioc_streamon = timblogiw_streamon, + .vidioc_streamoff = timblogiw_streamoff, + .vidioc_querystd = timblogiw_querystd, + .vidioc_enum_framesizes = timblogiw_enum_framesizes, +}; + +static const __devinitdata struct v4l2_file_operations timblogiw_fops = { + .owner = THIS_MODULE, + .open = timblogiw_open, + .release = timblogiw_close, + .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ + .mmap = timblogiw_mmap, + .read = timblogiw_read, + .poll = timblogiw_poll, +}; + +static const __devinitdata struct video_device timblogiw_template = { + .name = TIMBLOGIWIN_NAME, + .fops = &timblogiw_fops, + .ioctl_ops = &timblogiw_ioctl_ops, + .release = video_device_release_empty, + .minor = -1, + .tvnorms = V4L2_STD_PAL | V4L2_STD_NTSC +}; + +static int __devinit timblogiw_probe(struct platform_device *pdev) +{ + int err; + struct timblogiw *lw = NULL; + struct timb_video_platform_data *pdata = pdev->dev.platform_data; + + if (!pdata) { + dev_err(&pdev->dev, "No platform data\n"); + err = -EINVAL; + goto err; + } + + if (!pdata->encoder.module_name) + dev_info(&pdev->dev, "Running without decoder\n"); + + lw = kzalloc(sizeof(*lw), GFP_KERNEL); + if (!lw) { + err = -ENOMEM; + goto err; + } + + if (pdev->dev.parent) + lw->dev = pdev->dev.parent; + else + lw->dev = &pdev->dev; + + memcpy(&lw->pdata, pdata, sizeof(lw->pdata)); + + mutex_init(&lw->lock); + + lw->video_dev = timblogiw_template; + + strlcpy(lw->v4l2_dev.name, DRIVER_NAME, sizeof(lw->v4l2_dev.name)); + err = v4l2_device_register(NULL, &lw->v4l2_dev); + if (err) + goto err_register; + + lw->video_dev.v4l2_dev = &lw->v4l2_dev; + + platform_set_drvdata(pdev, lw); + video_set_drvdata(&lw->video_dev, lw); + + err = video_register_device(&lw->video_dev, VFL_TYPE_GRABBER, 0); + if (err) { + dev_err(&pdev->dev, "Error reg video: %d\n", err); + goto err_request; + } + + + return 0; + +err_request: + platform_set_drvdata(pdev, NULL); + v4l2_device_unregister(&lw->v4l2_dev); +err_register: + kfree(lw); +err: + dev_err(&pdev->dev, "Failed to register: %d\n", err); + + return err; +} + +static int __devexit timblogiw_remove(struct platform_device *pdev) +{ + struct timblogiw *lw = platform_get_drvdata(pdev); + + video_unregister_device(&lw->video_dev); + + v4l2_device_unregister(&lw->v4l2_dev); + + kfree(lw); + + platform_set_drvdata(pdev, NULL); + + return 0; +} + +static struct platform_driver timblogiw_platform_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, + .probe = timblogiw_probe, + .remove = __devexit_p(timblogiw_remove), +}; + +/* Module functions */ + +static int __init timblogiw_init(void) +{ + return platform_driver_register(&timblogiw_platform_driver); +} + +static void __exit timblogiw_exit(void) +{ + platform_driver_unregister(&timblogiw_platform_driver); +} + +module_init(timblogiw_init); +module_exit(timblogiw_exit); + +MODULE_DESCRIPTION(TIMBLOGIWIN_NAME); +MODULE_AUTHOR("Pelagicore AB "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:"DRIVER_NAME); diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index 727f62c15a60..e948a2b45b86 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c @@ -271,11 +271,9 @@ static __devinitdata struct timb_radio_platform_data timberdale_radio_platform_data = { .i2c_adapter = 0, .tuner = { - .module_name = "tef6862", .info = &timberdale_tef6868_i2c_board_info }, .dsp = { - .module_name = "saa7706h", .info = &timberdale_saa7706_i2c_board_info } }; diff --git a/include/media/timb_radio.h b/include/media/timb_radio.h index fcd32a3696ba..a59a84854dc1 100644 --- a/include/media/timb_radio.h +++ b/include/media/timb_radio.h @@ -24,7 +24,6 @@ struct timb_radio_platform_data { int i2c_adapter; /* I2C adapter where the tuner and dsp are attached */ struct { - const char *module_name; struct i2c_board_info *info; } tuner; struct { diff --git a/include/media/timb_video.h b/include/media/timb_video.h new file mode 100644 index 000000000000..70ae43970a49 --- /dev/null +++ b/include/media/timb_video.h @@ -0,0 +1,33 @@ +/* + * timb_video.h Platform struct for the Timberdale video driver + * Copyright (c) 2009-2010 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _TIMB_VIDEO_ +#define _TIMB_VIDEO_ 1 + +#include + +struct timb_video_platform_data { + int dma_channel; + int i2c_adapter; /* The I2C adapter where the encoder is attached */ + struct { + const char *module_name; + struct i2c_board_info *info; + } encoder; +}; + +#endif -- cgit v1.2.3 From a6e3b81f6198654207c4e972e7ed91931e53e93c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 10:05:29 -0300 Subject: [media] rc: Remove ir-common.h Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/bt8xx/bttv-input.c | 5 ++ drivers/media/video/bt8xx/bttv.h | 1 - drivers/media/video/bt8xx/bttvp.h | 43 +++++++++++++++- drivers/media/video/saa7134/saa7134-input.c | 30 +++++------ drivers/media/video/saa7134/saa7134.h | 23 ++++++++- include/media/ir-common.h | 77 ----------------------------- include/media/ir-kbd-i2c.h | 2 +- 7 files changed, 85 insertions(+), 96 deletions(-) delete mode 100644 include/media/ir-common.h (limited to 'include') diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index e8f60ab58db6..e4df7f85f9df 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -147,6 +147,11 @@ static void bttv_input_timer(unsigned long data) * testing. */ +#define RC5_START(x) (((x) >> 12) & 3) +#define RC5_TOGGLE(x) (((x) >> 11) & 1) +#define RC5_ADDR(x) (((x) >> 6) & 31) +#define RC5_INSTR(x) ((x) & 63) + /* decode raw bit pattern to RC5 code */ static u32 bttv_rc5_decode(unsigned int code) { diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index 6fd2a8ebda1e..fd62bf15d779 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 157285b434c9..0bbdd481e336 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include "bt848.h" @@ -120,6 +120,47 @@ struct bttv_format { int hshift,vshift; /* for planar modes */ }; +struct card_ir { + struct rc_dev *dev; + + char name[32]; + char phys[32]; +#if 0 + int users; + u32 running:1; +#endif + /* Usual gpio signalling */ + u32 mask_keycode; + u32 mask_keydown; + u32 mask_keyup; + u32 polling; + u32 last_gpio; + int shift_by; + int start; // What should RC5_START() be + int addr; // What RC5_ADDR() should be. + int rc5_remote_gap; + struct work_struct work; + struct timer_list timer; + + /* RC5 gpio */ + u32 rc5_gpio; + struct timer_list timer_end; /* timer_end for code completion */ + u32 last_bit; /* last raw bit seen */ + u32 code; /* raw code under construction */ + struct timeval base_time; /* time of last seen code */ + int active; /* building raw code */ + +#if 0 + /* NEC decoding */ + u32 nec_gpio; + struct tasklet_struct tlet; + + /* IR core raw decoding */ + u32 raw_decode; +#endif +}; + + /* ---------------------------------------------------------- */ struct bttv_geometry { diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 72562b8cf3be..900e7985d9b3 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -61,7 +61,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev); static int build_key(struct saa7134_dev *dev) { - struct card_ir *ir = dev->remote; + struct saa7134_card_ir *ir = dev->remote; u32 gpio, data; /* here comes the additional handshake steps for some cards */ @@ -385,7 +385,7 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) void saa7134_input_irq(struct saa7134_dev *dev) { - struct card_ir *ir; + struct saa7134_card_ir *ir; if (!dev || !dev->remote) return; @@ -404,7 +404,7 @@ void saa7134_input_irq(struct saa7134_dev *dev) static void saa7134_input_timer(unsigned long data) { struct saa7134_dev *dev = (struct saa7134_dev *)data; - struct card_ir *ir = dev->remote; + struct saa7134_card_ir *ir = dev->remote; build_key(dev); mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); @@ -413,17 +413,17 @@ static void saa7134_input_timer(unsigned long data) static void ir_raw_decode_timer_end(unsigned long data) { struct saa7134_dev *dev = (struct saa7134_dev *)data; - struct card_ir *ir = dev->remote; + struct saa7134_card_ir *ir = dev->remote; ir_raw_event_handle(dev->remote->dev); - ir->active = 0; + ir->active = false; } static int __saa7134_ir_start(void *priv) { struct saa7134_dev *dev = priv; - struct card_ir *ir; + struct saa7134_card_ir *ir; if (!dev) return -EINVAL; @@ -435,7 +435,7 @@ static int __saa7134_ir_start(void *priv) if (ir->running) return 0; - ir->running = 1; + ir->running = true; if (ir->polling) { setup_timer(&ir->timer, saa7134_input_timer, (unsigned long)dev); @@ -446,7 +446,7 @@ static int __saa7134_ir_start(void *priv) init_timer(&ir->timer_end); ir->timer_end.function = ir_raw_decode_timer_end; ir->timer_end.data = (unsigned long)dev; - ir->active = 0; + ir->active = false; } return 0; @@ -455,7 +455,7 @@ static int __saa7134_ir_start(void *priv) static void __saa7134_ir_stop(void *priv) { struct saa7134_dev *dev = priv; - struct card_ir *ir; + struct saa7134_card_ir *ir; if (!dev) return; @@ -470,10 +470,10 @@ static void __saa7134_ir_stop(void *priv) del_timer_sync(&dev->remote->timer); else if (ir->raw_decode) { del_timer_sync(&ir->timer_end); - ir->active = 0; + ir->active = false; } - ir->running = 0; + ir->running = false; return; } @@ -511,7 +511,7 @@ static void saa7134_ir_close(struct rc_dev *rc) int saa7134_input_init1(struct saa7134_dev *dev) { - struct card_ir *ir; + struct saa7134_card_ir *ir; struct rc_dev *rc; char *ir_codes = NULL; u32 mask_keycode = 0; @@ -764,7 +764,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->dev = rc; dev->remote = ir; - ir->running = 0; + ir->running = false; /* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; @@ -934,7 +934,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) static int saa7134_raw_decode_irq(struct saa7134_dev *dev) { - struct card_ir *ir = dev->remote; + struct saa7134_card_ir *ir = dev->remote; unsigned long timeout; int space; @@ -953,7 +953,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) if (!ir->active) { timeout = jiffies + jiffies_to_msecs(15); mod_timer(&ir->timer_end, timeout); - ir->active = 1; + ir->active = true; } return 1; diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index a6c726fe4c5d..c6ef95ec68f2 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -119,6 +119,27 @@ struct saa7134_format { unsigned int uvswap:1; }; +struct saa7134_card_ir { + struct rc_dev *dev; + + char name[32]; + char phys[32]; + int users; + + u32 polling; + u32 last_gpio; + u32 mask_keycode, mask_keydown, mask_keyup; + + bool running; + bool active; + + struct timer_list timer; + struct timer_list timer_end; /* timer_end for code completion */ + + /* IR core raw decoding */ + u32 raw_decode; +}; + /* ----------------------------------------------------------- */ /* card configuration */ @@ -530,7 +551,7 @@ struct saa7134_dev { /* infrared remote */ int has_remote; - struct card_ir *remote; + struct saa7134_card_ir *remote; /* pci i/o */ char name[32]; diff --git a/include/media/ir-common.h b/include/media/ir-common.h deleted file mode 100644 index 41fefd9816ea..000000000000 --- a/include/media/ir-common.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 [SuSE Labs] - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _IR_COMMON -#define _IR_COMMON - -#include -#include -#include -#include - -#define RC5_START(x) (((x)>>12)&3) -#define RC5_TOGGLE(x) (((x)>>11)&1) -#define RC5_ADDR(x) (((x)>>6)&31) -#define RC5_INSTR(x) ((x)&63) - -/* this was saa7134_ir and bttv_ir, moved here for - * rc5 decoding. */ -struct card_ir { - struct rc_dev *dev; - char name[32]; - char phys[32]; - int users; - u32 running:1; - - /* Usual gpio signalling */ - u32 mask_keycode; - u32 mask_keydown; - u32 mask_keyup; - u32 polling; - u32 last_gpio; - int shift_by; - int start; // What should RC5_START() be - int addr; // What RC5_ADDR() should be. - int rc5_remote_gap; - struct work_struct work; - struct timer_list timer; - - /* RC5 gpio */ - u32 rc5_gpio; - struct timer_list timer_end; /* timer_end for code completion */ - u32 last_bit; /* last raw bit seen */ - u32 code; /* raw code under construction */ - struct timeval base_time; /* time of last seen code */ - int active; /* building raw code */ - - /* NEC decoding */ - u32 nec_gpio; - struct tasklet_struct tlet; - - /* IR core raw decoding */ - u32 raw_decode; -}; - -/* Routines from ir-functions.c */ -void ir_rc5_timer_end(unsigned long data); - -#endif diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index aca015e04f17..d27505f2448e 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -1,7 +1,7 @@ #ifndef _IR_I2C #define _IR_I2C -#include +#include #define DEFAULT_POLLING_INTERVAL 100 /* ms */ -- cgit v1.2.3 From 6bda96447cef24fbf97a798b1ea664224d5fdc25 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 13:28:38 -0300 Subject: [media] rc: rename the remaining things to rc_core The Remote Controller subsystem is meant to be used not only by Infra Red but also for similar types of Remote Controllers. The core is not specific to Infra Red. As such, rename: - ir-core.h to rc-core.h - IR_CORE to RC_CORE - namespace inside rc-core.c/rc-core.h To be consistent with the other changes. No functional change on this patch. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/Kconfig | 2 +- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/dvb-usb/Kconfig | 2 +- drivers/media/dvb/dvb-usb/dvb-usb.h | 2 +- drivers/media/dvb/dvb-usb/lmedm04.c | 2 +- drivers/media/dvb/mantis/Kconfig | 2 +- drivers/media/dvb/mantis/mantis_input.c | 2 +- drivers/media/dvb/siano/Kconfig | 2 +- drivers/media/dvb/siano/smsir.h | 2 +- drivers/media/dvb/ttpci/Kconfig | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- drivers/media/rc/Kconfig | 35 ++--- drivers/media/rc/Makefile | 2 +- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/imon.c | 2 +- drivers/media/rc/ir-lirc-codec.c | 2 +- drivers/media/rc/keymaps/Kconfig | 2 +- drivers/media/rc/keymaps/rc-lirc.c | 2 +- drivers/media/rc/mceusb.c | 2 +- drivers/media/rc/nuvoton-cir.c | 2 +- drivers/media/rc/rc-core-priv.h | 2 +- drivers/media/rc/rc-main.c | 18 +-- drivers/media/rc/rc-raw.c | 2 +- drivers/media/rc/streamzap.c | 2 +- drivers/media/rc/winbond-cir.c | 2 +- drivers/media/video/Kconfig | 2 +- drivers/media/video/bt8xx/Kconfig | 2 +- drivers/media/video/bt8xx/bttvp.h | 2 +- drivers/media/video/cx18/Kconfig | 2 +- drivers/media/video/cx231xx/Kconfig | 4 +- drivers/media/video/cx231xx/cx231xx.h | 2 +- drivers/media/video/cx23885/Kconfig | 2 +- drivers/media/video/cx23885/cx23885-input.c | 2 +- drivers/media/video/cx23885/cx23885.h | 2 +- drivers/media/video/cx23885/cx23888-ir.c | 2 +- drivers/media/video/cx25840/cx25840-ir.c | 2 +- drivers/media/video/cx88/Kconfig | 2 +- drivers/media/video/cx88/cx88-input.c | 2 +- drivers/media/video/em28xx/Kconfig | 2 +- drivers/media/video/em28xx/em28xx.h | 2 +- drivers/media/video/ir-kbd-i2c.c | 2 +- drivers/media/video/ivtv/Kconfig | 2 +- drivers/media/video/saa7134/Kconfig | 2 +- drivers/media/video/saa7134/saa7134.h | 2 +- drivers/media/video/tlg2300/Kconfig | 2 +- drivers/staging/cx25821/Kconfig | 2 +- drivers/staging/go7007/Kconfig | 2 +- drivers/staging/tm6000/Kconfig | 2 +- drivers/staging/tm6000/tm6000-input.c | 2 +- include/media/ir-core.h | 211 ---------------------------- include/media/ir-kbd-i2c.h | 2 +- include/media/rc-core.h | 211 ++++++++++++++++++++++++++++ 52 files changed, 287 insertions(+), 286 deletions(-) delete mode 100644 include/media/ir-core.h create mode 100644 include/media/rc-core.h (limited to 'include') diff --git a/drivers/media/dvb/dm1105/Kconfig b/drivers/media/dvb/dm1105/Kconfig index 576f3b70d792..f3de0a4d63f2 100644 --- a/drivers/media/dvb/dm1105/Kconfig +++ b/drivers/media/dvb/dm1105/Kconfig @@ -8,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 IR_CORE + depends on RC_CORE help Support for cards based on the SDMC DM1105 PCI chip like DvbWorld 2002 diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index d1a43858f29c..e9cacf6e9277 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "demux.h" #include "dmxdev.h" diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 2525d3b3c88d..3d48ba019342 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig @@ -1,6 +1,6 @@ config DVB_USB tristate "Support for various USB DVB devices" - depends on DVB_CORE && USB && I2C && IR_CORE + depends on DVB_CORE && USB && I2C && RC_CORE help By enabling this you will be able to choose the various supported USB1.1 and USB2.0 DVB devices. diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 83aa9826560f..18828cb282c4 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "dvb_frontend.h" #include "dvb_demux.h" diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index d8f1b150e1cb..f0c030837f29 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -61,7 +61,7 @@ #define DVB_USB_LOG_PREFIX "LME2510(C)" #include #include -#include +#include #include "dvb-usb.h" #include "lmedm04.h" diff --git a/drivers/media/dvb/mantis/Kconfig b/drivers/media/dvb/mantis/Kconfig index fd0830ed10d8..a13a50503134 100644 --- a/drivers/media/dvb/mantis/Kconfig +++ b/drivers/media/dvb/mantis/Kconfig @@ -1,6 +1,6 @@ config MANTIS_CORE tristate "Mantis/Hopper PCI bridge based devices" - depends on PCI && I2C && INPUT && IR_CORE + depends on PCI && I2C && INPUT && RC_CORE help Support for PCI cards based on the Mantis and Hopper PCi bridge. diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 209f2110e20c..e030b18ad6d9 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include #include #include "dmxdev.h" diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig index e520bceee0af..bc6456eb2c4f 100644 --- a/drivers/media/dvb/siano/Kconfig +++ b/drivers/media/dvb/siano/Kconfig @@ -4,7 +4,7 @@ config SMS_SIANO_MDTV tristate "Siano SMS1xxx based MDTV receiver" - depends on DVB_CORE && IR_CORE && HAS_DMA + depends on DVB_CORE && RC_CORE && HAS_DMA ---help--- Choose Y or M here if you have MDTV receiver with a Siano chipset. diff --git a/drivers/media/dvb/siano/smsir.h b/drivers/media/dvb/siano/smsir.h index c2f68a460ee1..ae92b3a8587e 100644 --- a/drivers/media/dvb/siano/smsir.h +++ b/drivers/media/dvb/siano/smsir.h @@ -28,7 +28,7 @@ along with this program. If not, see . #define __SMS_IR_H__ #include -#include +#include #define IR_DEFAULT_TIMEOUT 100 diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 0ffd6943da83..44afab2fdc2d 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig @@ -97,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 IR_CORE + depends on RC_CORE help Support for simple SAA7146 based DVB cards (so called Budget- or Nova-PCI cards) without onboard diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 9aca0f37993b..32caa9b7af8e 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "budget.h" diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig index ef19375899ec..42b4feb0e7f9 100644 --- a/drivers/media/rc/Kconfig +++ b/drivers/media/rc/Kconfig @@ -1,16 +1,17 @@ -menuconfig IR_CORE - tristate "Infrared remote controller adapters" +menuconfig RC_CORE + tristate "Remote Controller adapters" depends on INPUT default INPUT ---help--- Enable support for Remote Controllers on Linux. This is needed in order to support several video capture adapters. + Currently, all supported devices use InfraRed. Enable this option if you have a video capture board even if you don't need IR, as otherwise, you may not be able to compile the driver for your adapter. -if IR_CORE +if RC_CORE config LIRC tristate @@ -27,7 +28,7 @@ source "drivers/media/rc/keymaps/Kconfig" config IR_NEC_DECODER tristate "Enable IR raw decoder for the NEC protocol" - depends on IR_CORE + depends on RC_CORE select BITREVERSE default y @@ -37,7 +38,7 @@ config IR_NEC_DECODER config IR_RC5_DECODER tristate "Enable IR raw decoder for the RC-5 protocol" - depends on IR_CORE + depends on RC_CORE select BITREVERSE default y @@ -47,7 +48,7 @@ config IR_RC5_DECODER config IR_RC6_DECODER tristate "Enable IR raw decoder for the RC6 protocol" - depends on IR_CORE + depends on RC_CORE select BITREVERSE default y @@ -57,7 +58,7 @@ config IR_RC6_DECODER config IR_JVC_DECODER tristate "Enable IR raw decoder for the JVC protocol" - depends on IR_CORE + depends on RC_CORE select BITREVERSE default y @@ -67,7 +68,7 @@ config IR_JVC_DECODER config IR_SONY_DECODER tristate "Enable IR raw decoder for the Sony protocol" - depends on IR_CORE + depends on RC_CORE default y ---help--- @@ -76,7 +77,7 @@ config IR_SONY_DECODER config IR_RC5_SZ_DECODER tristate "Enable IR raw decoder for the RC-5 (streamzap) protocol" - depends on IR_CORE + depends on RC_CORE select BITREVERSE default y @@ -88,7 +89,7 @@ config IR_RC5_SZ_DECODER config IR_LIRC_CODEC tristate "Enable IR to LIRC bridge" - depends on IR_CORE + depends on RC_CORE depends on LIRC default y @@ -99,7 +100,7 @@ config IR_LIRC_CODEC config IR_ENE tristate "ENE eHome Receiver/Transceiver (pnp id: ENE0100/ENE02xxx)" depends on PNP - depends on IR_CORE + depends on RC_CORE ---help--- Say Y here to enable support for integrated infrared receiver /transceiver made by ENE. @@ -113,7 +114,7 @@ config IR_ENE config IR_IMON tristate "SoundGraph iMON Receiver and Display" depends on USB_ARCH_HAS_HCD - depends on IR_CORE + depends on RC_CORE select USB ---help--- Say Y here if you want to use a SoundGraph iMON (aka Antec Veris) @@ -125,7 +126,7 @@ config IR_IMON config IR_MCEUSB tristate "Windows Media Center Ed. eHome Infrared Transceiver" depends on USB_ARCH_HAS_HCD - depends on IR_CORE + depends on RC_CORE select USB ---help--- Say Y here if you want to use a Windows Media Center Edition @@ -137,7 +138,7 @@ config IR_MCEUSB config IR_NUVOTON tristate "Nuvoton w836x7hg Consumer Infrared Transceiver" depends on PNP - depends on IR_CORE + depends on RC_CORE ---help--- Say Y here to enable support for integrated infrared receiver /transciever made by Nuvoton (formerly Winbond). This chip is @@ -150,7 +151,7 @@ config IR_NUVOTON config IR_STREAMZAP tristate "Streamzap PC Remote IR Receiver" depends on USB_ARCH_HAS_HCD - depends on IR_CORE + depends on RC_CORE select USB ---help--- Say Y here if you want to use a Streamzap PC Remote @@ -162,7 +163,7 @@ config IR_STREAMZAP config IR_WINBOND_CIR tristate "Winbond IR remote control" depends on X86 && PNP - depends on IR_CORE + depends on RC_CORE select NEW_LEDS select LEDS_CLASS select LEDS_TRIGGERS @@ -176,4 +177,4 @@ config IR_WINBOND_CIR To compile this driver as a module, choose M here: the module will be called winbond_cir. -endif #IR_CORE +endif #RC_CORE diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile index 8c0e4cb19551..21251ba55904 100644 --- a/drivers/media/rc/Makefile +++ b/drivers/media/rc/Makefile @@ -2,7 +2,7 @@ rc-core-objs := rc-main.o rc-raw.o obj-y += keymaps/ -obj-$(CONFIG_IR_CORE) += rc-core.o +obj-$(CONFIG_RC_CORE) += rc-core.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 diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 0a4151f03c7e..1ace4581f157 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "ene_ir.h" static int sample_period; diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 8d4b35d1ae56..b6ba3c7dc632 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index ceabea6053de..f9086c5ba8b1 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "rc-core-priv.h" #define LIRCBUF_SIZE 256 diff --git a/drivers/media/rc/keymaps/Kconfig b/drivers/media/rc/keymaps/Kconfig index 14b22f58f823..8e615fd55852 100644 --- a/drivers/media/rc/keymaps/Kconfig +++ b/drivers/media/rc/keymaps/Kconfig @@ -1,6 +1,6 @@ config RC_MAP tristate "Compile Remote Controller keymap modules" - depends on IR_CORE + depends on RC_CORE default y ---help--- diff --git a/drivers/media/rc/keymaps/rc-lirc.c b/drivers/media/rc/keymaps/rc-lirc.c index 43fcf9035082..9c8577d6e497 100644 --- a/drivers/media/rc/keymaps/rc-lirc.c +++ b/drivers/media/rc/keymaps/rc-lirc.c @@ -9,7 +9,7 @@ * (at your option) any later version. */ -#include +#include static struct ir_scancode lirc[] = { { }, diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 539bec2974b7..db7787ac67a3 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #define DRIVER_VERSION "1.91" #define DRIVER_AUTHOR "Jarod Wilson " diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 0ce328f9dacf..bf3f58f7bd7c 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include "nuvoton-cir.h" diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 3616c32d3f87..48065b714d00 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -18,7 +18,7 @@ #include #include -#include +#include struct ir_raw_handler { struct list_head list; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 5b67eea96ebb..d91b62cf1324 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -12,7 +12,7 @@ * GNU General Public License for more details. */ -#include +#include #include #include #include @@ -1103,11 +1103,11 @@ EXPORT_SYMBOL_GPL(rc_unregister_device); * Init/exit code for the module. Basically, creates/removes /sys/class/rc */ -static int __init ir_core_init(void) +static int __init rc_core_init(void) { int rc = class_register(&ir_input_class); if (rc) { - printk(KERN_ERR "ir_core: unable to register rc class\n"); + printk(KERN_ERR "rc_core: unable to register rc class\n"); return rc; } @@ -1118,18 +1118,18 @@ static int __init ir_core_init(void) return 0; } -static void __exit ir_core_exit(void) +static void __exit rc_core_exit(void) { class_unregister(&ir_input_class); ir_unregister_map(&empty_map); } -module_init(ir_core_init); -module_exit(ir_core_exit); +module_init(rc_core_init); +module_exit(rc_core_exit); -int ir_core_debug; /* ir_debug level (0,1,2) */ -EXPORT_SYMBOL_GPL(ir_core_debug); -module_param_named(debug, ir_core_debug, int, 0644); +int rc_core_debug; /* ir_debug level (0,1,2) */ +EXPORT_SYMBOL_GPL(rc_core_debug); +module_param_named(debug, rc_core_debug, int, 0644); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); diff --git a/drivers/media/rc/rc-raw.c b/drivers/media/rc/rc-raw.c index ab9b1e4071c0..165412fd240e 100644 --- a/drivers/media/rc/rc-raw.c +++ b/drivers/media/rc/rc-raw.c @@ -357,7 +357,7 @@ static void init_decoders(struct work_struct *work) load_lirc_codec(); /* If needed, we may later add some init code. In this case, - it is needed to change the CONFIG_MODULE test at ir-core.h + it is needed to change the CONFIG_MODULE test at rc-core.h */ } #endif diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index f05f5c173fdf..ea2cb636a193 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #define DRIVER_VERSION "1.61" #define DRIVER_NAME "streamzap" diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 0ee16ec23bbf..186de5522001 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #define DRVNAME "winbond-cir" diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 963b3e6c4a97..4b751ef47a83 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -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 && IR_CORE + depends on I2C && RC_CORE default y ---help--- Most boards have an IR chip directly connected via GPIO. However, diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index 3c7c0a572c45..7da5c2e1fc12 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig @@ -4,7 +4,7 @@ config VIDEO_BT848 select I2C_ALGOBIT select VIDEO_BTCX select VIDEOBUF_DMA_SG - depends on IR_CORE + depends on RC_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 0bbdd481e336..b71d04d12085 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include "bt848.h" diff --git a/drivers/media/video/cx18/Kconfig b/drivers/media/video/cx18/Kconfig index f3c3ccb491fe..d9d2f6ad6ffb 100644 --- a/drivers/media/video/cx18/Kconfig +++ b/drivers/media/video/cx18/Kconfig @@ -2,7 +2,7 @@ config VIDEO_CX18 tristate "Conexant cx23418 MPEG encoder support" depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL select I2C_ALGOBIT - depends on IR_CORE + depends on RC_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X diff --git a/drivers/media/video/cx231xx/Kconfig b/drivers/media/video/cx231xx/Kconfig index d6a235007a7d..ae85a7a7bd73 100644 --- a/drivers/media/video/cx231xx/Kconfig +++ b/drivers/media/video/cx231xx/Kconfig @@ -3,7 +3,7 @@ config VIDEO_CX231XX depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on IR_CORE + depends on RC_CORE select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X @@ -16,7 +16,7 @@ config VIDEO_CX231XX config VIDEO_CX231XX_RC bool "Conexant cx231xx Remote Controller additional support" - depends on IR_CORE + depends on RC_CORE depends on VIDEO_CX231XX default y ---help--- diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index fcccc9d2a08e..87a20ae6fcc0 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index e1367b35647a..6b4a516addfe 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig @@ -5,7 +5,7 @@ config VIDEO_CX23885 select VIDEO_BTCX select VIDEO_TUNER select VIDEO_TVEEPROM - depends on IR_CORE + depends on RC_CORE select VIDEOBUF_DVB select VIDEOBUF_DMA_SG select VIDEO_CX25840 diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index f1bb3a8683c1..e824ba63fdde 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -36,7 +36,7 @@ */ #include -#include +#include #include #include "cx23885.h" diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index f350d88944e8..fd387229daff 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "btcx-risc.h" #include "cx23885-reg.h" diff --git a/drivers/media/video/cx23885/cx23888-ir.c b/drivers/media/video/cx23885/cx23888-ir.c index e78e3e4c8112..e37be6fcf67d 100644 --- a/drivers/media/video/cx23885/cx23888-ir.c +++ b/drivers/media/video/cx23885/cx23888-ir.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "cx23885.h" diff --git a/drivers/media/video/cx25840/cx25840-ir.c b/drivers/media/video/cx25840/cx25840-ir.c index 97a4e9b25fe4..627926f6bde8 100644 --- a/drivers/media/video/cx25840/cx25840-ir.c +++ b/drivers/media/video/cx25840/cx25840-ir.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "cx25840-core.h" diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index dbae62935e1f..5c42abdf422f 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -1,6 +1,6 @@ config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && I2C && IR_CORE + depends on VIDEO_DEV && PCI && I2C && RC_CORE select I2C_ALGOBIT select VIDEO_BTCX select VIDEOBUF_DMA_SG diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 3b2ef45d6348..a73033846fce 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -29,7 +29,7 @@ #include #include "cx88.h" -#include +#include #define MODULE_NAME "cx88xx" diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 72ea2baba790..985100ea17a4 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig @@ -3,7 +3,7 @@ config VIDEO_EM28XX depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on IR_CORE + depends on RC_CORE select VIDEOBUF_VMALLOC select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 6a48043a7b92..6f2795a3d4b7 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #if defined(CONFIG_VIDEO_EM28XX_DVB) || defined(CONFIG_VIDEO_EM28XX_DVB_MODULE) #include #endif diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index de0060fa33f1..83662a4ff73c 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include /* ----------------------------------------------------------------------- */ diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig index c4f19801c73b..89f65914cc8e 100644 --- a/drivers/media/video/ivtv/Kconfig +++ b/drivers/media/video/ivtv/Kconfig @@ -2,7 +2,7 @@ config VIDEO_IVTV tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" depends on VIDEO_V4L2 && PCI && I2C select I2C_ALGOBIT - depends on IR_CORE + depends on RC_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index e03bff9e4246..380f1b28cfcc 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -26,7 +26,7 @@ config VIDEO_SAA7134_ALSA config VIDEO_SAA7134_RC bool "Philips SAA7134 Remote Controller support" - depends on IR_CORE + depends on RC_CORE depends on VIDEO_SAA7134 default y ---help--- diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index c6ef95ec68f2..1923f3ca0eab 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drivers/media/video/tlg2300/Kconfig b/drivers/media/video/tlg2300/Kconfig index 580580ec9362..645d915267e6 100644 --- a/drivers/media/video/tlg2300/Kconfig +++ b/drivers/media/video/tlg2300/Kconfig @@ -3,7 +3,7 @@ config VIDEO_TLG2300 depends on VIDEO_DEV && I2C && SND && DVB_CORE select VIDEO_TUNER select VIDEO_TVEEPROM - depends on IR_CORE + depends on RC_CORE select VIDEOBUF_VMALLOC select SND_PCM select VIDEOBUF_DVB diff --git a/drivers/staging/cx25821/Kconfig b/drivers/staging/cx25821/Kconfig index f8f2bb01055f..b2656957aa8f 100644 --- a/drivers/staging/cx25821/Kconfig +++ b/drivers/staging/cx25821/Kconfig @@ -5,7 +5,7 @@ config VIDEO_CX25821 select I2C_ALGOBIT select VIDEO_BTCX select VIDEO_TVEEPROM - depends on IR_CORE + depends on RC_CORE select VIDEOBUF_DVB select VIDEOBUF_DMA_SG select VIDEO_CX25840 diff --git a/drivers/staging/go7007/Kconfig b/drivers/staging/go7007/Kconfig index edc90919f3c6..1da57df5cbcb 100644 --- a/drivers/staging/go7007/Kconfig +++ b/drivers/staging/go7007/Kconfig @@ -4,7 +4,7 @@ config VIDEO_GO7007 depends on BKL # please fix depends on SND select VIDEOBUF_DMA_SG - depends on IR_CORE + depends on RC_CORE select VIDEO_TUNER select VIDEO_TVEEPROM select SND_PCM diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index de7ebb99d8f6..114eec8a630a 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -1,6 +1,6 @@ config VIDEO_TM6000 tristate "TV Master TM5600/6000/6010 driver" - depends on VIDEO_DEV && I2C && INPUT && IR_CORE && USB && EXPERIMENTAL + depends on VIDEO_DEV && I2C && INPUT && RC_CORE && USB && EXPERIMENTAL select VIDEO_TUNER select MEDIA_TUNER_XC2028 select MEDIA_TUNER_XC5000 diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 3517d20c1310..58e93d0f304f 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include "tm6000.h" #include "tm6000-regs.h" diff --git a/include/media/ir-core.h b/include/media/ir-core.h deleted file mode 100644 index c5909981b075..000000000000 --- a/include/media/ir-core.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Remote Controller core header - * - * Copyright (C) 2009-2010 by Mauro Carvalho Chehab - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _IR_CORE -#define _IR_CORE - -#include -#include -#include -#include -#include - -extern int ir_core_debug; -#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ - printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) - -enum rc_driver_type { - RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ - RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ -}; - -/** - * struct rc_dev - represents a remote control device - * @dev: driver model's view of this device - * @input_name: name of the input child device - * @input_phys: physical path to the input child device - * @input_id: id of the input child device (struct input_id) - * @driver_name: name of the hardware driver which registered this device - * @map_name: name of the default keymap - * @rc_tab: current scan/key table - * @devno: unique remote control device number - * @raw: additional data for raw pulse/space devices - * @input_dev: the input child device used to communicate events to userspace - * @driver_type: specifies if protocol decoding is done in hardware or software - * @idle: used to keep track of RX state - * @allowed_protos: bitmask with the supported IR_TYPE_* protocols - * @scanmask: some hardware decoders are not capable of providing the full - * scancode to the application. As this is a hardware limit, we can't do - * anything with it. Yet, as the same keycode table can be used with other - * devices, a mask is provided to allow its usage. Drivers should generally - * leave this field in blank - * @priv: driver-specific data - * @keylock: protects the remaining members of the struct - * @keypressed: whether a key is currently pressed - * @keyup_jiffies: time (in jiffies) when the current keypress should be released - * @timer_keyup: timer for releasing a keypress - * @last_keycode: keycode of last keypress - * @last_scancode: scancode of last keypress - * @last_toggle: toggle value of last command - * @timeout: optional time after which device stops sending data - * @min_timeout: minimum timeout supported by device - * @max_timeout: maximum timeout supported by device - * @rx_resolution : resolution (in ns) of input sampler - * @tx_resolution: resolution (in ns) of output sampler - * @change_protocol: allow changing the protocol used on hardware decoders - * @open: callback to allow drivers to enable polling/irq when IR input device - * is opened. - * @close: callback to allow drivers to disable polling/irq when IR input device - * is opened. - * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) - * @s_tx_carrier: set transmit carrier frequency - * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) - * @s_rx_carrier: inform driver about carrier it is expected to handle - * @tx_ir: transmit IR - * @s_idle: enable/disable hardware idle mode, upon which, - * device doesn't interrupt host until it sees IR pulses - * @s_learning_mode: enable wide band receiver used for learning - * @s_carrier_report: enable carrier reports - */ -struct rc_dev { - struct device dev; - const char *input_name; - const char *input_phys; - struct input_id input_id; - char *driver_name; - const char *map_name; - struct ir_scancode_table rc_tab; - unsigned long devno; - struct ir_raw_event_ctrl *raw; - struct input_dev *input_dev; - enum rc_driver_type driver_type; - bool idle; - u64 allowed_protos; - u32 scanmask; - void *priv; - spinlock_t keylock; - bool keypressed; - unsigned long keyup_jiffies; - struct timer_list timer_keyup; - u32 last_keycode; - u32 last_scancode; - u8 last_toggle; - u32 timeout; - u32 min_timeout; - u32 max_timeout; - u32 rx_resolution; - u32 tx_resolution; - int (*change_protocol)(struct rc_dev *dev, u64 ir_type); - int (*open)(struct rc_dev *dev); - void (*close)(struct rc_dev *dev); - int (*s_tx_mask)(struct rc_dev *dev, u32 mask); - int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); - int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); - int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); - int (*tx_ir)(struct rc_dev *dev, int *txbuf, u32 n); - void (*s_idle)(struct rc_dev *dev, bool enable); - int (*s_learning_mode)(struct rc_dev *dev, int enable); - int (*s_carrier_report) (struct rc_dev *dev, int enable); -}; - -enum raw_event_type { - IR_SPACE = (1 << 0), - IR_PULSE = (1 << 1), - IR_START_EVENT = (1 << 2), - IR_STOP_EVENT = (1 << 3), -}; - -#define to_rc_dev(d) container_of(d, struct rc_dev, dev) - - -void ir_repeat(struct rc_dev *dev); -void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle); -void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); -void ir_keyup(struct rc_dev *dev); -u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode); - -/* From ir-raw-event.c */ -struct ir_raw_event { - union { - u32 duration; - - struct { - u32 carrier; - u8 duty_cycle; - }; - }; - - unsigned pulse:1; - unsigned reset:1; - unsigned timeout:1; - unsigned carrier_report:1; -}; - -#define DEFINE_IR_RAW_EVENT(event) \ - struct ir_raw_event event = { \ - { .duration = 0 } , \ - .pulse = 0, \ - .reset = 0, \ - .timeout = 0, \ - .carrier_report = 0 } - -static inline void init_ir_raw_event(struct ir_raw_event *ev) -{ - memset(ev, 0, sizeof(*ev)); -} - -#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ - -struct rc_dev *rc_allocate_device(void); -void rc_free_device(struct rc_dev *dev); -int rc_register_device(struct rc_dev *dev); -void rc_unregister_device(struct rc_dev *dev); - -void ir_raw_event_handle(struct rc_dev *dev); -int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); -int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type); -int ir_raw_event_store_with_filter(struct rc_dev *dev, - struct ir_raw_event *ev); -void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); - -static inline void ir_raw_event_reset(struct rc_dev *dev) -{ - DEFINE_IR_RAW_EVENT(ev); - ev.reset = true; - - ir_raw_event_store(dev, &ev); - ir_raw_event_handle(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 */ diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index d27505f2448e..f22b359c37ff 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -1,7 +1,7 @@ #ifndef _IR_I2C #define _IR_I2C -#include +#include #define DEFAULT_POLLING_INTERVAL 100 /* ms */ diff --git a/include/media/rc-core.h b/include/media/rc-core.h new file mode 100644 index 000000000000..eedb2f0575a4 --- /dev/null +++ b/include/media/rc-core.h @@ -0,0 +1,211 @@ +/* + * Remote Controller core header + * + * Copyright (C) 2009-2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _IR_CORE +#define _IR_CORE + +#include +#include +#include +#include +#include + +extern int rc_core_debug; +#define IR_dprintk(level, fmt, arg...) if (rc_core_debug >= level) \ + printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) + +enum rc_driver_type { + RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ + RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ +}; + +/** + * struct rc_dev - represents a remote control device + * @dev: driver model's view of this device + * @input_name: name of the input child device + * @input_phys: physical path to the input child device + * @input_id: id of the input child device (struct input_id) + * @driver_name: name of the hardware driver which registered this device + * @map_name: name of the default keymap + * @rc_tab: current scan/key table + * @devno: unique remote control device number + * @raw: additional data for raw pulse/space devices + * @input_dev: the input child device used to communicate events to userspace + * @driver_type: specifies if protocol decoding is done in hardware or software + * @idle: used to keep track of RX state + * @allowed_protos: bitmask with the supported IR_TYPE_* protocols + * @scanmask: some hardware decoders are not capable of providing the full + * scancode to the application. As this is a hardware limit, we can't do + * anything with it. Yet, as the same keycode table can be used with other + * devices, a mask is provided to allow its usage. Drivers should generally + * leave this field in blank + * @priv: driver-specific data + * @keylock: protects the remaining members of the struct + * @keypressed: whether a key is currently pressed + * @keyup_jiffies: time (in jiffies) when the current keypress should be released + * @timer_keyup: timer for releasing a keypress + * @last_keycode: keycode of last keypress + * @last_scancode: scancode of last keypress + * @last_toggle: toggle value of last command + * @timeout: optional time after which device stops sending data + * @min_timeout: minimum timeout supported by device + * @max_timeout: maximum timeout supported by device + * @rx_resolution : resolution (in ns) of input sampler + * @tx_resolution: resolution (in ns) of output sampler + * @change_protocol: allow changing the protocol used on hardware decoders + * @open: callback to allow drivers to enable polling/irq when IR input device + * is opened. + * @close: callback to allow drivers to disable polling/irq when IR input device + * is opened. + * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) + * @s_tx_carrier: set transmit carrier frequency + * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) + * @s_rx_carrier: inform driver about carrier it is expected to handle + * @tx_ir: transmit IR + * @s_idle: enable/disable hardware idle mode, upon which, + * device doesn't interrupt host until it sees IR pulses + * @s_learning_mode: enable wide band receiver used for learning + * @s_carrier_report: enable carrier reports + */ +struct rc_dev { + struct device dev; + const char *input_name; + const char *input_phys; + struct input_id input_id; + char *driver_name; + const char *map_name; + struct ir_scancode_table rc_tab; + unsigned long devno; + struct ir_raw_event_ctrl *raw; + struct input_dev *input_dev; + enum rc_driver_type driver_type; + bool idle; + u64 allowed_protos; + u32 scanmask; + void *priv; + spinlock_t keylock; + bool keypressed; + unsigned long keyup_jiffies; + struct timer_list timer_keyup; + u32 last_keycode; + u32 last_scancode; + u8 last_toggle; + u32 timeout; + u32 min_timeout; + u32 max_timeout; + u32 rx_resolution; + u32 tx_resolution; + int (*change_protocol)(struct rc_dev *dev, u64 ir_type); + int (*open)(struct rc_dev *dev); + void (*close)(struct rc_dev *dev); + int (*s_tx_mask)(struct rc_dev *dev, u32 mask); + int (*s_tx_carrier)(struct rc_dev *dev, u32 carrier); + int (*s_tx_duty_cycle)(struct rc_dev *dev, u32 duty_cycle); + int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max); + int (*tx_ir)(struct rc_dev *dev, int *txbuf, u32 n); + void (*s_idle)(struct rc_dev *dev, bool enable); + int (*s_learning_mode)(struct rc_dev *dev, int enable); + int (*s_carrier_report) (struct rc_dev *dev, int enable); +}; + +enum raw_event_type { + IR_SPACE = (1 << 0), + IR_PULSE = (1 << 1), + IR_START_EVENT = (1 << 2), + IR_STOP_EVENT = (1 << 3), +}; + +#define to_rc_dev(d) container_of(d, struct rc_dev, dev) + + +void ir_repeat(struct rc_dev *dev); +void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle); +void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); +void ir_keyup(struct rc_dev *dev); +u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode); + +/* From ir-raw-event.c */ +struct ir_raw_event { + union { + u32 duration; + + struct { + u32 carrier; + u8 duty_cycle; + }; + }; + + unsigned pulse:1; + unsigned reset:1; + unsigned timeout:1; + unsigned carrier_report:1; +}; + +#define DEFINE_IR_RAW_EVENT(event) \ + struct ir_raw_event event = { \ + { .duration = 0 } , \ + .pulse = 0, \ + .reset = 0, \ + .timeout = 0, \ + .carrier_report = 0 } + +static inline void init_ir_raw_event(struct ir_raw_event *ev) +{ + memset(ev, 0, sizeof(*ev)); +} + +#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ + +struct rc_dev *rc_allocate_device(void); +void rc_free_device(struct rc_dev *dev); +int rc_register_device(struct rc_dev *dev); +void rc_unregister_device(struct rc_dev *dev); + +void ir_raw_event_handle(struct rc_dev *dev); +int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); +int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type); +int ir_raw_event_store_with_filter(struct rc_dev *dev, + struct ir_raw_event *ev); +void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); + +static inline void ir_raw_event_reset(struct rc_dev *dev) +{ + DEFINE_IR_RAW_EVENT(ev); + ev.reset = true; + + ir_raw_event_store(dev, &ev); + ir_raw_event_handle(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 */ -- cgit v1.2.3 From ca86674b8a93ea11c4bb6f4dd0113b1adf1fa841 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 13:53:11 -0300 Subject: [media] Rename all public generic RC functions from ir_ to rc_ Those functions are not InfraRed specific. So, rename them to properly reflect it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/dvb-usb/af9015.c | 4 +-- drivers/media/dvb/dvb-usb/anysee.c | 2 +- drivers/media/dvb/dvb-usb/dib0700_core.c | 2 +- drivers/media/dvb/dvb-usb/dib0700_devices.c | 4 +-- drivers/media/dvb/dvb-usb/lmedm04.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- drivers/media/rc/imon.c | 10 +++--- drivers/media/rc/ir-jvc-decoder.c | 4 +-- drivers/media/rc/ir-nec-decoder.c | 6 ++-- drivers/media/rc/ir-rc5-decoder.c | 2 +- drivers/media/rc/ir-rc5-sz-decoder.c | 2 +- drivers/media/rc/ir-rc6-decoder.c | 2 +- drivers/media/rc/ir-sony-decoder.c | 2 +- drivers/media/rc/rc-main.c | 36 ++++++++++----------- drivers/media/video/bt8xx/bttv-input.c | 16 +++++----- drivers/media/video/cx88/cx88-input.c | 14 ++++----- drivers/media/video/em28xx/em28xx-input.c | 4 +-- drivers/media/video/ir-kbd-i2c.c | 2 +- drivers/media/video/saa7134/saa7134-input.c | 12 +++---- drivers/staging/tm6000/tm6000-input.c | 2 +- include/media/rc-core.h | 49 +++++++++++++++++------------ 22 files changed, 95 insertions(+), 86 deletions(-) (limited to 'include') diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index e9cacf6e9277..2d8b4044be36 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -531,7 +531,7 @@ static void dm1105_emit_key(struct work_struct *work) data = (ircom >> 8) & 0x7f; - ir_keydown(ir->dev, data, 0); + rc_keydown(ir->dev, data, 0); } /* work handler */ diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 8b9ab3002e11..bc2a6e464cea 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -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_dev, priv->rc_keycode, 0); + rc_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_dev, priv->rc_keycode, 0); + rc_keydown(d->rc_dev, priv->rc_keycode, 0); } else { deb_rc("%s: no key press\n", __func__); } diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index c6e4ba53ad61..5e12488f3c76 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -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_dev, 0x08 << 8 | ircode[1], 0); + rc_keydown(d->rc_dev, 0x08 << 8 | ircode[1], 0); } return 0; diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 3b58f4575689..1dd119e7b676 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -600,7 +600,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) goto resubmit; } - ir_keydown(d->rc_dev, keycode, toggle); + rc_keydown(d->rc_dev, keycode, toggle); resubmit: /* Clean the buffer before we requeue */ diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index be167f2bea33..9ac920d0483e 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -520,13 +520,13 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) d->last_event = keycode; } - ir_keydown(d->rc_dev, keycode, 0); + rc_keydown(d->rc_dev, keycode, 0); break; default: /* RC-5 protocol changes toggle bit on new keypress */ keycode = key[3-2] << 8 | key[3-3]; toggle = key[3-1]; - ir_keydown(d->rc_dev, keycode, toggle); + rc_keydown(d->rc_dev, keycode, toggle); break; } diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index f0c030837f29..1455c238b01b 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -198,7 +198,7 @@ static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u16 keypress) deb_info(1, "INT Key Keypress =%04x", keypress); if (keypress > 0) - ir_keydown(d->rc_dev, keypress, 0); + rc_keydown(d->rc_dev, keypress, 0); return 0; } diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 32caa9b7af8e..8ae67c1751a9 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -159,7 +159,7 @@ static void msp430_ir_interrupt(unsigned long data) budget_ci->ir.rc5_device != (command & 0x1f)) return; - ir_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0); + rc_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0); } static int msp430_ir_init(struct budget_ci *budget_ci) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index b6ba3c7dc632..d67573edb052 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1146,14 +1146,14 @@ static u32 imon_remote_key_lookup(struct imon_context *ictx, u32 scancode) bool is_release_code = false; /* Look for the initial press of a button */ - keycode = ir_g_keycode_from_table(ictx->rdev, scancode); + keycode = rc_g_keycode_from_table(ictx->rdev, scancode); ictx->rc_toggle = 0x0; ictx->rc_scancode = scancode; /* Look for the release of a button */ if (keycode == KEY_RESERVED) { release = scancode & ~0x4000; - keycode = ir_g_keycode_from_table(ictx->rdev, release); + keycode = rc_g_keycode_from_table(ictx->rdev, release); if (keycode != KEY_RESERVED) is_release_code = true; } @@ -1182,7 +1182,7 @@ static u32 imon_mce_key_lookup(struct imon_context *ictx, u32 scancode) scancode = scancode | MCE_KEY_MASK | MCE_TOGGLE_BIT; ictx->rc_scancode = scancode; - keycode = ir_g_keycode_from_table(ictx->rdev, scancode); + keycode = rc_g_keycode_from_table(ictx->rdev, scancode); /* not used in mce mode, but make sure we know its false */ ictx->release_code = false; @@ -1564,9 +1564,9 @@ static void imon_incoming_packet(struct imon_context *ictx, if (ktype != IMON_KEY_PANEL) { if (press_type == 0) - ir_keyup(ictx->rdev); + rc_keyup(ictx->rdev); else { - ir_keydown(ictx->rdev, ictx->rc_scancode, ictx->rc_toggle); + rc_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); diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index cfe0e70440a5..09c143ff33f3 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c @@ -139,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(dev, scancode, data->toggle); + rc_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(dev); + rc_repeat(dev); } else { IR_dprintk(1, "JVC invalid repeat msg\n"); break; diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 8ff157a140ca..235d774d0ec2 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -88,7 +88,7 @@ static int ir_nec_decode(struct rc_dev *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(dev); + rc_repeat(dev); IR_dprintk(1, "Repeat last key\n"); data->state = STATE_TRAILER_PULSE; return 0; @@ -114,7 +114,7 @@ static int ir_nec_decode(struct rc_dev *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(dev); + rc_repeat(dev); data->state = STATE_INACTIVE; return 0; @@ -178,7 +178,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) if (data->is_nec_x) data->necx_repeat = true; - ir_keydown(dev, scancode, 0); + rc_keydown(dev, scancode, 0); data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index dae6f9a9b662..779ab0d0a285 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c @@ -150,7 +150,7 @@ again: scancode, toggle); } - ir_keydown(dev, scancode, toggle); + rc_keydown(dev, scancode, toggle); data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c index d8a53c02c1e4..5586bf20c8d7 100644 --- a/drivers/media/rc/ir-rc5-sz-decoder.c +++ b/drivers/media/rc/ir-rc5-sz-decoder.c @@ -114,7 +114,7 @@ again: IR_dprintk(1, "RC5-sz scancode 0x%04x (toggle: %u)\n", scancode, toggle); - ir_keydown(dev, scancode, toggle); + rc_keydown(dev, scancode, toggle); data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 2435bbd1dbcc..88d948728c2f 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -242,7 +242,7 @@ again: goto out; } - ir_keydown(dev, scancode, toggle); + rc_keydown(dev, scancode, toggle); data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index 3138520fb9e7..5292b89f8de2 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c @@ -143,7 +143,7 @@ static int ir_sony_decode(struct rc_dev *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(dev, scancode, 0); + rc_keydown(dev, scancode, 0); data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index d91b62cf1324..11e2703ef1c4 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -481,7 +481,7 @@ out: } /** - * ir_g_keycode_from_table() - gets the keycode that corresponds to a scancode + * rc_g_keycode_from_table() - gets the keycode that corresponds to a scancode * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode to look for * @return: the corresponding keycode, or KEY_RESERVED @@ -490,7 +490,7 @@ out: * keycode. Normally it should not be used since drivers should have no * interest in keycodes. */ -u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode) +u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode) { struct ir_scancode_table *rc_tab = &dev->rc_tab; unsigned int keycode; @@ -511,7 +511,7 @@ u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode) return keycode; } -EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); +EXPORT_SYMBOL_GPL(rc_g_keycode_from_table); /** * ir_do_keyup() - internal function to signal the release of a keypress @@ -532,13 +532,13 @@ static void ir_do_keyup(struct rc_dev *dev) } /** - * ir_keyup() - signals the release of a keypress + * rc_keyup() - signals the release of a keypress * @dev: the struct rc_dev descriptor of the device * * This routine is used to signal that a key has been released on the * remote control. */ -void ir_keyup(struct rc_dev *dev) +void rc_keyup(struct rc_dev *dev) { unsigned long flags; @@ -546,7 +546,7 @@ void ir_keyup(struct rc_dev *dev) ir_do_keyup(dev); spin_unlock_irqrestore(&dev->keylock, flags); } -EXPORT_SYMBOL_GPL(ir_keyup); +EXPORT_SYMBOL_GPL(rc_keyup); /** * ir_timer_keyup() - generates a keyup event after a timeout @@ -577,14 +577,14 @@ static void ir_timer_keyup(unsigned long cookie) } /** - * ir_repeat() - signals that a key is still pressed + * rc_repeat() - signals that a key is still pressed * @dev: the struct rc_dev descriptor of the device * * This routine is used by IR decoders when a repeat message which does * not include the necessary bits to reproduce the scancode has been * received. */ -void ir_repeat(struct rc_dev *dev) +void rc_repeat(struct rc_dev *dev) { unsigned long flags; @@ -601,7 +601,7 @@ void ir_repeat(struct rc_dev *dev) out: spin_unlock_irqrestore(&dev->keylock, flags); } -EXPORT_SYMBOL_GPL(ir_repeat); +EXPORT_SYMBOL_GPL(rc_repeat); /** * ir_do_keydown() - internal function to process a keypress @@ -643,7 +643,7 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, } /** - * ir_keydown() - generates input event for a key press + * rc_keydown() - generates input event for a key press * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode that we're seeking * @toggle: the toggle value (protocol dependent, if the protocol doesn't @@ -652,10 +652,10 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, * This routine is used to signal that a key has been pressed on the * remote control. */ -void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle) +void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle) { unsigned long flags; - u32 keycode = ir_g_keycode_from_table(dev, scancode); + u32 keycode = rc_g_keycode_from_table(dev, scancode); spin_lock_irqsave(&dev->keylock, flags); ir_do_keydown(dev, scancode, keycode, toggle); @@ -666,10 +666,10 @@ void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle) } spin_unlock_irqrestore(&dev->keylock, flags); } -EXPORT_SYMBOL_GPL(ir_keydown); +EXPORT_SYMBOL_GPL(rc_keydown); /** - * ir_keydown_notimeout() - generates input event for a key press without + * rc_keydown_notimeout() - generates input event for a key press without * an automatic keyup event at a later time * @dev: the struct rc_dev descriptor of the device * @scancode: the scancode that we're seeking @@ -677,18 +677,18 @@ EXPORT_SYMBOL_GPL(ir_keydown); * support toggle values, this should be set to zero) * * This routine is used to signal that a key has been pressed on the - * remote control. The driver must manually call ir_keyup() at a later stage. + * remote control. The driver must manually call rc_keyup() at a later stage. */ -void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle) +void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle) { unsigned long flags; - u32 keycode = ir_g_keycode_from_table(dev, scancode); + u32 keycode = rc_g_keycode_from_table(dev, scancode); spin_lock_irqsave(&dev->keylock, flags); ir_do_keydown(dev, scancode, keycode, toggle); spin_unlock_irqrestore(&dev->keylock, flags); } -EXPORT_SYMBOL_GPL(ir_keydown_notimeout); +EXPORT_SYMBOL_GPL(rc_keydown_notimeout); static int ir_open(struct input_dev *idev) { diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index e4df7f85f9df..773ee6a8eed4 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -70,14 +70,14 @@ static void ir_handle_key(struct bttv *btv) if ((ir->mask_keydown && (gpio & ir->mask_keydown)) || (ir->mask_keyup && !(gpio & ir->mask_keyup))) { - ir_keydown_notimeout(ir->dev, data, 0); + rc_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_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); - ir_keyup(ir->dev); + rc_keyup(ir->dev); } } @@ -100,9 +100,9 @@ static void ir_enltv_handle_key(struct bttv *btv) gpio, data, (gpio & ir->mask_keyup) ? " up" : "up/down"); - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); if (keyup) - ir_keyup(ir->dev); + rc_keyup(ir->dev); } else { if ((ir->last_gpio & 1 << 31) == keyup) return; @@ -112,9 +112,9 @@ static void ir_enltv_handle_key(struct bttv *btv) (gpio & ir->mask_keyup) ? " up" : "down"); if (keyup) - ir_keyup(ir->dev); + rc_keyup(ir->dev); else - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); } ir->last_gpio = data | keyup; @@ -232,7 +232,7 @@ void bttv_rc5_timer_end(unsigned long data) u32 instr = RC5_INSTR(rc5); /* Good code */ - ir_keydown(ir->dev, instr, toggle); + rc_keydown(ir->dev, instr, toggle); dprintk(KERN_INFO DEVNAME ":" " instruction %x, toggle %x\n", instr, toggle); diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index a73033846fce..cfeba4c08715 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -123,26 +123,26 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) data = (data << 4) | ((gpio_key & 0xf0) >> 4); - ir_keydown(ir->dev, data, 0); + rc_keydown(ir->dev, data, 0); } else if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); else - ir_keyup(ir->dev); + rc_keyup(ir->dev); } else if (ir->mask_keyup) { /* bit cleared on keydown */ if (0 == (gpio & ir->mask_keyup)) - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); else - ir_keyup(ir->dev); + rc_keyup(ir->dev); } else { /* can't distinguish keydown/up :-/ */ - ir_keydown_notimeout(ir->dev, data, 0); - ir_keyup(ir->dev); + rc_keydown_notimeout(ir->dev, data, 0); + rc_keyup(ir->dev); } } diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index b7d3999f0417..e32eb38564e6 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -297,12 +297,12 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) poll_result.toggle_bit, poll_result.read_count, poll_result.rc_address, poll_result.rc_data[0]); if (ir->full_code) - ir_keydown(ir->rc, + rc_keydown(ir->rc, poll_result.rc_address << 8 | poll_result.rc_data[0], poll_result.toggle_bit); else - ir_keydown(ir->rc, + rc_keydown(ir->rc, poll_result.rc_data[0], poll_result.toggle_bit); diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 83662a4ff73c..c77ea53f50d7 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -252,7 +252,7 @@ static void ir_key_poll(struct IR_i2c *ir) } if (rc) - ir_keydown(ir->rc, ir_key, 0); + rc_keydown(ir->rc, ir_key, 0); } static void ir_work(struct work_struct *work) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 900e7985d9b3..cd39aea30389 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -89,25 +89,25 @@ static int build_key(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: if (data == ir->mask_keycode) - ir_keyup(ir->dev); + rc_keyup(ir->dev); else - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); return 0; } if (ir->polling) { if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { - ir_keydown_notimeout(ir->dev, data, 0); + rc_keydown_notimeout(ir->dev, data, 0); } else { - ir_keyup(ir->dev); + rc_keyup(ir->dev); } } else { /* IRQ driven mode - handle key press and release in one go */ if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { - ir_keydown_notimeout(ir->dev, data, 0); - ir_keyup(ir->dev); + rc_keydown_notimeout(ir->dev, data, 0); + rc_keyup(ir->dev); } } diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 58e93d0f304f..02b982978bb8 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -199,7 +199,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_keydown(ir->rc, poll_result.rc_data, 0); + rc_keydown(ir->rc, poll_result.rc_data, 0); ir->key = 0; } return; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index eedb2f0575a4..170581b4fa84 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#ifndef _IR_CORE -#define _IR_CORE +#ifndef _RC_CORE +#define _RC_CORE #include #include @@ -120,6 +120,32 @@ struct rc_dev { int (*s_carrier_report) (struct rc_dev *dev, int enable); }; +#define to_rc_dev(d) container_of(d, struct rc_dev, dev) + +/* + * From rc-main.c + * Those functions can be used on any type of Remote Controller. They + * basically creates an input_dev and properly reports the device as a + * Remote Controller, at sys/class/rc. + */ + +struct rc_dev *rc_allocate_device(void); +void rc_free_device(struct rc_dev *dev); +int rc_register_device(struct rc_dev *dev); +void rc_unregister_device(struct rc_dev *dev); + +void rc_repeat(struct rc_dev *dev); +void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle); +void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); +void rc_keyup(struct rc_dev *dev); +u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode); + +/* + * From rc-raw.c + * The Raw interface is specific to InfraRed. It may be a good idea to + * split it later into a separate header. + */ + enum raw_event_type { IR_SPACE = (1 << 0), IR_PULSE = (1 << 1), @@ -127,16 +153,6 @@ enum raw_event_type { IR_STOP_EVENT = (1 << 3), }; -#define to_rc_dev(d) container_of(d, struct rc_dev, dev) - - -void ir_repeat(struct rc_dev *dev); -void ir_keydown(struct rc_dev *dev, int scancode, u8 toggle); -void ir_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle); -void ir_keyup(struct rc_dev *dev); -u32 ir_g_keycode_from_table(struct rc_dev *dev, u32 scancode); - -/* From ir-raw-event.c */ struct ir_raw_event { union { u32 duration; @@ -168,11 +184,6 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev) #define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ -struct rc_dev *rc_allocate_device(void); -void rc_free_device(struct rc_dev *dev); -int rc_register_device(struct rc_dev *dev); -void rc_unregister_device(struct rc_dev *dev); - void ir_raw_event_handle(struct rc_dev *dev); int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type); @@ -189,7 +200,6 @@ static inline void ir_raw_event_reset(struct rc_dev *dev) ir_raw_event_handle(dev); } - /* extract mask bits out of data and pack them into the result */ static inline u32 ir_extract_bits(u32 data, u32 mask) { @@ -207,5 +217,4 @@ static inline u32 ir_extract_bits(u32 data, u32 mask) return value; } - -#endif /* _IR_CORE */ +#endif /* _RC_CORE */ -- cgit v1.2.3 From 52b661449aecc47e652a164c0d8078b31e10aca0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 14:20:52 -0300 Subject: [media] rc: Rename remote controller type to rc_type instead of ir_type for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,IR_TYPE,RC_TYPE,g <$i >a && mv a $i; done for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_type,rc_type,g <$i >a && mv a $i; done Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/af9015.c | 12 +-- drivers/media/dvb/dvb-usb/anysee.c | 2 +- drivers/media/dvb/dvb-usb/dib0700.h | 2 +- drivers/media/dvb/dvb-usb/dib0700_core.c | 12 +-- drivers/media/dvb/dvb-usb/dib0700_devices.c | 86 +++++++++++----------- drivers/media/dvb/dvb-usb/dvb-usb.h | 2 +- drivers/media/dvb/mantis/mantis_input.c | 2 +- drivers/media/dvb/siano/smsir.c | 2 +- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/imon.c | 38 +++++----- drivers/media/rc/ir-jvc-decoder.c | 4 +- drivers/media/rc/ir-lirc-codec.c | 4 +- drivers/media/rc/ir-nec-decoder.c | 4 +- drivers/media/rc/ir-rc5-decoder.c | 4 +- drivers/media/rc/ir-rc5-sz-decoder.c | 4 +- drivers/media/rc/ir-rc6-decoder.c | 4 +- drivers/media/rc/ir-sony-decoder.c | 4 +- drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 2 +- drivers/media/rc/keymaps/rc-alink-dtu-m.c | 2 +- drivers/media/rc/keymaps/rc-anysee.c | 2 +- drivers/media/rc/keymaps/rc-apac-viewcomp.c | 2 +- drivers/media/rc/keymaps/rc-asus-pc39.c | 2 +- drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-a16d.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-m135a.c | 2 +- .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 2 +- drivers/media/rc/keymaps/rc-avermedia.c | 2 +- drivers/media/rc/keymaps/rc-avertv-303.c | 2 +- drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 2 +- drivers/media/rc/keymaps/rc-behold-columbus.c | 2 +- drivers/media/rc/keymaps/rc-behold.c | 2 +- drivers/media/rc/keymaps/rc-budget-ci-old.c | 2 +- drivers/media/rc/keymaps/rc-cinergy-1400.c | 2 +- drivers/media/rc/keymaps/rc-cinergy.c | 2 +- drivers/media/rc/keymaps/rc-dib0700-nec.c | 2 +- drivers/media/rc/keymaps/rc-dib0700-rc5.c | 2 +- drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 2 +- drivers/media/rc/keymaps/rc-digittrade.c | 2 +- drivers/media/rc/keymaps/rc-dm1105-nec.c | 2 +- drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 2 +- drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 2 +- drivers/media/rc/keymaps/rc-em-terratec.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv2.c | 2 +- drivers/media/rc/keymaps/rc-evga-indtube.c | 2 +- drivers/media/rc/keymaps/rc-eztv.c | 2 +- drivers/media/rc/keymaps/rc-flydvb.c | 2 +- drivers/media/rc/keymaps/rc-flyvideo.c | 2 +- drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 2 +- drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 2 +- drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 2 +- drivers/media/rc/keymaps/rc-gotview7135.c | 2 +- drivers/media/rc/keymaps/rc-hauppauge-new.c | 2 +- drivers/media/rc/keymaps/rc-imon-mce.c | 2 +- drivers/media/rc/keymaps/rc-imon-pad.c | 2 +- drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 2 +- drivers/media/rc/keymaps/rc-kaiomy.c | 2 +- drivers/media/rc/keymaps/rc-kworld-315u.c | 2 +- .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 2 +- drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 2 +- drivers/media/rc/keymaps/rc-lirc.c | 2 +- drivers/media/rc/keymaps/rc-lme2510.c | 2 +- drivers/media/rc/keymaps/rc-manli.c | 2 +- drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 2 +- drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 2 +- drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 2 +- drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 2 +- drivers/media/rc/keymaps/rc-nebula.c | 2 +- .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 2 +- drivers/media/rc/keymaps/rc-norwood.c | 2 +- drivers/media/rc/keymaps/rc-npgtech.c | 2 +- drivers/media/rc/keymaps/rc-pctv-sedna.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-color.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-grey.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 2 +- drivers/media/rc/keymaps/rc-pixelview-mk12.c | 2 +- drivers/media/rc/keymaps/rc-pixelview-new.c | 2 +- drivers/media/rc/keymaps/rc-pixelview.c | 2 +- .../media/rc/keymaps/rc-powercolor-real-angel.c | 2 +- drivers/media/rc/keymaps/rc-proteus-2309.c | 2 +- drivers/media/rc/keymaps/rc-purpletv.c | 2 +- drivers/media/rc/keymaps/rc-pv951.c | 2 +- drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c | 2 +- drivers/media/rc/keymaps/rc-rc5-tv.c | 2 +- drivers/media/rc/keymaps/rc-rc6-mce.c | 2 +- .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 2 +- drivers/media/rc/keymaps/rc-streamzap.c | 2 +- drivers/media/rc/keymaps/rc-tbs-nec.c | 2 +- drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 2 +- drivers/media/rc/keymaps/rc-terratec-slim.c | 2 +- drivers/media/rc/keymaps/rc-tevii-nec.c | 2 +- drivers/media/rc/keymaps/rc-total-media-in-hand.c | 2 +- drivers/media/rc/keymaps/rc-trekstor.c | 2 +- drivers/media/rc/keymaps/rc-tt-1500.c | 2 +- drivers/media/rc/keymaps/rc-twinhan1027.c | 2 +- drivers/media/rc/keymaps/rc-videomate-s350.c | 2 +- drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 2 +- drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 2 +- drivers/media/rc/keymaps/rc-winfast.c | 2 +- drivers/media/rc/mceusb.c | 2 +- drivers/media/rc/nuvoton-cir.c | 2 +- drivers/media/rc/rc-main.c | 34 ++++----- drivers/media/rc/streamzap.c | 2 +- drivers/media/video/cx18/cx18-i2c.c | 2 +- drivers/media/video/cx231xx/cx231xx-input.c | 2 +- drivers/media/video/cx23885/cx23885-input.c | 4 +- drivers/media/video/cx88/cx88-input.c | 8 +- drivers/media/video/em28xx/em28xx-input.c | 12 +-- drivers/media/video/ir-kbd-i2c.c | 18 ++--- drivers/media/video/ivtv/ivtv-i2c.c | 6 +- drivers/media/video/saa7134/saa7134-input.c | 2 +- drivers/staging/tm6000/tm6000-input.c | 12 +-- include/media/ir-kbd-i2c.h | 2 +- include/media/rc-core.h | 4 +- include/media/rc-map.h | 26 +++---- 119 files changed, 249 insertions(+), 249 deletions(-) (limited to 'include') diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index bc2a6e464cea..8671ca362c81 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1344,11 +1344,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = IR_TYPE_NEC, + .protocol = RC_TYPE_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = IR_TYPE_NEC, + .allowed_protos = RC_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo, @@ -1472,11 +1472,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = IR_TYPE_NEC, + .protocol = RC_TYPE_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = IR_TYPE_NEC, + .allowed_protos = RC_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo, @@ -1584,11 +1584,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { .identify_state = af9015_identify_state, .rc.core = { - .protocol = IR_TYPE_NEC, + .protocol = RC_TYPE_NEC, .module_name = "af9015", .rc_query = af9015_rc_query, .rc_interval = AF9015_RC_INTERVAL, - .allowed_protos = IR_TYPE_NEC, + .allowed_protos = RC_TYPE_NEC, }, .i2c_algo = &af9015_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 5e12488f3c76..6b402e943539 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -476,7 +476,7 @@ static struct dvb_usb_device_properties anysee_properties = { .rc.core = { .rc_codes = RC_MAP_ANYSEE, - .protocol = IR_TYPE_OTHER, + .protocol = RC_TYPE_OTHER, .module_name = "anysee", .rc_query = anysee_rc_query, .rc_interval = 250, /* windows driver uses 500ms */ diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index 1e7d780332b5..3537d65c04bc 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h @@ -60,7 +60,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); extern struct i2c_algorithm dib0700_i2c_algo; extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, struct dvb_usb_device_description **desc, int *cold); -extern int dib0700_change_protocol(struct rc_dev *dev, u64 ir_type); +extern int dib0700_change_protocol(struct rc_dev *dev, u64 rc_type); extern int dib0700_device_count; extern int dvb_usb_dib0700_ir_proto; diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 1dd119e7b676..8ca48f76dfa9 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -471,7 +471,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) return dib0700_ctrl_wr(adap->dev, b, 4); } -int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type) +int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) { struct dvb_usb_device *d = rc->priv; struct dib0700_state *st = d->priv; @@ -479,11 +479,11 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type) int new_proto, ret; /* Set the IR mode */ - if (ir_type == IR_TYPE_RC5) + if (rc_type == RC_TYPE_RC5) new_proto = 1; - else if (ir_type == IR_TYPE_NEC) + else if (rc_type == RC_TYPE_NEC) new_proto = 0; - else if (ir_type == IR_TYPE_RC6) { + else if (rc_type == RC_TYPE_RC6) { if (st->fw_version < 0x10200) return -EINVAL; @@ -499,7 +499,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 ir_type) return ret; } - d->props.rc.core.protocol = ir_type; + d->props.rc.core.protocol = rc_type; return ret; } @@ -562,7 +562,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) purb->actual_length); switch (d->props.rc.core.protocol) { - case IR_TYPE_NEC: + case RC_TYPE_NEC: toggle = 0; /* NEC protocol sends repeat code as 0 0 0 FF */ diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 9ac920d0483e..defd83964ce2 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -510,7 +510,7 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) d->last_event = 0; switch (d->props.rc.core.protocol) { - case IR_TYPE_NEC: + case RC_TYPE_NEC: /* NEC protocol sends repeat code as 0 0 0 FF */ if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && (key[3] == 0xff)) @@ -1924,9 +1924,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -1958,9 +1958,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2017,9 +2017,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_interval = DEFAULT_RC_INTERVAL, .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2059,9 +2059,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2135,9 +2135,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2179,9 +2179,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2247,9 +2247,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2294,9 +2294,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_NEC_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2363,9 +2363,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2399,9 +2399,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2467,9 +2467,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2511,9 +2511,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_NEC_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2560,9 +2560,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2597,9 +2597,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { .rc_codes = RC_MAP_DIB0700_RC5_TABLE, .module_name = "dib0700", .rc_query = dib0700_rc_query_old_firmware, - .allowed_protos = IR_TYPE_RC5 | - IR_TYPE_RC6 | - IR_TYPE_NEC, + .allowed_protos = RC_TYPE_RC5 | + RC_TYPE_RC6 | + RC_TYPE_NEC, .change_protocol = dib0700_change_protocol, }, }, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 18828cb282c4..95b1603d5be8 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -190,7 +190,7 @@ struct dvb_rc { char *rc_codes; u64 protocol; u64 allowed_protos; - int (*change_protocol)(struct rc_dev *dev, u64 ir_type); + int (*change_protocol)(struct rc_dev *dev, u64 rc_type); char *module_name; int (*rc_query) (struct dvb_usb_device *d); int rc_interval; diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index e030b18ad6d9..cf5f8ca6f685 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -99,7 +99,7 @@ static struct rc_keymap ir_mantis_map = { .map = { .scan = mantis_ir_table, .size = ARRAY_SIZE(mantis_ir_table), - .ir_type = IR_TYPE_UNKNOWN, + .rc_type = RC_TYPE_UNKNOWN, .name = RC_MAP_MANTIS, } }; diff --git a/drivers/media/dvb/siano/smsir.c b/drivers/media/dvb/siano/smsir.c index ebd73059b518..37bc5c4b8ad8 100644 --- a/drivers/media/dvb/siano/smsir.c +++ b/drivers/media/dvb/siano/smsir.c @@ -88,7 +88,7 @@ int sms_ir_init(struct smscore_device_t *coredev) dev->priv = coredev; dev->driver_type = RC_DRIVER_IR_RAW; - dev->allowed_protos = IR_TYPE_ALL; + dev->allowed_protos = RC_TYPE_ALL; dev->map_name = sms_get_board(board_id)->rc_codes; dev->driver_name = MODULE_NAME; diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 1ace4581f157..80b3c319f698 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -1052,7 +1052,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) learning_mode_force = false; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protos = IR_TYPE_ALL; + rdev->allowed_protos = RC_TYPE_ALL; rdev->priv = dev; rdev->open = ene_open; rdev->close = ene_close; diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index d67573edb052..de9dc0e202d5 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -131,7 +131,7 @@ struct imon_context { u32 last_keycode; /* last reported input keycode */ u32 rc_scancode; /* the computed remote scancode */ u8 rc_toggle; /* the computed remote toggle bit */ - u64 ir_type; /* iMON or MCE (RC6) IR protocol? */ + u64 rc_type; /* iMON or MCE (RC6) IR protocol? */ bool release_code; /* some keys send a release code */ u8 display_type; /* store the display type */ @@ -983,7 +983,7 @@ static void imon_touch_display_timeout(unsigned long data) * really just RC-6), but only one or the other at a time, as the signals * are decoded onboard the receiver. */ -static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) +static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) { int retval; struct imon_context *ictx = rc->priv; @@ -992,18 +992,18 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) unsigned char ir_proto_packet[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; - if (ir_type && !(ir_type & rc->allowed_protos)) + if (rc_type && !(rc_type & rc->allowed_protos)) dev_warn(dev, "Looks like you're trying to use an IR protocol " "this device does not support\n"); - switch (ir_type) { - case IR_TYPE_RC6: + switch (rc_type) { + case RC_TYPE_RC6: dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); ir_proto_packet[0] = 0x01; pad_mouse = false; break; - case IR_TYPE_UNKNOWN: - case IR_TYPE_OTHER: + case RC_TYPE_UNKNOWN: + case RC_TYPE_OTHER: dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); if (pad_stabilize && !nomouse) pad_mouse = true; @@ -1012,7 +1012,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) pad_mouse = false; } /* ir_proto_packet[0] = 0x00; // already the default */ - ir_type = IR_TYPE_OTHER; + rc_type = RC_TYPE_OTHER; break; default: dev_warn(dev, "Unsupported IR protocol specified, overriding " @@ -1024,7 +1024,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) pad_mouse = false; } /* ir_proto_packet[0] = 0x00; // already the default */ - ir_type = IR_TYPE_OTHER; + rc_type = RC_TYPE_OTHER; break; } @@ -1034,7 +1034,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type) if (retval) goto out; - ictx->ir_type = ir_type; + ictx->rc_type = rc_type; ictx->pad_mouse = pad_mouse; out: @@ -1306,7 +1306,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) rel_x = buf[2]; rel_y = buf[3]; - if (ictx->ir_type == IR_TYPE_OTHER && pad_stabilize) { + if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { dir = stabilize((int)rel_x, (int)rel_y, timeout, threshold); @@ -1373,7 +1373,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) buf[0] = 0x01; buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; - if (ictx->ir_type == IR_TYPE_OTHER && pad_stabilize) { + if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { dir = stabilize((int)rel_x, (int)rel_y, timeout, threshold); if (!dir) { @@ -1495,7 +1495,7 @@ static void imon_incoming_packet(struct imon_context *ictx, kc = imon_panel_key_lookup(scancode); } else { scancode = be32_to_cpu(*((u32 *)buf)); - if (ictx->ir_type == IR_TYPE_RC6) { + if (ictx->rc_type == RC_TYPE_RC6) { ktype = IMON_KEY_IMON; if (buf[0] == 0x80) ktype = IMON_KEY_MCE; @@ -1709,7 +1709,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) { u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; - u64 allowed_protos = IR_TYPE_OTHER; + u64 allowed_protos = RC_TYPE_OTHER; switch (ffdc_cfg_byte) { /* iMON Knob, no display, iMON IR + vol knob */ @@ -1738,13 +1738,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx) case 0x9e: dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); detected_display_type = IMON_DISPLAY_TYPE_VFD; - allowed_protos = IR_TYPE_RC6; + allowed_protos = RC_TYPE_RC6; break; /* iMON LCD, MCE IR */ case 0x9f: dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); detected_display_type = IMON_DISPLAY_TYPE_LCD; - allowed_protos = IR_TYPE_RC6; + allowed_protos = RC_TYPE_RC6; break; default: dev_info(ictx->dev, "Unknown 0xffdc device, " @@ -1757,7 +1757,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) ictx->display_type = detected_display_type; ictx->rdev->allowed_protos = allowed_protos; - ictx->ir_type = allowed_protos; + ictx->rc_type = allowed_protos; } static void imon_set_display_type(struct imon_context *ictx) @@ -1836,10 +1836,10 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) rdev->priv = ictx; rdev->driver_type = RC_DRIVER_SCANCODE; - rdev->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */ + rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ rdev->change_protocol = imon_ir_change_protocol; rdev->driver_name = MOD_NAME; - if (ictx->ir_type == IR_TYPE_RC6) + if (ictx->rc_type == RC_TYPE_RC6) rdev->map_name = RC_MAP_IMON_MCE; else rdev->map_name = RC_MAP_IMON_PAD; diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index 09c143ff33f3..624449afaa61 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c @@ -46,7 +46,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev) { struct jvc_dec *data = &dev->raw->jvc; - if (!(dev->raw->enabled_protocols & IR_TYPE_JVC)) + if (!(dev->raw->enabled_protocols & RC_TYPE_JVC)) return 0; if (!is_timing_event(ev)) { @@ -173,7 +173,7 @@ out: } static struct ir_raw_handler jvc_handler = { - .protocols = IR_TYPE_JVC, + .protocols = RC_TYPE_JVC, .decode = ir_jvc_decode, }; diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index f9086c5ba8b1..1e87ee8e5c99 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -34,7 +34,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) struct lirc_codec *lirc = &dev->raw->lirc; int sample; - if (!(dev->raw->enabled_protocols & IR_TYPE_LIRC)) + if (!(dev->raw->enabled_protocols & RC_TYPE_LIRC)) return 0; if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) @@ -373,7 +373,7 @@ static int ir_lirc_unregister(struct rc_dev *dev) } static struct ir_raw_handler lirc_handler = { - .protocols = IR_TYPE_LIRC, + .protocols = RC_TYPE_LIRC, .decode = ir_lirc_decode, .raw_register = ir_lirc_register, .raw_unregister = ir_lirc_unregister, diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 235d774d0ec2..5d15c31288b9 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -50,7 +50,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) u32 scancode; u8 address, not_address, command, not_command; - if (!(dev->raw->enabled_protocols & IR_TYPE_NEC)) + if (!(dev->raw->enabled_protocols & RC_TYPE_NEC)) return 0; if (!is_timing_event(ev)) { @@ -190,7 +190,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) } static struct ir_raw_handler nec_handler = { - .protocols = IR_TYPE_NEC, + .protocols = RC_TYPE_NEC, .decode = ir_nec_decode, }; diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index 779ab0d0a285..ebdba5539916 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c @@ -51,7 +51,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev) u8 toggle; u32 scancode; - if (!(dev->raw->enabled_protocols & IR_TYPE_RC5)) + if (!(dev->raw->enabled_protocols & RC_TYPE_RC5)) return 0; if (!is_timing_event(ev)) { @@ -163,7 +163,7 @@ out: } static struct ir_raw_handler rc5_handler = { - .protocols = IR_TYPE_RC5, + .protocols = RC_TYPE_RC5, .decode = ir_rc5_decode, }; diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c index 5586bf20c8d7..90aa8868629a 100644 --- a/drivers/media/rc/ir-rc5-sz-decoder.c +++ b/drivers/media/rc/ir-rc5-sz-decoder.c @@ -47,7 +47,7 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev) u8 toggle, command, system; u32 scancode; - if (!(dev->raw->enabled_protocols & IR_TYPE_RC5_SZ)) + if (!(dev->raw->enabled_protocols & RC_TYPE_RC5_SZ)) return 0; if (!is_timing_event(ev)) { @@ -127,7 +127,7 @@ out: } static struct ir_raw_handler rc5_sz_handler = { - .protocols = IR_TYPE_RC5_SZ, + .protocols = RC_TYPE_RC5_SZ, .decode = ir_rc5_sz_decode, }; diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 88d948728c2f..755dafa3871b 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -81,7 +81,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) u32 scancode; u8 toggle; - if (!(dev->raw->enabled_protocols & IR_TYPE_RC6)) + if (!(dev->raw->enabled_protocols & RC_TYPE_RC6)) return 0; if (!is_timing_event(ev)) { @@ -255,7 +255,7 @@ out: } static struct ir_raw_handler rc6_handler = { - .protocols = IR_TYPE_RC6, + .protocols = RC_TYPE_RC6, .decode = ir_rc6_decode, }; diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index 5292b89f8de2..a92de80c48db 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c @@ -44,7 +44,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev) u32 scancode; u8 device, subdevice, function; - if (!(dev->raw->enabled_protocols & IR_TYPE_SONY)) + if (!(dev->raw->enabled_protocols & RC_TYPE_SONY)) return 0; if (!is_timing_event(ev)) { @@ -156,7 +156,7 @@ out: } static struct ir_raw_handler sony_handler = { - .protocols = IR_TYPE_SONY, + .protocols = RC_TYPE_SONY, .decode = ir_sony_decode, }; diff --git a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c index b17283176ecd..0ea0aeee6e78 100644 --- a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c +++ b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c @@ -67,7 +67,7 @@ static struct rc_keymap adstech_dvb_t_pci_map = { .map = { .scan = adstech_dvb_t_pci, .size = ARRAY_SIZE(adstech_dvb_t_pci), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ADSTECH_DVB_T_PCI, } }; diff --git a/drivers/media/rc/keymaps/rc-alink-dtu-m.c b/drivers/media/rc/keymaps/rc-alink-dtu-m.c index ddfee7f8093d..b0ec1c81a080 100644 --- a/drivers/media/rc/keymaps/rc-alink-dtu-m.c +++ b/drivers/media/rc/keymaps/rc-alink-dtu-m.c @@ -46,7 +46,7 @@ static struct rc_keymap alink_dtu_m_map = { .map = { .scan = alink_dtu_m, .size = ARRAY_SIZE(alink_dtu_m), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_ALINK_DTU_M, } }; diff --git a/drivers/media/rc/keymaps/rc-anysee.c b/drivers/media/rc/keymaps/rc-anysee.c index 30d70498cfed..9bfe60e663b4 100644 --- a/drivers/media/rc/keymaps/rc-anysee.c +++ b/drivers/media/rc/keymaps/rc-anysee.c @@ -71,7 +71,7 @@ static struct rc_keymap anysee_map = { .map = { .scan = anysee, .size = ARRAY_SIZE(anysee), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_ANYSEE, } }; diff --git a/drivers/media/rc/keymaps/rc-apac-viewcomp.c b/drivers/media/rc/keymaps/rc-apac-viewcomp.c index 0ef2b562baf0..a32840dd4df4 100644 --- a/drivers/media/rc/keymaps/rc-apac-viewcomp.c +++ b/drivers/media/rc/keymaps/rc-apac-viewcomp.c @@ -58,7 +58,7 @@ static struct rc_keymap apac_viewcomp_map = { .map = { .scan = apac_viewcomp, .size = ARRAY_SIZE(apac_viewcomp), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_APAC_VIEWCOMP, } }; diff --git a/drivers/media/rc/keymaps/rc-asus-pc39.c b/drivers/media/rc/keymaps/rc-asus-pc39.c index 2996e0a3b8d5..f86bfb7bf271 100644 --- a/drivers/media/rc/keymaps/rc-asus-pc39.c +++ b/drivers/media/rc/keymaps/rc-asus-pc39.c @@ -69,7 +69,7 @@ static struct rc_keymap asus_pc39_map = { .map = { .scan = asus_pc39, .size = ARRAY_SIZE(asus_pc39), - .ir_type = IR_TYPE_RC5, + .rc_type = RC_TYPE_RC5, .name = RC_MAP_ASUS_PC39, } }; diff --git a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c index 8edfd293d010..0cefe1c5536d 100644 --- a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c +++ b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c @@ -47,7 +47,7 @@ static struct rc_keymap ati_tv_wonder_hd_600_map = { .map = { .scan = ati_tv_wonder_hd_600, .size = ARRAY_SIZE(ati_tv_wonder_hd_600), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ATI_TV_WONDER_HD_600, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-a16d.c b/drivers/media/rc/keymaps/rc-avermedia-a16d.c index 12f043587f2e..43525c8c111a 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-a16d.c +++ b/drivers/media/rc/keymaps/rc-avermedia-a16d.c @@ -53,7 +53,7 @@ static struct rc_keymap avermedia_a16d_map = { .map = { .scan = avermedia_a16d, .size = ARRAY_SIZE(avermedia_a16d), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_A16D, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c index 2a945b02e8ca..2d528cac2caf 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c +++ b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c @@ -75,7 +75,7 @@ static struct rc_keymap avermedia_cardbus_map = { .map = { .scan = avermedia_cardbus, .size = ARRAY_SIZE(avermedia_cardbus), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_CARDBUS, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c index 39dde6222875..e45b67ffcf3f 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c +++ b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c @@ -56,7 +56,7 @@ static struct rc_keymap avermedia_dvbt_map = { .map = { .scan = avermedia_dvbt, .size = ARRAY_SIZE(avermedia_dvbt), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA_DVBT, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c b/drivers/media/rc/keymaps/rc-avermedia-m135a.c index e4471fb2ad1e..d5622c507d5f 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c +++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c @@ -125,7 +125,7 @@ static struct rc_keymap avermedia_m135a_map = { .map = { .scan = avermedia_m135a, .size = ARRAY_SIZE(avermedia_m135a), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_AVERMEDIA_M135A, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c index cf8d45717cb3..b0e10bec82b2 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c +++ b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c @@ -73,7 +73,7 @@ static struct rc_keymap avermedia_m733a_rm_k6_map = { .map = { .scan = avermedia_m733a_rm_k6, .size = ARRAY_SIZE(avermedia_m733a_rm_k6), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_AVERMEDIA_M733A_RM_K6, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c index 9ee60906c861..334846654a55 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c +++ b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c @@ -57,7 +57,7 @@ static struct rc_keymap avermedia_rm_ks_map = { .map = { .scan = avermedia_rm_ks, .size = ARRAY_SIZE(avermedia_rm_ks), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_AVERMEDIA_RM_KS, } }; diff --git a/drivers/media/rc/keymaps/rc-avermedia.c b/drivers/media/rc/keymaps/rc-avermedia.c index 21effd5bfb0d..cfde54e15d5c 100644 --- a/drivers/media/rc/keymaps/rc-avermedia.c +++ b/drivers/media/rc/keymaps/rc-avermedia.c @@ -64,7 +64,7 @@ static struct rc_keymap avermedia_map = { .map = { .scan = avermedia, .size = ARRAY_SIZE(avermedia), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERMEDIA, } }; diff --git a/drivers/media/rc/keymaps/rc-avertv-303.c b/drivers/media/rc/keymaps/rc-avertv-303.c index 971c59d6f9d6..ae586632b48e 100644 --- a/drivers/media/rc/keymaps/rc-avertv-303.c +++ b/drivers/media/rc/keymaps/rc-avertv-303.c @@ -63,7 +63,7 @@ static struct rc_keymap avertv_303_map = { .map = { .scan = avertv_303, .size = ARRAY_SIZE(avertv_303), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_AVERTV_303, } }; diff --git a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c index e0876147d471..579fafedd35a 100644 --- a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c +++ b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c @@ -80,7 +80,7 @@ static struct rc_keymap azurewave_ad_tu700_map = { .map = { .scan = azurewave_ad_tu700, .size = ARRAY_SIZE(azurewave_ad_tu700), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_AZUREWAVE_AD_TU700, } }; diff --git a/drivers/media/rc/keymaps/rc-behold-columbus.c b/drivers/media/rc/keymaps/rc-behold-columbus.c index 9f56c98fef5b..6abb712c9e04 100644 --- a/drivers/media/rc/keymaps/rc-behold-columbus.c +++ b/drivers/media/rc/keymaps/rc-behold-columbus.c @@ -86,7 +86,7 @@ static struct rc_keymap behold_columbus_map = { .map = { .scan = behold_columbus, .size = ARRAY_SIZE(behold_columbus), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_BEHOLD_COLUMBUS, } }; diff --git a/drivers/media/rc/keymaps/rc-behold.c b/drivers/media/rc/keymaps/rc-behold.c index abc140b2098b..5694185a869d 100644 --- a/drivers/media/rc/keymaps/rc-behold.c +++ b/drivers/media/rc/keymaps/rc-behold.c @@ -119,7 +119,7 @@ static struct rc_keymap behold_map = { .map = { .scan = behold, .size = ARRAY_SIZE(behold), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_BEHOLD, } }; diff --git a/drivers/media/rc/keymaps/rc-budget-ci-old.c b/drivers/media/rc/keymaps/rc-budget-ci-old.c index 64c2ac913338..99f73232c714 100644 --- a/drivers/media/rc/keymaps/rc-budget-ci-old.c +++ b/drivers/media/rc/keymaps/rc-budget-ci-old.c @@ -70,7 +70,7 @@ static struct rc_keymap budget_ci_old_map = { .map = { .scan = budget_ci_old, .size = ARRAY_SIZE(budget_ci_old), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_BUDGET_CI_OLD, } }; diff --git a/drivers/media/rc/keymaps/rc-cinergy-1400.c b/drivers/media/rc/keymaps/rc-cinergy-1400.c index 074f2c2c2c61..b504ddd1a922 100644 --- a/drivers/media/rc/keymaps/rc-cinergy-1400.c +++ b/drivers/media/rc/keymaps/rc-cinergy-1400.c @@ -62,7 +62,7 @@ static struct rc_keymap cinergy_1400_map = { .map = { .scan = cinergy_1400, .size = ARRAY_SIZE(cinergy_1400), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_CINERGY_1400, } }; diff --git a/drivers/media/rc/keymaps/rc-cinergy.c b/drivers/media/rc/keymaps/rc-cinergy.c index cf84c3dba742..8bf02f154339 100644 --- a/drivers/media/rc/keymaps/rc-cinergy.c +++ b/drivers/media/rc/keymaps/rc-cinergy.c @@ -56,7 +56,7 @@ static struct rc_keymap cinergy_map = { .map = { .scan = cinergy, .size = ARRAY_SIZE(cinergy), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_CINERGY, } }; diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c index ae1832038fbe..47d5476d50e8 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-nec.c +++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c @@ -102,7 +102,7 @@ static struct rc_keymap dib0700_nec_map = { .map = { .scan = dib0700_nec_table, .size = ARRAY_SIZE(dib0700_nec_table), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_DIB0700_NEC_TABLE, } }; diff --git a/drivers/media/rc/keymaps/rc-dib0700-rc5.c b/drivers/media/rc/keymaps/rc-dib0700-rc5.c index 4a4797cfd77d..1d09921f076f 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-rc5.c +++ b/drivers/media/rc/keymaps/rc-dib0700-rc5.c @@ -213,7 +213,7 @@ static struct rc_keymap dib0700_rc5_map = { .map = { .scan = dib0700_rc5_table, .size = ARRAY_SIZE(dib0700_rc5_table), - .ir_type = IR_TYPE_RC5, + .rc_type = RC_TYPE_RC5, .name = RC_MAP_DIB0700_RC5_TABLE, } }; diff --git a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c index 63e469e2dd21..8ae726b568ed 100644 --- a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c +++ b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c @@ -76,7 +76,7 @@ static struct rc_keymap digitalnow_tinytwin_map = { .map = { .scan = digitalnow_tinytwin, .size = ARRAY_SIZE(digitalnow_tinytwin), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_DIGITALNOW_TINYTWIN, } }; diff --git a/drivers/media/rc/keymaps/rc-digittrade.c b/drivers/media/rc/keymaps/rc-digittrade.c index 5dece78e19c5..206469fb028e 100644 --- a/drivers/media/rc/keymaps/rc-digittrade.c +++ b/drivers/media/rc/keymaps/rc-digittrade.c @@ -60,7 +60,7 @@ static struct rc_keymap digittrade_map = { .map = { .scan = digittrade, .size = ARRAY_SIZE(digittrade), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_DIGITTRADE, } }; diff --git a/drivers/media/rc/keymaps/rc-dm1105-nec.c b/drivers/media/rc/keymaps/rc-dm1105-nec.c index 90684d0efea3..ba6fb0be9d3c 100644 --- a/drivers/media/rc/keymaps/rc-dm1105-nec.c +++ b/drivers/media/rc/keymaps/rc-dm1105-nec.c @@ -54,7 +54,7 @@ static struct rc_keymap dm1105_nec_map = { .map = { .scan = dm1105_nec, .size = ARRAY_SIZE(dm1105_nec), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DM1105_NEC, } }; diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c index 8a4027af964a..b703937f160b 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c @@ -56,7 +56,7 @@ static struct rc_keymap dntv_live_dvb_t_map = { .map = { .scan = dntv_live_dvb_t, .size = ARRAY_SIZE(dntv_live_dvb_t), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DNTV_LIVE_DVB_T, } }; diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c index 6f4d60764d59..b0126b2fceab 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c @@ -75,7 +75,7 @@ static struct rc_keymap dntv_live_dvbt_pro_map = { .map = { .scan = dntv_live_dvbt_pro, .size = ARRAY_SIZE(dntv_live_dvbt_pro), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_DNTV_LIVE_DVBT_PRO, } }; diff --git a/drivers/media/rc/keymaps/rc-em-terratec.c b/drivers/media/rc/keymaps/rc-em-terratec.c index 3130c9c29e6b..57bcd556821d 100644 --- a/drivers/media/rc/keymaps/rc-em-terratec.c +++ b/drivers/media/rc/keymaps/rc-em-terratec.c @@ -47,7 +47,7 @@ static struct rc_keymap em_terratec_map = { .map = { .scan = em_terratec, .size = ARRAY_SIZE(em_terratec), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EM_TERRATEC, } }; diff --git a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c index 4b816967877e..97e01f4cb76a 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c @@ -59,7 +59,7 @@ static struct rc_keymap encore_enltv_fm53_map = { .map = { .scan = encore_enltv_fm53, .size = ARRAY_SIZE(encore_enltv_fm53), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV_FM53, } }; diff --git a/drivers/media/rc/keymaps/rc-encore-enltv.c b/drivers/media/rc/keymaps/rc-encore-enltv.c index 9fabffd28cc9..d3030cf74839 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv.c @@ -90,7 +90,7 @@ static struct rc_keymap encore_enltv_map = { .map = { .scan = encore_enltv, .size = ARRAY_SIZE(encore_enltv), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV, } }; diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c index efefd5166618..1871b32efa98 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv2.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c @@ -68,7 +68,7 @@ static struct rc_keymap encore_enltv2_map = { .map = { .scan = encore_enltv2, .size = ARRAY_SIZE(encore_enltv2), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_ENCORE_ENLTV2, } }; diff --git a/drivers/media/rc/keymaps/rc-evga-indtube.c b/drivers/media/rc/keymaps/rc-evga-indtube.c index 3f3fb13813b3..192d7f8287f4 100644 --- a/drivers/media/rc/keymaps/rc-evga-indtube.c +++ b/drivers/media/rc/keymaps/rc-evga-indtube.c @@ -39,7 +39,7 @@ static struct rc_keymap evga_indtube_map = { .map = { .scan = evga_indtube, .size = ARRAY_SIZE(evga_indtube), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EVGA_INDTUBE, } }; diff --git a/drivers/media/rc/keymaps/rc-eztv.c b/drivers/media/rc/keymaps/rc-eztv.c index 660907a78db9..fe3ab5e31a7f 100644 --- a/drivers/media/rc/keymaps/rc-eztv.c +++ b/drivers/media/rc/keymaps/rc-eztv.c @@ -74,7 +74,7 @@ static struct rc_keymap eztv_map = { .map = { .scan = eztv, .size = ARRAY_SIZE(eztv), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EZTV, } }; diff --git a/drivers/media/rc/keymaps/rc-flydvb.c b/drivers/media/rc/keymaps/rc-flydvb.c index a173c81035f4..f48249e070f5 100644 --- a/drivers/media/rc/keymaps/rc-flydvb.c +++ b/drivers/media/rc/keymaps/rc-flydvb.c @@ -55,7 +55,7 @@ static struct rc_keymap flydvb_map = { .map = { .scan = flydvb, .size = ARRAY_SIZE(flydvb), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FLYDVB, } }; diff --git a/drivers/media/rc/keymaps/rc-flyvideo.c b/drivers/media/rc/keymaps/rc-flyvideo.c index 9c73043cbdba..59713fb46820 100644 --- a/drivers/media/rc/keymaps/rc-flyvideo.c +++ b/drivers/media/rc/keymaps/rc-flyvideo.c @@ -48,7 +48,7 @@ static struct rc_keymap flyvideo_map = { .map = { .scan = flyvideo, .size = ARRAY_SIZE(flyvideo), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FLYVIDEO, } }; diff --git a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c index cdb10389b10e..e69458d8eb1b 100644 --- a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c +++ b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c @@ -76,7 +76,7 @@ static struct rc_keymap fusionhdtv_mce_map = { .map = { .scan = fusionhdtv_mce, .size = ARRAY_SIZE(fusionhdtv_mce), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_FUSIONHDTV_MCE, } }; diff --git a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c index c16c0d1263ac..13587b8d6a4a 100644 --- a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c +++ b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c @@ -59,7 +59,7 @@ static struct rc_keymap gadmei_rm008z_map = { .map = { .scan = gadmei_rm008z, .size = ARRAY_SIZE(gadmei_rm008z), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GADMEI_RM008Z, } }; diff --git a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c index 89f8e384e52a..2304bf677b3d 100644 --- a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c +++ b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c @@ -62,7 +62,7 @@ static struct rc_keymap genius_tvgo_a11mce_map = { .map = { .scan = genius_tvgo_a11mce, .size = ARRAY_SIZE(genius_tvgo_a11mce), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GENIUS_TVGO_A11MCE, } }; diff --git a/drivers/media/rc/keymaps/rc-gotview7135.c b/drivers/media/rc/keymaps/rc-gotview7135.c index 52f025bb35f6..b5be7bfbb7f0 100644 --- a/drivers/media/rc/keymaps/rc-gotview7135.c +++ b/drivers/media/rc/keymaps/rc-gotview7135.c @@ -57,7 +57,7 @@ static struct rc_keymap gotview7135_map = { .map = { .scan = gotview7135, .size = ARRAY_SIZE(gotview7135), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_GOTVIEW7135, } }; diff --git a/drivers/media/rc/keymaps/rc-hauppauge-new.c b/drivers/media/rc/keymaps/rc-hauppauge-new.c index c6f8cd7c5186..c60f845dd930 100644 --- a/drivers/media/rc/keymaps/rc-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-hauppauge-new.c @@ -78,7 +78,7 @@ static struct rc_keymap hauppauge_new_map = { .map = { .scan = hauppauge_new, .size = ARRAY_SIZE(hauppauge_new), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_HAUPPAUGE_NEW, } }; diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c index e49f350e3a0d..4ce902f87701 100644 --- a/drivers/media/rc/keymaps/rc-imon-mce.c +++ b/drivers/media/rc/keymaps/rc-imon-mce.c @@ -120,7 +120,7 @@ static struct rc_keymap imon_mce_map = { .scan = imon_mce, .size = ARRAY_SIZE(imon_mce), /* its RC6, but w/a hardware decoder */ - .ir_type = IR_TYPE_RC6, + .rc_type = RC_TYPE_RC6, .name = RC_MAP_IMON_MCE, } }; diff --git a/drivers/media/rc/keymaps/rc-imon-pad.c b/drivers/media/rc/keymaps/rc-imon-pad.c index bc4db72f02e6..6d4633af4393 100644 --- a/drivers/media/rc/keymaps/rc-imon-pad.c +++ b/drivers/media/rc/keymaps/rc-imon-pad.c @@ -134,7 +134,7 @@ static struct rc_keymap imon_pad_map = { .scan = imon_pad, .size = ARRAY_SIZE(imon_pad), /* actual protocol details unknown, hardware decoder */ - .ir_type = IR_TYPE_OTHER, + .rc_type = RC_TYPE_OTHER, .name = RC_MAP_IMON_PAD, } }; diff --git a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c index ef6600259fc0..c5208f10e7c0 100644 --- a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c +++ b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c @@ -66,7 +66,7 @@ static struct rc_keymap iodata_bctv7e_map = { .map = { .scan = iodata_bctv7e, .size = ARRAY_SIZE(iodata_bctv7e), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_IODATA_BCTV7E, } }; diff --git a/drivers/media/rc/keymaps/rc-kaiomy.c b/drivers/media/rc/keymaps/rc-kaiomy.c index 4c7883ba0f15..1b6da7ffb8f1 100644 --- a/drivers/media/rc/keymaps/rc-kaiomy.c +++ b/drivers/media/rc/keymaps/rc-kaiomy.c @@ -65,7 +65,7 @@ static struct rc_keymap kaiomy_map = { .map = { .scan = kaiomy, .size = ARRAY_SIZE(kaiomy), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_KAIOMY, } }; diff --git a/drivers/media/rc/keymaps/rc-kworld-315u.c b/drivers/media/rc/keymaps/rc-kworld-315u.c index 618c817374e6..3418e075938c 100644 --- a/drivers/media/rc/keymaps/rc-kworld-315u.c +++ b/drivers/media/rc/keymaps/rc-kworld-315u.c @@ -61,7 +61,7 @@ static struct rc_keymap kworld_315u_map = { .map = { .scan = kworld_315u, .size = ARRAY_SIZE(kworld_315u), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_KWORLD_315U, } }; diff --git a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c index 366732f1f7b7..4d681eb7aaf4 100644 --- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c +++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c @@ -77,7 +77,7 @@ static struct rc_keymap kworld_plus_tv_analog_map = { .map = { .scan = kworld_plus_tv_analog, .size = ARRAY_SIZE(kworld_plus_tv_analog), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_KWORLD_PLUS_TV_ANALOG, } }; diff --git a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c index 7521315fd876..ebdd1226bada 100644 --- a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c +++ b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c @@ -77,7 +77,7 @@ static struct rc_keymap leadtek_y04g0051_map = { .map = { .scan = leadtek_y04g0051, .size = ARRAY_SIZE(leadtek_y04g0051), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_LEADTEK_Y04G0051, } }; diff --git a/drivers/media/rc/keymaps/rc-lirc.c b/drivers/media/rc/keymaps/rc-lirc.c index 9c8577d6e497..6d8a64170fd9 100644 --- a/drivers/media/rc/keymaps/rc-lirc.c +++ b/drivers/media/rc/keymaps/rc-lirc.c @@ -19,7 +19,7 @@ static struct rc_keymap lirc_map = { .map = { .scan = lirc, .size = ARRAY_SIZE(lirc), - .ir_type = IR_TYPE_LIRC, + .rc_type = RC_TYPE_LIRC, .name = RC_MAP_LIRC, } }; diff --git a/drivers/media/rc/keymaps/rc-lme2510.c b/drivers/media/rc/keymaps/rc-lme2510.c index 40dcf0b4e21a..ca7e2acb682a 100644 --- a/drivers/media/rc/keymaps/rc-lme2510.c +++ b/drivers/media/rc/keymaps/rc-lme2510.c @@ -46,7 +46,7 @@ static struct rc_keymap lme2510_map = { .map = { .scan = lme2510_rc, .size = ARRAY_SIZE(lme2510_rc), - .ir_type = IR_TYPE_UNKNOWN, + .rc_type = RC_TYPE_UNKNOWN, .name = RC_MAP_LME2510, } }; diff --git a/drivers/media/rc/keymaps/rc-manli.c b/drivers/media/rc/keymaps/rc-manli.c index 0f590b3d01c0..056cf52dce60 100644 --- a/drivers/media/rc/keymaps/rc-manli.c +++ b/drivers/media/rc/keymaps/rc-manli.c @@ -112,7 +112,7 @@ static struct rc_keymap manli_map = { .map = { .scan = manli, .size = ARRAY_SIZE(manli), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MANLI, } }; diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c index 67237fbf9e4b..3a14d31bec4d 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c @@ -45,7 +45,7 @@ static struct rc_keymap msi_digivox_ii_map = { .map = { .scan = msi_digivox_ii, .size = ARRAY_SIZE(msi_digivox_ii), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_MSI_DIGIVOX_II, } }; diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c index 882056e52ef9..16c5b0aa8c43 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c @@ -63,7 +63,7 @@ static struct rc_keymap msi_digivox_iii_map = { .map = { .scan = msi_digivox_iii, .size = ARRAY_SIZE(msi_digivox_iii), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_MSI_DIGIVOX_III, } }; diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c index eb8e42c18ff9..d4c91020fc07 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c @@ -101,7 +101,7 @@ static struct rc_keymap msi_tvanywhere_plus_map = { .map = { .scan = msi_tvanywhere_plus, .size = ARRAY_SIZE(msi_tvanywhere_plus), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MSI_TVANYWHERE_PLUS, } }; diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c index ef411854f067..aec064cb7b15 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c @@ -47,7 +47,7 @@ static struct rc_keymap msi_tvanywhere_map = { .map = { .scan = msi_tvanywhere, .size = ARRAY_SIZE(msi_tvanywhere), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_MSI_TVANYWHERE, } }; diff --git a/drivers/media/rc/keymaps/rc-nebula.c b/drivers/media/rc/keymaps/rc-nebula.c index ccc50eb402ec..2c44b90d48c9 100644 --- a/drivers/media/rc/keymaps/rc-nebula.c +++ b/drivers/media/rc/keymaps/rc-nebula.c @@ -74,7 +74,7 @@ static struct rc_keymap nebula_map = { .map = { .scan = nebula, .size = ARRAY_SIZE(nebula), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NEBULA, } }; diff --git a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c index e1b54d20db60..929084bcaa4d 100644 --- a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c @@ -83,7 +83,7 @@ static struct rc_keymap nec_terratec_cinergy_xs_map = { .map = { .scan = nec_terratec_cinergy_xs, .size = ARRAY_SIZE(nec_terratec_cinergy_xs), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_NEC_TERRATEC_CINERGY_XS, } }; diff --git a/drivers/media/rc/keymaps/rc-norwood.c b/drivers/media/rc/keymaps/rc-norwood.c index e5849a6b3f05..7fe774628edc 100644 --- a/drivers/media/rc/keymaps/rc-norwood.c +++ b/drivers/media/rc/keymaps/rc-norwood.c @@ -63,7 +63,7 @@ static struct rc_keymap norwood_map = { .map = { .scan = norwood, .size = ARRAY_SIZE(norwood), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NORWOOD, } }; diff --git a/drivers/media/rc/keymaps/rc-npgtech.c b/drivers/media/rc/keymaps/rc-npgtech.c index b9ece1e90296..a9cbcde98a30 100644 --- a/drivers/media/rc/keymaps/rc-npgtech.c +++ b/drivers/media/rc/keymaps/rc-npgtech.c @@ -58,7 +58,7 @@ static struct rc_keymap npgtech_map = { .map = { .scan = npgtech, .size = ARRAY_SIZE(npgtech), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_NPGTECH, } }; diff --git a/drivers/media/rc/keymaps/rc-pctv-sedna.c b/drivers/media/rc/keymaps/rc-pctv-sedna.c index 4129bb44a25b..68b33b31f6bf 100644 --- a/drivers/media/rc/keymaps/rc-pctv-sedna.c +++ b/drivers/media/rc/keymaps/rc-pctv-sedna.c @@ -58,7 +58,7 @@ static struct rc_keymap pctv_sedna_map = { .map = { .scan = pctv_sedna, .size = ARRAY_SIZE(pctv_sedna), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PCTV_SEDNA, } }; diff --git a/drivers/media/rc/keymaps/rc-pinnacle-color.c b/drivers/media/rc/keymaps/rc-pinnacle-color.c index 326e023ce126..364ccde87a04 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-color.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-color.c @@ -72,7 +72,7 @@ static struct rc_keymap pinnacle_color_map = { .map = { .scan = pinnacle_color, .size = ARRAY_SIZE(pinnacle_color), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_COLOR, } }; diff --git a/drivers/media/rc/keymaps/rc-pinnacle-grey.c b/drivers/media/rc/keymaps/rc-pinnacle-grey.c index 14cb772515c6..993eff72f233 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-grey.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-grey.c @@ -67,7 +67,7 @@ static struct rc_keymap pinnacle_grey_map = { .map = { .scan = pinnacle_grey, .size = ARRAY_SIZE(pinnacle_grey), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_GREY, } }; diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c index 835bf4ef8de7..56e6a7e203ec 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c @@ -51,7 +51,7 @@ static struct rc_keymap pinnacle_pctv_hd_map = { .map = { .scan = pinnacle_pctv_hd, .size = ARRAY_SIZE(pinnacle_pctv_hd), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PINNACLE_PCTV_HD, } }; diff --git a/drivers/media/rc/keymaps/rc-pixelview-mk12.c b/drivers/media/rc/keymaps/rc-pixelview-mk12.c index 5a735d569a8b..84f89ebd8998 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-mk12.c +++ b/drivers/media/rc/keymaps/rc-pixelview-mk12.c @@ -61,7 +61,7 @@ static struct rc_keymap pixelview_map = { .map = { .scan = pixelview_mk12, .size = ARRAY_SIZE(pixelview_mk12), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_PIXELVIEW_MK12, } }; diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c index 7bbbbf5735e6..703f86bca132 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-new.c +++ b/drivers/media/rc/keymaps/rc-pixelview-new.c @@ -61,7 +61,7 @@ static struct rc_keymap pixelview_new_map = { .map = { .scan = pixelview_new, .size = ARRAY_SIZE(pixelview_new), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PIXELVIEW_NEW, } }; diff --git a/drivers/media/rc/keymaps/rc-pixelview.c b/drivers/media/rc/keymaps/rc-pixelview.c index 82ff12e182a0..5a50aa7e411d 100644 --- a/drivers/media/rc/keymaps/rc-pixelview.c +++ b/drivers/media/rc/keymaps/rc-pixelview.c @@ -60,7 +60,7 @@ static struct rc_keymap pixelview_map = { .map = { .scan = pixelview, .size = ARRAY_SIZE(pixelview), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PIXELVIEW, } }; diff --git a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c index 7cef8190a224..4eec4371f7d1 100644 --- a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c +++ b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c @@ -59,7 +59,7 @@ static struct rc_keymap powercolor_real_angel_map = { .map = { .scan = powercolor_real_angel, .size = ARRAY_SIZE(powercolor_real_angel), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_POWERCOLOR_REAL_ANGEL, } }; diff --git a/drivers/media/rc/keymaps/rc-proteus-2309.c b/drivers/media/rc/keymaps/rc-proteus-2309.c index 22e92d39dee5..802c58a0ae26 100644 --- a/drivers/media/rc/keymaps/rc-proteus-2309.c +++ b/drivers/media/rc/keymaps/rc-proteus-2309.c @@ -47,7 +47,7 @@ static struct rc_keymap proteus_2309_map = { .map = { .scan = proteus_2309, .size = ARRAY_SIZE(proteus_2309), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PROTEUS_2309, } }; diff --git a/drivers/media/rc/keymaps/rc-purpletv.c b/drivers/media/rc/keymaps/rc-purpletv.c index 4e20fc2269f7..f3e9709b7c1f 100644 --- a/drivers/media/rc/keymaps/rc-purpletv.c +++ b/drivers/media/rc/keymaps/rc-purpletv.c @@ -59,7 +59,7 @@ static struct rc_keymap purpletv_map = { .map = { .scan = purpletv, .size = ARRAY_SIZE(purpletv), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PURPLETV, } }; diff --git a/drivers/media/rc/keymaps/rc-pv951.c b/drivers/media/rc/keymaps/rc-pv951.c index 36679e706cf3..e301ff033af1 100644 --- a/drivers/media/rc/keymaps/rc-pv951.c +++ b/drivers/media/rc/keymaps/rc-pv951.c @@ -56,7 +56,7 @@ static struct rc_keymap pv951_map = { .map = { .scan = pv951, .size = ARRAY_SIZE(pv951), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_PV951, } }; diff --git a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c index cc6b8f548747..91bcab8bd266 100644 --- a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c @@ -81,7 +81,7 @@ static struct rc_keymap rc5_hauppauge_new_map = { .map = { .scan = rc5_hauppauge_new, .size = ARRAY_SIZE(rc5_hauppauge_new), - .ir_type = IR_TYPE_RC5, + .rc_type = RC_TYPE_RC5, .name = RC_MAP_RC5_HAUPPAUGE_NEW, } }; diff --git a/drivers/media/rc/keymaps/rc-rc5-tv.c b/drivers/media/rc/keymaps/rc-rc5-tv.c index 73cce2f8ddfb..cda2a2fae04d 100644 --- a/drivers/media/rc/keymaps/rc-rc5-tv.c +++ b/drivers/media/rc/keymaps/rc-rc5-tv.c @@ -59,7 +59,7 @@ static struct rc_keymap rc5_tv_map = { .map = { .scan = rc5_tv, .size = ARRAY_SIZE(rc5_tv), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_RC5_TV, } }; diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 6da955dfef48..f926477a0562 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c @@ -91,7 +91,7 @@ static struct rc_keymap rc6_mce_map = { .map = { .scan = rc6_mce, .size = ARRAY_SIZE(rc6_mce), - .ir_type = IR_TYPE_RC6, + .rc_type = RC_TYPE_RC6, .name = RC_MAP_RC6_MCE, } }; diff --git a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c index ab1a6d2baf72..678142659183 100644 --- a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c +++ b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c @@ -56,7 +56,7 @@ static struct rc_keymap real_audio_220_32_keys_map = { .map = { .scan = real_audio_220_32_keys, .size = ARRAY_SIZE(real_audio_220_32_keys), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_REAL_AUDIO_220_32_KEYS, } }; diff --git a/drivers/media/rc/keymaps/rc-streamzap.c b/drivers/media/rc/keymaps/rc-streamzap.c index df32013a321c..bafe5b8f4192 100644 --- a/drivers/media/rc/keymaps/rc-streamzap.c +++ b/drivers/media/rc/keymaps/rc-streamzap.c @@ -60,7 +60,7 @@ static struct rc_keymap streamzap_map = { .map = { .scan = streamzap, .size = ARRAY_SIZE(streamzap), - .ir_type = IR_TYPE_RC5_SZ, + .rc_type = RC_TYPE_RC5_SZ, .name = RC_MAP_STREAMZAP, } }; diff --git a/drivers/media/rc/keymaps/rc-tbs-nec.c b/drivers/media/rc/keymaps/rc-tbs-nec.c index 3309631e6f80..4ef4f811d011 100644 --- a/drivers/media/rc/keymaps/rc-tbs-nec.c +++ b/drivers/media/rc/keymaps/rc-tbs-nec.c @@ -51,7 +51,7 @@ static struct rc_keymap tbs_nec_map = { .map = { .scan = tbs_nec, .size = ARRAY_SIZE(tbs_nec), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TBS_NEC, } }; diff --git a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c index 5326a0b444c1..4064a32569e2 100644 --- a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c @@ -70,7 +70,7 @@ static struct rc_keymap terratec_cinergy_xs_map = { .map = { .scan = terratec_cinergy_xs, .size = ARRAY_SIZE(terratec_cinergy_xs), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TERRATEC_CINERGY_XS, } }; diff --git a/drivers/media/rc/keymaps/rc-terratec-slim.c b/drivers/media/rc/keymaps/rc-terratec-slim.c index 10dee4c1deff..c23caf70036b 100644 --- a/drivers/media/rc/keymaps/rc-terratec-slim.c +++ b/drivers/media/rc/keymaps/rc-terratec-slim.c @@ -57,7 +57,7 @@ static struct rc_keymap terratec_slim_map = { .map = { .scan = terratec_slim, .size = ARRAY_SIZE(terratec_slim), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_TERRATEC_SLIM, } }; diff --git a/drivers/media/rc/keymaps/rc-tevii-nec.c b/drivers/media/rc/keymaps/rc-tevii-nec.c index e30d411c07bb..eabfb70973b5 100644 --- a/drivers/media/rc/keymaps/rc-tevii-nec.c +++ b/drivers/media/rc/keymaps/rc-tevii-nec.c @@ -66,7 +66,7 @@ static struct rc_keymap tevii_nec_map = { .map = { .scan = tevii_nec, .size = ARRAY_SIZE(tevii_nec), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TEVII_NEC, } }; diff --git a/drivers/media/rc/keymaps/rc-total-media-in-hand.c b/drivers/media/rc/keymaps/rc-total-media-in-hand.c index fd1985763781..cd39b3dbab06 100644 --- a/drivers/media/rc/keymaps/rc-total-media-in-hand.c +++ b/drivers/media/rc/keymaps/rc-total-media-in-hand.c @@ -63,7 +63,7 @@ static struct rc_keymap total_media_in_hand_map = { .map = { .scan = total_media_in_hand, .size = ARRAY_SIZE(total_media_in_hand), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_TOTAL_MEDIA_IN_HAND, } }; diff --git a/drivers/media/rc/keymaps/rc-trekstor.c b/drivers/media/rc/keymaps/rc-trekstor.c index 91092caca452..31d6c6c23642 100644 --- a/drivers/media/rc/keymaps/rc-trekstor.c +++ b/drivers/media/rc/keymaps/rc-trekstor.c @@ -58,7 +58,7 @@ static struct rc_keymap trekstor_map = { .map = { .scan = trekstor, .size = ARRAY_SIZE(trekstor), - .ir_type = IR_TYPE_NEC, + .rc_type = RC_TYPE_NEC, .name = RC_MAP_TREKSTOR, } }; diff --git a/drivers/media/rc/keymaps/rc-tt-1500.c b/drivers/media/rc/keymaps/rc-tt-1500.c index bc88de011d5d..45a060850e53 100644 --- a/drivers/media/rc/keymaps/rc-tt-1500.c +++ b/drivers/media/rc/keymaps/rc-tt-1500.c @@ -60,7 +60,7 @@ static struct rc_keymap tt_1500_map = { .map = { .scan = tt_1500, .size = ARRAY_SIZE(tt_1500), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TT_1500, } }; diff --git a/drivers/media/rc/keymaps/rc-twinhan1027.c b/drivers/media/rc/keymaps/rc-twinhan1027.c index 0b5d356c2d84..b5def5387ded 100644 --- a/drivers/media/rc/keymaps/rc-twinhan1027.c +++ b/drivers/media/rc/keymaps/rc-twinhan1027.c @@ -65,7 +65,7 @@ static struct rc_keymap twinhan_vp1027_map = { .map = { .scan = twinhan_vp1027, .size = ARRAY_SIZE(twinhan_vp1027), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_TWINHAN_VP1027_DVBS, } }; diff --git a/drivers/media/rc/keymaps/rc-videomate-s350.c b/drivers/media/rc/keymaps/rc-videomate-s350.c index 4df7fcd1d2fc..7c422b4670fa 100644 --- a/drivers/media/rc/keymaps/rc-videomate-s350.c +++ b/drivers/media/rc/keymaps/rc-videomate-s350.c @@ -63,7 +63,7 @@ static struct rc_keymap videomate_s350_map = { .map = { .scan = videomate_s350, .size = ARRAY_SIZE(videomate_s350), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_VIDEOMATE_S350, } }; diff --git a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c index 776b0a638d87..4d31b47dfc30 100644 --- a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c +++ b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c @@ -65,7 +65,7 @@ static struct rc_keymap videomate_tv_pvr_map = { .map = { .scan = videomate_tv_pvr, .size = ARRAY_SIZE(videomate_tv_pvr), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_VIDEOMATE_TV_PVR, } }; diff --git a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c index 9d2d550aaa90..ade3c14c4c0f 100644 --- a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c +++ b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c @@ -60,7 +60,7 @@ static struct rc_keymap winfast_usbii_deluxe_map = { .map = { .scan = winfast_usbii_deluxe, .size = ARRAY_SIZE(winfast_usbii_deluxe), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_WINFAST_USBII_DELUXE, } }; diff --git a/drivers/media/rc/keymaps/rc-winfast.c b/drivers/media/rc/keymaps/rc-winfast.c index 0e90a3bd9499..502b5f54f84e 100644 --- a/drivers/media/rc/keymaps/rc-winfast.c +++ b/drivers/media/rc/keymaps/rc-winfast.c @@ -80,7 +80,7 @@ static struct rc_keymap winfast_map = { .map = { .scan = winfast, .size = ARRAY_SIZE(winfast), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_WINFAST, } }; diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index db7787ac67a3..c2cb58a0c6ed 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1060,7 +1060,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) rc->dev.parent = dev; rc->priv = ir; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protos = IR_TYPE_ALL; + rc->allowed_protos = RC_TYPE_ALL; rc->timeout = MS_TO_NS(1000); if (!ir->flags.no_tx) { rc->s_tx_mask = mceusb_set_tx_mask; diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index bf3f58f7bd7c..7fca6d1549ed 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -1060,7 +1060,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) /* Set up the rc device */ rdev->priv = nvt; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protos = IR_TYPE_ALL; + rdev->allowed_protos = RC_TYPE_ALL; rdev->open = nvt_open; rdev->close = nvt_close; rdev->tx_ir = nvt_tx_ir; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 11e2703ef1c4..f3244eba66c6 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -102,7 +102,7 @@ static struct rc_keymap empty_map = { .map = { .scan = empty, .size = ARRAY_SIZE(empty), - .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ .name = RC_MAP_EMPTY, } }; @@ -111,7 +111,7 @@ static struct rc_keymap empty_map = { * ir_create_table() - initializes a scancode table * @rc_tab: the ir_scancode_table to initialize * @name: name to assign to the table - * @ir_type: ir type to assign to the new table + * @rc_type: ir type to assign to the new table * @size: initial size of the table * @return: zero on success or a negative error code * @@ -119,10 +119,10 @@ static struct rc_keymap empty_map = { * memory to hold at least the specified number of elements. */ static int ir_create_table(struct ir_scancode_table *rc_tab, - const char *name, u64 ir_type, size_t size) + const char *name, u64 rc_type, size_t size) { rc_tab->name = name; - rc_tab->ir_type = ir_type; + rc_tab->rc_type = rc_type; rc_tab->alloc = roundup_pow_of_two(size * sizeof(struct ir_scancode)); rc_tab->size = rc_tab->alloc / sizeof(struct ir_scancode); rc_tab->scan = kmalloc(rc_tab->alloc, GFP_KERNEL); @@ -372,7 +372,7 @@ static int ir_setkeytable(struct rc_dev *dev, int rc; rc = ir_create_table(rc_tab, from->name, - from->ir_type, from->size); + from->rc_type, from->size); if (rc) return rc; @@ -719,14 +719,14 @@ static struct { u64 type; char *name; } proto_names[] = { - { IR_TYPE_UNKNOWN, "unknown" }, - { IR_TYPE_RC5, "rc-5" }, - { IR_TYPE_NEC, "nec" }, - { IR_TYPE_RC6, "rc-6" }, - { IR_TYPE_JVC, "jvc" }, - { IR_TYPE_SONY, "sony" }, - { IR_TYPE_RC5_SZ, "rc-5-sz" }, - { IR_TYPE_LIRC, "lirc" }, + { RC_TYPE_UNKNOWN, "unknown" }, + { RC_TYPE_RC5, "rc-5" }, + { RC_TYPE_NEC, "nec" }, + { RC_TYPE_RC6, "rc-6" }, + { RC_TYPE_JVC, "jvc" }, + { RC_TYPE_SONY, "sony" }, + { RC_TYPE_RC5_SZ, "rc-5-sz" }, + { RC_TYPE_LIRC, "lirc" }, }; #define PROTO_NONE "none" @@ -755,7 +755,7 @@ static ssize_t show_protocols(struct device *device, return -EINVAL; if (dev->driver_type == RC_DRIVER_SCANCODE) { - enabled = dev->rc_tab.ir_type; + enabled = dev->rc_tab.rc_type; allowed = dev->allowed_protos; } else { enabled = dev->raw->enabled_protocols; @@ -813,7 +813,7 @@ static ssize_t store_protocols(struct device *device, return -EINVAL; if (dev->driver_type == RC_DRIVER_SCANCODE) - type = dev->rc_tab.ir_type; + type = dev->rc_tab.rc_type; else if (dev->raw) type = dev->raw->enabled_protocols; else { @@ -881,7 +881,7 @@ static ssize_t store_protocols(struct device *device, if (dev->driver_type == RC_DRIVER_SCANCODE) { spin_lock_irqsave(&dev->rc_tab.lock, flags); - dev->rc_tab.ir_type = type; + dev->rc_tab.rc_type = type; spin_unlock_irqrestore(&dev->rc_tab.lock, flags); } else { dev->raw->enabled_protocols = type; @@ -1052,7 +1052,7 @@ int rc_register_device(struct rc_dev *dev) } if (dev->change_protocol) { - rc = dev->change_protocol(dev, rc_tab->ir_type); + rc = dev->change_protocol(dev, rc_tab->rc_type); if (rc < 0) goto out_raw; } diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index ea2cb636a193..7814ec709bfc 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -318,7 +318,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) rdev->input_phys = sz->phys; rdev->priv = sz; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protos = IR_TYPE_ALL; + rdev->allowed_protos = RC_TYPE_ALL; rdev->driver_name = DRIVER_NAME; rdev->map_name = RC_MAP_STREAMZAP; diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index e71a026f3419..c330fb917b50 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c @@ -98,7 +98,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, case CX18_HW_Z8F0811_IR_RX_HAUP: init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = IR_TYPE_RC5; + init_data->type = RC_TYPE_RC5; init_data->name = cx->card_name; info.platform_data = init_data; break; diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 1d043ed1bc32..c236a4e7e97b 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c @@ -84,7 +84,7 @@ int cx231xx_ir_init(struct cx231xx *dev) /* The i2c micro-controller only outputs the cmd part of NEC protocol */ dev->init_data.rc_dev->scanmask = 0xff; dev->init_data.rc_dev->driver_name = "cx231xx"; - dev->init_data.type = IR_TYPE_NEC; + dev->init_data.type = RC_TYPE_NEC; info.addr = 0x30; /* Load and bind ir-kbd-i2c */ diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index e824ba63fdde..0b0d0664382a 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -264,14 +264,14 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1250: /* Integrated CX2388[58] IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = IR_TYPE_ALL; + allowed_protos = RC_TYPE_ALL; /* The grey Hauppauge RC-5 remote */ rc_map = RC_MAP_RC5_HAUPPAUGE_NEW; break; case CX23885_BOARD_TEVII_S470: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = IR_TYPE_ALL; + allowed_protos = RC_TYPE_ALL; /* A guess at the remote */ rc_map = RC_MAP_TEVII_NEC; break; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index cfeba4c08715..4a3bf5476c71 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -241,7 +241,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) struct cx88_IR *ir; struct rc_dev *dev; char *ir_codes = NULL; - u64 ir_type = IR_TYPE_OTHER; + u64 rc_type = RC_TYPE_OTHER; int err = -ENOMEM; u32 hardware_mask = 0; /* For devices with a hardware mask, when * used with a full-code IR table @@ -404,7 +404,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_TWINHAN_VP1027_DVBS: ir_codes = RC_MAP_TWINHAN_VP1027_DVBS; - ir_type = IR_TYPE_NEC; + rc_type = RC_TYPE_NEC; ir->sampling = 0xff00; /* address */ break; } @@ -457,7 +457,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) dev->timeout = 10 * 1000 * 1000; /* 10 ms */ } else { dev->driver_type = RC_DRIVER_SCANCODE; - dev->allowed_protos = ir_type; + dev->allowed_protos = rc_type; } ir->core = core; @@ -557,7 +557,7 @@ void cx88_i2c_init_ir(struct cx88_core *core) /* Hauppauge XVR */ core->init_data.name = "cx88 Hauppauge XVR remote"; core->init_data.ir_codes = RC_MAP_HAUPPAUGE_NEW; - core->init_data.type = IR_TYPE_RC5; + core->init_data.type = RC_TYPE_RC5; core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; info.platform_data = &core->init_data; diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index e32eb38564e6..29cc74441a7d 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -343,7 +343,7 @@ static void em28xx_ir_stop(struct rc_dev *rc) cancel_delayed_work_sync(&ir->work); } -int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 ir_type) +int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) { int rc = 0; struct em28xx_IR *ir = rc_dev->priv; @@ -352,14 +352,14 @@ int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 ir_type) /* Adjust xclk based o IR table for RC5/NEC tables */ - if (ir_type == IR_TYPE_RC5) { + if (rc_type == RC_TYPE_RC5) { dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; ir->full_code = 1; - } else if (ir_type == IR_TYPE_NEC) { + } else if (rc_type == RC_TYPE_NEC) { dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; ir_config = EM2874_IR_NEC; ir->full_code = 1; - } else if (ir_type != IR_TYPE_UNKNOWN) + } else if (rc_type != RC_TYPE_UNKNOWN) rc = -EINVAL; em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, @@ -408,14 +408,14 @@ int em28xx_ir_init(struct em28xx *dev) * em2874 supports more protocols. For now, let's just announce * the two protocols that were already tested */ - rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; rc->priv = ir; rc->change_protocol = em28xx_ir_change_protocol; rc->open = em28xx_ir_start; rc->close = em28xx_ir_stop; /* By default, keep protocol field untouched */ - err = em28xx_ir_change_protocol(rc, IR_TYPE_UNKNOWN); + err = em28xx_ir_change_protocol(rc, RC_TYPE_UNKNOWN); if (err) goto err_out_free; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index c77ea53f50d7..dd54c3dae054 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -269,7 +269,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 = IR_TYPE_UNKNOWN; + u64 rc_type = RC_TYPE_UNKNOWN; struct IR_i2c *ir; struct rc_dev *rc = NULL; struct i2c_adapter *adap = client->adapter; @@ -288,7 +288,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) case 0x64: name = "Pixelview"; ir->get_key = get_key_pixelview; - ir_type = IR_TYPE_OTHER; + rc_type = RC_TYPE_OTHER; ir_codes = RC_MAP_EMPTY; break; case 0x18: @@ -296,7 +296,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) case 0x1a: name = "Hauppauge"; ir->get_key = get_key_haup; - ir_type = IR_TYPE_RC5; + rc_type = RC_TYPE_RC5; if (hauppauge == 1) { ir_codes = RC_MAP_HAUPPAUGE_NEW; } else { @@ -306,19 +306,19 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) case 0x30: name = "KNC One"; ir->get_key = get_key_knc1; - ir_type = IR_TYPE_OTHER; + rc_type = RC_TYPE_OTHER; ir_codes = RC_MAP_EMPTY; break; case 0x6b: name = "FusionHDTV"; ir->get_key = get_key_fusionhdtv; - ir_type = IR_TYPE_RC5; + rc_type = RC_TYPE_RC5; ir_codes = RC_MAP_FUSIONHDTV_MCE; break; case 0x40: name = "AVerMedia Cardbus remote"; ir->get_key = get_key_avermedia_cardbus; - ir_type = IR_TYPE_OTHER; + rc_type = RC_TYPE_OTHER; ir_codes = RC_MAP_AVERMEDIA_CARDBUS; break; } @@ -333,7 +333,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) name = init_data->name; if (init_data->type) - ir_type = init_data->type; + rc_type = init_data->type; if (init_data->polling_interval) ir->polling_interval = init_data->polling_interval; @@ -378,7 +378,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir->rc = rc; /* Make sure we are all setup before going on */ - if (!name || !ir->get_key || !ir_type || !ir_codes) { + if (!name || !ir->get_key || !rc_type || !ir_codes) { dprintk(1, ": Unsupported device at address 0x%02x\n", addr); err = -ENODEV; @@ -405,7 +405,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) * Initialize the other fields of rc_dev */ rc->map_name = ir->ir_codes; - rc->allowed_protos = ir_type; + rc->allowed_protos = rc_type; if (!rc->driver_name) rc->driver_name = MODULE_NAME; diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 665191c9b407..68170924448c 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c @@ -172,7 +172,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; init_data->internal_get_key_func = IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; - init_data->type = IR_TYPE_OTHER; + init_data->type = RC_TYPE_OTHER; init_data->name = "AVerMedia AVerTV card"; break; case IVTV_HW_I2C_IR_RX_HAUP_EXT: @@ -180,14 +180,14 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) /* Default to old black remote */ init_data->ir_codes = RC_MAP_RC5_TV; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; - init_data->type = IR_TYPE_RC5; + init_data->type = RC_TYPE_RC5; init_data->name = itv->card_name; break; case IVTV_HW_Z8F0811_IR_RX_HAUP: /* Default to grey remote */ init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = IR_TYPE_RC5; + init_data->type = RC_TYPE_RC5; init_data->name = itv->card_name; break; } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index cd39aea30389..f3f4aff2761e 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -909,7 +909,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name = "BeholdTV"; dev->init_data.get_key = get_key_beholdm6xx; dev->init_data.ir_codes = RC_MAP_BEHOLD; - dev->init_data.type = IR_TYPE_NEC; + dev->init_data.type = RC_TYPE_NEC; info.addr = 0x2d; break; case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 02b982978bb8..e02ea6720380 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c @@ -65,7 +65,7 @@ struct tm6000_IR { int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); /* IR device properties */ - u64 ir_type; + u64 rc_type; }; @@ -143,7 +143,7 @@ static int default_polling_getkey(struct tm6000_IR *ir, return 0; if (&dev->int_in) { - if (ir->ir_type == IR_TYPE_RC5) + if (ir->rc_type == RC_TYPE_RC5) poll_result->rc_data = ir->urb_data[0]; else poll_result->rc_data = ir->urb_data[0] | ir->urb_data[1] << 8; @@ -153,7 +153,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_type == IR_TYPE_RC5) { + if (ir->rc_type == RC_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); @@ -230,7 +230,7 @@ static void tm6000_ir_stop(struct rc_dev *rc) cancel_delayed_work_sync(&ir->work); } -int tm6000_ir_change_protocol(struct rc_dev *rc, u64 ir_type) +int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) { struct tm6000_IR *ir = rc->priv; @@ -268,7 +268,7 @@ int tm6000_ir_init(struct tm6000_core *dev) ir->rc = rc; /* input einrichten */ - rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; rc->priv = ir; rc->change_protocol = tm6000_ir_change_protocol; rc->open = tm6000_ir_start; @@ -283,7 +283,7 @@ int tm6000_ir_init(struct tm6000_core *dev) usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys)); - tm6000_ir_change_protocol(rc, IR_TYPE_UNKNOWN); + tm6000_ir_change_protocol(rc, RC_TYPE_UNKNOWN); rc->input_name = ir->name; rc->input_phys = ir->phys; diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index f22b359c37ff..768aa77925cd 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -37,7 +37,7 @@ enum ir_kbd_get_key_fn { struct IR_i2c_init_data { char *ir_codes; const char *name; - u64 type; /* IR_TYPE_RC5, etc */ + u64 type; /* RC_TYPE_RC5, etc */ u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ /* diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 170581b4fa84..42543257fa0f 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -45,7 +45,7 @@ enum rc_driver_type { * @input_dev: the input child device used to communicate events to userspace * @driver_type: specifies if protocol decoding is done in hardware or software * @idle: used to keep track of RX state - * @allowed_protos: bitmask with the supported IR_TYPE_* protocols + * @allowed_protos: bitmask with the supported RC_TYPE_* protocols * @scanmask: some hardware decoders are not capable of providing the full * scancode to the application. As this is a hardware limit, we can't do * anything with it. Yet, as the same keycode table can be used with other @@ -107,7 +107,7 @@ struct rc_dev { u32 max_timeout; u32 rx_resolution; u32 tx_resolution; - int (*change_protocol)(struct rc_dev *dev, u64 ir_type); + int (*change_protocol)(struct rc_dev *dev, u64 rc_type); int (*open)(struct rc_dev *dev); void (*close)(struct rc_dev *dev); int (*s_tx_mask)(struct rc_dev *dev, u32 mask); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index e0f17edf38ed..c53351e15f50 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -11,19 +11,19 @@ #include -#define IR_TYPE_UNKNOWN 0 -#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ -#define IR_TYPE_NEC (1 << 1) -#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ -#define IR_TYPE_JVC (1 << 3) /* JVC protocol */ -#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ -#define IR_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ -#define IR_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ -#define IR_TYPE_OTHER (1u << 31) +#define RC_TYPE_UNKNOWN 0 +#define RC_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ +#define RC_TYPE_NEC (1 << 1) +#define RC_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ +#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ +#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ +#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ +#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ +#define RC_TYPE_OTHER (1u << 31) -#define IR_TYPE_ALL (IR_TYPE_RC5 | IR_TYPE_NEC | IR_TYPE_RC6 | \ - IR_TYPE_JVC | IR_TYPE_SONY | IR_TYPE_LIRC | \ - IR_TYPE_RC5_SZ | IR_TYPE_OTHER) +#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ + RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ + RC_TYPE_RC5_SZ | RC_TYPE_OTHER) struct ir_scancode { u32 scancode; @@ -35,7 +35,7 @@ struct ir_scancode_table { unsigned int size; /* Max number of entries */ unsigned int len; /* Used number of entries */ unsigned int alloc; /* Size of *scan in bytes */ - u64 ir_type; + u64 rc_type; const char *name; spinlock_t lock; }; -- cgit v1.2.3 From b088ba658b3438056dab4d744701364db3f08b9a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 14:28:27 -0300 Subject: [media] rc: Properly name the rc_map struct The struct that describes a rc mapping had an weird and long name. We should properly name it, to make easier for developers to work with it, and to avoid confusion. Basically, generated by this script: for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode_table,rc_map,g <$i >a && mv a $i; done for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_tab,rc_map,g <$i >a && mv a $i; done (and manually fixed where needed) Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/rc-main.c | 212 +++++++++++++++++----------------- drivers/media/video/cx231xx/cx231xx.h | 2 +- include/media/rc-core.h | 4 +- include/media/rc-map.h | 6 +- 4 files changed, 112 insertions(+), 112 deletions(-) (limited to 'include') diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f3244eba66c6..caa8d70de726 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -47,7 +47,7 @@ static struct rc_keymap *seek_rc_map(const char *name) return NULL; } -struct ir_scancode_table *get_rc_map(const char *name) +struct rc_map *get_rc_map(const char *name) { struct rc_keymap *map; @@ -109,71 +109,71 @@ static struct rc_keymap empty_map = { /** * ir_create_table() - initializes a scancode table - * @rc_tab: the ir_scancode_table to initialize + * @rc_map: the rc_map to initialize * @name: name to assign to the table * @rc_type: ir type to assign to the new table * @size: initial size of the table * @return: zero on success or a negative error code * - * This routine will initialize the ir_scancode_table and will allocate + * This routine will initialize the rc_map and will allocate * memory to hold at least the specified number of elements. */ -static int ir_create_table(struct ir_scancode_table *rc_tab, +static int ir_create_table(struct rc_map *rc_map, const char *name, u64 rc_type, size_t size) { - rc_tab->name = name; - rc_tab->rc_type = rc_type; - rc_tab->alloc = roundup_pow_of_two(size * sizeof(struct ir_scancode)); - rc_tab->size = rc_tab->alloc / sizeof(struct ir_scancode); - rc_tab->scan = kmalloc(rc_tab->alloc, GFP_KERNEL); - if (!rc_tab->scan) + rc_map->name = name; + rc_map->rc_type = rc_type; + rc_map->alloc = roundup_pow_of_two(size * sizeof(struct ir_scancode)); + rc_map->size = rc_map->alloc / sizeof(struct ir_scancode); + rc_map->scan = kmalloc(rc_map->alloc, GFP_KERNEL); + if (!rc_map->scan) return -ENOMEM; IR_dprintk(1, "Allocated space for %u keycode entries (%u bytes)\n", - rc_tab->size, rc_tab->alloc); + rc_map->size, rc_map->alloc); return 0; } /** * ir_free_table() - frees memory allocated by a scancode table - * @rc_tab: the table whose mappings need to be freed + * @rc_map: the table whose mappings need to be freed * * This routine will free memory alloctaed for key mappings used by given * scancode table. */ -static void ir_free_table(struct ir_scancode_table *rc_tab) +static void ir_free_table(struct rc_map *rc_map) { - rc_tab->size = 0; - kfree(rc_tab->scan); - rc_tab->scan = NULL; + rc_map->size = 0; + kfree(rc_map->scan); + rc_map->scan = NULL; } /** * ir_resize_table() - resizes a scancode table if necessary - * @rc_tab: the ir_scancode_table to resize + * @rc_map: the rc_map to resize * @gfp_flags: gfp flags to use when allocating memory * @return: zero on success or a negative error code * - * This routine will shrink the ir_scancode_table if it has lots of + * This routine will shrink the rc_map if it has lots of * unused entries and grow it if it is full. */ -static int ir_resize_table(struct ir_scancode_table *rc_tab, gfp_t gfp_flags) +static int ir_resize_table(struct rc_map *rc_map, gfp_t gfp_flags) { - unsigned int oldalloc = rc_tab->alloc; + unsigned int oldalloc = rc_map->alloc; unsigned int newalloc = oldalloc; - struct ir_scancode *oldscan = rc_tab->scan; + struct ir_scancode *oldscan = rc_map->scan; struct ir_scancode *newscan; - if (rc_tab->size == rc_tab->len) { + if (rc_map->size == rc_map->len) { /* All entries in use -> grow keytable */ - if (rc_tab->alloc >= IR_TAB_MAX_SIZE) + if (rc_map->alloc >= IR_TAB_MAX_SIZE) return -ENOMEM; newalloc *= 2; IR_dprintk(1, "Growing table to %u bytes\n", newalloc); } - if ((rc_tab->len * 3 < rc_tab->size) && (oldalloc > IR_TAB_MIN_SIZE)) { + if ((rc_map->len * 3 < rc_map->size) && (oldalloc > IR_TAB_MIN_SIZE)) { /* Less than 1/3 of entries in use -> shrink keytable */ newalloc /= 2; IR_dprintk(1, "Shrinking table to %u bytes\n", newalloc); @@ -188,10 +188,10 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab, gfp_t gfp_flags) return -ENOMEM; } - memcpy(newscan, rc_tab->scan, rc_tab->len * sizeof(struct ir_scancode)); - rc_tab->scan = newscan; - rc_tab->alloc = newalloc; - rc_tab->size = rc_tab->alloc / sizeof(struct ir_scancode); + memcpy(newscan, rc_map->scan, rc_map->len * sizeof(struct ir_scancode)); + rc_map->scan = newscan; + rc_map->alloc = newalloc; + rc_map->size = rc_map->alloc / sizeof(struct ir_scancode); kfree(oldscan); return 0; } @@ -199,7 +199,7 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab, gfp_t gfp_flags) /** * ir_update_mapping() - set a keycode in the scancode->keycode table * @dev: the struct rc_dev device descriptor - * @rc_tab: scancode table to be adjusted + * @rc_map: scancode table to be adjusted * @index: index of the mapping that needs to be updated * @keycode: the desired keycode * @return: previous keycode assigned to the mapping @@ -208,26 +208,26 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab, gfp_t gfp_flags) * position. */ static unsigned int ir_update_mapping(struct rc_dev *dev, - struct ir_scancode_table *rc_tab, + struct rc_map *rc_map, unsigned int index, unsigned int new_keycode) { - int old_keycode = rc_tab->scan[index].keycode; + int old_keycode = rc_map->scan[index].keycode; int i; /* Did the user wish to remove the mapping? */ if (new_keycode == KEY_RESERVED || new_keycode == KEY_UNKNOWN) { IR_dprintk(1, "#%d: Deleting scan 0x%04x\n", - index, rc_tab->scan[index].scancode); - rc_tab->len--; - memmove(&rc_tab->scan[index], &rc_tab->scan[index+ 1], - (rc_tab->len - index) * sizeof(struct ir_scancode)); + index, rc_map->scan[index].scancode); + rc_map->len--; + memmove(&rc_map->scan[index], &rc_map->scan[index+ 1], + (rc_map->len - index) * sizeof(struct ir_scancode)); } else { IR_dprintk(1, "#%d: %s scan 0x%04x with key 0x%04x\n", index, old_keycode == KEY_RESERVED ? "New" : "Replacing", - rc_tab->scan[index].scancode, new_keycode); - rc_tab->scan[index].keycode = new_keycode; + rc_map->scan[index].scancode, new_keycode); + rc_map->scan[index].keycode = new_keycode; __set_bit(new_keycode, dev->input_dev->keybit); } @@ -235,15 +235,15 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, /* A previous mapping was updated... */ __clear_bit(old_keycode, dev->input_dev->keybit); /* ... but another scancode might use the same keycode */ - for (i = 0; i < rc_tab->len; i++) { - if (rc_tab->scan[i].keycode == old_keycode) { + for (i = 0; i < rc_map->len; i++) { + if (rc_map->scan[i].keycode == old_keycode) { __set_bit(old_keycode, dev->input_dev->keybit); break; } } /* Possibly shrink the keytable, failure is not a problem */ - ir_resize_table(rc_tab, GFP_ATOMIC); + ir_resize_table(rc_map, GFP_ATOMIC); } return old_keycode; @@ -252,19 +252,19 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, /** * ir_establish_scancode() - set a keycode in the scancode->keycode table * @dev: the struct rc_dev device descriptor - * @rc_tab: scancode table to be searched + * @rc_map: scancode table to be searched * @scancode: the desired scancode * @resize: controls whether we allowed to resize the table to * accomodate not yet present scancodes * @return: index of the mapping containing scancode in question * or -1U in case of failure. * - * This routine is used to locate given scancode in ir_scancode_table. + * This routine is used to locate given scancode in rc_map. * If scancode is not yet present the routine will allocate a new slot * for it. */ static unsigned int ir_establish_scancode(struct rc_dev *dev, - struct ir_scancode_table *rc_tab, + struct rc_map *rc_map, unsigned int scancode, bool resize) { @@ -282,28 +282,28 @@ static unsigned int ir_establish_scancode(struct rc_dev *dev, scancode &= dev->scanmask; /* First check if we already have a mapping for this ir command */ - for (i = 0; i < rc_tab->len; i++) { - if (rc_tab->scan[i].scancode == scancode) + for (i = 0; i < rc_map->len; i++) { + if (rc_map->scan[i].scancode == scancode) return i; /* Keytable is sorted from lowest to highest scancode */ - if (rc_tab->scan[i].scancode >= scancode) + if (rc_map->scan[i].scancode >= scancode) break; } /* No previous mapping found, we might need to grow the table */ - if (rc_tab->size == rc_tab->len) { - if (!resize || ir_resize_table(rc_tab, GFP_ATOMIC)) + if (rc_map->size == rc_map->len) { + if (!resize || ir_resize_table(rc_map, GFP_ATOMIC)) return -1U; } /* i is the proper index to insert our new keycode */ - if (i < rc_tab->len) - memmove(&rc_tab->scan[i + 1], &rc_tab->scan[i], - (rc_tab->len - i) * sizeof(struct ir_scancode)); - rc_tab->scan[i].scancode = scancode; - rc_tab->scan[i].keycode = KEY_RESERVED; - rc_tab->len++; + if (i < rc_map->len) + memmove(&rc_map->scan[i + 1], &rc_map->scan[i], + (rc_map->len - i) * sizeof(struct ir_scancode)); + rc_map->scan[i].scancode = scancode; + rc_map->scan[i].keycode = KEY_RESERVED; + rc_map->len++; return i; } @@ -322,17 +322,17 @@ static int ir_setkeycode(struct input_dev *idev, unsigned int *old_keycode) { struct rc_dev *rdev = input_get_drvdata(idev); - struct ir_scancode_table *rc_tab = &rdev->rc_tab; + struct rc_map *rc_map = &rdev->rc_map; unsigned int index; unsigned int scancode; int retval; unsigned long flags; - spin_lock_irqsave(&rc_tab->lock, flags); + spin_lock_irqsave(&rc_map->lock, flags); if (ke->flags & INPUT_KEYMAP_BY_INDEX) { index = ke->index; - if (index >= rc_tab->len) { + if (index >= rc_map->len) { retval = -EINVAL; goto out; } @@ -341,83 +341,83 @@ static int ir_setkeycode(struct input_dev *idev, if (retval) goto out; - index = ir_establish_scancode(rdev, rc_tab, scancode, true); - if (index >= rc_tab->len) { + index = ir_establish_scancode(rdev, rc_map, scancode, true); + if (index >= rc_map->len) { retval = -ENOMEM; goto out; } } - *old_keycode = ir_update_mapping(rdev, rc_tab, index, ke->keycode); + *old_keycode = ir_update_mapping(rdev, rc_map, index, ke->keycode); out: - spin_unlock_irqrestore(&rc_tab->lock, flags); + spin_unlock_irqrestore(&rc_map->lock, flags); return retval; } /** * ir_setkeytable() - sets several entries in the scancode->keycode table * @dev: the struct rc_dev device descriptor - * @to: the struct ir_scancode_table to copy entries to - * @from: the struct ir_scancode_table to copy entries from + * @to: the struct rc_map to copy entries to + * @from: the struct rc_map to copy entries from * @return: -ENOMEM if all keycodes could not be inserted, otherwise zero. * * This routine is used to handle table initialization. */ static int ir_setkeytable(struct rc_dev *dev, - const struct ir_scancode_table *from) + const struct rc_map *from) { - struct ir_scancode_table *rc_tab = &dev->rc_tab; + struct rc_map *rc_map = &dev->rc_map; unsigned int i, index; int rc; - rc = ir_create_table(rc_tab, from->name, + rc = ir_create_table(rc_map, from->name, from->rc_type, from->size); if (rc) return rc; IR_dprintk(1, "Allocated space for %u keycode entries (%u bytes)\n", - rc_tab->size, rc_tab->alloc); + rc_map->size, rc_map->alloc); for (i = 0; i < from->size; i++) { - index = ir_establish_scancode(dev, rc_tab, + index = ir_establish_scancode(dev, rc_map, from->scan[i].scancode, false); - if (index >= rc_tab->len) { + if (index >= rc_map->len) { rc = -ENOMEM; break; } - ir_update_mapping(dev, rc_tab, index, + ir_update_mapping(dev, rc_map, index, from->scan[i].keycode); } if (rc) - ir_free_table(rc_tab); + ir_free_table(rc_map); return rc; } /** * ir_lookup_by_scancode() - locate mapping by scancode - * @rc_tab: the struct ir_scancode_table to search + * @rc_map: the struct rc_map to search * @scancode: scancode to look for in the table * @return: index in the table, -1U if not found * * This routine performs binary search in RC keykeymap table for * given scancode. */ -static unsigned int ir_lookup_by_scancode(const struct ir_scancode_table *rc_tab, +static unsigned int ir_lookup_by_scancode(const struct rc_map *rc_map, unsigned int scancode) { int start = 0; - int end = rc_tab->len - 1; + int end = rc_map->len - 1; int mid; while (start <= end) { mid = (start + end) / 2; - if (rc_tab->scan[mid].scancode < scancode) + if (rc_map->scan[mid].scancode < scancode) start = mid + 1; - else if (rc_tab->scan[mid].scancode > scancode) + else if (rc_map->scan[mid].scancode > scancode) end = mid - 1; else return mid; @@ -439,14 +439,14 @@ static int ir_getkeycode(struct input_dev *idev, struct input_keymap_entry *ke) { struct rc_dev *rdev = input_get_drvdata(idev); - struct ir_scancode_table *rc_tab = &rdev->rc_tab; + struct rc_map *rc_map = &rdev->rc_map; struct ir_scancode *entry; unsigned long flags; unsigned int index; unsigned int scancode; int retval; - spin_lock_irqsave(&rc_tab->lock, flags); + spin_lock_irqsave(&rc_map->lock, flags); if (ke->flags & INPUT_KEYMAP_BY_INDEX) { index = ke->index; @@ -455,10 +455,10 @@ static int ir_getkeycode(struct input_dev *idev, if (retval) goto out; - index = ir_lookup_by_scancode(rc_tab, scancode); + index = ir_lookup_by_scancode(rc_map, scancode); } - if (index >= rc_tab->len) { + if (index >= rc_map->len) { if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) IR_dprintk(1, "unknown key for scancode 0x%04x\n", scancode); @@ -466,7 +466,7 @@ static int ir_getkeycode(struct input_dev *idev, goto out; } - entry = &rc_tab->scan[index]; + entry = &rc_map->scan[index]; ke->index = index; ke->keycode = entry->keycode; @@ -476,7 +476,7 @@ static int ir_getkeycode(struct input_dev *idev, retval = 0; out: - spin_unlock_irqrestore(&rc_tab->lock, flags); + spin_unlock_irqrestore(&rc_map->lock, flags); return retval; } @@ -492,18 +492,18 @@ out: */ u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode) { - struct ir_scancode_table *rc_tab = &dev->rc_tab; + struct rc_map *rc_map = &dev->rc_map; unsigned int keycode; unsigned int index; unsigned long flags; - spin_lock_irqsave(&rc_tab->lock, flags); + spin_lock_irqsave(&rc_map->lock, flags); - index = ir_lookup_by_scancode(rc_tab, scancode); - keycode = index < rc_tab->len ? - rc_tab->scan[index].keycode : KEY_RESERVED; + index = ir_lookup_by_scancode(rc_map, scancode); + keycode = index < rc_map->len ? + rc_map->scan[index].keycode : KEY_RESERVED; - spin_unlock_irqrestore(&rc_tab->lock, flags); + spin_unlock_irqrestore(&rc_map->lock, flags); if (keycode != KEY_RESERVED) IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", @@ -755,7 +755,7 @@ static ssize_t show_protocols(struct device *device, return -EINVAL; if (dev->driver_type == RC_DRIVER_SCANCODE) { - enabled = dev->rc_tab.rc_type; + enabled = dev->rc_map.rc_type; allowed = dev->allowed_protos; } else { enabled = dev->raw->enabled_protocols; @@ -813,7 +813,7 @@ static ssize_t store_protocols(struct device *device, return -EINVAL; if (dev->driver_type == RC_DRIVER_SCANCODE) - type = dev->rc_tab.rc_type; + type = dev->rc_map.rc_type; else if (dev->raw) type = dev->raw->enabled_protocols; else { @@ -880,9 +880,9 @@ static ssize_t store_protocols(struct device *device, } if (dev->driver_type == RC_DRIVER_SCANCODE) { - spin_lock_irqsave(&dev->rc_tab.lock, flags); - dev->rc_tab.rc_type = type; - spin_unlock_irqrestore(&dev->rc_tab.lock, flags); + spin_lock_irqsave(&dev->rc_map.lock, flags); + dev->rc_map.rc_type = type; + spin_unlock_irqrestore(&dev->rc_map.lock, flags); } else { dev->raw->enabled_protocols = type; } @@ -912,8 +912,8 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) { struct rc_dev *dev = to_rc_dev(device); - if (dev->rc_tab.name) - ADD_HOTPLUG_VAR("NAME=%s", dev->rc_tab.name); + if (dev->rc_map.name) + ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name); if (dev->driver_name) ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name); @@ -964,7 +964,7 @@ struct rc_dev *rc_allocate_device(void) dev->input_dev->setkeycode_new = ir_setkeycode; input_set_drvdata(dev->input_dev, dev); - spin_lock_init(&dev->rc_tab.lock); + spin_lock_init(&dev->rc_map.lock); spin_lock_init(&dev->keylock); setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev); @@ -989,17 +989,17 @@ EXPORT_SYMBOL_GPL(rc_free_device); int rc_register_device(struct rc_dev *dev) { static atomic_t devno = ATOMIC_INIT(0); - struct ir_scancode_table *rc_tab; + struct rc_map *rc_map; const char *path; int rc; if (!dev || !dev->map_name) return -EINVAL; - rc_tab = get_rc_map(dev->map_name); - if (!rc_tab) - rc_tab = get_rc_map(RC_MAP_EMPTY); - if (!rc_tab || !rc_tab->scan || rc_tab->size == 0) + rc_map = get_rc_map(dev->map_name); + if (!rc_map) + rc_map = get_rc_map(RC_MAP_EMPTY); + if (!rc_map || !rc_map->scan || rc_map->size == 0) return -EINVAL; set_bit(EV_KEY, dev->input_dev->evbit); @@ -1018,7 +1018,7 @@ int rc_register_device(struct rc_dev *dev) if (rc) return rc; - rc = ir_setkeytable(dev, rc_tab); + rc = ir_setkeytable(dev, rc_map); if (rc) goto out_dev; @@ -1052,7 +1052,7 @@ int rc_register_device(struct rc_dev *dev) } if (dev->change_protocol) { - rc = dev->change_protocol(dev, rc_tab->rc_type); + rc = dev->change_protocol(dev, rc_map->rc_type); if (rc < 0) goto out_raw; } @@ -1060,7 +1060,7 @@ int rc_register_device(struct rc_dev *dev) IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n", dev->devno, dev->driver_name ? dev->driver_name : "unknown", - rc_tab->name ? rc_tab->name : "unknown", + rc_map->name ? rc_map->name : "unknown", dev->driver_type == RC_DRIVER_IR_RAW ? "raw" : "cooked"); return 0; @@ -1072,7 +1072,7 @@ out_input: input_unregister_device(dev->input_dev); dev->input_dev = NULL; out_table: - ir_free_table(&dev->rc_tab); + ir_free_table(&dev->rc_map); out_dev: device_del(&dev->dev); return rc; @@ -1092,7 +1092,7 @@ void rc_unregister_device(struct rc_dev *dev) input_unregister_device(dev->input_dev); dev->input_dev = NULL; - ir_free_table(&dev->rc_tab); + ir_free_table(&dev->rc_map); IR_dprintk(1, "Freed keycode table\n"); device_unregister(&dev->dev); diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 709cb87a7762..72bbea2bcd56 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -362,7 +362,7 @@ struct cx231xx_board { struct cx231xx_input input[MAX_CX231XX_INPUT]; struct cx231xx_input radio; - struct ir_scancode_table *ir_codes; + struct rc_map *ir_codes; }; /* device states */ diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 42543257fa0f..affb93feed3b 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -39,7 +39,7 @@ enum rc_driver_type { * @input_id: id of the input child device (struct input_id) * @driver_name: name of the hardware driver which registered this device * @map_name: name of the default keymap - * @rc_tab: current scan/key table + * @rc_map: current scan/key table * @devno: unique remote control device number * @raw: additional data for raw pulse/space devices * @input_dev: the input child device used to communicate events to userspace @@ -86,7 +86,7 @@ struct rc_dev { struct input_id input_id; char *driver_name; const char *map_name; - struct ir_scancode_table rc_tab; + struct rc_map rc_map; unsigned long devno; struct ir_raw_event_ctrl *raw; struct input_dev *input_dev; diff --git a/include/media/rc-map.h b/include/media/rc-map.h index c53351e15f50..a6b2738f2d60 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -30,7 +30,7 @@ struct ir_scancode { u32 keycode; }; -struct ir_scancode_table { +struct rc_map { struct ir_scancode *scan; unsigned int size; /* Max number of entries */ unsigned int len; /* Used number of entries */ @@ -42,14 +42,14 @@ struct ir_scancode_table { struct rc_keymap { struct list_head list; - struct ir_scancode_table map; + struct rc_map map; }; /* Routines from rc-map.c */ int ir_register_map(struct rc_keymap *map); void ir_unregister_map(struct rc_keymap *map); -struct ir_scancode_table *get_rc_map(const char *name); +struct rc_map *get_rc_map(const char *name); void rc_map_init(void); /* Names of the several keytables defined in-kernel */ -- cgit v1.2.3 From 2f4f58d689dd71dea67407b74405a3c43e797cb1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 15:46:09 -0300 Subject: [media] rc: Name RC keymap tables as rc_map_table Remote keytables had different names all over the place. Part of the fault is due to a bad naming when rc subsystem was created, but there were lots of old names that were still here. Use a common standard for everything. Patch generated by this script: for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/a800.c | 6 +-- drivers/media/dvb/dvb-usb/af9005-remote.c | 16 +++--- drivers/media/dvb/dvb-usb/af9005.c | 16 +++--- drivers/media/dvb/dvb-usb/af9005.h | 4 +- drivers/media/dvb/dvb-usb/az6027.c | 6 +-- drivers/media/dvb/dvb-usb/cinergyT2-core.c | 6 +-- drivers/media/dvb/dvb-usb/cxusb.c | 62 +++++++++++----------- drivers/media/dvb/dvb-usb/dibusb-common.c | 4 +- drivers/media/dvb/dvb-usb/dibusb-mb.c | 16 +++--- drivers/media/dvb/dvb-usb/dibusb-mc.c | 4 +- drivers/media/dvb/dvb-usb/dibusb.h | 2 +- drivers/media/dvb/dvb-usb/digitv.c | 14 ++--- drivers/media/dvb/dvb-usb/dtt200u.c | 18 +++---- drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 26 ++++----- drivers/media/dvb/dvb-usb/dvb-usb.h | 14 ++--- drivers/media/dvb/dvb-usb/dw2102.c | 54 +++++++++---------- drivers/media/dvb/dvb-usb/m920x.c | 24 ++++----- drivers/media/dvb/dvb-usb/nova-t-usb2.c | 18 +++---- drivers/media/dvb/dvb-usb/opera1.c | 16 +++--- drivers/media/dvb/dvb-usb/vp702x.c | 12 ++--- drivers/media/dvb/dvb-usb/vp7045.c | 12 ++--- drivers/media/dvb/mantis/mantis_input.c | 2 +- drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 2 +- drivers/media/rc/keymaps/rc-alink-dtu-m.c | 2 +- drivers/media/rc/keymaps/rc-anysee.c | 2 +- drivers/media/rc/keymaps/rc-apac-viewcomp.c | 2 +- drivers/media/rc/keymaps/rc-asus-pc39.c | 2 +- drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-a16d.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-m135a.c | 2 +- .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 2 +- drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 2 +- drivers/media/rc/keymaps/rc-avermedia.c | 2 +- drivers/media/rc/keymaps/rc-avertv-303.c | 2 +- drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 2 +- drivers/media/rc/keymaps/rc-behold-columbus.c | 2 +- drivers/media/rc/keymaps/rc-behold.c | 2 +- drivers/media/rc/keymaps/rc-budget-ci-old.c | 2 +- drivers/media/rc/keymaps/rc-cinergy-1400.c | 2 +- drivers/media/rc/keymaps/rc-cinergy.c | 2 +- drivers/media/rc/keymaps/rc-dib0700-nec.c | 2 +- drivers/media/rc/keymaps/rc-dib0700-rc5.c | 2 +- drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 2 +- drivers/media/rc/keymaps/rc-digittrade.c | 2 +- drivers/media/rc/keymaps/rc-dm1105-nec.c | 2 +- drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 2 +- drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 2 +- drivers/media/rc/keymaps/rc-em-terratec.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv.c | 2 +- drivers/media/rc/keymaps/rc-encore-enltv2.c | 2 +- drivers/media/rc/keymaps/rc-evga-indtube.c | 2 +- drivers/media/rc/keymaps/rc-eztv.c | 2 +- drivers/media/rc/keymaps/rc-flydvb.c | 2 +- drivers/media/rc/keymaps/rc-flyvideo.c | 2 +- drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 2 +- drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 2 +- drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 2 +- drivers/media/rc/keymaps/rc-gotview7135.c | 2 +- drivers/media/rc/keymaps/rc-hauppauge-new.c | 2 +- drivers/media/rc/keymaps/rc-imon-mce.c | 2 +- drivers/media/rc/keymaps/rc-imon-pad.c | 2 +- drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 2 +- drivers/media/rc/keymaps/rc-kaiomy.c | 2 +- drivers/media/rc/keymaps/rc-kworld-315u.c | 2 +- .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 2 +- drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 2 +- drivers/media/rc/keymaps/rc-lirc.c | 2 +- drivers/media/rc/keymaps/rc-lme2510.c | 2 +- drivers/media/rc/keymaps/rc-manli.c | 2 +- drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 2 +- drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 2 +- drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 2 +- drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 2 +- drivers/media/rc/keymaps/rc-nebula.c | 2 +- .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 2 +- drivers/media/rc/keymaps/rc-norwood.c | 2 +- drivers/media/rc/keymaps/rc-npgtech.c | 2 +- drivers/media/rc/keymaps/rc-pctv-sedna.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-color.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-grey.c | 2 +- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 2 +- drivers/media/rc/keymaps/rc-pixelview-mk12.c | 2 +- drivers/media/rc/keymaps/rc-pixelview-new.c | 2 +- drivers/media/rc/keymaps/rc-pixelview.c | 2 +- .../media/rc/keymaps/rc-powercolor-real-angel.c | 2 +- drivers/media/rc/keymaps/rc-proteus-2309.c | 2 +- drivers/media/rc/keymaps/rc-purpletv.c | 2 +- drivers/media/rc/keymaps/rc-pv951.c | 2 +- drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c | 2 +- drivers/media/rc/keymaps/rc-rc5-tv.c | 2 +- drivers/media/rc/keymaps/rc-rc6-mce.c | 2 +- .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 2 +- drivers/media/rc/keymaps/rc-streamzap.c | 2 +- drivers/media/rc/keymaps/rc-tbs-nec.c | 2 +- drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 2 +- drivers/media/rc/keymaps/rc-terratec-slim.c | 2 +- drivers/media/rc/keymaps/rc-tevii-nec.c | 2 +- drivers/media/rc/keymaps/rc-total-media-in-hand.c | 2 +- drivers/media/rc/keymaps/rc-trekstor.c | 2 +- drivers/media/rc/keymaps/rc-tt-1500.c | 2 +- drivers/media/rc/keymaps/rc-twinhan1027.c | 2 +- drivers/media/rc/keymaps/rc-videomate-s350.c | 2 +- drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 2 +- drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 2 +- drivers/media/rc/keymaps/rc-winfast.c | 2 +- drivers/media/rc/rc-main.c | 20 +++---- include/media/rc-map.h | 4 +- 110 files changed, 274 insertions(+), 274 deletions(-) (limited to 'include') diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index a5c363727133..53b93a4b6f8a 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -37,7 +37,7 @@ static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_pr return 0; } -static struct ir_scancode ir_codes_a800_table[] = { +static struct rc_map_table rc_map_a800_table[] = { { 0x0201, KEY_PROG1 }, /* SOURCE */ { 0x0200, KEY_POWER }, /* POWER */ { 0x0205, KEY_1 }, /* 1 */ @@ -148,8 +148,8 @@ static struct dvb_usb_device_properties a800_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_a800_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), + .rc_map_table = rc_map_a800_table, + .rc_map_size = ARRAY_SIZE(rc_map_a800_table), .rc_query = a800_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/af9005-remote.c b/drivers/media/dvb/dvb-usb/af9005-remote.c index 696207fe37ec..c3bc64ed405c 100644 --- a/drivers/media/dvb/dvb-usb/af9005-remote.c +++ b/drivers/media/dvb/dvb-usb/af9005-remote.c @@ -33,7 +33,7 @@ MODULE_PARM_DESC(debug, #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) -struct ir_scancode ir_codes_af9005_table[] = { +struct rc_map_table rc_map_af9005_table[] = { {0x01b7, KEY_POWER}, {0x01a7, KEY_VOLUMEUP}, @@ -74,7 +74,7 @@ struct ir_scancode ir_codes_af9005_table[] = { {0x00d5, KEY_GOTO}, /* marked jump on the remote */ }; -int ir_codes_af9005_table_size = ARRAY_SIZE(ir_codes_af9005_table); +int rc_map_af9005_table_size = ARRAY_SIZE(rc_map_af9005_table); static int repeatable_keys[] = { KEY_VOLUMEUP, @@ -130,10 +130,10 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, deb_decode("code != inverted code\n"); return 0; } - for (i = 0; i < ir_codes_af9005_table_size; i++) { - if (rc5_custom(&ir_codes_af9005_table[i]) == cust - && rc5_data(&ir_codes_af9005_table[i]) == dat) { - *event = ir_codes_af9005_table[i].keycode; + for (i = 0; i < rc_map_af9005_table_size; i++) { + if (rc5_custom(&rc_map_af9005_table[i]) == cust + && rc5_data(&rc_map_af9005_table[i]) == dat) { + *event = rc_map_af9005_table[i].keycode; *state = REMOTE_KEY_PRESSED; deb_decode ("key pressed, event %x\n", *event); @@ -146,8 +146,8 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, return 0; } -EXPORT_SYMBOL(ir_codes_af9005_table); -EXPORT_SYMBOL(ir_codes_af9005_table_size); +EXPORT_SYMBOL(rc_map_af9005_table); +EXPORT_SYMBOL(rc_map_af9005_table_size); EXPORT_SYMBOL(af9005_rc_decode); MODULE_AUTHOR("Luca Olivetti "); diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index 8ecba8848bcf..51f6439dcfd5 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c @@ -1027,8 +1027,8 @@ static struct dvb_usb_device_properties af9005_properties = { .rc.legacy = { .rc_interval = 200, - .rc_key_map = NULL, - .rc_key_map_size = 0, + .rc_map_table = NULL, + .rc_map_size = 0, .rc_query = af9005_rc_query, }, @@ -1070,14 +1070,14 @@ static int __init af9005_usb_module_init(void) return result; } rc_decode = symbol_request(af9005_rc_decode); - rc_keys = symbol_request(ir_codes_af9005_table); - rc_keys_size = symbol_request(ir_codes_af9005_table_size); + rc_keys = symbol_request(rc_map_af9005_table); + rc_keys_size = symbol_request(rc_map_af9005_table_size); if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { err("af9005_rc_decode function not found, disabling remote"); af9005_properties.rc.legacy.rc_query = NULL; } else { - af9005_properties.rc.legacy.rc_key_map = rc_keys; - af9005_properties.rc.legacy.rc_key_map_size = *rc_keys_size; + af9005_properties.rc.legacy.rc_map_table = rc_keys; + af9005_properties.rc.legacy.rc_map_size = *rc_keys_size; } return 0; @@ -1089,9 +1089,9 @@ static void __exit af9005_usb_module_exit(void) if (rc_decode != NULL) symbol_put(af9005_rc_decode); if (rc_keys != NULL) - symbol_put(ir_codes_af9005_table); + symbol_put(rc_map_af9005_table); if (rc_keys_size != NULL) - symbol_put(ir_codes_af9005_table_size); + symbol_put(rc_map_af9005_table_size); /* deregister this driver from the USB subsystem */ usb_deregister(&af9005_usb_driver); } diff --git a/drivers/media/dvb/dvb-usb/af9005.h b/drivers/media/dvb/dvb-usb/af9005.h index 3c1fbd1c5d60..c71c77bd7f4b 100644 --- a/drivers/media/dvb/dvb-usb/af9005.h +++ b/drivers/media/dvb/dvb-usb/af9005.h @@ -3490,7 +3490,7 @@ extern u8 regmask[8]; /* remote control decoder */ extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, int *state); -extern struct ir_scancode ir_codes_af9005_table[]; -extern int ir_codes_af9005_table_size; +extern struct rc_map_table rc_map_af9005_table[]; +extern int rc_map_af9005_table_size; #endif diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 62c58288469f..9a7837fcfd7f 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -386,7 +386,7 @@ static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct ir_scancode ir_codes_az6027_table[] = { +static struct rc_map_table rc_map_az6027_table[] = { { 0x01, KEY_1 }, { 0x02, KEY_2 }, }; @@ -1126,8 +1126,8 @@ static struct dvb_usb_device_properties az6027_properties = { .read_mac_address = az6027_read_mac_addr, */ .rc.legacy = { - .rc_key_map = ir_codes_az6027_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), + .rc_map_table = rc_map_az6027_table, + .rc_map_size = ARRAY_SIZE(rc_map_az6027_table), .rc_interval = 400, .rc_query = az6027_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index 4f5aa83fc1fc..16f2ce2bc15a 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c @@ -84,7 +84,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) return 0; } -static struct ir_scancode ir_codes_cinergyt2_table[] = { +static struct rc_map_table rc_map_cinergyt2_table[] = { { 0x0401, KEY_POWER }, { 0x0402, KEY_1 }, { 0x0403, KEY_2 }, @@ -219,8 +219,8 @@ static struct dvb_usb_device_properties cinergyt2_properties = { .rc.legacy = { .rc_interval = 50, - .rc_key_map = ir_codes_cinergyt2_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), + .rc_map_table = rc_map_cinergyt2_table, + .rc_map_size = ARRAY_SIZE(rc_map_cinergyt2_table), .rc_query = cinergyt2_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index cd9f362c37b2..acb5fb2d2e73 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -385,7 +385,7 @@ static int cxusb_d680_dmb_streaming_ctrl( static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; u8 ircode[4]; int i; @@ -394,7 +394,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) *event = 0; *state = REMOTE_NO_KEY_PRESSED; - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { if (rc5_custom(&keymap[i]) == ircode[2] && rc5_data(&keymap[i]) == ircode[3]) { *event = keymap[i].keycode; @@ -410,7 +410,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; u8 ircode[4]; int i; struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, @@ -422,7 +422,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) return 0; - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { if (rc5_custom(&keymap[i]) == ircode[1] && rc5_data(&keymap[i]) == ircode[2]) { *event = keymap[i].keycode; @@ -438,7 +438,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; u8 ircode[2]; int i; @@ -448,7 +448,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) return 0; - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { if (rc5_custom(&keymap[i]) == ircode[0] && rc5_data(&keymap[i]) == ircode[1]) { *event = keymap[i].keycode; @@ -461,7 +461,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, return 0; } -static struct ir_scancode ir_codes_dvico_mce_table[] = { +static struct rc_map_table rc_map_dvico_mce_table[] = { { 0xfe02, KEY_TV }, { 0xfe0e, KEY_MP3 }, { 0xfe1a, KEY_DVD }, @@ -509,7 +509,7 @@ static struct ir_scancode ir_codes_dvico_mce_table[] = { { 0xfe4e, KEY_POWER }, }; -static struct ir_scancode ir_codes_dvico_portable_table[] = { +static struct rc_map_table rc_map_dvico_portable_table[] = { { 0xfc02, KEY_SETUP }, /* Profile */ { 0xfc43, KEY_POWER2 }, { 0xfc06, KEY_EPG }, @@ -548,7 +548,7 @@ static struct ir_scancode ir_codes_dvico_portable_table[] = { { 0xfc00, KEY_UNKNOWN }, /* HD */ }; -static struct ir_scancode ir_codes_d680_dmb_table[] = { +static struct rc_map_table rc_map_d680_dmb_table[] = { { 0x0038, KEY_UNKNOWN }, /* TV/AV */ { 0x080c, KEY_ZOOM }, { 0x0800, KEY_0 }, @@ -923,7 +923,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) return -EIO; /* try to determine if there is no IR decoder on the I2C bus */ - for (i = 0; adap->dev->props.rc.legacy.rc_key_map != NULL && i < 5; i++) { + for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) { msleep(20); if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) goto no_IR; @@ -931,7 +931,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) continue; if (ircode[2] + ircode[3] != 0xff) { no_IR: - adap->dev->props.rc.legacy.rc_key_map = NULL; + adap->dev->props.rc.legacy.rc_map_table = NULL; info("No IR receiver detected on this device."); break; } @@ -1453,8 +1453,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_portable_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), + .rc_map_table = rc_map_dvico_portable_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), .rc_query = cxusb_rc_query, }, @@ -1506,8 +1506,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { .rc.legacy = { .rc_interval = 150, - .rc_key_map = ir_codes_dvico_mce_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), + .rc_map_table = rc_map_dvico_mce_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), .rc_query = cxusb_rc_query, }, @@ -1567,8 +1567,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_portable_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), + .rc_map_table = rc_map_dvico_portable_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), .rc_query = cxusb_rc_query, }, @@ -1619,8 +1619,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_portable_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), + .rc_map_table = rc_map_dvico_portable_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), .rc_query = cxusb_rc_query, }, @@ -1670,8 +1670,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_mce_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), + .rc_map_table = rc_map_dvico_mce_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), .rc_query = cxusb_bluebird2_rc_query, }, @@ -1720,8 +1720,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_portable_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), + .rc_map_table = rc_map_dvico_portable_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), .rc_query = cxusb_bluebird2_rc_query, }, @@ -1772,8 +1772,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_portable_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), + .rc_map_table = rc_map_dvico_portable_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_portable_table), .rc_query = cxusb_rc_query, }, @@ -1865,8 +1865,8 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_dvico_mce_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), + .rc_map_table = rc_map_dvico_mce_table, + .rc_map_size = ARRAY_SIZE(rc_map_dvico_mce_table), .rc_query = cxusb_rc_query, }, @@ -1915,8 +1915,8 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_d680_dmb_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), + .rc_map_table = rc_map_d680_dmb_table, + .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, }, @@ -1966,8 +1966,8 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_d680_dmb_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), + .rc_map_table = rc_map_d680_dmb_table, + .rc_map_size = ARRAY_SIZE(rc_map_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index ba991aa21aff..956f7ae2e510 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -327,7 +327,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); /* * common remote control stuff */ -struct ir_scancode ir_codes_dibusb_table[] = { +struct rc_map_table rc_map_dibusb_table[] = { /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, @@ -456,7 +456,7 @@ struct ir_scancode ir_codes_dibusb_table[] = { { 0x804e, KEY_ENTER }, { 0x804f, KEY_VOLUMEDOWN }, }; -EXPORT_SYMBOL(ir_codes_dibusb_table); +EXPORT_SYMBOL(rc_map_dibusb_table); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 8e3c0d2cce16..04d91bdd3562 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -213,8 +213,8 @@ static struct dvb_usb_device_properties dibusb1_1_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_dibusb_table, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_map_table = rc_map_dibusb_table, + .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, }, @@ -299,8 +299,8 @@ static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_dibusb_table, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_map_table = rc_map_dibusb_table, + .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, }, @@ -365,8 +365,8 @@ static struct dvb_usb_device_properties dibusb2_0b_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_dibusb_table, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_map_table = rc_map_dibusb_table, + .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, }, @@ -424,8 +424,8 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_dibusb_table, - .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ + .rc_map_table = rc_map_dibusb_table, + .rc_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index 1cbc41cb4e8f..c1d9094b61e5 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -83,8 +83,8 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { .rc.legacy = { .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = ir_codes_dibusb_table, - .rc_key_map_size = 111, /* FIXME */ + .rc_map_table = rc_map_dibusb_table, + .rc_map_size = 111, /* FIXME */ .rc_query = dibusb_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 61a6bf389472..e47c321b3ffc 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h @@ -124,7 +124,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); #define DEFAULT_RC_INTERVAL 150 //#define DEFAULT_RC_INTERVAL 100000 -extern struct ir_scancode ir_codes_dibusb_table[]; +extern struct rc_map_table rc_map_dibusb_table[]; extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 13d006bb19db..f2dbce7edb3b 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c @@ -161,7 +161,7 @@ static int digitv_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct ir_scancode ir_codes_digitv_table[] = { +static struct rc_map_table rc_map_digitv_table[] = { { 0x5f55, KEY_0 }, { 0x6f55, KEY_1 }, { 0x9f55, KEY_2 }, @@ -237,10 +237,10 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) /* if something is inside the buffer, simulate key press */ if (key[1] != 0) { - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { - if (rc5_custom(&d->props.rc.legacy.rc_key_map[i]) == key[1] && - rc5_data(&d->props.rc.legacy.rc_key_map[i]) == key[2]) { - *event = d->props.rc.legacy.rc_key_map[i].keycode; + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { + if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] && + rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) { + *event = d->props.rc.legacy.rc_map_table[i].keycode; *state = REMOTE_KEY_PRESSED; return 0; } @@ -312,8 +312,8 @@ static struct dvb_usb_device_properties digitv_properties = { .rc.legacy = { .rc_interval = 1000, - .rc_key_map = ir_codes_digitv_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), + .rc_map_table = rc_map_digitv_table, + .rc_map_size = ARRAY_SIZE(rc_map_digitv_table), .rc_query = digitv_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index ca495e07f35c..ecd86eca2548 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c @@ -57,7 +57,7 @@ static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, /* remote control */ /* key list for the tiny remote control (Yakumo, don't know about the others) */ -static struct ir_scancode ir_codes_dtt200u_table[] = { +static struct rc_map_table rc_map_dtt200u_table[] = { { 0x8001, KEY_MUTE }, { 0x8002, KEY_CHANNELDOWN }, { 0x8003, KEY_VOLUMEDOWN }, @@ -163,8 +163,8 @@ static struct dvb_usb_device_properties dtt200u_properties = { .rc.legacy = { .rc_interval = 300, - .rc_key_map = ir_codes_dtt200u_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), + .rc_map_table = rc_map_dtt200u_table, + .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), .rc_query = dtt200u_rc_query, }, @@ -210,8 +210,8 @@ static struct dvb_usb_device_properties wt220u_properties = { .rc.legacy = { .rc_interval = 300, - .rc_key_map = ir_codes_dtt200u_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), + .rc_map_table = rc_map_dtt200u_table, + .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), .rc_query = dtt200u_rc_query, }, @@ -257,8 +257,8 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { .rc.legacy = { .rc_interval = 300, - .rc_key_map = ir_codes_dtt200u_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), + .rc_map_table = rc_map_dtt200u_table, + .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), .rc_query = dtt200u_rc_query, }, @@ -304,8 +304,8 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { .rc.legacy = { .rc_interval = 300, - .rc_key_map = ir_codes_dtt200u_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), + .rc_map_table = rc_map_dtt200u_table, + .rc_map_size = ARRAY_SIZE(rc_map_dtt200u_table), .rc_query = dtt200u_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index bbba149a2ceb..c6498f536dff 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -13,11 +13,11 @@ static int legacy_dvb_usb_getkeycode(struct input_dev *dev, { struct dvb_usb_device *d = input_get_drvdata(dev); - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; int i; /* See if we can match the raw key code. */ - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) if (keymap[i].scancode == scancode) { *keycode = keymap[i].keycode; return 0; @@ -28,7 +28,7 @@ static int legacy_dvb_usb_getkeycode(struct input_dev *dev, * otherwise, input core won't let legacy_dvb_usb_setkeycode * to work */ - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) if (keymap[i].keycode == KEY_RESERVED || keymap[i].keycode == KEY_UNKNOWN) { *keycode = KEY_RESERVED; @@ -43,18 +43,18 @@ static int legacy_dvb_usb_setkeycode(struct input_dev *dev, { struct dvb_usb_device *d = input_get_drvdata(dev); - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; int i; /* Search if it is replacing an existing keycode */ - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) if (keymap[i].scancode == scancode) { keymap[i].keycode = keycode; return 0; } /* Search if is there a clean entry. If so, use it */ - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) if (keymap[i].keycode == KEY_RESERVED || keymap[i].keycode == KEY_UNKNOWN) { keymap[i].scancode = scancode; @@ -175,11 +175,11 @@ static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d) input_dev->setkeycode = legacy_dvb_usb_setkeycode; /* set the bits for the keys */ - deb_rc("key map size: %d\n", d->props.rc.legacy.rc_key_map_size); - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { + deb_rc("key map size: %d\n", d->props.rc.legacy.rc_map_size); + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { deb_rc("setting bit for event %d item %d\n", - d->props.rc.legacy.rc_key_map[i].keycode, i); - set_bit(d->props.rc.legacy.rc_key_map[i].keycode, input_dev->keybit); + d->props.rc.legacy.rc_map_table[i].keycode, i); + set_bit(d->props.rc.legacy.rc_map_table[i].keycode, input_dev->keybit); } /* setting these two values to non-zero, we have to manage key repeats */ @@ -284,7 +284,7 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) if (dvb_usb_disable_rc_polling) return 0; - if (d->props.rc.legacy.rc_key_map && d->props.rc.legacy.rc_query) + if (d->props.rc.legacy.rc_map_table && d->props.rc.legacy.rc_query) d->props.rc.mode = DVB_RC_LEGACY; else if (d->props.rc.core.rc_codes) d->props.rc.mode = DVB_RC_CORE; @@ -331,7 +331,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, u8 keybuf[5], u32 *event, int *state) { int i; - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; *event = 0; *state = REMOTE_NO_KEY_PRESSED; switch (keybuf[0]) { @@ -344,7 +344,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, break; } /* See if we can match the raw key code. */ - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) if (rc5_custom(&keymap[i]) == keybuf[1] && rc5_data(&keymap[i]) == keybuf[3]) { *event = keymap[i].keycode; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 95b1603d5be8..65fa9268e7f7 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -75,17 +75,17 @@ struct dvb_usb_device_description { struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; }; -static inline u8 rc5_custom(struct ir_scancode *key) +static inline u8 rc5_custom(struct rc_map_table *key) { return (key->scancode >> 8) & 0xff; } -static inline u8 rc5_data(struct ir_scancode *key) +static inline u8 rc5_data(struct rc_map_table *key) { return key->scancode & 0xff; } -static inline u8 rc5_scan(struct ir_scancode *key) +static inline u8 rc5_scan(struct rc_map_table *key) { return key->scancode & 0xffff; } @@ -159,9 +159,9 @@ struct dvb_usb_adapter_properties { /** * struct dvb_rc_legacy - old properties of remote controller - * @rc_key_map: a hard-wired array of struct ir_scancode (NULL to disable + * @rc_map_table: a hard-wired array of struct rc_map_table (NULL to disable * remote control handling). - * @rc_key_map_size: number of items in @rc_key_map. + * @rc_map_size: number of items in @rc_map_table. * @rc_query: called to query an event event. * @rc_interval: time in ms between two queries. */ @@ -170,8 +170,8 @@ struct dvb_rc_legacy { #define REMOTE_NO_KEY_PRESSED 0x00 #define REMOTE_KEY_PRESSED 0x01 #define REMOTE_KEY_REPEAT 0x02 - struct ir_scancode *rc_key_map; - int rc_key_map_size; + struct rc_map_table *rc_map_table; + int rc_map_size; int (*rc_query) (struct dvb_usb_device *, u32 *, int *); int rc_interval; }; diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index 774df88dc6e3..2c307ba0d28b 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c @@ -73,8 +73,8 @@ "Please see linux/Documentation/dvb/ for more details " \ "on firmware-problems." -struct ir_codes_dvb_usb_table_table { - struct ir_scancode *rc_keys; +struct rc_map_dvb_usb_table_table { + struct rc_map_table *rc_keys; int rc_keys_size; }; @@ -948,7 +948,7 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct ir_scancode ir_codes_dw210x_table[] = { +static struct rc_map_table rc_map_dw210x_table[] = { { 0xf80a, KEY_Q }, /*power*/ { 0xf80c, KEY_M }, /*mute*/ { 0xf811, KEY_1 }, @@ -982,7 +982,7 @@ static struct ir_scancode ir_codes_dw210x_table[] = { { 0xf81b, KEY_B }, /*recall*/ }; -static struct ir_scancode ir_codes_tevii_table[] = { +static struct rc_map_table rc_map_tevii_table[] = { { 0xf80a, KEY_POWER }, { 0xf80c, KEY_MUTE }, { 0xf811, KEY_1 }, @@ -1032,7 +1032,7 @@ static struct ir_scancode ir_codes_tevii_table[] = { { 0xf858, KEY_SWITCHVIDEOMODE }, }; -static struct ir_scancode ir_codes_tbs_table[] = { +static struct rc_map_table rc_map_tbs_table[] = { { 0xf884, KEY_POWER }, { 0xf894, KEY_MUTE }, { 0xf887, KEY_1 }, @@ -1067,16 +1067,16 @@ static struct ir_scancode ir_codes_tbs_table[] = { { 0xf89b, KEY_MODE } }; -static struct ir_codes_dvb_usb_table_table keys_tables[] = { - { ir_codes_dw210x_table, ARRAY_SIZE(ir_codes_dw210x_table) }, - { ir_codes_tevii_table, ARRAY_SIZE(ir_codes_tevii_table) }, - { ir_codes_tbs_table, ARRAY_SIZE(ir_codes_tbs_table) }, +static struct rc_map_dvb_usb_table_table keys_tables[] = { + { rc_map_dw210x_table, ARRAY_SIZE(rc_map_dw210x_table) }, + { rc_map_tevii_table, ARRAY_SIZE(rc_map_tevii_table) }, + { rc_map_tbs_table, ARRAY_SIZE(rc_map_tbs_table) }, }; static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; - int keymap_size = d->props.rc.legacy.rc_key_map_size; + struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table; + int keymap_size = d->props.rc.legacy.rc_map_size; u8 key[2]; struct i2c_msg msg = { .addr = DW2102_RC_QUERY, @@ -1185,14 +1185,14 @@ static int dw2102_load_firmware(struct usb_device *dev, /* init registers */ switch (dev->descriptor.idProduct) { case USB_PID_PROF_1100: - s6x0_properties.rc.legacy.rc_key_map = ir_codes_tbs_table; - s6x0_properties.rc.legacy.rc_key_map_size = - ARRAY_SIZE(ir_codes_tbs_table); + s6x0_properties.rc.legacy.rc_map_table = rc_map_tbs_table; + s6x0_properties.rc.legacy.rc_map_size = + ARRAY_SIZE(rc_map_tbs_table); break; case USB_PID_TEVII_S650: - dw2104_properties.rc.legacy.rc_key_map = ir_codes_tevii_table; - dw2104_properties.rc.legacy.rc_key_map_size = - ARRAY_SIZE(ir_codes_tevii_table); + dw2104_properties.rc.legacy.rc_map_table = rc_map_tevii_table; + dw2104_properties.rc.legacy.rc_map_size = + ARRAY_SIZE(rc_map_tevii_table); case USB_PID_DW2104: reset = 1; dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, @@ -1257,8 +1257,8 @@ static struct dvb_usb_device_properties dw2102_properties = { .i2c_algo = &dw2102_serit_i2c_algo, .rc.legacy = { - .rc_key_map = ir_codes_dw210x_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), + .rc_map_table = rc_map_dw210x_table, + .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, }, @@ -1310,8 +1310,8 @@ static struct dvb_usb_device_properties dw2104_properties = { .i2c_algo = &dw2104_i2c_algo, .rc.legacy = { - .rc_key_map = ir_codes_dw210x_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), + .rc_map_table = rc_map_dw210x_table, + .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, }, @@ -1359,8 +1359,8 @@ static struct dvb_usb_device_properties dw3101_properties = { .i2c_algo = &dw3101_i2c_algo, .rc.legacy = { - .rc_key_map = ir_codes_dw210x_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), + .rc_map_table = rc_map_dw210x_table, + .rc_map_size = ARRAY_SIZE(rc_map_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, }, @@ -1404,8 +1404,8 @@ static struct dvb_usb_device_properties s6x0_properties = { .i2c_algo = &s6x0_i2c_algo, .rc.legacy = { - .rc_key_map = ir_codes_tevii_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), + .rc_map_table = rc_map_tevii_table, + .rc_map_size = ARRAY_SIZE(rc_map_tevii_table), .rc_interval = 150, .rc_query = dw2102_rc_query, }, @@ -1468,8 +1468,8 @@ static int dw2102_probe(struct usb_interface *intf, /* fill only different fields */ p7500->firmware = "dvb-usb-p7500.fw"; p7500->devices[0] = d7500; - p7500->rc.legacy.rc_key_map = ir_codes_tbs_table; - p7500->rc.legacy.rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); + p7500->rc.legacy.rc_map_table = rc_map_tbs_table; + p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table); p7500->adapter->frontend_attach = prof_7500_frontend_attach; if (0 == dvb_usb_device_init(intf, &dw2102_properties, diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index bdef1a18b664..da9dc91ce910 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c @@ -142,9 +142,9 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) goto unlock; - for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) - if (rc5_data(&d->props.rc.legacy.rc_key_map[i]) == rc_state[1]) { - *event = d->props.rc.legacy.rc_key_map[i].keycode; + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) + if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { + *event = d->props.rc.legacy.rc_map_table[i].keycode; switch(rc_state[0]) { case 0x80: @@ -589,7 +589,7 @@ static struct m920x_inits pinnacle310e_init[] = { }; /* ir keymaps */ -static struct ir_scancode ir_codes_megasky_table[] = { +static struct rc_map_table rc_map_megasky_table[] = { { 0x0012, KEY_POWER }, { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ { 0x0002, KEY_CHANNELUP }, @@ -608,7 +608,7 @@ static struct ir_scancode ir_codes_megasky_table[] = { { 0x000e, KEY_COFFEE }, /* "MTS" */ }; -static struct ir_scancode ir_codes_tvwalkertwin_table[] = { +static struct rc_map_table rc_map_tvwalkertwin_table[] = { { 0x0001, KEY_ZOOM }, /* Full Screen */ { 0x0002, KEY_CAMERA }, /* snapshot */ { 0x0003, KEY_MUTE }, @@ -628,7 +628,7 @@ static struct ir_scancode ir_codes_tvwalkertwin_table[] = { { 0x001e, KEY_VOLUMEUP }, }; -static struct ir_scancode ir_codes_pinnacle310e_table[] = { +static struct rc_map_table rc_map_pinnacle310e_table[] = { { 0x16, KEY_POWER }, { 0x17, KEY_FAVORITES }, { 0x0f, KEY_TEXT }, @@ -786,8 +786,8 @@ static struct dvb_usb_device_properties megasky_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_megasky_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), + .rc_map_table = rc_map_megasky_table, + .rc_map_size = ARRAY_SIZE(rc_map_megasky_table), .rc_query = m920x_rc_query, }, @@ -889,8 +889,8 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_tvwalkertwin_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), + .rc_map_table = rc_map_tvwalkertwin_table, + .rc_map_size = ARRAY_SIZE(rc_map_tvwalkertwin_table), .rc_query = m920x_rc_query, }, @@ -998,8 +998,8 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_pinnacle310e_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), + .rc_map_table = rc_map_pinnacle310e_table, + .rc_map_size = ARRAY_SIZE(rc_map_pinnacle310e_table), .rc_query = m920x_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index 181f36a12e2a..9d3cd2de46fc 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -21,7 +21,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define deb_ee(args...) dprintk(debug,0x02,args) /* Hauppauge NOVA-T USB2 keys */ -static struct ir_scancode ir_codes_haupp_table[] = { +static struct rc_map_table rc_map_haupp_table[] = { { 0x1e00, KEY_0 }, { 0x1e01, KEY_1 }, { 0x1e02, KEY_2 }, @@ -91,14 +91,14 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); - for (i = 0; i < ARRAY_SIZE(ir_codes_haupp_table); i++) { - if (rc5_data(&ir_codes_haupp_table[i]) == data && - rc5_custom(&ir_codes_haupp_table[i]) == custom) { + for (i = 0; i < ARRAY_SIZE(rc_map_haupp_table); i++) { + if (rc5_data(&rc_map_haupp_table[i]) == data && + rc5_custom(&rc_map_haupp_table[i]) == custom) { - deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), - rc5_custom(&ir_codes_haupp_table[i])); + deb_rc("c: %x, d: %x\n", rc5_data(&rc_map_haupp_table[i]), + rc5_custom(&rc_map_haupp_table[i])); - *event = ir_codes_haupp_table[i].keycode; + *event = rc_map_haupp_table[i].keycode; *state = REMOTE_KEY_PRESSED; if (st->old_toggle == toggle) { if (st->last_repeat_count++ < 2) @@ -197,8 +197,8 @@ static struct dvb_usb_device_properties nova_t_properties = { .rc.legacy = { .rc_interval = 100, - .rc_key_map = ir_codes_haupp_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), + .rc_map_table = rc_map_haupp_table, + .rc_map_size = ARRAY_SIZE(rc_map_haupp_table), .rc_query = nova_t_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index f896337b4535..1f1b7d6980a5 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c @@ -35,7 +35,7 @@ struct opera1_state { u32 last_key_pressed; }; -struct ir_codes_opera_table { +struct rc_map_opera_table { u32 keycode; u32 event; }; @@ -331,7 +331,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) return 0; } -static struct ir_scancode ir_codes_opera1_table[] = { +static struct rc_map_table rc_map_opera1_table[] = { {0x5fa0, KEY_1}, {0x51af, KEY_2}, {0x5da2, KEY_3}, @@ -404,12 +404,12 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) send_key = (send_key & 0xffff) | 0x0100; - for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { - if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { + for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) { + if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) { *state = REMOTE_KEY_PRESSED; - *event = ir_codes_opera1_table[i].keycode; + *event = rc_map_opera1_table[i].keycode; opst->last_key_pressed = - ir_codes_opera1_table[i].keycode; + rc_map_opera1_table[i].keycode; break; } opst->last_key_pressed = 0; @@ -497,8 +497,8 @@ static struct dvb_usb_device_properties opera1_properties = { .i2c_algo = &opera1_i2c_algo, .rc.legacy = { - .rc_key_map = ir_codes_opera1_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), + .rc_map_table = rc_map_opera1_table, + .rc_map_size = ARRAY_SIZE(rc_map_opera1_table), .rc_interval = 200, .rc_query = opera1_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index 5c9f3275aaa0..7890e75600df 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c @@ -174,7 +174,7 @@ static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct ir_scancode ir_codes_vp702x_table[] = { +static struct rc_map_table rc_map_vp702x_table[] = { { 0x0001, KEY_1 }, { 0x0002, KEY_2 }, }; @@ -197,10 +197,10 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) - if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { + for (i = 0; i < ARRAY_SIZE(rc_map_vp702x_table); i++) + if (rc5_custom(&rc_map_vp702x_table[i]) == key[1]) { *state = REMOTE_KEY_PRESSED; - *event = ir_codes_vp702x_table[i].keycode; + *event = rc_map_vp702x_table[i].keycode; break; } return 0; @@ -284,8 +284,8 @@ static struct dvb_usb_device_properties vp702x_properties = { .read_mac_address = vp702x_read_mac_addr, .rc.legacy = { - .rc_key_map = ir_codes_vp702x_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), + .rc_map_table = rc_map_vp702x_table, + .rc_map_size = ARRAY_SIZE(rc_map_vp702x_table), .rc_interval = 400, .rc_query = vp702x_rc_query, }, diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index f13791ca5994..ab0ab3c35e80 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c @@ -99,7 +99,7 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) /* The keymapping struct. Somehow this should be loaded to the driver, but * currently it is hardcoded. */ -static struct ir_scancode ir_codes_vp7045_table[] = { +static struct rc_map_table rc_map_vp7045_table[] = { { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, { 0x0003, KEY_1 }, @@ -165,10 +165,10 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) - if (rc5_data(&ir_codes_vp7045_table[i]) == key) { + for (i = 0; i < ARRAY_SIZE(rc_map_vp7045_table); i++) + if (rc5_data(&rc_map_vp7045_table[i]) == key) { *state = REMOTE_KEY_PRESSED; - *event = ir_codes_vp7045_table[i].keycode; + *event = rc_map_vp7045_table[i].keycode; break; } return 0; @@ -261,8 +261,8 @@ static struct dvb_usb_device_properties vp7045_properties = { .rc.legacy = { .rc_interval = 400, - .rc_key_map = ir_codes_vp7045_table, - .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), + .rc_map_table = rc_map_vp7045_table, + .rc_map_size = ARRAY_SIZE(rc_map_vp7045_table), .rc_query = vp7045_rc_query, }, diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index cf5f8ca6f685..572929a2cd6f 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -34,7 +34,7 @@ #define MODULE_NAME "mantis_core" #define RC_MAP_MANTIS "rc-mantis" -static struct ir_scancode mantis_ir_table[] = { +static struct rc_map_table mantis_ir_table[] = { { 0x29, KEY_POWER }, { 0x28, KEY_FAVORITES }, { 0x30, KEY_TEXT }, diff --git a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c index 0ea0aeee6e78..da6556dd1cf6 100644 --- a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c +++ b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c @@ -14,7 +14,7 @@ /* ADS Tech Instant TV DVB-T PCI Remote */ -static struct ir_scancode adstech_dvb_t_pci[] = { +static struct rc_map_table adstech_dvb_t_pci[] = { /* Keys 0 to 9 */ { 0x4d, KEY_0 }, { 0x57, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-alink-dtu-m.c b/drivers/media/rc/keymaps/rc-alink-dtu-m.c index b0ec1c81a080..36e1eb1d8347 100644 --- a/drivers/media/rc/keymaps/rc-alink-dtu-m.c +++ b/drivers/media/rc/keymaps/rc-alink-dtu-m.c @@ -21,7 +21,7 @@ #include /* A-Link DTU(m) slim remote, 6 rows, 3 columns. */ -static struct ir_scancode alink_dtu_m[] = { +static struct rc_map_table alink_dtu_m[] = { { 0x0800, KEY_VOLUMEUP }, { 0x0801, KEY_1 }, { 0x0802, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-anysee.c b/drivers/media/rc/keymaps/rc-anysee.c index 9bfe60e663b4..6ca91e0704b9 100644 --- a/drivers/media/rc/keymaps/rc-anysee.c +++ b/drivers/media/rc/keymaps/rc-anysee.c @@ -20,7 +20,7 @@ #include -static struct ir_scancode anysee[] = { +static struct rc_map_table anysee[] = { { 0x0800, KEY_0 }, { 0x0801, KEY_1 }, { 0x0802, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-apac-viewcomp.c b/drivers/media/rc/keymaps/rc-apac-viewcomp.c index a32840dd4df4..a40a1b6ab6b1 100644 --- a/drivers/media/rc/keymaps/rc-apac-viewcomp.c +++ b/drivers/media/rc/keymaps/rc-apac-viewcomp.c @@ -14,7 +14,7 @@ /* Attila Kondoros */ -static struct ir_scancode apac_viewcomp[] = { +static struct rc_map_table apac_viewcomp[] = { { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-asus-pc39.c b/drivers/media/rc/keymaps/rc-asus-pc39.c index f86bfb7bf271..2a58ffe49bb6 100644 --- a/drivers/media/rc/keymaps/rc-asus-pc39.c +++ b/drivers/media/rc/keymaps/rc-asus-pc39.c @@ -18,7 +18,7 @@ * which has a label saying is "Model PC-39" */ -static struct ir_scancode asus_pc39[] = { +static struct rc_map_table asus_pc39[] = { /* Keys 0 to 9 */ { 0x082a, KEY_0 }, { 0x0816, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c index 0cefe1c5536d..ac0a7d981a92 100644 --- a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c +++ b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c @@ -16,7 +16,7 @@ Devin Heitmueller */ -static struct ir_scancode ati_tv_wonder_hd_600[] = { +static struct rc_map_table ati_tv_wonder_hd_600[] = { { 0x00, KEY_RECORD}, /* Row 1 */ { 0x01, KEY_PLAYPAUSE}, { 0x02, KEY_STOP}, diff --git a/drivers/media/rc/keymaps/rc-avermedia-a16d.c b/drivers/media/rc/keymaps/rc-avermedia-a16d.c index 43525c8c111a..df3360fb3dbe 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-a16d.c +++ b/drivers/media/rc/keymaps/rc-avermedia-a16d.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode avermedia_a16d[] = { +static struct rc_map_table avermedia_a16d[] = { { 0x20, KEY_LIST}, { 0x00, KEY_POWER}, { 0x28, KEY_1}, diff --git a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c index 2d528cac2caf..40f2f2d418c6 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c +++ b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c @@ -14,7 +14,7 @@ /* Oldrich Jedlicka */ -static struct ir_scancode avermedia_cardbus[] = { +static struct rc_map_table avermedia_cardbus[] = { { 0x00, KEY_POWER }, { 0x01, KEY_TUNER }, /* TV/FM */ { 0x03, KEY_TEXT }, /* Teletext */ diff --git a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c index e45b67ffcf3f..b4a1aa134360 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c +++ b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c @@ -14,7 +14,7 @@ /* Matt Jesson */ -static struct ir_scancode avermedia_m135a[] = { +static struct rc_map_table avermedia_m135a[] = { /* RM-JX */ { 0x0200, KEY_POWER2 }, { 0x022e, KEY_DOT }, /* '.' */ diff --git a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c index b0e10bec82b2..74f3a20ff72a 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c +++ b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c @@ -16,7 +16,7 @@ * Herton Ronaldo Krzesinski */ -static struct ir_scancode avermedia_m733a_rm_k6[] = { +static struct rc_map_table avermedia_m733a_rm_k6[] = { { 0x0401, KEY_POWER2 }, { 0x0406, KEY_MUTE }, { 0x0408, KEY_MODE }, /* TV/FM */ diff --git a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c index 334846654a55..dc6a32144e47 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c +++ b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c @@ -23,7 +23,7 @@ /* Initial keytable is from Jose Alberto Reguero and Felipe Morales Moreno */ /* FIXME: mappings are not 100% correct? */ -static struct ir_scancode avermedia_rm_ks[] = { +static struct rc_map_table avermedia_rm_ks[] = { { 0x0501, KEY_POWER2 }, { 0x0502, KEY_CHANNELUP }, { 0x0503, KEY_CHANNELDOWN }, diff --git a/drivers/media/rc/keymaps/rc-avermedia.c b/drivers/media/rc/keymaps/rc-avermedia.c index cfde54e15d5c..a5ef695e1797 100644 --- a/drivers/media/rc/keymaps/rc-avermedia.c +++ b/drivers/media/rc/keymaps/rc-avermedia.c @@ -14,7 +14,7 @@ /* Alex Hermann */ -static struct ir_scancode avermedia[] = { +static struct rc_map_table avermedia[] = { { 0x28, KEY_1 }, { 0x18, KEY_2 }, { 0x38, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-avertv-303.c b/drivers/media/rc/keymaps/rc-avertv-303.c index ae586632b48e..386ba5922046 100644 --- a/drivers/media/rc/keymaps/rc-avertv-303.c +++ b/drivers/media/rc/keymaps/rc-avertv-303.c @@ -14,7 +14,7 @@ /* AVERTV STUDIO 303 Remote */ -static struct ir_scancode avertv_303[] = { +static struct rc_map_table avertv_303[] = { { 0x2a, KEY_1 }, { 0x32, KEY_2 }, { 0x3a, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c index 579fafedd35a..fbaaba5f3893 100644 --- a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c +++ b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c @@ -20,7 +20,7 @@ #include -static struct ir_scancode azurewave_ad_tu700[] = { +static struct rc_map_table azurewave_ad_tu700[] = { { 0x0000, KEY_TAB }, /* Tab */ { 0x0001, KEY_2 }, { 0x0002, KEY_CHANNELDOWN }, diff --git a/drivers/media/rc/keymaps/rc-behold-columbus.c b/drivers/media/rc/keymaps/rc-behold-columbus.c index 6abb712c9e04..33accf5b3998 100644 --- a/drivers/media/rc/keymaps/rc-behold-columbus.c +++ b/drivers/media/rc/keymaps/rc-behold-columbus.c @@ -21,7 +21,7 @@ * helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode behold_columbus[] = { +static struct rc_map_table behold_columbus[] = { /* 0x13 0x11 0x1C 0x12 * * Mute Source TV/FM Power * diff --git a/drivers/media/rc/keymaps/rc-behold.c b/drivers/media/rc/keymaps/rc-behold.c index 5694185a869d..4402414bacd9 100644 --- a/drivers/media/rc/keymaps/rc-behold.c +++ b/drivers/media/rc/keymaps/rc-behold.c @@ -24,7 +24,7 @@ * helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode behold[] = { +static struct rc_map_table behold[] = { /* 0x1c 0x12 * * TV/FM POWER * diff --git a/drivers/media/rc/keymaps/rc-budget-ci-old.c b/drivers/media/rc/keymaps/rc-budget-ci-old.c index 99f73232c714..e4827a6abf31 100644 --- a/drivers/media/rc/keymaps/rc-budget-ci-old.c +++ b/drivers/media/rc/keymaps/rc-budget-ci-old.c @@ -18,7 +18,7 @@ * This is a "middle of the road" approach, differences are noted */ -static struct ir_scancode budget_ci_old[] = { +static struct rc_map_table budget_ci_old[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-cinergy-1400.c b/drivers/media/rc/keymaps/rc-cinergy-1400.c index b504ddd1a922..6a69866d836c 100644 --- a/drivers/media/rc/keymaps/rc-cinergy-1400.c +++ b/drivers/media/rc/keymaps/rc-cinergy-1400.c @@ -14,7 +14,7 @@ /* Cinergy 1400 DVB-T */ -static struct ir_scancode cinergy_1400[] = { +static struct rc_map_table cinergy_1400[] = { { 0x01, KEY_POWER }, { 0x02, KEY_1 }, { 0x03, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-cinergy.c b/drivers/media/rc/keymaps/rc-cinergy.c index 8bf02f154339..ba36d14a01a0 100644 --- a/drivers/media/rc/keymaps/rc-cinergy.c +++ b/drivers/media/rc/keymaps/rc-cinergy.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode cinergy[] = { +static struct rc_map_table cinergy[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c index 47d5476d50e8..921230d84b84 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-nec.c +++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c @@ -17,7 +17,7 @@ #include -static struct ir_scancode dib0700_nec_table[] = { +static struct rc_map_table dib0700_nec_table[] = { /* Key codes for the Pixelview SBTVD remote */ { 0x8613, KEY_MUTE }, { 0x8612, KEY_POWER }, diff --git a/drivers/media/rc/keymaps/rc-dib0700-rc5.c b/drivers/media/rc/keymaps/rc-dib0700-rc5.c index 1d09921f076f..9febb722c402 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-rc5.c +++ b/drivers/media/rc/keymaps/rc-dib0700-rc5.c @@ -17,7 +17,7 @@ #include -static struct ir_scancode dib0700_rc5_table[] = { +static struct rc_map_table dib0700_rc5_table[] = { /* Key codes for the tiny Pinnacle remote*/ { 0x0700, KEY_MUTE }, { 0x0701, KEY_MENU }, /* Pinnacle logo */ diff --git a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c index 8ae726b568ed..da50d7dbb9ef 100644 --- a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c +++ b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c @@ -20,7 +20,7 @@ #include -static struct ir_scancode digitalnow_tinytwin[] = { +static struct rc_map_table digitalnow_tinytwin[] = { { 0x0000, KEY_MUTE }, /* [symbol speaker] */ { 0x0001, KEY_VOLUMEUP }, { 0x0002, KEY_POWER2 }, /* TV [power button] */ diff --git a/drivers/media/rc/keymaps/rc-digittrade.c b/drivers/media/rc/keymaps/rc-digittrade.c index 206469fb028e..706f95dd6bdc 100644 --- a/drivers/media/rc/keymaps/rc-digittrade.c +++ b/drivers/media/rc/keymaps/rc-digittrade.c @@ -25,7 +25,7 @@ Initial keytable was from Alain Kalker */ /* Digittrade DVB-T USB Stick */ -static struct ir_scancode digittrade[] = { +static struct rc_map_table digittrade[] = { { 0x0000, KEY_9 }, { 0x0001, KEY_EPG }, /* EPG */ { 0x0002, KEY_VOLUMEDOWN }, /* Vol Dn */ diff --git a/drivers/media/rc/keymaps/rc-dm1105-nec.c b/drivers/media/rc/keymaps/rc-dm1105-nec.c index ba6fb0be9d3c..9023dc9a65aa 100644 --- a/drivers/media/rc/keymaps/rc-dm1105-nec.c +++ b/drivers/media/rc/keymaps/rc-dm1105-nec.c @@ -16,7 +16,7 @@ Igor M. Liplianin */ -static struct ir_scancode dm1105_nec[] = { +static struct rc_map_table dm1105_nec[] = { { 0x0a, KEY_POWER2}, /* power */ { 0x0c, KEY_MUTE}, /* mute */ { 0x11, KEY_1}, diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c index b703937f160b..7fbeaed46516 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c @@ -14,7 +14,7 @@ /* DigitalNow DNTV Live DVB-T Remote */ -static struct ir_scancode dntv_live_dvb_t[] = { +static struct rc_map_table dntv_live_dvb_t[] = { { 0x00, KEY_ESC }, /* 'go up a level?' */ /* Keys 0 to 9 */ { 0x0a, KEY_0 }, diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c index b0126b2fceab..660f2e793d9a 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c @@ -14,7 +14,7 @@ /* DigitalNow DNTV Live! DVB-T Pro Remote */ -static struct ir_scancode dntv_live_dvbt_pro[] = { +static struct rc_map_table dntv_live_dvbt_pro[] = { { 0x16, KEY_POWER }, { 0x5b, KEY_HOME }, diff --git a/drivers/media/rc/keymaps/rc-em-terratec.c b/drivers/media/rc/keymaps/rc-em-terratec.c index 57bcd556821d..4d0ad8ca41a2 100644 --- a/drivers/media/rc/keymaps/rc-em-terratec.c +++ b/drivers/media/rc/keymaps/rc-em-terratec.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode em_terratec[] = { +static struct rc_map_table em_terratec[] = { { 0x01, KEY_CHANNEL }, { 0x02, KEY_SELECT }, { 0x03, KEY_MUTE }, diff --git a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c index 97e01f4cb76a..3005d4baf211 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c @@ -16,7 +16,7 @@ Mauro Carvalho Chehab */ -static struct ir_scancode encore_enltv_fm53[] = { +static struct rc_map_table encore_enltv_fm53[] = { { 0x10, KEY_POWER2}, { 0x06, KEY_MUTE}, diff --git a/drivers/media/rc/keymaps/rc-encore-enltv.c b/drivers/media/rc/keymaps/rc-encore-enltv.c index d3030cf74839..d16db500ed31 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv.c @@ -15,7 +15,7 @@ /* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons Juan Pablo Sormani */ -static struct ir_scancode encore_enltv[] = { +static struct rc_map_table encore_enltv[] = { /* Power button does nothing, neither in Windows app, although it sends data (used for BIOS wakeup?) */ diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c index 1871b32efa98..a5e07c7e6eaf 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv2.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c @@ -15,7 +15,7 @@ /* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton Mauro Carvalho Chehab */ -static struct ir_scancode encore_enltv2[] = { +static struct rc_map_table encore_enltv2[] = { { 0x4c, KEY_POWER2 }, { 0x4a, KEY_TUNER }, { 0x40, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-evga-indtube.c b/drivers/media/rc/keymaps/rc-evga-indtube.c index 192d7f8287f4..e2d0590d3323 100644 --- a/drivers/media/rc/keymaps/rc-evga-indtube.c +++ b/drivers/media/rc/keymaps/rc-evga-indtube.c @@ -16,7 +16,7 @@ Devin Heitmueller */ -static struct ir_scancode evga_indtube[] = { +static struct rc_map_table evga_indtube[] = { { 0x12, KEY_POWER}, { 0x02, KEY_MODE}, /* TV */ { 0x14, KEY_MUTE}, diff --git a/drivers/media/rc/keymaps/rc-eztv.c b/drivers/media/rc/keymaps/rc-eztv.c index fe3ab5e31a7f..ee134c58d033 100644 --- a/drivers/media/rc/keymaps/rc-eztv.c +++ b/drivers/media/rc/keymaps/rc-eztv.c @@ -15,7 +15,7 @@ /* Alfons Geser * updates from Job D. R. Borges */ -static struct ir_scancode eztv[] = { +static struct rc_map_table eztv[] = { { 0x12, KEY_POWER }, { 0x01, KEY_TV }, /* DVR */ { 0x15, KEY_DVD }, /* DVD */ diff --git a/drivers/media/rc/keymaps/rc-flydvb.c b/drivers/media/rc/keymaps/rc-flydvb.c index f48249e070f5..ef90a05a16f2 100644 --- a/drivers/media/rc/keymaps/rc-flydvb.c +++ b/drivers/media/rc/keymaps/rc-flydvb.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode flydvb[] = { +static struct rc_map_table flydvb[] = { { 0x01, KEY_ZOOM }, /* Full Screen */ { 0x00, KEY_POWER }, /* Power */ diff --git a/drivers/media/rc/keymaps/rc-flyvideo.c b/drivers/media/rc/keymaps/rc-flyvideo.c index 59713fb46820..20a133325e6e 100644 --- a/drivers/media/rc/keymaps/rc-flyvideo.c +++ b/drivers/media/rc/keymaps/rc-flyvideo.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode flyvideo[] = { +static struct rc_map_table flyvideo[] = { { 0x0f, KEY_0 }, { 0x03, KEY_1 }, { 0x04, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c index e69458d8eb1b..2687af77a806 100644 --- a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c +++ b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c @@ -14,7 +14,7 @@ /* DViCO FUSION HDTV MCE remote */ -static struct ir_scancode fusionhdtv_mce[] = { +static struct rc_map_table fusionhdtv_mce[] = { { 0x0b, KEY_1 }, { 0x17, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c index 13587b8d6a4a..fb247baafde1 100644 --- a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c +++ b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c @@ -16,7 +16,7 @@ Shine Liu */ -static struct ir_scancode gadmei_rm008z[] = { +static struct rc_map_table gadmei_rm008z[] = { { 0x14, KEY_POWER2}, /* POWER OFF */ { 0x0c, KEY_MUTE}, /* MUTE */ diff --git a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c index 2304bf677b3d..7e6834acc87f 100644 --- a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c +++ b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c @@ -17,7 +17,7 @@ * Adrian Pardini */ -static struct ir_scancode genius_tvgo_a11mce[] = { +static struct rc_map_table genius_tvgo_a11mce[] = { /* Keys 0 to 9 */ { 0x48, KEY_0 }, { 0x09, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-gotview7135.c b/drivers/media/rc/keymaps/rc-gotview7135.c index b5be7bfbb7f0..54222caeff7c 100644 --- a/drivers/media/rc/keymaps/rc-gotview7135.c +++ b/drivers/media/rc/keymaps/rc-gotview7135.c @@ -14,7 +14,7 @@ /* Mike Baikov */ -static struct ir_scancode gotview7135[] = { +static struct rc_map_table gotview7135[] = { { 0x11, KEY_POWER }, { 0x35, KEY_TV }, diff --git a/drivers/media/rc/keymaps/rc-hauppauge-new.c b/drivers/media/rc/keymaps/rc-hauppauge-new.c index c60f845dd930..239625785f68 100644 --- a/drivers/media/rc/keymaps/rc-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-hauppauge-new.c @@ -16,7 +16,7 @@ * slightly different versions), shipped with cx88+ivtv cards. * almost rc5 coding, but some non-standard keys */ -static struct ir_scancode hauppauge_new[] = { +static struct rc_map_table hauppauge_new[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c index 4ce902f87701..291e5d8850ec 100644 --- a/drivers/media/rc/keymaps/rc-imon-mce.c +++ b/drivers/media/rc/keymaps/rc-imon-mce.c @@ -12,7 +12,7 @@ #include /* mce-mode imon mce remote key table */ -static struct ir_scancode imon_mce[] = { +static struct rc_map_table imon_mce[] = { /* keys sorted mostly by frequency of use to optimize lookups */ { 0x800ff415, KEY_REWIND }, { 0x800ff414, KEY_FASTFORWARD }, diff --git a/drivers/media/rc/keymaps/rc-imon-pad.c b/drivers/media/rc/keymaps/rc-imon-pad.c index 6d4633af4393..33f28d428ef9 100644 --- a/drivers/media/rc/keymaps/rc-imon-pad.c +++ b/drivers/media/rc/keymaps/rc-imon-pad.c @@ -17,7 +17,7 @@ * same remote to different hex codes, and the silkscreened names * vary a bit between the SoundGraph and Antec remotes... ugh. */ -static struct ir_scancode imon_pad[] = { +static struct rc_map_table imon_pad[] = { /* keys sorted mostly by frequency of use to optimize lookups */ { 0x2a8195b7, KEY_REWIND }, { 0x298315b7, KEY_REWIND }, diff --git a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c index c5208f10e7c0..5e5263f2380d 100644 --- a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c +++ b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c @@ -14,7 +14,7 @@ /* IO-DATA BCTV7E Remote */ -static struct ir_scancode iodata_bctv7e[] = { +static struct rc_map_table iodata_bctv7e[] = { { 0x40, KEY_TV }, { 0x20, KEY_RADIO }, /* FM */ { 0x60, KEY_EPG }, diff --git a/drivers/media/rc/keymaps/rc-kaiomy.c b/drivers/media/rc/keymaps/rc-kaiomy.c index 1b6da7ffb8f1..527ab1b5fb6f 100644 --- a/drivers/media/rc/keymaps/rc-kaiomy.c +++ b/drivers/media/rc/keymaps/rc-kaiomy.c @@ -16,7 +16,7 @@ Mauro Carvalho Chehab */ -static struct ir_scancode kaiomy[] = { +static struct rc_map_table kaiomy[] = { { 0x43, KEY_POWER2}, { 0x01, KEY_LIST}, { 0x0b, KEY_ZOOM}, diff --git a/drivers/media/rc/keymaps/rc-kworld-315u.c b/drivers/media/rc/keymaps/rc-kworld-315u.c index 3418e075938c..f58703e2a3ac 100644 --- a/drivers/media/rc/keymaps/rc-kworld-315u.c +++ b/drivers/media/rc/keymaps/rc-kworld-315u.c @@ -15,7 +15,7 @@ /* Kworld 315U */ -static struct ir_scancode kworld_315u[] = { +static struct rc_map_table kworld_315u[] = { { 0x6143, KEY_POWER }, { 0x6101, KEY_TUNER }, /* source */ { 0x610b, KEY_ZOOM }, diff --git a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c index 4d681eb7aaf4..f6235bbad507 100644 --- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c +++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c @@ -16,7 +16,7 @@ Mauro Carvalho Chehab */ -static struct ir_scancode kworld_plus_tv_analog[] = { +static struct rc_map_table kworld_plus_tv_analog[] = { { 0x0c, KEY_PROG1 }, /* Kworld key */ { 0x16, KEY_CLOSECD }, /* -> ) */ { 0x1d, KEY_POWER2 }, diff --git a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c index ebdd1226bada..e1b8726daa51 100644 --- a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c +++ b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c @@ -20,7 +20,7 @@ #include -static struct ir_scancode leadtek_y04g0051[] = { +static struct rc_map_table leadtek_y04g0051[] = { { 0x0300, KEY_POWER2 }, { 0x0303, KEY_SCREEN }, { 0x0304, KEY_RIGHT }, diff --git a/drivers/media/rc/keymaps/rc-lirc.c b/drivers/media/rc/keymaps/rc-lirc.c index 6d8a64170fd9..d4dfee72b8ca 100644 --- a/drivers/media/rc/keymaps/rc-lirc.c +++ b/drivers/media/rc/keymaps/rc-lirc.c @@ -11,7 +11,7 @@ #include -static struct ir_scancode lirc[] = { +static struct rc_map_table lirc[] = { { }, }; diff --git a/drivers/media/rc/keymaps/rc-lme2510.c b/drivers/media/rc/keymaps/rc-lme2510.c index ca7e2acb682a..eb2d39698ef0 100644 --- a/drivers/media/rc/keymaps/rc-lme2510.c +++ b/drivers/media/rc/keymaps/rc-lme2510.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode lme2510_rc[] = { +static struct rc_map_table lme2510_rc[] = { { 0xba45, KEY_0 }, { 0xa05f, KEY_1 }, { 0xaf50, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-manli.c b/drivers/media/rc/keymaps/rc-manli.c index 056cf52dce60..b24b0821da5a 100644 --- a/drivers/media/rc/keymaps/rc-manli.c +++ b/drivers/media/rc/keymaps/rc-manli.c @@ -21,7 +21,7 @@ helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode manli[] = { +static struct rc_map_table manli[] = { /* 0x1c 0x12 * * FUNCTION POWER * diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c index 3a14d31bec4d..4ad89b79a3e8 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c @@ -20,7 +20,7 @@ #include -static struct ir_scancode msi_digivox_ii[] = { +static struct rc_map_table msi_digivox_ii[] = { { 0x0002, KEY_2 }, { 0x0003, KEY_UP }, /* up */ { 0x0004, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c index 16c5b0aa8c43..d3304e798356 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c @@ -24,7 +24,7 @@ /* Uses NEC extended 0x61d6. */ /* This remote seems to be same as rc-kworld-315u.c. Anyhow, add new remote since rc-kworld-315u.c lacks NEC extended address byte. */ -static struct ir_scancode msi_digivox_iii[] = { +static struct rc_map_table msi_digivox_iii[] = { { 0x61d601, KEY_VIDEO }, /* Source */ { 0x61d602, KEY_3 }, { 0x61d603, KEY_POWER }, /* ShutDown */ diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c index d4c91020fc07..51999c469884 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c @@ -26,7 +26,7 @@ Some changes to formatting and keycodes by Mark Schultz */ -static struct ir_scancode msi_tvanywhere_plus[] = { +static struct rc_map_table msi_tvanywhere_plus[] = { /* ---- Remote Button Layout ---- diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c index aec064cb7b15..619df9dcbf12 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c @@ -14,7 +14,7 @@ /* MSI TV@nywhere MASTER remote */ -static struct ir_scancode msi_tvanywhere[] = { +static struct rc_map_table msi_tvanywhere[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-nebula.c b/drivers/media/rc/keymaps/rc-nebula.c index 2c44b90d48c9..8672859aaad1 100644 --- a/drivers/media/rc/keymaps/rc-nebula.c +++ b/drivers/media/rc/keymaps/rc-nebula.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode nebula[] = { +static struct rc_map_table nebula[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c index 929084bcaa4d..2f560dc791c0 100644 --- a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c @@ -16,7 +16,7 @@ Mauro Carvalho Chehab */ -static struct ir_scancode nec_terratec_cinergy_xs[] = { +static struct rc_map_table nec_terratec_cinergy_xs[] = { { 0x1441, KEY_HOME}, { 0x1401, KEY_POWER2}, diff --git a/drivers/media/rc/keymaps/rc-norwood.c b/drivers/media/rc/keymaps/rc-norwood.c index 7fe774628edc..f4a85033b297 100644 --- a/drivers/media/rc/keymaps/rc-norwood.c +++ b/drivers/media/rc/keymaps/rc-norwood.c @@ -16,7 +16,7 @@ By Peter Naulls Key comments are the functions given in the manual */ -static struct ir_scancode norwood[] = { +static struct rc_map_table norwood[] = { /* Keys 0 to 9 */ { 0x20, KEY_0 }, { 0x21, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-npgtech.c b/drivers/media/rc/keymaps/rc-npgtech.c index a9cbcde98a30..fdfa549323cc 100644 --- a/drivers/media/rc/keymaps/rc-npgtech.c +++ b/drivers/media/rc/keymaps/rc-npgtech.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode npgtech[] = { +static struct rc_map_table npgtech[] = { { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ { 0x2a, KEY_FRONT }, diff --git a/drivers/media/rc/keymaps/rc-pctv-sedna.c b/drivers/media/rc/keymaps/rc-pctv-sedna.c index 68b33b31f6bf..86c1101c47df 100644 --- a/drivers/media/rc/keymaps/rc-pctv-sedna.c +++ b/drivers/media/rc/keymaps/rc-pctv-sedna.c @@ -17,7 +17,7 @@ Pavel Mihaylov Also for the remote bundled with Kozumi KTV-01C card */ -static struct ir_scancode pctv_sedna[] = { +static struct rc_map_table pctv_sedna[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-pinnacle-color.c b/drivers/media/rc/keymaps/rc-pinnacle-color.c index 364ccde87a04..d3f4cd411e3b 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-color.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-color.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode pinnacle_color[] = { +static struct rc_map_table pinnacle_color[] = { { 0x59, KEY_MUTE }, { 0x4a, KEY_POWER }, diff --git a/drivers/media/rc/keymaps/rc-pinnacle-grey.c b/drivers/media/rc/keymaps/rc-pinnacle-grey.c index 993eff72f233..1f48b43e4939 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-grey.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-grey.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode pinnacle_grey[] = { +static struct rc_map_table pinnacle_grey[] = { { 0x3a, KEY_0 }, { 0x31, KEY_1 }, { 0x32, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c index 56e6a7e203ec..dc7267c2d04a 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c @@ -14,7 +14,7 @@ /* Pinnacle PCTV HD 800i mini remote */ -static struct ir_scancode pinnacle_pctv_hd[] = { +static struct rc_map_table pinnacle_pctv_hd[] = { { 0x0f, KEY_1 }, { 0x15, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-pixelview-mk12.c b/drivers/media/rc/keymaps/rc-pixelview-mk12.c index 84f89ebd8998..93f72487a7bb 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-mk12.c +++ b/drivers/media/rc/keymaps/rc-pixelview-mk12.c @@ -16,7 +16,7 @@ * Keytable for MK-F12 IR remote provided together with Pixelview * Ultra Pro Remote Controller. Uses NEC extended format. */ -static struct ir_scancode pixelview_mk12[] = { +static struct rc_map_table pixelview_mk12[] = { { 0x866b03, KEY_TUNER }, /* Timeshift */ { 0x866b1e, KEY_POWER2 }, /* power */ diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c index 703f86bca132..e6d60d2cf271 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-new.c +++ b/drivers/media/rc/keymaps/rc-pixelview-new.c @@ -17,7 +17,7 @@ present on PV MPEG 8000GT */ -static struct ir_scancode pixelview_new[] = { +static struct rc_map_table pixelview_new[] = { { 0x3c, KEY_TIME }, /* Timeshift */ { 0x12, KEY_POWER }, diff --git a/drivers/media/rc/keymaps/rc-pixelview.c b/drivers/media/rc/keymaps/rc-pixelview.c index 5a50aa7e411d..2a767102a164 100644 --- a/drivers/media/rc/keymaps/rc-pixelview.c +++ b/drivers/media/rc/keymaps/rc-pixelview.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode pixelview[] = { +static struct rc_map_table pixelview[] = { { 0x1e, KEY_POWER }, /* power */ { 0x07, KEY_MEDIA }, /* source */ diff --git a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c index 4eec4371f7d1..7cc0d57df3be 100644 --- a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c +++ b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c @@ -17,7 +17,7 @@ * Daniel Fraga */ -static struct ir_scancode powercolor_real_angel[] = { +static struct rc_map_table powercolor_real_angel[] = { { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ { 0x00, KEY_0 }, diff --git a/drivers/media/rc/keymaps/rc-proteus-2309.c b/drivers/media/rc/keymaps/rc-proteus-2309.c index 802c58a0ae26..d5e62a50c1df 100644 --- a/drivers/media/rc/keymaps/rc-proteus-2309.c +++ b/drivers/media/rc/keymaps/rc-proteus-2309.c @@ -14,7 +14,7 @@ /* Michal Majchrowicz */ -static struct ir_scancode proteus_2309[] = { +static struct rc_map_table proteus_2309[] = { /* numeric */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-purpletv.c b/drivers/media/rc/keymaps/rc-purpletv.c index f3e9709b7c1f..5dbfd913b211 100644 --- a/drivers/media/rc/keymaps/rc-purpletv.c +++ b/drivers/media/rc/keymaps/rc-purpletv.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode purpletv[] = { +static struct rc_map_table purpletv[] = { { 0x03, KEY_POWER }, { 0x6f, KEY_MUTE }, { 0x10, KEY_BACKSPACE }, /* Recall */ diff --git a/drivers/media/rc/keymaps/rc-pv951.c b/drivers/media/rc/keymaps/rc-pv951.c index e301ff033af1..d9c7e2f26add 100644 --- a/drivers/media/rc/keymaps/rc-pv951.c +++ b/drivers/media/rc/keymaps/rc-pv951.c @@ -14,7 +14,7 @@ /* Mark Phalan */ -static struct ir_scancode pv951[] = { +static struct rc_map_table pv951[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, diff --git a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c index 91bcab8bd266..eef2e8714542 100644 --- a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c @@ -19,7 +19,7 @@ * This table contains the complete RC5 code, instead of just the data part */ -static struct ir_scancode rc5_hauppauge_new[] = { +static struct rc_map_table rc5_hauppauge_new[] = { /* Keys 0 to 9 */ { 0x1e00, KEY_0 }, { 0x1e01, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-rc5-tv.c b/drivers/media/rc/keymaps/rc-rc5-tv.c index cda2a2fae04d..efa14882e762 100644 --- a/drivers/media/rc/keymaps/rc-rc5-tv.c +++ b/drivers/media/rc/keymaps/rc-rc5-tv.c @@ -16,7 +16,7 @@ /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ /* used by old (black) Hauppauge remotes */ -static struct ir_scancode rc5_tv[] = { +static struct rc_map_table rc5_tv[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index f926477a0562..81f41723fde3 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c @@ -11,7 +11,7 @@ #include -static struct ir_scancode rc6_mce[] = { +static struct rc_map_table rc6_mce[] = { { 0x800f0400, KEY_NUMERIC_0 }, { 0x800f0401, KEY_NUMERIC_1 }, diff --git a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c index 678142659183..884416ca0ebe 100644 --- a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c +++ b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c @@ -14,7 +14,7 @@ /* Zogis Real Audio 220 - 32 keys IR */ -static struct ir_scancode real_audio_220_32_keys[] = { +static struct rc_map_table real_audio_220_32_keys[] = { { 0x1c, KEY_RADIO}, { 0x12, KEY_POWER2}, diff --git a/drivers/media/rc/keymaps/rc-streamzap.c b/drivers/media/rc/keymaps/rc-streamzap.c index bafe5b8f4192..5a86a7151488 100644 --- a/drivers/media/rc/keymaps/rc-streamzap.c +++ b/drivers/media/rc/keymaps/rc-streamzap.c @@ -11,7 +11,7 @@ #include -static struct ir_scancode streamzap[] = { +static struct rc_map_table streamzap[] = { /* * The Streamzap remote is almost, but not quite, RC-5, as it has an extra * bit in it, which throws the in-kernel RC-5 decoder for a loop. Currently, diff --git a/drivers/media/rc/keymaps/rc-tbs-nec.c b/drivers/media/rc/keymaps/rc-tbs-nec.c index 4ef4f811d011..6e2f5b5b7740 100644 --- a/drivers/media/rc/keymaps/rc-tbs-nec.c +++ b/drivers/media/rc/keymaps/rc-tbs-nec.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode tbs_nec[] = { +static struct rc_map_table tbs_nec[] = { { 0x04, KEY_POWER2}, /*power*/ { 0x14, KEY_MUTE}, /*mute*/ { 0x07, KEY_1}, diff --git a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c index 4064a32569e2..540020a7821b 100644 --- a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c @@ -16,7 +16,7 @@ Devin Heitmueller */ -static struct ir_scancode terratec_cinergy_xs[] = { +static struct rc_map_table terratec_cinergy_xs[] = { { 0x41, KEY_HOME}, { 0x01, KEY_POWER}, { 0x42, KEY_MENU}, diff --git a/drivers/media/rc/keymaps/rc-terratec-slim.c b/drivers/media/rc/keymaps/rc-terratec-slim.c index c23caf70036b..a1513f0299d2 100644 --- a/drivers/media/rc/keymaps/rc-terratec-slim.c +++ b/drivers/media/rc/keymaps/rc-terratec-slim.c @@ -22,7 +22,7 @@ /* TerraTec slim remote, 7 rows, 4 columns. */ /* Uses NEC extended 0x02bd. */ -static struct ir_scancode terratec_slim[] = { +static struct rc_map_table terratec_slim[] = { { 0x02bd00, KEY_1 }, { 0x02bd01, KEY_2 }, { 0x02bd02, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-tevii-nec.c b/drivers/media/rc/keymaps/rc-tevii-nec.c index eabfb70973b5..6b2fc431689e 100644 --- a/drivers/media/rc/keymaps/rc-tevii-nec.c +++ b/drivers/media/rc/keymaps/rc-tevii-nec.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode tevii_nec[] = { +static struct rc_map_table tevii_nec[] = { { 0x0a, KEY_POWER2}, { 0x0c, KEY_MUTE}, { 0x11, KEY_1}, diff --git a/drivers/media/rc/keymaps/rc-total-media-in-hand.c b/drivers/media/rc/keymaps/rc-total-media-in-hand.c index cd39b3dbab06..61a4234f13af 100644 --- a/drivers/media/rc/keymaps/rc-total-media-in-hand.c +++ b/drivers/media/rc/keymaps/rc-total-media-in-hand.c @@ -21,7 +21,7 @@ #include /* Uses NEC extended 0x02bd */ -static struct ir_scancode total_media_in_hand[] = { +static struct rc_map_table total_media_in_hand[] = { { 0x02bd00, KEY_1 }, { 0x02bd01, KEY_2 }, { 0x02bd02, KEY_3 }, diff --git a/drivers/media/rc/keymaps/rc-trekstor.c b/drivers/media/rc/keymaps/rc-trekstor.c index 31d6c6c23642..2d7bbf8ae83e 100644 --- a/drivers/media/rc/keymaps/rc-trekstor.c +++ b/drivers/media/rc/keymaps/rc-trekstor.c @@ -23,7 +23,7 @@ /* TrekStor DVB-T USB Stick remote controller. */ /* Imported from af9015.h. Initial keytable was from Marc Schneider */ -static struct ir_scancode trekstor[] = { +static struct rc_map_table trekstor[] = { { 0x0084, KEY_0 }, { 0x0085, KEY_MUTE }, /* Mute */ { 0x0086, KEY_HOMEPAGE }, /* Home */ diff --git a/drivers/media/rc/keymaps/rc-tt-1500.c b/drivers/media/rc/keymaps/rc-tt-1500.c index 45a060850e53..f3fe9f39d069 100644 --- a/drivers/media/rc/keymaps/rc-tt-1500.c +++ b/drivers/media/rc/keymaps/rc-tt-1500.c @@ -14,7 +14,7 @@ /* for the Technotrend 1500 bundled remotes (grey and black): */ -static struct ir_scancode tt_1500[] = { +static struct rc_map_table tt_1500[] = { { 0x01, KEY_POWER }, { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ { 0x03, KEY_1 }, diff --git a/drivers/media/rc/keymaps/rc-twinhan1027.c b/drivers/media/rc/keymaps/rc-twinhan1027.c index b5def5387ded..67cc6e0b326b 100644 --- a/drivers/media/rc/keymaps/rc-twinhan1027.c +++ b/drivers/media/rc/keymaps/rc-twinhan1027.c @@ -1,6 +1,6 @@ #include -static struct ir_scancode twinhan_vp1027[] = { +static struct rc_map_table twinhan_vp1027[] = { { 0x16, KEY_POWER2 }, { 0x17, KEY_FAVORITES }, { 0x0f, KEY_TEXT }, diff --git a/drivers/media/rc/keymaps/rc-videomate-s350.c b/drivers/media/rc/keymaps/rc-videomate-s350.c index 7c422b4670fa..f8a0d107001e 100644 --- a/drivers/media/rc/keymaps/rc-videomate-s350.c +++ b/drivers/media/rc/keymaps/rc-videomate-s350.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode videomate_s350[] = { +static struct rc_map_table videomate_s350[] = { { 0x00, KEY_TV}, { 0x01, KEY_DVD}, { 0x04, KEY_RECORD}, diff --git a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c index 4d31b47dfc30..04d102457ea6 100644 --- a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c +++ b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c @@ -12,7 +12,7 @@ #include -static struct ir_scancode videomate_tv_pvr[] = { +static struct rc_map_table videomate_tv_pvr[] = { { 0x14, KEY_MUTE }, { 0x24, KEY_ZOOM }, diff --git a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c index ade3c14c4c0f..78fc7da4b9e2 100644 --- a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c +++ b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c @@ -16,7 +16,7 @@ Magnus Alm */ -static struct ir_scancode winfast_usbii_deluxe[] = { +static struct rc_map_table winfast_usbii_deluxe[] = { { 0x62, KEY_0}, { 0x75, KEY_1}, { 0x76, KEY_2}, diff --git a/drivers/media/rc/keymaps/rc-winfast.c b/drivers/media/rc/keymaps/rc-winfast.c index 502b5f54f84e..a8fbd7662d39 100644 --- a/drivers/media/rc/keymaps/rc-winfast.c +++ b/drivers/media/rc/keymaps/rc-winfast.c @@ -14,7 +14,7 @@ /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ -static struct ir_scancode winfast[] = { +static struct rc_map_table winfast[] = { /* Keys 0 to 9 */ { 0x12, KEY_0 }, { 0x05, KEY_1 }, diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index caa8d70de726..b989f5d98d5f 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -94,7 +94,7 @@ void ir_unregister_map(struct rc_keymap *map) EXPORT_SYMBOL_GPL(ir_unregister_map); -static struct ir_scancode empty[] = { +static struct rc_map_table empty[] = { { 0x2a, KEY_COFFEE }, }; @@ -123,8 +123,8 @@ static int ir_create_table(struct rc_map *rc_map, { rc_map->name = name; rc_map->rc_type = rc_type; - rc_map->alloc = roundup_pow_of_two(size * sizeof(struct ir_scancode)); - rc_map->size = rc_map->alloc / sizeof(struct ir_scancode); + rc_map->alloc = roundup_pow_of_two(size * sizeof(struct rc_map_table)); + rc_map->size = rc_map->alloc / sizeof(struct rc_map_table); rc_map->scan = kmalloc(rc_map->alloc, GFP_KERNEL); if (!rc_map->scan) return -ENOMEM; @@ -161,8 +161,8 @@ static int ir_resize_table(struct rc_map *rc_map, gfp_t gfp_flags) { unsigned int oldalloc = rc_map->alloc; unsigned int newalloc = oldalloc; - struct ir_scancode *oldscan = rc_map->scan; - struct ir_scancode *newscan; + struct rc_map_table *oldscan = rc_map->scan; + struct rc_map_table *newscan; if (rc_map->size == rc_map->len) { /* All entries in use -> grow keytable */ @@ -188,10 +188,10 @@ static int ir_resize_table(struct rc_map *rc_map, gfp_t gfp_flags) return -ENOMEM; } - memcpy(newscan, rc_map->scan, rc_map->len * sizeof(struct ir_scancode)); + memcpy(newscan, rc_map->scan, rc_map->len * sizeof(struct rc_map_table)); rc_map->scan = newscan; rc_map->alloc = newalloc; - rc_map->size = rc_map->alloc / sizeof(struct ir_scancode); + rc_map->size = rc_map->alloc / sizeof(struct rc_map_table); kfree(oldscan); return 0; } @@ -221,7 +221,7 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, index, rc_map->scan[index].scancode); rc_map->len--; memmove(&rc_map->scan[index], &rc_map->scan[index+ 1], - (rc_map->len - index) * sizeof(struct ir_scancode)); + (rc_map->len - index) * sizeof(struct rc_map_table)); } else { IR_dprintk(1, "#%d: %s scan 0x%04x with key 0x%04x\n", index, @@ -300,7 +300,7 @@ static unsigned int ir_establish_scancode(struct rc_dev *dev, /* i is the proper index to insert our new keycode */ if (i < rc_map->len) memmove(&rc_map->scan[i + 1], &rc_map->scan[i], - (rc_map->len - i) * sizeof(struct ir_scancode)); + (rc_map->len - i) * sizeof(struct rc_map_table)); rc_map->scan[i].scancode = scancode; rc_map->scan[i].keycode = KEY_RESERVED; rc_map->len++; @@ -440,7 +440,7 @@ static int ir_getkeycode(struct input_dev *idev, { struct rc_dev *rdev = input_get_drvdata(idev); struct rc_map *rc_map = &rdev->rc_map; - struct ir_scancode *entry; + struct rc_map_table *entry; unsigned long flags; unsigned int index; unsigned int scancode; diff --git a/include/media/rc-map.h b/include/media/rc-map.h index a6b2738f2d60..5e9c06ad1d47 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -25,13 +25,13 @@ RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ RC_TYPE_RC5_SZ | RC_TYPE_OTHER) -struct ir_scancode { +struct rc_map_table { u32 scancode; u32 keycode; }; struct rc_map { - struct ir_scancode *scan; + struct rc_map_table *scan; unsigned int size; /* Max number of entries */ unsigned int len; /* Used number of entries */ unsigned int alloc; /* Size of *scan in bytes */ -- cgit v1.2.3 From d100e659b61a735c3343b3d82c1c009b04072cdd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Nov 2010 15:56:53 -0300 Subject: [media] rc: use rc_map_ prefix for all rc map tables Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/mantis/mantis_input.c | 8 +++---- drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c | 6 ++--- drivers/media/rc/keymaps/rc-alink-dtu-m.c | 6 ++--- drivers/media/rc/keymaps/rc-anysee.c | 6 ++--- drivers/media/rc/keymaps/rc-apac-viewcomp.c | 6 ++--- drivers/media/rc/keymaps/rc-asus-pc39.c | 6 ++--- drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia-a16d.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia-cardbus.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia-dvbt.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia-m135a.c | 6 ++--- .../media/rc/keymaps/rc-avermedia-m733a-rm-k6.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia-rm-ks.c | 6 ++--- drivers/media/rc/keymaps/rc-avermedia.c | 6 ++--- drivers/media/rc/keymaps/rc-avertv-303.c | 6 ++--- drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c | 6 ++--- drivers/media/rc/keymaps/rc-behold-columbus.c | 6 ++--- drivers/media/rc/keymaps/rc-behold.c | 6 ++--- drivers/media/rc/keymaps/rc-budget-ci-old.c | 6 ++--- drivers/media/rc/keymaps/rc-cinergy-1400.c | 6 ++--- drivers/media/rc/keymaps/rc-cinergy.c | 6 ++--- drivers/media/rc/keymaps/rc-dib0700-nec.c | 6 ++--- drivers/media/rc/keymaps/rc-dib0700-rc5.c | 6 ++--- drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c | 6 ++--- drivers/media/rc/keymaps/rc-digittrade.c | 6 ++--- drivers/media/rc/keymaps/rc-dm1105-nec.c | 6 ++--- drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c | 6 ++--- drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c | 6 ++--- drivers/media/rc/keymaps/rc-em-terratec.c | 6 ++--- drivers/media/rc/keymaps/rc-encore-enltv-fm53.c | 6 ++--- drivers/media/rc/keymaps/rc-encore-enltv.c | 6 ++--- drivers/media/rc/keymaps/rc-encore-enltv2.c | 6 ++--- drivers/media/rc/keymaps/rc-evga-indtube.c | 6 ++--- drivers/media/rc/keymaps/rc-eztv.c | 6 ++--- drivers/media/rc/keymaps/rc-flydvb.c | 6 ++--- drivers/media/rc/keymaps/rc-flyvideo.c | 6 ++--- drivers/media/rc/keymaps/rc-fusionhdtv-mce.c | 6 ++--- drivers/media/rc/keymaps/rc-gadmei-rm008z.c | 6 ++--- drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c | 6 ++--- drivers/media/rc/keymaps/rc-gotview7135.c | 6 ++--- drivers/media/rc/keymaps/rc-hauppauge-new.c | 6 ++--- drivers/media/rc/keymaps/rc-imon-mce.c | 6 ++--- drivers/media/rc/keymaps/rc-imon-pad.c | 6 ++--- drivers/media/rc/keymaps/rc-iodata-bctv7e.c | 6 ++--- drivers/media/rc/keymaps/rc-kaiomy.c | 6 ++--- drivers/media/rc/keymaps/rc-kworld-315u.c | 6 ++--- .../media/rc/keymaps/rc-kworld-plus-tv-analog.c | 6 ++--- drivers/media/rc/keymaps/rc-leadtek-y04g0051.c | 6 ++--- drivers/media/rc/keymaps/rc-lirc.c | 6 ++--- drivers/media/rc/keymaps/rc-lme2510.c | 6 ++--- drivers/media/rc/keymaps/rc-manli.c | 6 ++--- drivers/media/rc/keymaps/rc-msi-digivox-ii.c | 6 ++--- drivers/media/rc/keymaps/rc-msi-digivox-iii.c | 6 ++--- drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c | 6 ++--- drivers/media/rc/keymaps/rc-msi-tvanywhere.c | 6 ++--- drivers/media/rc/keymaps/rc-nebula.c | 6 ++--- .../media/rc/keymaps/rc-nec-terratec-cinergy-xs.c | 6 ++--- drivers/media/rc/keymaps/rc-norwood.c | 6 ++--- drivers/media/rc/keymaps/rc-npgtech.c | 6 ++--- drivers/media/rc/keymaps/rc-pctv-sedna.c | 6 ++--- drivers/media/rc/keymaps/rc-pinnacle-color.c | 6 ++--- drivers/media/rc/keymaps/rc-pinnacle-grey.c | 6 ++--- drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c | 6 ++--- drivers/media/rc/keymaps/rc-pixelview-mk12.c | 6 ++--- drivers/media/rc/keymaps/rc-pixelview-new.c | 6 ++--- drivers/media/rc/keymaps/rc-pixelview.c | 6 ++--- .../media/rc/keymaps/rc-powercolor-real-angel.c | 6 ++--- drivers/media/rc/keymaps/rc-proteus-2309.c | 6 ++--- drivers/media/rc/keymaps/rc-purpletv.c | 6 ++--- drivers/media/rc/keymaps/rc-pv951.c | 6 ++--- drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c | 6 ++--- drivers/media/rc/keymaps/rc-rc5-tv.c | 6 ++--- drivers/media/rc/keymaps/rc-rc6-mce.c | 6 ++--- .../media/rc/keymaps/rc-real-audio-220-32-keys.c | 6 ++--- drivers/media/rc/keymaps/rc-streamzap.c | 6 ++--- drivers/media/rc/keymaps/rc-tbs-nec.c | 6 ++--- drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c | 6 ++--- drivers/media/rc/keymaps/rc-terratec-slim.c | 6 ++--- drivers/media/rc/keymaps/rc-tevii-nec.c | 6 ++--- drivers/media/rc/keymaps/rc-total-media-in-hand.c | 6 ++--- drivers/media/rc/keymaps/rc-trekstor.c | 6 ++--- drivers/media/rc/keymaps/rc-tt-1500.c | 6 ++--- drivers/media/rc/keymaps/rc-twinhan1027.c | 6 ++--- drivers/media/rc/keymaps/rc-videomate-s350.c | 6 ++--- drivers/media/rc/keymaps/rc-videomate-tv-pvr.c | 6 ++--- drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c | 6 ++--- drivers/media/rc/keymaps/rc-winfast.c | 6 ++--- drivers/media/rc/rc-main.c | 28 +++++++++++----------- include/media/rc-map.h | 8 +++---- 89 files changed, 280 insertions(+), 280 deletions(-) (limited to 'include') diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 572929a2cd6f..db6d54d3fec0 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -95,7 +95,7 @@ static struct rc_map_table mantis_ir_table[] = { { 0x00, KEY_BLUE }, }; -static struct rc_keymap ir_mantis_map = { +static struct rc_map_list ir_mantis_map = { .map = { .scan = mantis_ir_table, .size = ARRAY_SIZE(mantis_ir_table), @@ -109,7 +109,7 @@ int mantis_input_init(struct mantis_pci *mantis) struct rc_dev *dev; int err; - err = ir_register_map(&ir_mantis_map); + err = rc_map_register(&ir_mantis_map); if (err) goto out; @@ -145,7 +145,7 @@ int mantis_input_init(struct mantis_pci *mantis) out_dev: rc_free_device(dev); out_map: - ir_unregister_map(&ir_mantis_map); + rc_map_unregister(&ir_mantis_map); out: return err; } @@ -153,7 +153,7 @@ out: int mantis_exit(struct mantis_pci *mantis) { rc_unregister_device(mantis->rc); - ir_unregister_map(&ir_mantis_map); + rc_map_unregister(&ir_mantis_map); return 0; } diff --git a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c index da6556dd1cf6..136d3952dedc 100644 --- a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c +++ b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c @@ -63,7 +63,7 @@ static struct rc_map_table adstech_dvb_t_pci[] = { { 0x1c, KEY_VOLUMEDOWN }, }; -static struct rc_keymap adstech_dvb_t_pci_map = { +static struct rc_map_list adstech_dvb_t_pci_map = { .map = { .scan = adstech_dvb_t_pci, .size = ARRAY_SIZE(adstech_dvb_t_pci), @@ -74,12 +74,12 @@ static struct rc_keymap adstech_dvb_t_pci_map = { static int __init init_rc_map_adstech_dvb_t_pci(void) { - return ir_register_map(&adstech_dvb_t_pci_map); + return rc_map_register(&adstech_dvb_t_pci_map); } static void __exit exit_rc_map_adstech_dvb_t_pci(void) { - ir_unregister_map(&adstech_dvb_t_pci_map); + rc_map_unregister(&adstech_dvb_t_pci_map); } module_init(init_rc_map_adstech_dvb_t_pci) diff --git a/drivers/media/rc/keymaps/rc-alink-dtu-m.c b/drivers/media/rc/keymaps/rc-alink-dtu-m.c index 36e1eb1d8347..fe652e928dc0 100644 --- a/drivers/media/rc/keymaps/rc-alink-dtu-m.c +++ b/drivers/media/rc/keymaps/rc-alink-dtu-m.c @@ -42,7 +42,7 @@ static struct rc_map_table alink_dtu_m[] = { { 0x081d, KEY_CHANNELDOWN }, }; -static struct rc_keymap alink_dtu_m_map = { +static struct rc_map_list alink_dtu_m_map = { .map = { .scan = alink_dtu_m, .size = ARRAY_SIZE(alink_dtu_m), @@ -53,12 +53,12 @@ static struct rc_keymap alink_dtu_m_map = { static int __init init_rc_map_alink_dtu_m(void) { - return ir_register_map(&alink_dtu_m_map); + return rc_map_register(&alink_dtu_m_map); } static void __exit exit_rc_map_alink_dtu_m(void) { - ir_unregister_map(&alink_dtu_m_map); + rc_map_unregister(&alink_dtu_m_map); } module_init(init_rc_map_alink_dtu_m) diff --git a/drivers/media/rc/keymaps/rc-anysee.c b/drivers/media/rc/keymaps/rc-anysee.c index 6ca91e0704b9..884f1b51a8ee 100644 --- a/drivers/media/rc/keymaps/rc-anysee.c +++ b/drivers/media/rc/keymaps/rc-anysee.c @@ -67,7 +67,7 @@ static struct rc_map_table anysee[] = { { 0x0851, KEY_PAUSE }, }; -static struct rc_keymap anysee_map = { +static struct rc_map_list anysee_map = { .map = { .scan = anysee, .size = ARRAY_SIZE(anysee), @@ -78,12 +78,12 @@ static struct rc_keymap anysee_map = { static int __init init_rc_map_anysee(void) { - return ir_register_map(&anysee_map); + return rc_map_register(&anysee_map); } static void __exit exit_rc_map_anysee(void) { - ir_unregister_map(&anysee_map); + rc_map_unregister(&anysee_map); } module_init(init_rc_map_anysee) diff --git a/drivers/media/rc/keymaps/rc-apac-viewcomp.c b/drivers/media/rc/keymaps/rc-apac-viewcomp.c index a40a1b6ab6b1..7af188209ff9 100644 --- a/drivers/media/rc/keymaps/rc-apac-viewcomp.c +++ b/drivers/media/rc/keymaps/rc-apac-viewcomp.c @@ -54,7 +54,7 @@ static struct rc_map_table apac_viewcomp[] = { { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ }; -static struct rc_keymap apac_viewcomp_map = { +static struct rc_map_list apac_viewcomp_map = { .map = { .scan = apac_viewcomp, .size = ARRAY_SIZE(apac_viewcomp), @@ -65,12 +65,12 @@ static struct rc_keymap apac_viewcomp_map = { static int __init init_rc_map_apac_viewcomp(void) { - return ir_register_map(&apac_viewcomp_map); + return rc_map_register(&apac_viewcomp_map); } static void __exit exit_rc_map_apac_viewcomp(void) { - ir_unregister_map(&apac_viewcomp_map); + rc_map_unregister(&apac_viewcomp_map); } module_init(init_rc_map_apac_viewcomp) diff --git a/drivers/media/rc/keymaps/rc-asus-pc39.c b/drivers/media/rc/keymaps/rc-asus-pc39.c index 2a58ffe49bb6..b2481154491b 100644 --- a/drivers/media/rc/keymaps/rc-asus-pc39.c +++ b/drivers/media/rc/keymaps/rc-asus-pc39.c @@ -65,7 +65,7 @@ static struct rc_map_table asus_pc39[] = { { 0x083e, KEY_DVD }, /* dvd */ }; -static struct rc_keymap asus_pc39_map = { +static struct rc_map_list asus_pc39_map = { .map = { .scan = asus_pc39, .size = ARRAY_SIZE(asus_pc39), @@ -76,12 +76,12 @@ static struct rc_keymap asus_pc39_map = { static int __init init_rc_map_asus_pc39(void) { - return ir_register_map(&asus_pc39_map); + return rc_map_register(&asus_pc39_map); } static void __exit exit_rc_map_asus_pc39(void) { - ir_unregister_map(&asus_pc39_map); + rc_map_unregister(&asus_pc39_map); } module_init(init_rc_map_asus_pc39) diff --git a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c index ac0a7d981a92..f766b24b0158 100644 --- a/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c +++ b/drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c @@ -43,7 +43,7 @@ static struct rc_map_table ati_tv_wonder_hd_600[] = { { 0x17, KEY_VOLUMEDOWN}, }; -static struct rc_keymap ati_tv_wonder_hd_600_map = { +static struct rc_map_list ati_tv_wonder_hd_600_map = { .map = { .scan = ati_tv_wonder_hd_600, .size = ARRAY_SIZE(ati_tv_wonder_hd_600), @@ -54,12 +54,12 @@ static struct rc_keymap ati_tv_wonder_hd_600_map = { static int __init init_rc_map_ati_tv_wonder_hd_600(void) { - return ir_register_map(&ati_tv_wonder_hd_600_map); + return rc_map_register(&ati_tv_wonder_hd_600_map); } static void __exit exit_rc_map_ati_tv_wonder_hd_600(void) { - ir_unregister_map(&ati_tv_wonder_hd_600_map); + rc_map_unregister(&ati_tv_wonder_hd_600_map); } module_init(init_rc_map_ati_tv_wonder_hd_600) diff --git a/drivers/media/rc/keymaps/rc-avermedia-a16d.c b/drivers/media/rc/keymaps/rc-avermedia-a16d.c index df3360fb3dbe..ec9beeebd410 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-a16d.c +++ b/drivers/media/rc/keymaps/rc-avermedia-a16d.c @@ -49,7 +49,7 @@ static struct rc_map_table avermedia_a16d[] = { { 0x2a, KEY_MENU}, }; -static struct rc_keymap avermedia_a16d_map = { +static struct rc_map_list avermedia_a16d_map = { .map = { .scan = avermedia_a16d, .size = ARRAY_SIZE(avermedia_a16d), @@ -60,12 +60,12 @@ static struct rc_keymap avermedia_a16d_map = { static int __init init_rc_map_avermedia_a16d(void) { - return ir_register_map(&avermedia_a16d_map); + return rc_map_register(&avermedia_a16d_map); } static void __exit exit_rc_map_avermedia_a16d(void) { - ir_unregister_map(&avermedia_a16d_map); + rc_map_unregister(&avermedia_a16d_map); } module_init(init_rc_map_avermedia_a16d) diff --git a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c index 40f2f2d418c6..bdf97b74cf90 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c +++ b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c @@ -71,7 +71,7 @@ static struct rc_map_table avermedia_cardbus[] = { { 0x43, KEY_CHANNELUP }, /* Channel up */ }; -static struct rc_keymap avermedia_cardbus_map = { +static struct rc_map_list avermedia_cardbus_map = { .map = { .scan = avermedia_cardbus, .size = ARRAY_SIZE(avermedia_cardbus), @@ -82,12 +82,12 @@ static struct rc_keymap avermedia_cardbus_map = { static int __init init_rc_map_avermedia_cardbus(void) { - return ir_register_map(&avermedia_cardbus_map); + return rc_map_register(&avermedia_cardbus_map); } static void __exit exit_rc_map_avermedia_cardbus(void) { - ir_unregister_map(&avermedia_cardbus_map); + rc_map_unregister(&avermedia_cardbus_map); } module_init(init_rc_map_avermedia_cardbus) diff --git a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c index b4a1aa134360..3ddb41bc075e 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c +++ b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c @@ -52,7 +52,7 @@ static struct rc_map_table avermedia_dvbt[] = { { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ }; -static struct rc_keymap avermedia_dvbt_map = { +static struct rc_map_list avermedia_dvbt_map = { .map = { .scan = avermedia_dvbt, .size = ARRAY_SIZE(avermedia_dvbt), @@ -63,12 +63,12 @@ static struct rc_keymap avermedia_dvbt_map = { static int __init init_rc_map_avermedia_dvbt(void) { - return ir_register_map(&avermedia_dvbt_map); + return rc_map_register(&avermedia_dvbt_map); } static void __exit exit_rc_map_avermedia_dvbt(void) { - ir_unregister_map(&avermedia_dvbt_map); + rc_map_unregister(&avermedia_dvbt_map); } module_init(init_rc_map_avermedia_dvbt) diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c b/drivers/media/rc/keymaps/rc-avermedia-m135a.c index 971c6f979e94..357fea58a46e 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c +++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c @@ -121,7 +121,7 @@ static struct rc_map_table avermedia_m135a[] = { { 0x041e, KEY_NEXT }, }; -static struct rc_keymap avermedia_m135a_map = { +static struct rc_map_list avermedia_m135a_map = { .map = { .scan = avermedia_m135a, .size = ARRAY_SIZE(avermedia_m135a), @@ -132,12 +132,12 @@ static struct rc_keymap avermedia_m135a_map = { static int __init init_rc_map_avermedia_m135a(void) { - return ir_register_map(&avermedia_m135a_map); + return rc_map_register(&avermedia_m135a_map); } static void __exit exit_rc_map_avermedia_m135a(void) { - ir_unregister_map(&avermedia_m135a_map); + rc_map_unregister(&avermedia_m135a_map); } module_init(init_rc_map_avermedia_m135a) diff --git a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c index 74f3a20ff72a..e694e6eac37e 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c +++ b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c @@ -69,7 +69,7 @@ static struct rc_map_table avermedia_m733a_rm_k6[] = { { 0x041e, KEY_NEXT }, }; -static struct rc_keymap avermedia_m733a_rm_k6_map = { +static struct rc_map_list avermedia_m733a_rm_k6_map = { .map = { .scan = avermedia_m733a_rm_k6, .size = ARRAY_SIZE(avermedia_m733a_rm_k6), @@ -80,12 +80,12 @@ static struct rc_keymap avermedia_m733a_rm_k6_map = { static int __init init_rc_map_avermedia_m733a_rm_k6(void) { - return ir_register_map(&avermedia_m733a_rm_k6_map); + return rc_map_register(&avermedia_m733a_rm_k6_map); } static void __exit exit_rc_map_avermedia_m733a_rm_k6(void) { - ir_unregister_map(&avermedia_m733a_rm_k6_map); + rc_map_unregister(&avermedia_m733a_rm_k6_map); } module_init(init_rc_map_avermedia_m733a_rm_k6) diff --git a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c index dc6a32144e47..f4ca1fff455d 100644 --- a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c +++ b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c @@ -53,7 +53,7 @@ static struct rc_map_table avermedia_rm_ks[] = { { 0x0556, KEY_ZOOM }, }; -static struct rc_keymap avermedia_rm_ks_map = { +static struct rc_map_list avermedia_rm_ks_map = { .map = { .scan = avermedia_rm_ks, .size = ARRAY_SIZE(avermedia_rm_ks), @@ -64,12 +64,12 @@ static struct rc_keymap avermedia_rm_ks_map = { static int __init init_rc_map_avermedia_rm_ks(void) { - return ir_register_map(&avermedia_rm_ks_map); + return rc_map_register(&avermedia_rm_ks_map); } static void __exit exit_rc_map_avermedia_rm_ks(void) { - ir_unregister_map(&avermedia_rm_ks_map); + rc_map_unregister(&avermedia_rm_ks_map); } module_init(init_rc_map_avermedia_rm_ks) diff --git a/drivers/media/rc/keymaps/rc-avermedia.c b/drivers/media/rc/keymaps/rc-avermedia.c index a5ef695e1797..edfa71506d3e 100644 --- a/drivers/media/rc/keymaps/rc-avermedia.c +++ b/drivers/media/rc/keymaps/rc-avermedia.c @@ -60,7 +60,7 @@ static struct rc_map_table avermedia[] = { { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ }; -static struct rc_keymap avermedia_map = { +static struct rc_map_list avermedia_map = { .map = { .scan = avermedia, .size = ARRAY_SIZE(avermedia), @@ -71,12 +71,12 @@ static struct rc_keymap avermedia_map = { static int __init init_rc_map_avermedia(void) { - return ir_register_map(&avermedia_map); + return rc_map_register(&avermedia_map); } static void __exit exit_rc_map_avermedia(void) { - ir_unregister_map(&avermedia_map); + rc_map_unregister(&avermedia_map); } module_init(init_rc_map_avermedia) diff --git a/drivers/media/rc/keymaps/rc-avertv-303.c b/drivers/media/rc/keymaps/rc-avertv-303.c index 386ba5922046..32e94988dc94 100644 --- a/drivers/media/rc/keymaps/rc-avertv-303.c +++ b/drivers/media/rc/keymaps/rc-avertv-303.c @@ -59,7 +59,7 @@ static struct rc_map_table avertv_303[] = { { 0x1b, KEY_UP }, }; -static struct rc_keymap avertv_303_map = { +static struct rc_map_list avertv_303_map = { .map = { .scan = avertv_303, .size = ARRAY_SIZE(avertv_303), @@ -70,12 +70,12 @@ static struct rc_keymap avertv_303_map = { static int __init init_rc_map_avertv_303(void) { - return ir_register_map(&avertv_303_map); + return rc_map_register(&avertv_303_map); } static void __exit exit_rc_map_avertv_303(void) { - ir_unregister_map(&avertv_303_map); + rc_map_unregister(&avertv_303_map); } module_init(init_rc_map_avertv_303) diff --git a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c index fbaaba5f3893..c3f6d62ac892 100644 --- a/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c +++ b/drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c @@ -76,7 +76,7 @@ static struct rc_map_table azurewave_ad_tu700[] = { { 0x005f, KEY_BLUE }, }; -static struct rc_keymap azurewave_ad_tu700_map = { +static struct rc_map_list azurewave_ad_tu700_map = { .map = { .scan = azurewave_ad_tu700, .size = ARRAY_SIZE(azurewave_ad_tu700), @@ -87,12 +87,12 @@ static struct rc_keymap azurewave_ad_tu700_map = { static int __init init_rc_map_azurewave_ad_tu700(void) { - return ir_register_map(&azurewave_ad_tu700_map); + return rc_map_register(&azurewave_ad_tu700_map); } static void __exit exit_rc_map_azurewave_ad_tu700(void) { - ir_unregister_map(&azurewave_ad_tu700_map); + rc_map_unregister(&azurewave_ad_tu700_map); } module_init(init_rc_map_azurewave_ad_tu700) diff --git a/drivers/media/rc/keymaps/rc-behold-columbus.c b/drivers/media/rc/keymaps/rc-behold-columbus.c index 33accf5b3998..4b787fa94f08 100644 --- a/drivers/media/rc/keymaps/rc-behold-columbus.c +++ b/drivers/media/rc/keymaps/rc-behold-columbus.c @@ -82,7 +82,7 @@ static struct rc_map_table behold_columbus[] = { }; -static struct rc_keymap behold_columbus_map = { +static struct rc_map_list behold_columbus_map = { .map = { .scan = behold_columbus, .size = ARRAY_SIZE(behold_columbus), @@ -93,12 +93,12 @@ static struct rc_keymap behold_columbus_map = { static int __init init_rc_map_behold_columbus(void) { - return ir_register_map(&behold_columbus_map); + return rc_map_register(&behold_columbus_map); } static void __exit exit_rc_map_behold_columbus(void) { - ir_unregister_map(&behold_columbus_map); + rc_map_unregister(&behold_columbus_map); } module_init(init_rc_map_behold_columbus) diff --git a/drivers/media/rc/keymaps/rc-behold.c b/drivers/media/rc/keymaps/rc-behold.c index 4402414bacd9..ae4d2354c7b9 100644 --- a/drivers/media/rc/keymaps/rc-behold.c +++ b/drivers/media/rc/keymaps/rc-behold.c @@ -115,7 +115,7 @@ static struct rc_map_table behold[] = { }; -static struct rc_keymap behold_map = { +static struct rc_map_list behold_map = { .map = { .scan = behold, .size = ARRAY_SIZE(behold), @@ -126,12 +126,12 @@ static struct rc_keymap behold_map = { static int __init init_rc_map_behold(void) { - return ir_register_map(&behold_map); + return rc_map_register(&behold_map); } static void __exit exit_rc_map_behold(void) { - ir_unregister_map(&behold_map); + rc_map_unregister(&behold_map); } module_init(init_rc_map_behold) diff --git a/drivers/media/rc/keymaps/rc-budget-ci-old.c b/drivers/media/rc/keymaps/rc-budget-ci-old.c index e4827a6abf31..97fc3862f608 100644 --- a/drivers/media/rc/keymaps/rc-budget-ci-old.c +++ b/drivers/media/rc/keymaps/rc-budget-ci-old.c @@ -66,7 +66,7 @@ static struct rc_map_table budget_ci_old[] = { { 0x3e, KEY_TUNER }, }; -static struct rc_keymap budget_ci_old_map = { +static struct rc_map_list budget_ci_old_map = { .map = { .scan = budget_ci_old, .size = ARRAY_SIZE(budget_ci_old), @@ -77,12 +77,12 @@ static struct rc_keymap budget_ci_old_map = { static int __init init_rc_map_budget_ci_old(void) { - return ir_register_map(&budget_ci_old_map); + return rc_map_register(&budget_ci_old_map); } static void __exit exit_rc_map_budget_ci_old(void) { - ir_unregister_map(&budget_ci_old_map); + rc_map_unregister(&budget_ci_old_map); } module_init(init_rc_map_budget_ci_old) diff --git a/drivers/media/rc/keymaps/rc-cinergy-1400.c b/drivers/media/rc/keymaps/rc-cinergy-1400.c index 6a69866d836c..284534b67e7d 100644 --- a/drivers/media/rc/keymaps/rc-cinergy-1400.c +++ b/drivers/media/rc/keymaps/rc-cinergy-1400.c @@ -58,7 +58,7 @@ static struct rc_map_table cinergy_1400[] = { { 0x5c, KEY_NEXT }, }; -static struct rc_keymap cinergy_1400_map = { +static struct rc_map_list cinergy_1400_map = { .map = { .scan = cinergy_1400, .size = ARRAY_SIZE(cinergy_1400), @@ -69,12 +69,12 @@ static struct rc_keymap cinergy_1400_map = { static int __init init_rc_map_cinergy_1400(void) { - return ir_register_map(&cinergy_1400_map); + return rc_map_register(&cinergy_1400_map); } static void __exit exit_rc_map_cinergy_1400(void) { - ir_unregister_map(&cinergy_1400_map); + rc_map_unregister(&cinergy_1400_map); } module_init(init_rc_map_cinergy_1400) diff --git a/drivers/media/rc/keymaps/rc-cinergy.c b/drivers/media/rc/keymaps/rc-cinergy.c index ba36d14a01a0..99520ff65b61 100644 --- a/drivers/media/rc/keymaps/rc-cinergy.c +++ b/drivers/media/rc/keymaps/rc-cinergy.c @@ -52,7 +52,7 @@ static struct rc_map_table cinergy[] = { { 0x23, KEY_STOP }, }; -static struct rc_keymap cinergy_map = { +static struct rc_map_list cinergy_map = { .map = { .scan = cinergy, .size = ARRAY_SIZE(cinergy), @@ -63,12 +63,12 @@ static struct rc_keymap cinergy_map = { static int __init init_rc_map_cinergy(void) { - return ir_register_map(&cinergy_map); + return rc_map_register(&cinergy_map); } static void __exit exit_rc_map_cinergy(void) { - ir_unregister_map(&cinergy_map); + rc_map_unregister(&cinergy_map); } module_init(init_rc_map_cinergy) diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c index 921230d84b84..c59851b203da 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-nec.c +++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c @@ -98,7 +98,7 @@ static struct rc_map_table dib0700_nec_table[] = { { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */ }; -static struct rc_keymap dib0700_nec_map = { +static struct rc_map_list dib0700_nec_map = { .map = { .scan = dib0700_nec_table, .size = ARRAY_SIZE(dib0700_nec_table), @@ -109,12 +109,12 @@ static struct rc_keymap dib0700_nec_map = { static int __init init_rc_map(void) { - return ir_register_map(&dib0700_nec_map); + return rc_map_register(&dib0700_nec_map); } static void __exit exit_rc_map(void) { - ir_unregister_map(&dib0700_nec_map); + rc_map_unregister(&dib0700_nec_map); } module_init(init_rc_map) diff --git a/drivers/media/rc/keymaps/rc-dib0700-rc5.c b/drivers/media/rc/keymaps/rc-dib0700-rc5.c index 9febb722c402..4af12e45dfba 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-rc5.c +++ b/drivers/media/rc/keymaps/rc-dib0700-rc5.c @@ -209,7 +209,7 @@ static struct rc_map_table dib0700_rc5_table[] = { { 0x1d3d, KEY_POWER }, }; -static struct rc_keymap dib0700_rc5_map = { +static struct rc_map_list dib0700_rc5_map = { .map = { .scan = dib0700_rc5_table, .size = ARRAY_SIZE(dib0700_rc5_table), @@ -220,12 +220,12 @@ static struct rc_keymap dib0700_rc5_map = { static int __init init_rc_map(void) { - return ir_register_map(&dib0700_rc5_map); + return rc_map_register(&dib0700_rc5_map); } static void __exit exit_rc_map(void) { - ir_unregister_map(&dib0700_rc5_map); + rc_map_unregister(&dib0700_rc5_map); } module_init(init_rc_map) diff --git a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c index da50d7dbb9ef..f68b450f5593 100644 --- a/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c +++ b/drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c @@ -72,7 +72,7 @@ static struct rc_map_table digitalnow_tinytwin[] = { { 0x005a, KEY_PREVIOUS }, /* REPLAY */ }; -static struct rc_keymap digitalnow_tinytwin_map = { +static struct rc_map_list digitalnow_tinytwin_map = { .map = { .scan = digitalnow_tinytwin, .size = ARRAY_SIZE(digitalnow_tinytwin), @@ -83,12 +83,12 @@ static struct rc_keymap digitalnow_tinytwin_map = { static int __init init_rc_map_digitalnow_tinytwin(void) { - return ir_register_map(&digitalnow_tinytwin_map); + return rc_map_register(&digitalnow_tinytwin_map); } static void __exit exit_rc_map_digitalnow_tinytwin(void) { - ir_unregister_map(&digitalnow_tinytwin_map); + rc_map_unregister(&digitalnow_tinytwin_map); } module_init(init_rc_map_digitalnow_tinytwin) diff --git a/drivers/media/rc/keymaps/rc-digittrade.c b/drivers/media/rc/keymaps/rc-digittrade.c index 706f95dd6bdc..21d49871f2a3 100644 --- a/drivers/media/rc/keymaps/rc-digittrade.c +++ b/drivers/media/rc/keymaps/rc-digittrade.c @@ -56,7 +56,7 @@ static struct rc_map_table digittrade[] = { { 0x0054, KEY_0 }, }; -static struct rc_keymap digittrade_map = { +static struct rc_map_list digittrade_map = { .map = { .scan = digittrade, .size = ARRAY_SIZE(digittrade), @@ -67,12 +67,12 @@ static struct rc_keymap digittrade_map = { static int __init init_rc_map_digittrade(void) { - return ir_register_map(&digittrade_map); + return rc_map_register(&digittrade_map); } static void __exit exit_rc_map_digittrade(void) { - ir_unregister_map(&digittrade_map); + rc_map_unregister(&digittrade_map); } module_init(init_rc_map_digittrade) diff --git a/drivers/media/rc/keymaps/rc-dm1105-nec.c b/drivers/media/rc/keymaps/rc-dm1105-nec.c index 9023dc9a65aa..d024fbf88bc4 100644 --- a/drivers/media/rc/keymaps/rc-dm1105-nec.c +++ b/drivers/media/rc/keymaps/rc-dm1105-nec.c @@ -50,7 +50,7 @@ static struct rc_map_table dm1105_nec[] = { { 0x1b, KEY_B}, /* recall */ }; -static struct rc_keymap dm1105_nec_map = { +static struct rc_map_list dm1105_nec_map = { .map = { .scan = dm1105_nec, .size = ARRAY_SIZE(dm1105_nec), @@ -61,12 +61,12 @@ static struct rc_keymap dm1105_nec_map = { static int __init init_rc_map_dm1105_nec(void) { - return ir_register_map(&dm1105_nec_map); + return rc_map_register(&dm1105_nec_map); } static void __exit exit_rc_map_dm1105_nec(void) { - ir_unregister_map(&dm1105_nec_map); + rc_map_unregister(&dm1105_nec_map); } module_init(init_rc_map_dm1105_nec) diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c index 7fbeaed46516..43912bd02a9e 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c @@ -52,7 +52,7 @@ static struct rc_map_table dntv_live_dvb_t[] = { { 0x1f, KEY_VOLUMEDOWN }, }; -static struct rc_keymap dntv_live_dvb_t_map = { +static struct rc_map_list dntv_live_dvb_t_map = { .map = { .scan = dntv_live_dvb_t, .size = ARRAY_SIZE(dntv_live_dvb_t), @@ -63,12 +63,12 @@ static struct rc_keymap dntv_live_dvb_t_map = { static int __init init_rc_map_dntv_live_dvb_t(void) { - return ir_register_map(&dntv_live_dvb_t_map); + return rc_map_register(&dntv_live_dvb_t_map); } static void __exit exit_rc_map_dntv_live_dvb_t(void) { - ir_unregister_map(&dntv_live_dvb_t_map); + rc_map_unregister(&dntv_live_dvb_t_map); } module_init(init_rc_map_dntv_live_dvb_t) diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c index 660f2e793d9a..015e99de06de 100644 --- a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c +++ b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c @@ -71,7 +71,7 @@ static struct rc_map_table dntv_live_dvbt_pro[] = { { 0x5d, KEY_BLUE }, }; -static struct rc_keymap dntv_live_dvbt_pro_map = { +static struct rc_map_list dntv_live_dvbt_pro_map = { .map = { .scan = dntv_live_dvbt_pro, .size = ARRAY_SIZE(dntv_live_dvbt_pro), @@ -82,12 +82,12 @@ static struct rc_keymap dntv_live_dvbt_pro_map = { static int __init init_rc_map_dntv_live_dvbt_pro(void) { - return ir_register_map(&dntv_live_dvbt_pro_map); + return rc_map_register(&dntv_live_dvbt_pro_map); } static void __exit exit_rc_map_dntv_live_dvbt_pro(void) { - ir_unregister_map(&dntv_live_dvbt_pro_map); + rc_map_unregister(&dntv_live_dvbt_pro_map); } module_init(init_rc_map_dntv_live_dvbt_pro) diff --git a/drivers/media/rc/keymaps/rc-em-terratec.c b/drivers/media/rc/keymaps/rc-em-terratec.c index 4d0ad8ca41a2..269d4299da34 100644 --- a/drivers/media/rc/keymaps/rc-em-terratec.c +++ b/drivers/media/rc/keymaps/rc-em-terratec.c @@ -43,7 +43,7 @@ static struct rc_map_table em_terratec[] = { { 0x40, KEY_ZOOM }, }; -static struct rc_keymap em_terratec_map = { +static struct rc_map_list em_terratec_map = { .map = { .scan = em_terratec, .size = ARRAY_SIZE(em_terratec), @@ -54,12 +54,12 @@ static struct rc_keymap em_terratec_map = { static int __init init_rc_map_em_terratec(void) { - return ir_register_map(&em_terratec_map); + return rc_map_register(&em_terratec_map); } static void __exit exit_rc_map_em_terratec(void) { - ir_unregister_map(&em_terratec_map); + rc_map_unregister(&em_terratec_map); } module_init(init_rc_map_em_terratec) diff --git a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c index 3005d4baf211..e388698a0697 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c @@ -55,7 +55,7 @@ static struct rc_map_table encore_enltv_fm53[] = { { 0x47, KEY_SLEEP}, /* shutdown */ }; -static struct rc_keymap encore_enltv_fm53_map = { +static struct rc_map_list encore_enltv_fm53_map = { .map = { .scan = encore_enltv_fm53, .size = ARRAY_SIZE(encore_enltv_fm53), @@ -66,12 +66,12 @@ static struct rc_keymap encore_enltv_fm53_map = { static int __init init_rc_map_encore_enltv_fm53(void) { - return ir_register_map(&encore_enltv_fm53_map); + return rc_map_register(&encore_enltv_fm53_map); } static void __exit exit_rc_map_encore_enltv_fm53(void) { - ir_unregister_map(&encore_enltv_fm53_map); + rc_map_unregister(&encore_enltv_fm53_map); } module_init(init_rc_map_encore_enltv_fm53) diff --git a/drivers/media/rc/keymaps/rc-encore-enltv.c b/drivers/media/rc/keymaps/rc-encore-enltv.c index d16db500ed31..afa4e92284ef 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv.c @@ -86,7 +86,7 @@ static struct rc_map_table encore_enltv[] = { { 0x57, KEY_BLUE }, /* AP4 */ }; -static struct rc_keymap encore_enltv_map = { +static struct rc_map_list encore_enltv_map = { .map = { .scan = encore_enltv, .size = ARRAY_SIZE(encore_enltv), @@ -97,12 +97,12 @@ static struct rc_keymap encore_enltv_map = { static int __init init_rc_map_encore_enltv(void) { - return ir_register_map(&encore_enltv_map); + return rc_map_register(&encore_enltv_map); } static void __exit exit_rc_map_encore_enltv(void) { - ir_unregister_map(&encore_enltv_map); + rc_map_unregister(&encore_enltv_map); } module_init(init_rc_map_encore_enltv) diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c index a5e07c7e6eaf..7d5b00ed4ff2 100644 --- a/drivers/media/rc/keymaps/rc-encore-enltv2.c +++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c @@ -64,7 +64,7 @@ static struct rc_map_table encore_enltv2[] = { { 0x79, KEY_STOP }, }; -static struct rc_keymap encore_enltv2_map = { +static struct rc_map_list encore_enltv2_map = { .map = { .scan = encore_enltv2, .size = ARRAY_SIZE(encore_enltv2), @@ -75,12 +75,12 @@ static struct rc_keymap encore_enltv2_map = { static int __init init_rc_map_encore_enltv2(void) { - return ir_register_map(&encore_enltv2_map); + return rc_map_register(&encore_enltv2_map); } static void __exit exit_rc_map_encore_enltv2(void) { - ir_unregister_map(&encore_enltv2_map); + rc_map_unregister(&encore_enltv2_map); } module_init(init_rc_map_encore_enltv2) diff --git a/drivers/media/rc/keymaps/rc-evga-indtube.c b/drivers/media/rc/keymaps/rc-evga-indtube.c index e2d0590d3323..a2bf24f6dfbb 100644 --- a/drivers/media/rc/keymaps/rc-evga-indtube.c +++ b/drivers/media/rc/keymaps/rc-evga-indtube.c @@ -35,7 +35,7 @@ static struct rc_map_table evga_indtube[] = { { 0x13, KEY_CAMERA}, }; -static struct rc_keymap evga_indtube_map = { +static struct rc_map_list evga_indtube_map = { .map = { .scan = evga_indtube, .size = ARRAY_SIZE(evga_indtube), @@ -46,12 +46,12 @@ static struct rc_keymap evga_indtube_map = { static int __init init_rc_map_evga_indtube(void) { - return ir_register_map(&evga_indtube_map); + return rc_map_register(&evga_indtube_map); } static void __exit exit_rc_map_evga_indtube(void) { - ir_unregister_map(&evga_indtube_map); + rc_map_unregister(&evga_indtube_map); } module_init(init_rc_map_evga_indtube) diff --git a/drivers/media/rc/keymaps/rc-eztv.c b/drivers/media/rc/keymaps/rc-eztv.c index ee134c58d033..1e8e5b2d6e36 100644 --- a/drivers/media/rc/keymaps/rc-eztv.c +++ b/drivers/media/rc/keymaps/rc-eztv.c @@ -70,7 +70,7 @@ static struct rc_map_table eztv[] = { { 0x21, KEY_DOT }, /* . (decimal dot) */ }; -static struct rc_keymap eztv_map = { +static struct rc_map_list eztv_map = { .map = { .scan = eztv, .size = ARRAY_SIZE(eztv), @@ -81,12 +81,12 @@ static struct rc_keymap eztv_map = { static int __init init_rc_map_eztv(void) { - return ir_register_map(&eztv_map); + return rc_map_register(&eztv_map); } static void __exit exit_rc_map_eztv(void) { - ir_unregister_map(&eztv_map); + rc_map_unregister(&eztv_map); } module_init(init_rc_map_eztv) diff --git a/drivers/media/rc/keymaps/rc-flydvb.c b/drivers/media/rc/keymaps/rc-flydvb.c index ef90a05a16f2..aea2f4acf7d8 100644 --- a/drivers/media/rc/keymaps/rc-flydvb.c +++ b/drivers/media/rc/keymaps/rc-flydvb.c @@ -51,7 +51,7 @@ static struct rc_map_table flydvb[] = { { 0x0e, KEY_NEXT }, /* End >>| */ }; -static struct rc_keymap flydvb_map = { +static struct rc_map_list flydvb_map = { .map = { .scan = flydvb, .size = ARRAY_SIZE(flydvb), @@ -62,12 +62,12 @@ static struct rc_keymap flydvb_map = { static int __init init_rc_map_flydvb(void) { - return ir_register_map(&flydvb_map); + return rc_map_register(&flydvb_map); } static void __exit exit_rc_map_flydvb(void) { - ir_unregister_map(&flydvb_map); + rc_map_unregister(&flydvb_map); } module_init(init_rc_map_flydvb) diff --git a/drivers/media/rc/keymaps/rc-flyvideo.c b/drivers/media/rc/keymaps/rc-flyvideo.c index 20a133325e6e..5bbe68371756 100644 --- a/drivers/media/rc/keymaps/rc-flyvideo.c +++ b/drivers/media/rc/keymaps/rc-flyvideo.c @@ -44,7 +44,7 @@ static struct rc_map_table flyvideo[] = { { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ }; -static struct rc_keymap flyvideo_map = { +static struct rc_map_list flyvideo_map = { .map = { .scan = flyvideo, .size = ARRAY_SIZE(flyvideo), @@ -55,12 +55,12 @@ static struct rc_keymap flyvideo_map = { static int __init init_rc_map_flyvideo(void) { - return ir_register_map(&flyvideo_map); + return rc_map_register(&flyvideo_map); } static void __exit exit_rc_map_flyvideo(void) { - ir_unregister_map(&flyvideo_map); + rc_map_unregister(&flyvideo_map); } module_init(init_rc_map_flyvideo) diff --git a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c index 2687af77a806..c80b25c65b57 100644 --- a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c +++ b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c @@ -72,7 +72,7 @@ static struct rc_map_table fusionhdtv_mce[] = { { 0x4e, KEY_POWER }, }; -static struct rc_keymap fusionhdtv_mce_map = { +static struct rc_map_list fusionhdtv_mce_map = { .map = { .scan = fusionhdtv_mce, .size = ARRAY_SIZE(fusionhdtv_mce), @@ -83,12 +83,12 @@ static struct rc_keymap fusionhdtv_mce_map = { static int __init init_rc_map_fusionhdtv_mce(void) { - return ir_register_map(&fusionhdtv_mce_map); + return rc_map_register(&fusionhdtv_mce_map); } static void __exit exit_rc_map_fusionhdtv_mce(void) { - ir_unregister_map(&fusionhdtv_mce_map); + rc_map_unregister(&fusionhdtv_mce_map); } module_init(init_rc_map_fusionhdtv_mce) diff --git a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c index fb247baafde1..068c9ead98dd 100644 --- a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c +++ b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c @@ -55,7 +55,7 @@ static struct rc_map_table gadmei_rm008z[] = { { 0x15, KEY_ENTER}, /* OK */ }; -static struct rc_keymap gadmei_rm008z_map = { +static struct rc_map_list gadmei_rm008z_map = { .map = { .scan = gadmei_rm008z, .size = ARRAY_SIZE(gadmei_rm008z), @@ -66,12 +66,12 @@ static struct rc_keymap gadmei_rm008z_map = { static int __init init_rc_map_gadmei_rm008z(void) { - return ir_register_map(&gadmei_rm008z_map); + return rc_map_register(&gadmei_rm008z_map); } static void __exit exit_rc_map_gadmei_rm008z(void) { - ir_unregister_map(&gadmei_rm008z_map); + rc_map_unregister(&gadmei_rm008z_map); } module_init(init_rc_map_gadmei_rm008z) diff --git a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c index 7e6834acc87f..cdbbed467926 100644 --- a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c +++ b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c @@ -58,7 +58,7 @@ static struct rc_map_table genius_tvgo_a11mce[] = { { 0x50, KEY_BLUE }, }; -static struct rc_keymap genius_tvgo_a11mce_map = { +static struct rc_map_list genius_tvgo_a11mce_map = { .map = { .scan = genius_tvgo_a11mce, .size = ARRAY_SIZE(genius_tvgo_a11mce), @@ -69,12 +69,12 @@ static struct rc_keymap genius_tvgo_a11mce_map = { static int __init init_rc_map_genius_tvgo_a11mce(void) { - return ir_register_map(&genius_tvgo_a11mce_map); + return rc_map_register(&genius_tvgo_a11mce_map); } static void __exit exit_rc_map_genius_tvgo_a11mce(void) { - ir_unregister_map(&genius_tvgo_a11mce_map); + rc_map_unregister(&genius_tvgo_a11mce_map); } module_init(init_rc_map_genius_tvgo_a11mce) diff --git a/drivers/media/rc/keymaps/rc-gotview7135.c b/drivers/media/rc/keymaps/rc-gotview7135.c index 54222caeff7c..a38bdde8c140 100644 --- a/drivers/media/rc/keymaps/rc-gotview7135.c +++ b/drivers/media/rc/keymaps/rc-gotview7135.c @@ -53,7 +53,7 @@ static struct rc_map_table gotview7135[] = { { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ }; -static struct rc_keymap gotview7135_map = { +static struct rc_map_list gotview7135_map = { .map = { .scan = gotview7135, .size = ARRAY_SIZE(gotview7135), @@ -64,12 +64,12 @@ static struct rc_keymap gotview7135_map = { static int __init init_rc_map_gotview7135(void) { - return ir_register_map(&gotview7135_map); + return rc_map_register(&gotview7135_map); } static void __exit exit_rc_map_gotview7135(void) { - ir_unregister_map(&gotview7135_map); + rc_map_unregister(&gotview7135_map); } module_init(init_rc_map_gotview7135) diff --git a/drivers/media/rc/keymaps/rc-hauppauge-new.c b/drivers/media/rc/keymaps/rc-hauppauge-new.c index 239625785f68..bd11da46e56a 100644 --- a/drivers/media/rc/keymaps/rc-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-hauppauge-new.c @@ -74,7 +74,7 @@ static struct rc_map_table hauppauge_new[] = { { 0x3d, KEY_POWER }, /* system power (green button) */ }; -static struct rc_keymap hauppauge_new_map = { +static struct rc_map_list hauppauge_new_map = { .map = { .scan = hauppauge_new, .size = ARRAY_SIZE(hauppauge_new), @@ -85,12 +85,12 @@ static struct rc_keymap hauppauge_new_map = { static int __init init_rc_map_hauppauge_new(void) { - return ir_register_map(&hauppauge_new_map); + return rc_map_register(&hauppauge_new_map); } static void __exit exit_rc_map_hauppauge_new(void) { - ir_unregister_map(&hauppauge_new_map); + rc_map_unregister(&hauppauge_new_map); } module_init(init_rc_map_hauppauge_new) diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c index 291e5d8850ec..cb67184e015c 100644 --- a/drivers/media/rc/keymaps/rc-imon-mce.c +++ b/drivers/media/rc/keymaps/rc-imon-mce.c @@ -115,7 +115,7 @@ static struct rc_map_table imon_mce[] = { }; -static struct rc_keymap imon_mce_map = { +static struct rc_map_list imon_mce_map = { .map = { .scan = imon_mce, .size = ARRAY_SIZE(imon_mce), @@ -127,12 +127,12 @@ static struct rc_keymap imon_mce_map = { static int __init init_rc_map_imon_mce(void) { - return ir_register_map(&imon_mce_map); + return rc_map_register(&imon_mce_map); } static void __exit exit_rc_map_imon_mce(void) { - ir_unregister_map(&imon_mce_map); + rc_map_unregister(&imon_mce_map); } module_init(init_rc_map_imon_mce) diff --git a/drivers/media/rc/keymaps/rc-imon-pad.c b/drivers/media/rc/keymaps/rc-imon-pad.c index 33f28d428ef9..eef46b73ca7b 100644 --- a/drivers/media/rc/keymaps/rc-imon-pad.c +++ b/drivers/media/rc/keymaps/rc-imon-pad.c @@ -129,7 +129,7 @@ static struct rc_map_table imon_pad[] = { { 0x29b715b7, KEY_DASHBOARD }, /* AppLauncher */ }; -static struct rc_keymap imon_pad_map = { +static struct rc_map_list imon_pad_map = { .map = { .scan = imon_pad, .size = ARRAY_SIZE(imon_pad), @@ -141,12 +141,12 @@ static struct rc_keymap imon_pad_map = { static int __init init_rc_map_imon_pad(void) { - return ir_register_map(&imon_pad_map); + return rc_map_register(&imon_pad_map); } static void __exit exit_rc_map_imon_pad(void) { - ir_unregister_map(&imon_pad_map); + rc_map_unregister(&imon_pad_map); } module_init(init_rc_map_imon_pad) diff --git a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c index 5e5263f2380d..1f59e163f75d 100644 --- a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c +++ b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c @@ -62,7 +62,7 @@ static struct rc_map_table iodata_bctv7e[] = { { 0x01, KEY_NEXT }, /* skip >| */ }; -static struct rc_keymap iodata_bctv7e_map = { +static struct rc_map_list iodata_bctv7e_map = { .map = { .scan = iodata_bctv7e, .size = ARRAY_SIZE(iodata_bctv7e), @@ -73,12 +73,12 @@ static struct rc_keymap iodata_bctv7e_map = { static int __init init_rc_map_iodata_bctv7e(void) { - return ir_register_map(&iodata_bctv7e_map); + return rc_map_register(&iodata_bctv7e_map); } static void __exit exit_rc_map_iodata_bctv7e(void) { - ir_unregister_map(&iodata_bctv7e_map); + rc_map_unregister(&iodata_bctv7e_map); } module_init(init_rc_map_iodata_bctv7e) diff --git a/drivers/media/rc/keymaps/rc-kaiomy.c b/drivers/media/rc/keymaps/rc-kaiomy.c index 527ab1b5fb6f..f31dc5c1ad9c 100644 --- a/drivers/media/rc/keymaps/rc-kaiomy.c +++ b/drivers/media/rc/keymaps/rc-kaiomy.c @@ -61,7 +61,7 @@ static struct rc_map_table kaiomy[] = { { 0x1f, KEY_BLUE}, }; -static struct rc_keymap kaiomy_map = { +static struct rc_map_list kaiomy_map = { .map = { .scan = kaiomy, .size = ARRAY_SIZE(kaiomy), @@ -72,12 +72,12 @@ static struct rc_keymap kaiomy_map = { static int __init init_rc_map_kaiomy(void) { - return ir_register_map(&kaiomy_map); + return rc_map_register(&kaiomy_map); } static void __exit exit_rc_map_kaiomy(void) { - ir_unregister_map(&kaiomy_map); + rc_map_unregister(&kaiomy_map); } module_init(init_rc_map_kaiomy) diff --git a/drivers/media/rc/keymaps/rc-kworld-315u.c b/drivers/media/rc/keymaps/rc-kworld-315u.c index f58703e2a3ac..3ce6ef79fc34 100644 --- a/drivers/media/rc/keymaps/rc-kworld-315u.c +++ b/drivers/media/rc/keymaps/rc-kworld-315u.c @@ -57,7 +57,7 @@ static struct rc_map_table kworld_315u[] = { { 0x611f, KEY_BLUE }, }; -static struct rc_keymap kworld_315u_map = { +static struct rc_map_list kworld_315u_map = { .map = { .scan = kworld_315u, .size = ARRAY_SIZE(kworld_315u), @@ -68,12 +68,12 @@ static struct rc_keymap kworld_315u_map = { static int __init init_rc_map_kworld_315u(void) { - return ir_register_map(&kworld_315u_map); + return rc_map_register(&kworld_315u_map); } static void __exit exit_rc_map_kworld_315u(void) { - ir_unregister_map(&kworld_315u_map); + rc_map_unregister(&kworld_315u_map); } module_init(init_rc_map_kworld_315u) diff --git a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c index f6235bbad507..e45f0b8759d0 100644 --- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c +++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c @@ -73,7 +73,7 @@ static struct rc_map_table kworld_plus_tv_analog[] = { { 0x23, KEY_GREEN}, /* C */ }; -static struct rc_keymap kworld_plus_tv_analog_map = { +static struct rc_map_list kworld_plus_tv_analog_map = { .map = { .scan = kworld_plus_tv_analog, .size = ARRAY_SIZE(kworld_plus_tv_analog), @@ -84,12 +84,12 @@ static struct rc_keymap kworld_plus_tv_analog_map = { static int __init init_rc_map_kworld_plus_tv_analog(void) { - return ir_register_map(&kworld_plus_tv_analog_map); + return rc_map_register(&kworld_plus_tv_analog_map); } static void __exit exit_rc_map_kworld_plus_tv_analog(void) { - ir_unregister_map(&kworld_plus_tv_analog_map); + rc_map_unregister(&kworld_plus_tv_analog_map); } module_init(init_rc_map_kworld_plus_tv_analog) diff --git a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c index e1b8726daa51..8faa54ff16e6 100644 --- a/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c +++ b/drivers/media/rc/keymaps/rc-leadtek-y04g0051.c @@ -73,7 +73,7 @@ static struct rc_map_table leadtek_y04g0051[] = { { 0x035f, KEY_CHANNELDOWN }, }; -static struct rc_keymap leadtek_y04g0051_map = { +static struct rc_map_list leadtek_y04g0051_map = { .map = { .scan = leadtek_y04g0051, .size = ARRAY_SIZE(leadtek_y04g0051), @@ -84,12 +84,12 @@ static struct rc_keymap leadtek_y04g0051_map = { static int __init init_rc_map_leadtek_y04g0051(void) { - return ir_register_map(&leadtek_y04g0051_map); + return rc_map_register(&leadtek_y04g0051_map); } static void __exit exit_rc_map_leadtek_y04g0051(void) { - ir_unregister_map(&leadtek_y04g0051_map); + rc_map_unregister(&leadtek_y04g0051_map); } module_init(init_rc_map_leadtek_y04g0051) diff --git a/drivers/media/rc/keymaps/rc-lirc.c b/drivers/media/rc/keymaps/rc-lirc.c index d4dfee72b8ca..e8e23e233c39 100644 --- a/drivers/media/rc/keymaps/rc-lirc.c +++ b/drivers/media/rc/keymaps/rc-lirc.c @@ -15,7 +15,7 @@ static struct rc_map_table lirc[] = { { }, }; -static struct rc_keymap lirc_map = { +static struct rc_map_list lirc_map = { .map = { .scan = lirc, .size = ARRAY_SIZE(lirc), @@ -26,12 +26,12 @@ static struct rc_keymap lirc_map = { static int __init init_rc_map_lirc(void) { - return ir_register_map(&lirc_map); + return rc_map_register(&lirc_map); } static void __exit exit_rc_map_lirc(void) { - ir_unregister_map(&lirc_map); + rc_map_unregister(&lirc_map); } module_init(init_rc_map_lirc) diff --git a/drivers/media/rc/keymaps/rc-lme2510.c b/drivers/media/rc/keymaps/rc-lme2510.c index eb2d39698ef0..875cd81477c7 100644 --- a/drivers/media/rc/keymaps/rc-lme2510.c +++ b/drivers/media/rc/keymaps/rc-lme2510.c @@ -42,7 +42,7 @@ static struct rc_map_table lme2510_rc[] = { }; -static struct rc_keymap lme2510_map = { +static struct rc_map_list lme2510_map = { .map = { .scan = lme2510_rc, .size = ARRAY_SIZE(lme2510_rc), @@ -53,12 +53,12 @@ static struct rc_keymap lme2510_map = { static int __init init_rc_lme2510_map(void) { - return ir_register_map(&lme2510_map); + return rc_map_register(&lme2510_map); } static void __exit exit_rc_lme2510_map(void) { - ir_unregister_map(&lme2510_map); + rc_map_unregister(&lme2510_map); } module_init(init_rc_lme2510_map) diff --git a/drivers/media/rc/keymaps/rc-manli.c b/drivers/media/rc/keymaps/rc-manli.c index b24b0821da5a..23b2d04e7a9f 100644 --- a/drivers/media/rc/keymaps/rc-manli.c +++ b/drivers/media/rc/keymaps/rc-manli.c @@ -108,7 +108,7 @@ static struct rc_map_table manli[] = { /* 0x1d unused ? */ }; -static struct rc_keymap manli_map = { +static struct rc_map_list manli_map = { .map = { .scan = manli, .size = ARRAY_SIZE(manli), @@ -119,12 +119,12 @@ static struct rc_keymap manli_map = { static int __init init_rc_map_manli(void) { - return ir_register_map(&manli_map); + return rc_map_register(&manli_map); } static void __exit exit_rc_map_manli(void) { - ir_unregister_map(&manli_map); + rc_map_unregister(&manli_map); } module_init(init_rc_map_manli) diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c index 4ad89b79a3e8..7b9a01b6e4cf 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-ii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-ii.c @@ -41,7 +41,7 @@ static struct rc_map_table msi_digivox_ii[] = { { 0x001f, KEY_VOLUMEDOWN }, }; -static struct rc_keymap msi_digivox_ii_map = { +static struct rc_map_list msi_digivox_ii_map = { .map = { .scan = msi_digivox_ii, .size = ARRAY_SIZE(msi_digivox_ii), @@ -52,12 +52,12 @@ static struct rc_keymap msi_digivox_ii_map = { static int __init init_rc_map_msi_digivox_ii(void) { - return ir_register_map(&msi_digivox_ii_map); + return rc_map_register(&msi_digivox_ii_map); } static void __exit exit_rc_map_msi_digivox_ii(void) { - ir_unregister_map(&msi_digivox_ii_map); + rc_map_unregister(&msi_digivox_ii_map); } module_init(init_rc_map_msi_digivox_ii) diff --git a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c index d3304e798356..ae9d06b39157 100644 --- a/drivers/media/rc/keymaps/rc-msi-digivox-iii.c +++ b/drivers/media/rc/keymaps/rc-msi-digivox-iii.c @@ -59,7 +59,7 @@ static struct rc_map_table msi_digivox_iii[] = { { 0x61d643, KEY_POWER2 }, /* [red power button] */ }; -static struct rc_keymap msi_digivox_iii_map = { +static struct rc_map_list msi_digivox_iii_map = { .map = { .scan = msi_digivox_iii, .size = ARRAY_SIZE(msi_digivox_iii), @@ -70,12 +70,12 @@ static struct rc_keymap msi_digivox_iii_map = { static int __init init_rc_map_msi_digivox_iii(void) { - return ir_register_map(&msi_digivox_iii_map); + return rc_map_register(&msi_digivox_iii_map); } static void __exit exit_rc_map_msi_digivox_iii(void) { - ir_unregister_map(&msi_digivox_iii_map); + rc_map_unregister(&msi_digivox_iii_map); } module_init(init_rc_map_msi_digivox_iii) diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c index 51999c469884..fa8fd0ab94c7 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c @@ -97,7 +97,7 @@ static struct rc_map_table msi_tvanywhere_plus[] = { { 0x1d, KEY_RESTART }, /* Reset */ }; -static struct rc_keymap msi_tvanywhere_plus_map = { +static struct rc_map_list msi_tvanywhere_plus_map = { .map = { .scan = msi_tvanywhere_plus, .size = ARRAY_SIZE(msi_tvanywhere_plus), @@ -108,12 +108,12 @@ static struct rc_keymap msi_tvanywhere_plus_map = { static int __init init_rc_map_msi_tvanywhere_plus(void) { - return ir_register_map(&msi_tvanywhere_plus_map); + return rc_map_register(&msi_tvanywhere_plus_map); } static void __exit exit_rc_map_msi_tvanywhere_plus(void) { - ir_unregister_map(&msi_tvanywhere_plus_map); + rc_map_unregister(&msi_tvanywhere_plus_map); } module_init(init_rc_map_msi_tvanywhere_plus) diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c index 619df9dcbf12..18b37facb0dd 100644 --- a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c +++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c @@ -43,7 +43,7 @@ static struct rc_map_table msi_tvanywhere[] = { { 0x1f, KEY_VOLUMEDOWN }, }; -static struct rc_keymap msi_tvanywhere_map = { +static struct rc_map_list msi_tvanywhere_map = { .map = { .scan = msi_tvanywhere, .size = ARRAY_SIZE(msi_tvanywhere), @@ -54,12 +54,12 @@ static struct rc_keymap msi_tvanywhere_map = { static int __init init_rc_map_msi_tvanywhere(void) { - return ir_register_map(&msi_tvanywhere_map); + return rc_map_register(&msi_tvanywhere_map); } static void __exit exit_rc_map_msi_tvanywhere(void) { - ir_unregister_map(&msi_tvanywhere_map); + rc_map_unregister(&msi_tvanywhere_map); } module_init(init_rc_map_msi_tvanywhere) diff --git a/drivers/media/rc/keymaps/rc-nebula.c b/drivers/media/rc/keymaps/rc-nebula.c index 8672859aaad1..3e6f077eb700 100644 --- a/drivers/media/rc/keymaps/rc-nebula.c +++ b/drivers/media/rc/keymaps/rc-nebula.c @@ -70,7 +70,7 @@ static struct rc_map_table nebula[] = { { 0x36, KEY_PC }, }; -static struct rc_keymap nebula_map = { +static struct rc_map_list nebula_map = { .map = { .scan = nebula, .size = ARRAY_SIZE(nebula), @@ -81,12 +81,12 @@ static struct rc_keymap nebula_map = { static int __init init_rc_map_nebula(void) { - return ir_register_map(&nebula_map); + return rc_map_register(&nebula_map); } static void __exit exit_rc_map_nebula(void) { - ir_unregister_map(&nebula_map); + rc_map_unregister(&nebula_map); } module_init(init_rc_map_nebula) diff --git a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c index 2f560dc791c0..26f114c5c0de 100644 --- a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c @@ -79,7 +79,7 @@ static struct rc_map_table nec_terratec_cinergy_xs[] = { { 0x145c, KEY_NEXT}, }; -static struct rc_keymap nec_terratec_cinergy_xs_map = { +static struct rc_map_list nec_terratec_cinergy_xs_map = { .map = { .scan = nec_terratec_cinergy_xs, .size = ARRAY_SIZE(nec_terratec_cinergy_xs), @@ -90,12 +90,12 @@ static struct rc_keymap nec_terratec_cinergy_xs_map = { static int __init init_rc_map_nec_terratec_cinergy_xs(void) { - return ir_register_map(&nec_terratec_cinergy_xs_map); + return rc_map_register(&nec_terratec_cinergy_xs_map); } static void __exit exit_rc_map_nec_terratec_cinergy_xs(void) { - ir_unregister_map(&nec_terratec_cinergy_xs_map); + rc_map_unregister(&nec_terratec_cinergy_xs_map); } module_init(init_rc_map_nec_terratec_cinergy_xs) diff --git a/drivers/media/rc/keymaps/rc-norwood.c b/drivers/media/rc/keymaps/rc-norwood.c index f4a85033b297..629ee9d84537 100644 --- a/drivers/media/rc/keymaps/rc-norwood.c +++ b/drivers/media/rc/keymaps/rc-norwood.c @@ -59,7 +59,7 @@ static struct rc_map_table norwood[] = { { 0x65, KEY_POWER }, /* Computer power */ }; -static struct rc_keymap norwood_map = { +static struct rc_map_list norwood_map = { .map = { .scan = norwood, .size = ARRAY_SIZE(norwood), @@ -70,12 +70,12 @@ static struct rc_keymap norwood_map = { static int __init init_rc_map_norwood(void) { - return ir_register_map(&norwood_map); + return rc_map_register(&norwood_map); } static void __exit exit_rc_map_norwood(void) { - ir_unregister_map(&norwood_map); + rc_map_unregister(&norwood_map); } module_init(init_rc_map_norwood) diff --git a/drivers/media/rc/keymaps/rc-npgtech.c b/drivers/media/rc/keymaps/rc-npgtech.c index fdfa549323cc..4aa588bf6d69 100644 --- a/drivers/media/rc/keymaps/rc-npgtech.c +++ b/drivers/media/rc/keymaps/rc-npgtech.c @@ -54,7 +54,7 @@ static struct rc_map_table npgtech[] = { }; -static struct rc_keymap npgtech_map = { +static struct rc_map_list npgtech_map = { .map = { .scan = npgtech, .size = ARRAY_SIZE(npgtech), @@ -65,12 +65,12 @@ static struct rc_keymap npgtech_map = { static int __init init_rc_map_npgtech(void) { - return ir_register_map(&npgtech_map); + return rc_map_register(&npgtech_map); } static void __exit exit_rc_map_npgtech(void) { - ir_unregister_map(&npgtech_map); + rc_map_unregister(&npgtech_map); } module_init(init_rc_map_npgtech) diff --git a/drivers/media/rc/keymaps/rc-pctv-sedna.c b/drivers/media/rc/keymaps/rc-pctv-sedna.c index 86c1101c47df..fa5ae5981eb8 100644 --- a/drivers/media/rc/keymaps/rc-pctv-sedna.c +++ b/drivers/media/rc/keymaps/rc-pctv-sedna.c @@ -54,7 +54,7 @@ static struct rc_map_table pctv_sedna[] = { { 0x1f, KEY_PLAY }, /* Play */ }; -static struct rc_keymap pctv_sedna_map = { +static struct rc_map_list pctv_sedna_map = { .map = { .scan = pctv_sedna, .size = ARRAY_SIZE(pctv_sedna), @@ -65,12 +65,12 @@ static struct rc_keymap pctv_sedna_map = { static int __init init_rc_map_pctv_sedna(void) { - return ir_register_map(&pctv_sedna_map); + return rc_map_register(&pctv_sedna_map); } static void __exit exit_rc_map_pctv_sedna(void) { - ir_unregister_map(&pctv_sedna_map); + rc_map_unregister(&pctv_sedna_map); } module_init(init_rc_map_pctv_sedna) diff --git a/drivers/media/rc/keymaps/rc-pinnacle-color.c b/drivers/media/rc/keymaps/rc-pinnacle-color.c index d3f4cd411e3b..23b8c505c6aa 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-color.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-color.c @@ -68,7 +68,7 @@ static struct rc_map_table pinnacle_color[] = { { 0x0a, KEY_BACKSPACE }, }; -static struct rc_keymap pinnacle_color_map = { +static struct rc_map_list pinnacle_color_map = { .map = { .scan = pinnacle_color, .size = ARRAY_SIZE(pinnacle_color), @@ -79,12 +79,12 @@ static struct rc_keymap pinnacle_color_map = { static int __init init_rc_map_pinnacle_color(void) { - return ir_register_map(&pinnacle_color_map); + return rc_map_register(&pinnacle_color_map); } static void __exit exit_rc_map_pinnacle_color(void) { - ir_unregister_map(&pinnacle_color_map); + rc_map_unregister(&pinnacle_color_map); } module_init(init_rc_map_pinnacle_color) diff --git a/drivers/media/rc/keymaps/rc-pinnacle-grey.c b/drivers/media/rc/keymaps/rc-pinnacle-grey.c index 1f48b43e4939..6ba8c368d10a 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-grey.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-grey.c @@ -63,7 +63,7 @@ static struct rc_map_table pinnacle_grey[] = { { 0x18, KEY_EPG }, }; -static struct rc_keymap pinnacle_grey_map = { +static struct rc_map_list pinnacle_grey_map = { .map = { .scan = pinnacle_grey, .size = ARRAY_SIZE(pinnacle_grey), @@ -74,12 +74,12 @@ static struct rc_keymap pinnacle_grey_map = { static int __init init_rc_map_pinnacle_grey(void) { - return ir_register_map(&pinnacle_grey_map); + return rc_map_register(&pinnacle_grey_map); } static void __exit exit_rc_map_pinnacle_grey(void) { - ir_unregister_map(&pinnacle_grey_map); + rc_map_unregister(&pinnacle_grey_map); } module_init(init_rc_map_pinnacle_grey) diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c index dc7267c2d04a..bb10ffe086b4 100644 --- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c +++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c @@ -47,7 +47,7 @@ static struct rc_map_table pinnacle_pctv_hd[] = { { 0x3f, KEY_EPG }, /* Labeled "?" */ }; -static struct rc_keymap pinnacle_pctv_hd_map = { +static struct rc_map_list pinnacle_pctv_hd_map = { .map = { .scan = pinnacle_pctv_hd, .size = ARRAY_SIZE(pinnacle_pctv_hd), @@ -58,12 +58,12 @@ static struct rc_keymap pinnacle_pctv_hd_map = { static int __init init_rc_map_pinnacle_pctv_hd(void) { - return ir_register_map(&pinnacle_pctv_hd_map); + return rc_map_register(&pinnacle_pctv_hd_map); } static void __exit exit_rc_map_pinnacle_pctv_hd(void) { - ir_unregister_map(&pinnacle_pctv_hd_map); + rc_map_unregister(&pinnacle_pctv_hd_map); } module_init(init_rc_map_pinnacle_pctv_hd) diff --git a/drivers/media/rc/keymaps/rc-pixelview-mk12.c b/drivers/media/rc/keymaps/rc-pixelview-mk12.c index 93f72487a7bb..8d9f664e0a2d 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-mk12.c +++ b/drivers/media/rc/keymaps/rc-pixelview-mk12.c @@ -57,7 +57,7 @@ static struct rc_map_table pixelview_mk12[] = { { 0x866b07, KEY_RADIO }, /* FM */ }; -static struct rc_keymap pixelview_map = { +static struct rc_map_list pixelview_map = { .map = { .scan = pixelview_mk12, .size = ARRAY_SIZE(pixelview_mk12), @@ -68,12 +68,12 @@ static struct rc_keymap pixelview_map = { static int __init init_rc_map_pixelview(void) { - return ir_register_map(&pixelview_map); + return rc_map_register(&pixelview_map); } static void __exit exit_rc_map_pixelview(void) { - ir_unregister_map(&pixelview_map); + rc_map_unregister(&pixelview_map); } module_init(init_rc_map_pixelview) diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c index e6d60d2cf271..777a70076be2 100644 --- a/drivers/media/rc/keymaps/rc-pixelview-new.c +++ b/drivers/media/rc/keymaps/rc-pixelview-new.c @@ -57,7 +57,7 @@ static struct rc_map_table pixelview_new[] = { { 0x34, KEY_RADIO }, }; -static struct rc_keymap pixelview_new_map = { +static struct rc_map_list pixelview_new_map = { .map = { .scan = pixelview_new, .size = ARRAY_SIZE(pixelview_new), @@ -68,12 +68,12 @@ static struct rc_keymap pixelview_new_map = { static int __init init_rc_map_pixelview_new(void) { - return ir_register_map(&pixelview_new_map); + return rc_map_register(&pixelview_new_map); } static void __exit exit_rc_map_pixelview_new(void) { - ir_unregister_map(&pixelview_new_map); + rc_map_unregister(&pixelview_new_map); } module_init(init_rc_map_pixelview_new) diff --git a/drivers/media/rc/keymaps/rc-pixelview.c b/drivers/media/rc/keymaps/rc-pixelview.c index 2a767102a164..0ec5988916b9 100644 --- a/drivers/media/rc/keymaps/rc-pixelview.c +++ b/drivers/media/rc/keymaps/rc-pixelview.c @@ -56,7 +56,7 @@ static struct rc_map_table pixelview[] = { { 0x18, KEY_MUTE }, /* mute/unmute */ }; -static struct rc_keymap pixelview_map = { +static struct rc_map_list pixelview_map = { .map = { .scan = pixelview, .size = ARRAY_SIZE(pixelview), @@ -67,12 +67,12 @@ static struct rc_keymap pixelview_map = { static int __init init_rc_map_pixelview(void) { - return ir_register_map(&pixelview_map); + return rc_map_register(&pixelview_map); } static void __exit exit_rc_map_pixelview(void) { - ir_unregister_map(&pixelview_map); + rc_map_unregister(&pixelview_map); } module_init(init_rc_map_pixelview) diff --git a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c index 7cc0d57df3be..5f9d546a86c4 100644 --- a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c +++ b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c @@ -55,7 +55,7 @@ static struct rc_map_table powercolor_real_angel[] = { { 0x25, KEY_POWER }, /* power */ }; -static struct rc_keymap powercolor_real_angel_map = { +static struct rc_map_list powercolor_real_angel_map = { .map = { .scan = powercolor_real_angel, .size = ARRAY_SIZE(powercolor_real_angel), @@ -66,12 +66,12 @@ static struct rc_keymap powercolor_real_angel_map = { static int __init init_rc_map_powercolor_real_angel(void) { - return ir_register_map(&powercolor_real_angel_map); + return rc_map_register(&powercolor_real_angel_map); } static void __exit exit_rc_map_powercolor_real_angel(void) { - ir_unregister_map(&powercolor_real_angel_map); + rc_map_unregister(&powercolor_real_angel_map); } module_init(init_rc_map_powercolor_real_angel) diff --git a/drivers/media/rc/keymaps/rc-proteus-2309.c b/drivers/media/rc/keymaps/rc-proteus-2309.c index d5e62a50c1df..8a3a643879d4 100644 --- a/drivers/media/rc/keymaps/rc-proteus-2309.c +++ b/drivers/media/rc/keymaps/rc-proteus-2309.c @@ -43,7 +43,7 @@ static struct rc_map_table proteus_2309[] = { { 0x14, KEY_F1 }, }; -static struct rc_keymap proteus_2309_map = { +static struct rc_map_list proteus_2309_map = { .map = { .scan = proteus_2309, .size = ARRAY_SIZE(proteus_2309), @@ -54,12 +54,12 @@ static struct rc_keymap proteus_2309_map = { static int __init init_rc_map_proteus_2309(void) { - return ir_register_map(&proteus_2309_map); + return rc_map_register(&proteus_2309_map); } static void __exit exit_rc_map_proteus_2309(void) { - ir_unregister_map(&proteus_2309_map); + rc_map_unregister(&proteus_2309_map); } module_init(init_rc_map_proteus_2309) diff --git a/drivers/media/rc/keymaps/rc-purpletv.c b/drivers/media/rc/keymaps/rc-purpletv.c index 5dbfd913b211..ef90296bfd68 100644 --- a/drivers/media/rc/keymaps/rc-purpletv.c +++ b/drivers/media/rc/keymaps/rc-purpletv.c @@ -55,7 +55,7 @@ static struct rc_map_table purpletv[] = { }; -static struct rc_keymap purpletv_map = { +static struct rc_map_list purpletv_map = { .map = { .scan = purpletv, .size = ARRAY_SIZE(purpletv), @@ -66,12 +66,12 @@ static struct rc_keymap purpletv_map = { static int __init init_rc_map_purpletv(void) { - return ir_register_map(&purpletv_map); + return rc_map_register(&purpletv_map); } static void __exit exit_rc_map_purpletv(void) { - ir_unregister_map(&purpletv_map); + rc_map_unregister(&purpletv_map); } module_init(init_rc_map_purpletv) diff --git a/drivers/media/rc/keymaps/rc-pv951.c b/drivers/media/rc/keymaps/rc-pv951.c index d9c7e2f26add..83a418de12c6 100644 --- a/drivers/media/rc/keymaps/rc-pv951.c +++ b/drivers/media/rc/keymaps/rc-pv951.c @@ -52,7 +52,7 @@ static struct rc_map_table pv951[] = { { 0x1c, KEY_MEDIA }, /* PC/TV */ }; -static struct rc_keymap pv951_map = { +static struct rc_map_list pv951_map = { .map = { .scan = pv951, .size = ARRAY_SIZE(pv951), @@ -63,12 +63,12 @@ static struct rc_keymap pv951_map = { static int __init init_rc_map_pv951(void) { - return ir_register_map(&pv951_map); + return rc_map_register(&pv951_map); } static void __exit exit_rc_map_pv951(void) { - ir_unregister_map(&pv951_map); + rc_map_unregister(&pv951_map); } module_init(init_rc_map_pv951) diff --git a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c index eef2e8714542..df534b08959e 100644 --- a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c +++ b/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c @@ -77,7 +77,7 @@ static struct rc_map_table rc5_hauppauge_new[] = { { 0x1e3d, KEY_POWER }, /* system power (green button) */ }; -static struct rc_keymap rc5_hauppauge_new_map = { +static struct rc_map_list rc5_hauppauge_new_map = { .map = { .scan = rc5_hauppauge_new, .size = ARRAY_SIZE(rc5_hauppauge_new), @@ -88,12 +88,12 @@ static struct rc_keymap rc5_hauppauge_new_map = { static int __init init_rc_map_rc5_hauppauge_new(void) { - return ir_register_map(&rc5_hauppauge_new_map); + return rc_map_register(&rc5_hauppauge_new_map); } static void __exit exit_rc_map_rc5_hauppauge_new(void) { - ir_unregister_map(&rc5_hauppauge_new_map); + rc_map_unregister(&rc5_hauppauge_new_map); } module_init(init_rc_map_rc5_hauppauge_new) diff --git a/drivers/media/rc/keymaps/rc-rc5-tv.c b/drivers/media/rc/keymaps/rc-rc5-tv.c index efa14882e762..4fcef9f1f721 100644 --- a/drivers/media/rc/keymaps/rc-rc5-tv.c +++ b/drivers/media/rc/keymaps/rc-rc5-tv.c @@ -55,7 +55,7 @@ static struct rc_map_table rc5_tv[] = { }; -static struct rc_keymap rc5_tv_map = { +static struct rc_map_list rc5_tv_map = { .map = { .scan = rc5_tv, .size = ARRAY_SIZE(rc5_tv), @@ -66,12 +66,12 @@ static struct rc_keymap rc5_tv_map = { static int __init init_rc_map_rc5_tv(void) { - return ir_register_map(&rc5_tv_map); + return rc_map_register(&rc5_tv_map); } static void __exit exit_rc_map_rc5_tv(void) { - ir_unregister_map(&rc5_tv_map); + rc_map_unregister(&rc5_tv_map); } module_init(init_rc_map_rc5_tv) diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 81f41723fde3..3bf3337875d1 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c @@ -87,7 +87,7 @@ static struct rc_map_table rc6_mce[] = { { 0x800f0481, KEY_PLAYPAUSE }, }; -static struct rc_keymap rc6_mce_map = { +static struct rc_map_list rc6_mce_map = { .map = { .scan = rc6_mce, .size = ARRAY_SIZE(rc6_mce), @@ -98,12 +98,12 @@ static struct rc_keymap rc6_mce_map = { static int __init init_rc_map_rc6_mce(void) { - return ir_register_map(&rc6_mce_map); + return rc_map_register(&rc6_mce_map); } static void __exit exit_rc_map_rc6_mce(void) { - ir_unregister_map(&rc6_mce_map); + rc_map_unregister(&rc6_mce_map); } module_init(init_rc_map_rc6_mce) diff --git a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c index 884416ca0ebe..2d14598592d8 100644 --- a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c +++ b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c @@ -52,7 +52,7 @@ static struct rc_map_table real_audio_220_32_keys[] = { }; -static struct rc_keymap real_audio_220_32_keys_map = { +static struct rc_map_list real_audio_220_32_keys_map = { .map = { .scan = real_audio_220_32_keys, .size = ARRAY_SIZE(real_audio_220_32_keys), @@ -63,12 +63,12 @@ static struct rc_keymap real_audio_220_32_keys_map = { static int __init init_rc_map_real_audio_220_32_keys(void) { - return ir_register_map(&real_audio_220_32_keys_map); + return rc_map_register(&real_audio_220_32_keys_map); } static void __exit exit_rc_map_real_audio_220_32_keys(void) { - ir_unregister_map(&real_audio_220_32_keys_map); + rc_map_unregister(&real_audio_220_32_keys_map); } module_init(init_rc_map_real_audio_220_32_keys) diff --git a/drivers/media/rc/keymaps/rc-streamzap.c b/drivers/media/rc/keymaps/rc-streamzap.c index 5a86a7151488..92cc10d2f9cd 100644 --- a/drivers/media/rc/keymaps/rc-streamzap.c +++ b/drivers/media/rc/keymaps/rc-streamzap.c @@ -56,7 +56,7 @@ static struct rc_map_table streamzap[] = { }; -static struct rc_keymap streamzap_map = { +static struct rc_map_list streamzap_map = { .map = { .scan = streamzap, .size = ARRAY_SIZE(streamzap), @@ -67,12 +67,12 @@ static struct rc_keymap streamzap_map = { static int __init init_rc_map_streamzap(void) { - return ir_register_map(&streamzap_map); + return rc_map_register(&streamzap_map); } static void __exit exit_rc_map_streamzap(void) { - ir_unregister_map(&streamzap_map); + rc_map_unregister(&streamzap_map); } module_init(init_rc_map_streamzap) diff --git a/drivers/media/rc/keymaps/rc-tbs-nec.c b/drivers/media/rc/keymaps/rc-tbs-nec.c index 6e2f5b5b7740..15b9a9b80767 100644 --- a/drivers/media/rc/keymaps/rc-tbs-nec.c +++ b/drivers/media/rc/keymaps/rc-tbs-nec.c @@ -47,7 +47,7 @@ static struct rc_map_table tbs_nec[] = { { 0x1b, KEY_MODE}, }; -static struct rc_keymap tbs_nec_map = { +static struct rc_map_list tbs_nec_map = { .map = { .scan = tbs_nec, .size = ARRAY_SIZE(tbs_nec), @@ -58,12 +58,12 @@ static struct rc_keymap tbs_nec_map = { static int __init init_rc_map_tbs_nec(void) { - return ir_register_map(&tbs_nec_map); + return rc_map_register(&tbs_nec_map); } static void __exit exit_rc_map_tbs_nec(void) { - ir_unregister_map(&tbs_nec_map); + rc_map_unregister(&tbs_nec_map); } module_init(init_rc_map_tbs_nec) diff --git a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c index 540020a7821b..bc38e34b9fda 100644 --- a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c +++ b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c @@ -66,7 +66,7 @@ static struct rc_map_table terratec_cinergy_xs[] = { { 0x5c, KEY_NEXT}, }; -static struct rc_keymap terratec_cinergy_xs_map = { +static struct rc_map_list terratec_cinergy_xs_map = { .map = { .scan = terratec_cinergy_xs, .size = ARRAY_SIZE(terratec_cinergy_xs), @@ -77,12 +77,12 @@ static struct rc_keymap terratec_cinergy_xs_map = { static int __init init_rc_map_terratec_cinergy_xs(void) { - return ir_register_map(&terratec_cinergy_xs_map); + return rc_map_register(&terratec_cinergy_xs_map); } static void __exit exit_rc_map_terratec_cinergy_xs(void) { - ir_unregister_map(&terratec_cinergy_xs_map); + rc_map_unregister(&terratec_cinergy_xs_map); } module_init(init_rc_map_terratec_cinergy_xs) diff --git a/drivers/media/rc/keymaps/rc-terratec-slim.c b/drivers/media/rc/keymaps/rc-terratec-slim.c index a1513f0299d2..1abafa5fd303 100644 --- a/drivers/media/rc/keymaps/rc-terratec-slim.c +++ b/drivers/media/rc/keymaps/rc-terratec-slim.c @@ -53,7 +53,7 @@ static struct rc_map_table terratec_slim[] = { { 0x02bd45, KEY_POWER2 }, /* [red power button] */ }; -static struct rc_keymap terratec_slim_map = { +static struct rc_map_list terratec_slim_map = { .map = { .scan = terratec_slim, .size = ARRAY_SIZE(terratec_slim), @@ -64,12 +64,12 @@ static struct rc_keymap terratec_slim_map = { static int __init init_rc_map_terratec_slim(void) { - return ir_register_map(&terratec_slim_map); + return rc_map_register(&terratec_slim_map); } static void __exit exit_rc_map_terratec_slim(void) { - ir_unregister_map(&terratec_slim_map); + rc_map_unregister(&terratec_slim_map); } module_init(init_rc_map_terratec_slim) diff --git a/drivers/media/rc/keymaps/rc-tevii-nec.c b/drivers/media/rc/keymaps/rc-tevii-nec.c index 6b2fc431689e..ef5ba3f32735 100644 --- a/drivers/media/rc/keymaps/rc-tevii-nec.c +++ b/drivers/media/rc/keymaps/rc-tevii-nec.c @@ -62,7 +62,7 @@ static struct rc_map_table tevii_nec[] = { { 0x58, KEY_SWITCHVIDEOMODE}, }; -static struct rc_keymap tevii_nec_map = { +static struct rc_map_list tevii_nec_map = { .map = { .scan = tevii_nec, .size = ARRAY_SIZE(tevii_nec), @@ -73,12 +73,12 @@ static struct rc_keymap tevii_nec_map = { static int __init init_rc_map_tevii_nec(void) { - return ir_register_map(&tevii_nec_map); + return rc_map_register(&tevii_nec_map); } static void __exit exit_rc_map_tevii_nec(void) { - ir_unregister_map(&tevii_nec_map); + rc_map_unregister(&tevii_nec_map); } module_init(init_rc_map_tevii_nec) diff --git a/drivers/media/rc/keymaps/rc-total-media-in-hand.c b/drivers/media/rc/keymaps/rc-total-media-in-hand.c index 61a4234f13af..20ac4e19fb3f 100644 --- a/drivers/media/rc/keymaps/rc-total-media-in-hand.c +++ b/drivers/media/rc/keymaps/rc-total-media-in-hand.c @@ -59,7 +59,7 @@ static struct rc_map_table total_media_in_hand[] = { { 0x02bd45, KEY_INFO }, /* [red (I)] */ }; -static struct rc_keymap total_media_in_hand_map = { +static struct rc_map_list total_media_in_hand_map = { .map = { .scan = total_media_in_hand, .size = ARRAY_SIZE(total_media_in_hand), @@ -70,12 +70,12 @@ static struct rc_keymap total_media_in_hand_map = { static int __init init_rc_map_total_media_in_hand(void) { - return ir_register_map(&total_media_in_hand_map); + return rc_map_register(&total_media_in_hand_map); } static void __exit exit_rc_map_total_media_in_hand(void) { - ir_unregister_map(&total_media_in_hand_map); + rc_map_unregister(&total_media_in_hand_map); } module_init(init_rc_map_total_media_in_hand) diff --git a/drivers/media/rc/keymaps/rc-trekstor.c b/drivers/media/rc/keymaps/rc-trekstor.c index 2d7bbf8ae83e..f8190ead2e32 100644 --- a/drivers/media/rc/keymaps/rc-trekstor.c +++ b/drivers/media/rc/keymaps/rc-trekstor.c @@ -54,7 +54,7 @@ static struct rc_map_table trekstor[] = { { 0x009f, KEY_LEFT }, /* Left */ }; -static struct rc_keymap trekstor_map = { +static struct rc_map_list trekstor_map = { .map = { .scan = trekstor, .size = ARRAY_SIZE(trekstor), @@ -65,12 +65,12 @@ static struct rc_keymap trekstor_map = { static int __init init_rc_map_trekstor(void) { - return ir_register_map(&trekstor_map); + return rc_map_register(&trekstor_map); } static void __exit exit_rc_map_trekstor(void) { - ir_unregister_map(&trekstor_map); + rc_map_unregister(&trekstor_map); } module_init(init_rc_map_trekstor) diff --git a/drivers/media/rc/keymaps/rc-tt-1500.c b/drivers/media/rc/keymaps/rc-tt-1500.c index f3fe9f39d069..bb194879a794 100644 --- a/drivers/media/rc/keymaps/rc-tt-1500.c +++ b/drivers/media/rc/keymaps/rc-tt-1500.c @@ -56,7 +56,7 @@ static struct rc_map_table tt_1500[] = { { 0x3f, KEY_FORWARD }, }; -static struct rc_keymap tt_1500_map = { +static struct rc_map_list tt_1500_map = { .map = { .scan = tt_1500, .size = ARRAY_SIZE(tt_1500), @@ -67,12 +67,12 @@ static struct rc_keymap tt_1500_map = { static int __init init_rc_map_tt_1500(void) { - return ir_register_map(&tt_1500_map); + return rc_map_register(&tt_1500_map); } static void __exit exit_rc_map_tt_1500(void) { - ir_unregister_map(&tt_1500_map); + rc_map_unregister(&tt_1500_map); } module_init(init_rc_map_tt_1500) diff --git a/drivers/media/rc/keymaps/rc-twinhan1027.c b/drivers/media/rc/keymaps/rc-twinhan1027.c index 67cc6e0b326b..8bf8df64b081 100644 --- a/drivers/media/rc/keymaps/rc-twinhan1027.c +++ b/drivers/media/rc/keymaps/rc-twinhan1027.c @@ -61,7 +61,7 @@ static struct rc_map_table twinhan_vp1027[] = { { 0x5f, KEY_BLUE }, }; -static struct rc_keymap twinhan_vp1027_map = { +static struct rc_map_list twinhan_vp1027_map = { .map = { .scan = twinhan_vp1027, .size = ARRAY_SIZE(twinhan_vp1027), @@ -72,12 +72,12 @@ static struct rc_keymap twinhan_vp1027_map = { static int __init init_rc_map_twinhan_vp1027(void) { - return ir_register_map(&twinhan_vp1027_map); + return rc_map_register(&twinhan_vp1027_map); } static void __exit exit_rc_map_twinhan_vp1027(void) { - ir_unregister_map(&twinhan_vp1027_map); + rc_map_unregister(&twinhan_vp1027_map); } module_init(init_rc_map_twinhan_vp1027) diff --git a/drivers/media/rc/keymaps/rc-videomate-s350.c b/drivers/media/rc/keymaps/rc-videomate-s350.c index f8a0d107001e..9e474a6024e5 100644 --- a/drivers/media/rc/keymaps/rc-videomate-s350.c +++ b/drivers/media/rc/keymaps/rc-videomate-s350.c @@ -59,7 +59,7 @@ static struct rc_map_table videomate_s350[] = { { 0x20, KEY_TEXT}, }; -static struct rc_keymap videomate_s350_map = { +static struct rc_map_list videomate_s350_map = { .map = { .scan = videomate_s350, .size = ARRAY_SIZE(videomate_s350), @@ -70,12 +70,12 @@ static struct rc_keymap videomate_s350_map = { static int __init init_rc_map_videomate_s350(void) { - return ir_register_map(&videomate_s350_map); + return rc_map_register(&videomate_s350_map); } static void __exit exit_rc_map_videomate_s350(void) { - ir_unregister_map(&videomate_s350_map); + rc_map_unregister(&videomate_s350_map); } module_init(init_rc_map_videomate_s350) diff --git a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c index 04d102457ea6..5f2a46e1f8f6 100644 --- a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c +++ b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c @@ -61,7 +61,7 @@ static struct rc_map_table videomate_tv_pvr[] = { { 0x21, KEY_SLEEP }, }; -static struct rc_keymap videomate_tv_pvr_map = { +static struct rc_map_list videomate_tv_pvr_map = { .map = { .scan = videomate_tv_pvr, .size = ARRAY_SIZE(videomate_tv_pvr), @@ -72,12 +72,12 @@ static struct rc_keymap videomate_tv_pvr_map = { static int __init init_rc_map_videomate_tv_pvr(void) { - return ir_register_map(&videomate_tv_pvr_map); + return rc_map_register(&videomate_tv_pvr_map); } static void __exit exit_rc_map_videomate_tv_pvr(void) { - ir_unregister_map(&videomate_tv_pvr_map); + rc_map_unregister(&videomate_tv_pvr_map); } module_init(init_rc_map_videomate_tv_pvr) diff --git a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c index 78fc7da4b9e2..bd8d021f40aa 100644 --- a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c +++ b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c @@ -56,7 +56,7 @@ static struct rc_map_table winfast_usbii_deluxe[] = { }; -static struct rc_keymap winfast_usbii_deluxe_map = { +static struct rc_map_list winfast_usbii_deluxe_map = { .map = { .scan = winfast_usbii_deluxe, .size = ARRAY_SIZE(winfast_usbii_deluxe), @@ -67,12 +67,12 @@ static struct rc_keymap winfast_usbii_deluxe_map = { static int __init init_rc_map_winfast_usbii_deluxe(void) { - return ir_register_map(&winfast_usbii_deluxe_map); + return rc_map_register(&winfast_usbii_deluxe_map); } static void __exit exit_rc_map_winfast_usbii_deluxe(void) { - ir_unregister_map(&winfast_usbii_deluxe_map); + rc_map_unregister(&winfast_usbii_deluxe_map); } module_init(init_rc_map_winfast_usbii_deluxe) diff --git a/drivers/media/rc/keymaps/rc-winfast.c b/drivers/media/rc/keymaps/rc-winfast.c index a8fbd7662d39..2747db43b70c 100644 --- a/drivers/media/rc/keymaps/rc-winfast.c +++ b/drivers/media/rc/keymaps/rc-winfast.c @@ -76,7 +76,7 @@ static struct rc_map_table winfast[] = { { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ }; -static struct rc_keymap winfast_map = { +static struct rc_map_list winfast_map = { .map = { .scan = winfast, .size = ARRAY_SIZE(winfast), @@ -87,12 +87,12 @@ static struct rc_keymap winfast_map = { static int __init init_rc_map_winfast(void) { - return ir_register_map(&winfast_map); + return rc_map_register(&winfast_map); } static void __exit exit_rc_map_winfast(void) { - ir_unregister_map(&winfast_map); + rc_map_unregister(&winfast_map); } module_init(init_rc_map_winfast) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index b989f5d98d5f..0b0524c29325 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -31,9 +31,9 @@ static LIST_HEAD(rc_map_list); static DEFINE_SPINLOCK(rc_map_lock); -static struct rc_keymap *seek_rc_map(const char *name) +static struct rc_map_list *seek_rc_map(const char *name) { - struct rc_keymap *map = NULL; + struct rc_map_list *map = NULL; spin_lock(&rc_map_lock); list_for_each_entry(map, &rc_map_list, list) { @@ -47,10 +47,10 @@ static struct rc_keymap *seek_rc_map(const char *name) return NULL; } -struct rc_map *get_rc_map(const char *name) +struct rc_map *rc_map_get(const char *name) { - struct rc_keymap *map; + struct rc_map_list *map; map = seek_rc_map(name); #ifdef MODULE @@ -74,31 +74,31 @@ struct rc_map *get_rc_map(const char *name) return &map->map; } -EXPORT_SYMBOL_GPL(get_rc_map); +EXPORT_SYMBOL_GPL(rc_map_get); -int ir_register_map(struct rc_keymap *map) +int rc_map_register(struct rc_map_list *map) { spin_lock(&rc_map_lock); list_add_tail(&map->list, &rc_map_list); spin_unlock(&rc_map_lock); return 0; } -EXPORT_SYMBOL_GPL(ir_register_map); +EXPORT_SYMBOL_GPL(rc_map_register); -void ir_unregister_map(struct rc_keymap *map) +void rc_map_unregister(struct rc_map_list *map) { spin_lock(&rc_map_lock); list_del(&map->list); spin_unlock(&rc_map_lock); } -EXPORT_SYMBOL_GPL(ir_unregister_map); +EXPORT_SYMBOL_GPL(rc_map_unregister); static struct rc_map_table empty[] = { { 0x2a, KEY_COFFEE }, }; -static struct rc_keymap empty_map = { +static struct rc_map_list empty_map = { .map = { .scan = empty, .size = ARRAY_SIZE(empty), @@ -996,9 +996,9 @@ int rc_register_device(struct rc_dev *dev) if (!dev || !dev->map_name) return -EINVAL; - rc_map = get_rc_map(dev->map_name); + rc_map = rc_map_get(dev->map_name); if (!rc_map) - rc_map = get_rc_map(RC_MAP_EMPTY); + rc_map = rc_map_get(RC_MAP_EMPTY); if (!rc_map || !rc_map->scan || rc_map->size == 0) return -EINVAL; @@ -1113,7 +1113,7 @@ static int __init rc_core_init(void) /* Initialize/load the decoders/keymap code that will be used */ ir_raw_init(); - ir_register_map(&empty_map); + rc_map_register(&empty_map); return 0; } @@ -1121,7 +1121,7 @@ static int __init rc_core_init(void) static void __exit rc_core_exit(void) { class_unregister(&ir_input_class); - ir_unregister_map(&empty_map); + rc_map_unregister(&empty_map); } module_init(rc_core_init); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 5e9c06ad1d47..1a3d51da1864 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -40,16 +40,16 @@ struct rc_map { spinlock_t lock; }; -struct rc_keymap { +struct rc_map_list { struct list_head list; struct rc_map map; }; /* Routines from rc-map.c */ -int ir_register_map(struct rc_keymap *map); -void ir_unregister_map(struct rc_keymap *map); -struct rc_map *get_rc_map(const char *name); +int rc_map_register(struct rc_map_list *map); +void rc_map_unregister(struct rc_map_list *map); +struct rc_map *rc_map_get(const char *name); void rc_map_init(void); /* Names of the several keytables defined in-kernel */ -- cgit v1.2.3 From 829ba9fe34246f1f5e813b6bf84171d36e776734 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 19 Nov 2010 20:43:27 -0300 Subject: [media] rc-core: fix some leftovers from the renaming patches Fix some minor comments etc which are leftover from the old naming scheme. Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ir-raw.c | 2 +- drivers/media/rc/rc-core-priv.h | 6 +++--- drivers/media/rc/rc-main.c | 2 +- include/media/rc-core.h | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c index 165412fd240e..185baddcbf14 100644 --- a/drivers/media/rc/ir-raw.c +++ b/drivers/media/rc/ir-raw.c @@ -1,4 +1,4 @@ -/* ir-raw-event.c - handle IR Pulse/Space event +/* ir-raw.c - handle IR pulse/space events * * Copyright (C) 2010 by Mauro Carvalho Chehab * diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 48065b714d00..873b38789751 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#ifndef _IR_RAW_EVENT -#define _IR_RAW_EVENT +#ifndef _RC_CORE_PRIV +#define _RC_CORE_PRIV #include #include @@ -190,4 +190,4 @@ void ir_raw_init(void); #endif -#endif /* _IR_RAW_EVENT */ +#endif /* _RC_CORE_PRIV */ diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 0b0524c29325..6bdd0d3c02e8 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1,4 +1,4 @@ -/* rc-core.c - handle IR scancode->keycode tables +/* rc-main.c - Remote Controller core module * * Copyright (C) 2009-2010 by Mauro Carvalho Chehab * diff --git a/include/media/rc-core.h b/include/media/rc-core.h index affb93feed3b..a23c1fc685a1 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -206,12 +206,12 @@ 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; + if (mask & 1) { + if (data & 1) + value |= vbit; + vbit <<= 1; + } + data >>= 1; } while (mask >>= 1); return value; -- cgit v1.2.3 From 0e835087dfe7db19f1f072046f5e116d4ec6662b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 17 Nov 2010 02:13:39 -0300 Subject: [media] lirc_dev: add some __user annotations Sparse complains because there are no __user annotations. drivers/media/rc/lirc_dev.c:156:27: warning: incorrect type in initializer (incompatible argument 2 (different address spaces)) drivers/media/rc/lirc_dev.c:156:27: expected int ( *read )( ... ) drivers/media/rc/lirc_dev.c:156:27: got int ( extern [toplevel] * )( ... ) Signed-off-by: Dan Carpenter Acked-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/lirc_dev.c | 4 ++-- include/media/lirc_dev.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 756656e17bdd..6b9fc74f2e1d 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -627,7 +627,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) EXPORT_SYMBOL(lirc_dev_fop_ioctl); ssize_t lirc_dev_fop_read(struct file *file, - char *buffer, + char __user *buffer, size_t length, loff_t *ppos) { @@ -747,7 +747,7 @@ void *lirc_get_pdata(struct file *file) EXPORT_SYMBOL(lirc_get_pdata); -ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, +ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, size_t length, loff_t *ppos) { struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 54780a560d0e..630e702c9511 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h @@ -217,9 +217,9 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file); int lirc_dev_fop_close(struct inode *inode, struct file *file); unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait); long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -ssize_t lirc_dev_fop_read(struct file *file, char *buffer, size_t length, +ssize_t lirc_dev_fop_read(struct file *file, char __user *buffer, size_t length, loff_t *ppos); -ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, size_t length, - loff_t *ppos); +ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, + size_t length, loff_t *ppos); #endif -- cgit v1.2.3 From eac8ae087ac66b21de94fee3e920210b43d43076 Mon Sep 17 00:00:00 2001 From: Mariusz Białończyk Date: Mon, 15 Nov 2010 15:50:13 -0300 Subject: [media] Fix rc-tbs-nec table after converting the cx88 driver to ir-core The patch fixes the rc-tbs-nec table after converting drivers/media/video/cx88 to ir-core (commit ba7e90c9f878e0ac3c0614a5446fe5c62ccc33ec). It is also adds two missing buttons (10- and 10+) with its definition (KEY_10CHANNELSUP and KEY_10CHANNELSDOWN). [mchehab@redhat.com: move keycode numbers to 0x1b8/0x1b9 as requested by the input Maintainer] Signed-off-by: Mariusz Białończyk Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/keymaps/rc-tbs-nec.c | 66 ++++++++++++++++++----------------- include/linux/input.h | 2 ++ 2 files changed, 36 insertions(+), 32 deletions(-) (limited to 'include') diff --git a/drivers/media/rc/keymaps/rc-tbs-nec.c b/drivers/media/rc/keymaps/rc-tbs-nec.c index 15b9a9b80767..7242ee66f6e0 100644 --- a/drivers/media/rc/keymaps/rc-tbs-nec.c +++ b/drivers/media/rc/keymaps/rc-tbs-nec.c @@ -13,38 +13,40 @@ #include static struct rc_map_table tbs_nec[] = { - { 0x04, KEY_POWER2}, /*power*/ - { 0x14, KEY_MUTE}, /*mute*/ - { 0x07, KEY_1}, - { 0x06, KEY_2}, - { 0x05, KEY_3}, - { 0x0b, KEY_4}, - { 0x0a, KEY_5}, - { 0x09, KEY_6}, - { 0x0f, KEY_7}, - { 0x0e, KEY_8}, - { 0x0d, KEY_9}, - { 0x12, KEY_0}, - { 0x16, KEY_CHANNELUP}, /*ch+*/ - { 0x11, KEY_CHANNELDOWN},/*ch-*/ - { 0x13, KEY_VOLUMEUP}, /*vol+*/ - { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ - { 0x03, KEY_RECORD}, /*rec*/ - { 0x18, KEY_PAUSE}, /*pause*/ - { 0x19, KEY_OK}, /*ok*/ - { 0x1a, KEY_CAMERA}, /* snapshot */ - { 0x01, KEY_UP}, - { 0x10, KEY_LEFT}, - { 0x02, KEY_RIGHT}, - { 0x08, KEY_DOWN}, - { 0x15, KEY_FAVORITES}, - { 0x17, KEY_SUBTITLE}, - { 0x1d, KEY_ZOOM}, - { 0x1f, KEY_EXIT}, - { 0x1e, KEY_MENU}, - { 0x1c, KEY_EPG}, - { 0x00, KEY_PREVIOUS}, - { 0x1b, KEY_MODE}, + { 0x84, KEY_POWER2}, /* power */ + { 0x94, KEY_MUTE}, /* mute */ + { 0x87, KEY_1}, + { 0x86, KEY_2}, + { 0x85, KEY_3}, + { 0x8b, KEY_4}, + { 0x8a, KEY_5}, + { 0x89, KEY_6}, + { 0x8f, KEY_7}, + { 0x8e, KEY_8}, + { 0x8d, KEY_9}, + { 0x92, KEY_0}, + { 0xc0, KEY_10CHANNELSUP}, /* 10+ */ + { 0xd0, KEY_10CHANNELSDOWN}, /* 10- */ + { 0x96, KEY_CHANNELUP}, /* ch+ */ + { 0x91, KEY_CHANNELDOWN}, /* ch- */ + { 0x93, KEY_VOLUMEUP}, /* vol+ */ + { 0x8c, KEY_VOLUMEDOWN}, /* vol- */ + { 0x83, KEY_RECORD}, /* rec */ + { 0x98, KEY_PAUSE}, /* pause, yellow */ + { 0x99, KEY_OK}, /* ok */ + { 0x9a, KEY_CAMERA}, /* snapshot */ + { 0x81, KEY_UP}, + { 0x90, KEY_LEFT}, + { 0x82, KEY_RIGHT}, + { 0x88, KEY_DOWN}, + { 0x95, KEY_FAVORITES}, /* blue */ + { 0x97, KEY_SUBTITLE}, /* green */ + { 0x9d, KEY_ZOOM}, + { 0x9f, KEY_EXIT}, + { 0x9e, KEY_MENU}, + { 0x9c, KEY_EPG}, + { 0x80, KEY_PREVIOUS}, /* red */ + { 0x9b, KEY_MODE}, }; static struct rc_map_list tbs_nec_map = { diff --git a/include/linux/input.h b/include/linux/input.h index 9777668883be..f7a6e1966df3 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -590,6 +590,8 @@ struct input_keymap_entry { #define KEY_FRAMEFORWARD 0x1b5 #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ +#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ +#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ #define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOS 0x1c1 -- cgit v1.2.3 From 12007419b766b316998499bd07c6586928230729 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 17 Dec 2010 14:39:29 -0300 Subject: [media] Add a keymap for Pixelview 002-T remote Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/keymaps/Makefile | 1 + drivers/media/rc/keymaps/rc-pixelview-002t.c | 77 ++++++++++++++++++++++++++++ include/media/rc-map.h | 1 + 3 files changed, 79 insertions(+) create mode 100644 drivers/media/rc/keymaps/rc-pixelview-002t.c (limited to 'include') diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index 3194d391bbd4..148900f443d2 100644 --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-pinnacle-pctv-hd.o \ rc-pixelview.o \ rc-pixelview-mk12.o \ + rc-pixelview-002t.o \ rc-pixelview-new.o \ rc-powercolor-real-angel.o \ rc-proteus-2309.o \ diff --git a/drivers/media/rc/keymaps/rc-pixelview-002t.c b/drivers/media/rc/keymaps/rc-pixelview-002t.c new file mode 100644 index 000000000000..e5ab071f635a --- /dev/null +++ b/drivers/media/rc/keymaps/rc-pixelview-002t.c @@ -0,0 +1,77 @@ +/* rc-pixelview-mk12.h - Keytable for pixelview Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Keytable for 002-T IR remote provided together with Pixelview + * SBTVD Hybrid Remote Controller. Uses NEC extended format. + */ +static struct rc_map_table pixelview_002t[] = { + { 0x866b13, KEY_MUTE }, + { 0x866b12, KEY_POWER2 }, /* power */ + + { 0x866b01, KEY_1 }, + { 0x866b02, KEY_2 }, + { 0x866b03, KEY_3 }, + { 0x866b04, KEY_4 }, + { 0x866b05, KEY_5 }, + { 0x866b06, KEY_6 }, + { 0x866b07, KEY_7 }, + { 0x866b08, KEY_8 }, + { 0x866b09, KEY_9 }, + { 0x866b00, KEY_0 }, + + { 0x866b0d, KEY_CHANNELUP }, + { 0x866b19, KEY_CHANNELDOWN }, + { 0x866b10, KEY_VOLUMEUP }, /* vol + */ + { 0x866b0c, KEY_VOLUMEDOWN }, /* vol - */ + + { 0x866b0a, KEY_CAMERA }, /* snapshot */ + { 0x866b0b, KEY_ZOOM }, /* zoom */ + + { 0x866b1b, KEY_BACKSPACE }, + { 0x866b15, KEY_ENTER }, + + { 0x866b1d, KEY_UP }, + { 0x866b1e, KEY_DOWN }, + { 0x866b0e, KEY_LEFT }, + { 0x866b0f, KEY_RIGHT }, + + { 0x866b18, KEY_RECORD }, + { 0x866b1a, KEY_STOP }, +}; + +static struct rc_map_list pixelview_map = { + .map = { + .scan = pixelview_002t, + .size = ARRAY_SIZE(pixelview_002t), + .rc_type = RC_TYPE_NEC, + .name = RC_MAP_PIXELVIEW_002T, + } +}; + +static int __init init_rc_map_pixelview(void) +{ + return rc_map_register(&pixelview_map); +} + +static void __exit exit_rc_map_pixelview(void) +{ + rc_map_unregister(&pixelview_map); +} + +module_init(init_rc_map_pixelview) +module_exit(exit_rc_map_pixelview) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 1a3d51da1864..5d3a45748767 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -119,6 +119,7 @@ void rc_map_init(void); #define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd" #define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new" #define RC_MAP_PIXELVIEW "rc-pixelview" +#define RC_MAP_PIXELVIEW_002T "rc-pixelview-002t" #define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12" #define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel" #define RC_MAP_PROTEUS_2309 "rc-proteus-2309" -- cgit v1.2.3 From 383268a8e282fb549dabe3a33ccafc9434ab6006 Mon Sep 17 00:00:00 2001 From: Matti Aaltonen Date: Fri, 10 Dec 2010 11:41:33 -0300 Subject: [media] MFD: WL1273 FM Radio: MFD driver for the FM radio This is the core of the WL1273 FM radio driver, it connects the two child modules. The two child drivers are drivers/media/radio/radio-wl1273.c and sound/soc/codecs/wl1273.c. The radio-wl1273 driver implements the V4L2 interface and communicates with the device. The ALSA codec offers digital audio, without it only analog audio is available. Signed-off-by: Matti J. Aaltonen Acked-by: Samuel Ortiz Signed-off-by: Mauro Carvalho Chehab --- drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/wl1273-core.c | 148 +++++++++++++++++++++ include/linux/mfd/wl1273-core.h | 288 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 447 insertions(+) create mode 100644 drivers/mfd/wl1273-core.c create mode 100644 include/linux/mfd/wl1273-core.h (limited to 'include') diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3a1493b8b5e5..05ccab6fa919 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -606,6 +606,16 @@ config MFD_VX855 VIA VX855/VX875 south bridge. You will need to enable the vx855_spi and/or vx855_gpio drivers for this to do anything useful. +config MFD_WL1273_CORE + tristate + depends on I2C + select MFD_CORE + default n + help + This is the core driver for the TI WL1273 FM radio. This MFD + driver connects the radio-wl1273 V4L2 module and the wl1273 + audio codec. + endif # MFD_SUPPORT menu "Multimedia Capabilities Port drivers" diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index f54b3659abbb..ae2f9153174a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -81,3 +81,4 @@ obj-$(CONFIG_MFD_JANZ_CMODIO) += janz-cmodio.o obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o obj-$(CONFIG_MFD_VX855) += vx855.o +obj-$(CONFIG_MFD_WL1273_CORE) += wl1273-core.o diff --git a/drivers/mfd/wl1273-core.c b/drivers/mfd/wl1273-core.c new file mode 100644 index 000000000000..d2ecc2435736 --- /dev/null +++ b/drivers/mfd/wl1273-core.c @@ -0,0 +1,148 @@ +/* + * MFD driver for wl1273 FM radio and audio codec submodules. + * + * Copyright (C) 2010 Nokia Corporation + * Author: Matti Aaltonen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include + +#define DRIVER_DESC "WL1273 FM Radio Core" + +static struct i2c_device_id wl1273_driver_id_table[] = { + { WL1273_FM_DRIVER_NAME, 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, wl1273_driver_id_table); + +static int wl1273_core_remove(struct i2c_client *client) +{ + struct wl1273_core *core = i2c_get_clientdata(client); + + dev_dbg(&client->dev, "%s\n", __func__); + + mfd_remove_devices(&client->dev); + i2c_set_clientdata(client, NULL); + kfree(core); + + return 0; +} + +static int __devinit wl1273_core_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct wl1273_fm_platform_data *pdata = client->dev.platform_data; + struct wl1273_core *core; + struct mfd_cell *cell; + int children = 0; + int r = 0; + + dev_dbg(&client->dev, "%s\n", __func__); + + if (!pdata) { + dev_err(&client->dev, "No platform data.\n"); + return -EINVAL; + } + + if (!(pdata->children & WL1273_RADIO_CHILD)) { + dev_err(&client->dev, "Cannot function without radio child.\n"); + return -EINVAL; + } + + core = kzalloc(sizeof(*core), GFP_KERNEL); + if (!core) + return -ENOMEM; + + core->pdata = pdata; + core->client = client; + mutex_init(&core->lock); + + i2c_set_clientdata(client, core); + + dev_dbg(&client->dev, "%s: Have V4L2.\n", __func__); + + cell = &core->cells[children]; + cell->name = "wl1273_fm_radio"; + cell->platform_data = &core; + cell->data_size = sizeof(core); + children++; + + if (pdata->children & WL1273_CODEC_CHILD) { + cell = &core->cells[children]; + + dev_dbg(&client->dev, "%s: Have codec.\n", __func__); + cell->name = "wl1273-codec"; + cell->platform_data = &core; + cell->data_size = sizeof(core); + children++; + } + + dev_dbg(&client->dev, "%s: number of children: %d.\n", + __func__, children); + + r = mfd_add_devices(&client->dev, -1, core->cells, + children, NULL, 0); + if (r) + goto err; + + return 0; + +err: + i2c_set_clientdata(client, NULL); + pdata->free_resources(); + kfree(core); + + dev_dbg(&client->dev, "%s\n", __func__); + + return r; +} + +static struct i2c_driver wl1273_core_driver = { + .driver = { + .name = WL1273_FM_DRIVER_NAME, + }, + .probe = wl1273_core_probe, + .id_table = wl1273_driver_id_table, + .remove = __devexit_p(wl1273_core_remove), +}; + +static int __init wl1273_core_init(void) +{ + int r; + + r = i2c_add_driver(&wl1273_core_driver); + if (r) { + pr_err(WL1273_FM_DRIVER_NAME + ": driver registration failed\n"); + return r; + } + + return r; +} + +static void __exit wl1273_core_exit(void) +{ + i2c_del_driver(&wl1273_core_driver); +} +late_initcall(wl1273_core_init); +module_exit(wl1273_core_exit); + +MODULE_AUTHOR("Matti Aaltonen "); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/wl1273-core.h b/include/linux/mfd/wl1273-core.h new file mode 100644 index 000000000000..9787293eae5f --- /dev/null +++ b/include/linux/mfd/wl1273-core.h @@ -0,0 +1,288 @@ +/* + * include/linux/mfd/wl1273-core.h + * + * Some definitions for the wl1273 radio receiver/transmitter chip. + * + * Copyright (C) 2010 Nokia Corporation + * Author: Matti J. Aaltonen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef WL1273_CORE_H +#define WL1273_CORE_H + +#include +#include + +#define WL1273_FM_DRIVER_NAME "wl1273-fm" +#define RX71_FM_I2C_ADDR 0x22 + +#define WL1273_STEREO_GET 0 +#define WL1273_RSSI_LVL_GET 1 +#define WL1273_IF_COUNT_GET 2 +#define WL1273_FLAG_GET 3 +#define WL1273_RDS_SYNC_GET 4 +#define WL1273_RDS_DATA_GET 5 +#define WL1273_FREQ_SET 10 +#define WL1273_AF_FREQ_SET 11 +#define WL1273_MOST_MODE_SET 12 +#define WL1273_MOST_BLEND_SET 13 +#define WL1273_DEMPH_MODE_SET 14 +#define WL1273_SEARCH_LVL_SET 15 +#define WL1273_BAND_SET 16 +#define WL1273_MUTE_STATUS_SET 17 +#define WL1273_RDS_PAUSE_LVL_SET 18 +#define WL1273_RDS_PAUSE_DUR_SET 19 +#define WL1273_RDS_MEM_SET 20 +#define WL1273_RDS_BLK_B_SET 21 +#define WL1273_RDS_MSK_B_SET 22 +#define WL1273_RDS_PI_MASK_SET 23 +#define WL1273_RDS_PI_SET 24 +#define WL1273_RDS_SYSTEM_SET 25 +#define WL1273_INT_MASK_SET 26 +#define WL1273_SEARCH_DIR_SET 27 +#define WL1273_VOLUME_SET 28 +#define WL1273_AUDIO_ENABLE 29 +#define WL1273_PCM_MODE_SET 30 +#define WL1273_I2S_MODE_CONFIG_SET 31 +#define WL1273_POWER_SET 32 +#define WL1273_INTX_CONFIG_SET 33 +#define WL1273_PULL_EN_SET 34 +#define WL1273_HILO_SET 35 +#define WL1273_SWITCH2FREF 36 +#define WL1273_FREQ_DRIFT_REPORT 37 + +#define WL1273_PCE_GET 40 +#define WL1273_FIRM_VER_GET 41 +#define WL1273_ASIC_VER_GET 42 +#define WL1273_ASIC_ID_GET 43 +#define WL1273_MAN_ID_GET 44 +#define WL1273_TUNER_MODE_SET 45 +#define WL1273_STOP_SEARCH 46 +#define WL1273_RDS_CNTRL_SET 47 + +#define WL1273_WRITE_HARDWARE_REG 100 +#define WL1273_CODE_DOWNLOAD 101 +#define WL1273_RESET 102 + +#define WL1273_FM_POWER_MODE 254 +#define WL1273_FM_INTERRUPT 255 + +/* Transmitter API */ + +#define WL1273_CHANL_SET 55 +#define WL1273_SCAN_SPACING_SET 56 +#define WL1273_REF_SET 57 +#define WL1273_POWER_ENB_SET 90 +#define WL1273_POWER_ATT_SET 58 +#define WL1273_POWER_LEV_SET 59 +#define WL1273_AUDIO_DEV_SET 60 +#define WL1273_PILOT_DEV_SET 61 +#define WL1273_RDS_DEV_SET 62 +#define WL1273_PUPD_SET 91 +#define WL1273_AUDIO_IO_SET 63 +#define WL1273_PREMPH_SET 64 +#define WL1273_MONO_SET 66 +#define WL1273_MUTE 92 +#define WL1273_MPX_LMT_ENABLE 67 +#define WL1273_PI_SET 93 +#define WL1273_ECC_SET 69 +#define WL1273_PTY 70 +#define WL1273_AF 71 +#define WL1273_DISPLAY_MODE 74 +#define WL1273_RDS_REP_SET 77 +#define WL1273_RDS_CONFIG_DATA_SET 98 +#define WL1273_RDS_DATA_SET 99 +#define WL1273_RDS_DATA_ENB 94 +#define WL1273_TA_SET 78 +#define WL1273_TP_SET 79 +#define WL1273_DI_SET 80 +#define WL1273_MS_SET 81 +#define WL1273_PS_SCROLL_SPEED 82 +#define WL1273_TX_AUDIO_LEVEL_TEST 96 +#define WL1273_TX_AUDIO_LEVEL_TEST_THRESHOLD 73 +#define WL1273_TX_AUDIO_INPUT_LEVEL_RANGE_SET 54 +#define WL1273_RX_ANTENNA_SELECT 87 +#define WL1273_I2C_DEV_ADDR_SET 86 +#define WL1273_REF_ERR_CALIB_PARAM_SET 88 +#define WL1273_REF_ERR_CALIB_PERIODICITY_SET 89 +#define WL1273_SOC_INT_TRIGGER 52 +#define WL1273_SOC_AUDIO_PATH_SET 83 +#define WL1273_SOC_PCMI_OVERRIDE 84 +#define WL1273_SOC_I2S_OVERRIDE 85 +#define WL1273_RSSI_BLOCK_SCAN_FREQ_SET 95 +#define WL1273_RSSI_BLOCK_SCAN_START 97 +#define WL1273_RSSI_BLOCK_SCAN_DATA_GET 5 +#define WL1273_READ_FMANT_TUNE_VALUE 104 + +#define WL1273_RDS_OFF 0 +#define WL1273_RDS_ON 1 +#define WL1273_RDS_RESET 2 + +#define WL1273_AUDIO_DIGITAL 0 +#define WL1273_AUDIO_ANALOG 1 + +#define WL1273_MODE_RX BIT(0) +#define WL1273_MODE_TX BIT(1) +#define WL1273_MODE_OFF BIT(2) +#define WL1273_MODE_SUSPENDED BIT(3) + +#define WL1273_RADIO_CHILD BIT(0) +#define WL1273_CODEC_CHILD BIT(1) + +#define WL1273_RX_MONO 1 +#define WL1273_RX_STEREO 0 +#define WL1273_TX_MONO 0 +#define WL1273_TX_STEREO 1 + +#define WL1273_MAX_VOLUME 0xffff +#define WL1273_DEFAULT_VOLUME 0x78b8 + +/* I2S protocol, left channel first, data width 16 bits */ +#define WL1273_PCM_DEF_MODE 0x00 + +/* Rx */ +#define WL1273_AUDIO_ENABLE_I2S BIT(0) +#define WL1273_AUDIO_ENABLE_ANALOG BIT(1) + +/* Tx */ +#define WL1273_AUDIO_IO_SET_ANALOG 0 +#define WL1273_AUDIO_IO_SET_I2S 1 + +#define WL1273_PUPD_SET_OFF 0x00 +#define WL1273_PUPD_SET_ON 0x01 +#define WL1273_PUPD_SET_RETENTION 0x10 + +/* I2S mode */ +#define WL1273_IS2_WIDTH_32 0x0 +#define WL1273_IS2_WIDTH_40 0x1 +#define WL1273_IS2_WIDTH_22_23 0x2 +#define WL1273_IS2_WIDTH_23_22 0x3 +#define WL1273_IS2_WIDTH_48 0x4 +#define WL1273_IS2_WIDTH_50 0x5 +#define WL1273_IS2_WIDTH_60 0x6 +#define WL1273_IS2_WIDTH_64 0x7 +#define WL1273_IS2_WIDTH_80 0x8 +#define WL1273_IS2_WIDTH_96 0x9 +#define WL1273_IS2_WIDTH_128 0xa +#define WL1273_IS2_WIDTH 0xf + +#define WL1273_IS2_FORMAT_STD (0x0 << 4) +#define WL1273_IS2_FORMAT_LEFT (0x1 << 4) +#define WL1273_IS2_FORMAT_RIGHT (0x2 << 4) +#define WL1273_IS2_FORMAT_USER (0x3 << 4) + +#define WL1273_IS2_MASTER (0x0 << 6) +#define WL1273_IS2_SLAVEW (0x1 << 6) + +#define WL1273_IS2_TRI_AFTER_SENDING (0x0 << 7) +#define WL1273_IS2_TRI_ALWAYS_ACTIVE (0x1 << 7) + +#define WL1273_IS2_SDOWS_RR (0x0 << 8) +#define WL1273_IS2_SDOWS_RF (0x1 << 8) +#define WL1273_IS2_SDOWS_FR (0x2 << 8) +#define WL1273_IS2_SDOWS_FF (0x3 << 8) + +#define WL1273_IS2_TRI_OPT (0x0 << 10) +#define WL1273_IS2_TRI_ALWAYS (0x1 << 10) + +#define WL1273_IS2_RATE_48K (0x0 << 12) +#define WL1273_IS2_RATE_44_1K (0x1 << 12) +#define WL1273_IS2_RATE_32K (0x2 << 12) +#define WL1273_IS2_RATE_22_05K (0x4 << 12) +#define WL1273_IS2_RATE_16K (0x5 << 12) +#define WL1273_IS2_RATE_12K (0x8 << 12) +#define WL1273_IS2_RATE_11_025 (0x9 << 12) +#define WL1273_IS2_RATE_8K (0xa << 12) +#define WL1273_IS2_RATE (0xf << 12) + +#define WL1273_I2S_DEF_MODE (WL1273_IS2_WIDTH_32 | \ + WL1273_IS2_FORMAT_STD | \ + WL1273_IS2_MASTER | \ + WL1273_IS2_TRI_AFTER_SENDING | \ + WL1273_IS2_SDOWS_RR | \ + WL1273_IS2_TRI_OPT | \ + WL1273_IS2_RATE_48K) + +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 + +#define WL1273_FR_EVENT BIT(0) +#define WL1273_BL_EVENT BIT(1) +#define WL1273_RDS_EVENT BIT(2) +#define WL1273_BBLK_EVENT BIT(3) +#define WL1273_LSYNC_EVENT BIT(4) +#define WL1273_LEV_EVENT BIT(5) +#define WL1273_IFFR_EVENT BIT(6) +#define WL1273_PI_EVENT BIT(7) +#define WL1273_PD_EVENT BIT(8) +#define WL1273_STIC_EVENT BIT(9) +#define WL1273_MAL_EVENT BIT(10) +#define WL1273_POW_ENB_EVENT BIT(11) +#define WL1273_SCAN_OVER_EVENT BIT(12) +#define WL1273_ERROR_EVENT BIT(13) + +#define TUNER_MODE_STOP_SEARCH 0 +#define TUNER_MODE_PRESET 1 +#define TUNER_MODE_AUTO_SEEK 2 +#define TUNER_MODE_AF 3 +#define TUNER_MODE_AUTO_SEEK_PI 4 +#define TUNER_MODE_AUTO_SEEK_BULK 5 + +#define RDS_BLOCK_SIZE 3 + +struct wl1273_fm_platform_data { + int (*request_resources) (struct i2c_client *client); + void (*free_resources) (void); + void (*enable) (void); + void (*disable) (void); + + u8 forbidden_modes; + unsigned int children; +}; + +#define WL1273_FM_CORE_CELLS 2 + +#define WL1273_BAND_OTHER 0 +#define WL1273_BAND_JAPAN 1 + +#define WL1273_BAND_JAPAN_LOW 76000 +#define WL1273_BAND_JAPAN_HIGH 90000 +#define WL1273_BAND_OTHER_LOW 87500 +#define WL1273_BAND_OTHER_HIGH 108000 + +#define WL1273_BAND_TX_LOW 76000 +#define WL1273_BAND_TX_HIGH 108000 + +struct wl1273_core { + struct mfd_cell cells[WL1273_FM_CORE_CELLS]; + struct wl1273_fm_platform_data *pdata; + + unsigned int mode; + unsigned int i2s_mode; + unsigned int volume; + unsigned int audio_mode; + unsigned int channel_number; + struct mutex lock; /* for serializing fm radio operations */ + + struct i2c_client *client; + + int (*write)(struct wl1273_core *core, u8, u16); + int (*set_audio)(struct wl1273_core *core, unsigned int); + int (*set_volume)(struct wl1273_core *core, unsigned int); +}; + +#endif /* ifndef WL1273_CORE_H */ -- cgit v1.2.3 From 08af245de0cf6ab5f4ed008ee2bb99273774fce0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 24 Dec 2010 10:33:19 -0300 Subject: [media] V4L: remove V4L1 compatibility mode Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 15 - drivers/media/common/saa7146_video.c | 32 - drivers/media/video/Makefile | 4 - drivers/media/video/au0828/au0828-video.c | 12 - drivers/media/video/bt8xx/bttv-driver.c | 28 - drivers/media/video/cpia2/cpia2_v4l.c | 38 - drivers/media/video/cx231xx/cx231xx-video.c | 12 - drivers/media/video/cx23885/cx23885-video.c | 32 - drivers/media/video/cx88/cx88-video.c | 12 - drivers/media/video/em28xx/em28xx-video.c | 16 - drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 4 +- drivers/media/video/pwc/pwc-v4l.c | 17 - drivers/media/video/s2255drv.c | 12 - drivers/media/video/saa7134/saa7134-video.c | 11 - drivers/media/video/usbvision/usbvision-video.c | 3 - drivers/media/video/uvc/uvc_v4l2.c | 7 +- drivers/media/video/v4l1-compat.c | 1277 ----------------------- drivers/media/video/v4l2-compat-ioctl32.c | 325 ------ drivers/media/video/v4l2-ioctl.c | 86 -- drivers/media/video/via-camera.c | 13 - drivers/media/video/videobuf-core.c | 30 - drivers/media/video/videobuf-dma-sg.c | 23 - drivers/media/video/vivi.c | 12 - drivers/staging/cx25821/cx25821-video.c | 31 - drivers/staging/cx25821/cx25821-video.h | 6 - drivers/staging/dt3155v4l/dt3155v4l.c | 3 - drivers/staging/tm6000/tm6000-video.c | 12 - include/linux/videodev.h | 22 +- include/media/v4l2-ioctl.h | 22 +- include/media/videobuf-core.h | 8 - 30 files changed, 9 insertions(+), 2116 deletions(-) delete mode 100644 drivers/media/video/v4l1-compat.c (limited to 'include') diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c21dfc28482e..9ea1a6d70f0a 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -53,21 +53,6 @@ config VIDEO_ALLOW_V4L1 If you are unsure as to whether this is required, answer Y. -config VIDEO_V4L1_COMPAT - bool "Enable Video For Linux API 1 compatible Layer" if !VIDEO_ALLOW_V4L1 - depends on VIDEO_DEV - default y - ---help--- - Enables a compatibility API used by most V4L2 devices to allow - its usage with legacy applications that supports only V4L1 api. - - Documentation for the original API is included in the file - . - - User tools for this are available from - . - - If you are unsure as to whether this is required, answer Y. # # DVB Core diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index d246910129e8..0ac5c619aecf 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -1129,35 +1129,6 @@ static int vidioc_g_chip_ident(struct file *file, void *__fh, core, g_chip_ident, chip); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *mbuf) -{ - struct saa7146_fh *fh = __fh; - struct videobuf_queue *q = &fh->video_q; - int err, i; - - /* fixme: number of capture buffers and sizes for v4l apps */ - int gbuffers = 2; - int gbufsize = 768 * 576 * 4; - - DEB_D(("VIDIOCGMBUF \n")); - - q = &fh->video_q; - err = videobuf_mmap_setup(q, gbuffers, gbufsize, - V4L2_MEMORY_MMAP); - if (err < 0) - return err; - - gbuffers = err; - memset(mbuf, 0, sizeof(*mbuf)); - mbuf->frames = gbuffers; - mbuf->size = gbuffers * gbufsize; - for (i = 0; i < gbuffers; i++) - mbuf->offsets[i] = i * gbufsize; - return 0; -} -#endif - const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, @@ -1186,9 +1157,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_g_parm = vidioc_g_parm, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; /*********************************************************************************/ diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 482f14b3ff84..ace7b6eaf5b8 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -22,10 +22,6 @@ endif obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o -ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) - obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o -endif - # All i2c modules must come first: obj-$(CONFIG_VIDEO_TUNER) += tuner.o diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 48682af911fa..e41e4ad5cc40 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -1809,15 +1809,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct au0828_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - static struct v4l2_file_operations au0828_v4l_fops = { .owner = THIS_MODULE, .open = au0828_v4l2_open, @@ -1861,9 +1852,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_register = vidioc_s_register, #endif .vidioc_g_chip_ident = vidioc_g_chip_ident, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static const struct video_device au0828_video_template = { diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 54fbab95b88c..961d0805d877 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -2597,31 +2597,6 @@ static int bttv_s_fmt_vid_overlay(struct file *file, void *priv, return setup_window_lock(fh, btv, &f->fmt.win, 1); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - int retval; - unsigned int i; - struct bttv_fh *fh = priv; - - retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, - V4L2_MEMORY_MMAP); - if (retval < 0) { - return retval; - } - - gbuffers = retval; - memset(mbuf, 0, sizeof(*mbuf)); - mbuf->frames = gbuffers; - mbuf->size = gbuffers * gbufsize; - - for (i = 0; i < gbuffers; i++) - mbuf->offsets[i] = i * gbufsize; - - return 0; -} -#endif - static int bttv_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -3354,9 +3329,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { .vidioc_streamoff = bttv_streamoff, .vidioc_g_tuner = bttv_g_tuner, .vidioc_s_tuner = bttv_s_tuner, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_crop = bttv_g_crop, .vidioc_s_crop = bttv_s_crop, .vidioc_g_fbuf = bttv_g_fbuf, diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 46b433bbf2c1..7edf80b0d01a 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -417,28 +417,6 @@ static int sync(struct camera_data *cam, int frame_nr) } } -/****************************************************************************** - * - * ioctl_get_mbuf - * - *****************************************************************************/ -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int ioctl_get_mbuf(void *arg, struct camera_data *cam) -{ - struct video_mbuf *vm; - int i; - vm = arg; - - memset(vm, 0, sizeof(*vm)); - vm->size = cam->frame_size*cam->num_frames; - vm->frames = cam->num_frames; - for (i = 0; i < cam->num_frames; i++) - vm->offsets[i] = cam->frame_size * i; - - return 0; -} -#endif - /****************************************************************************** * * ioctl_set_gpio @@ -1380,17 +1358,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) } break; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGMBUF: - { - struct cpia2_fh *fh = file->private_data; - if(fh->prio != V4L2_PRIORITY_RECORD) { - mutex_unlock(&cam->busy_lock); - return -EBUSY; - } - break; - } -#endif default: break; } @@ -1400,11 +1367,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) case CPIA2_IOC_SET_GPIO: retval = ioctl_set_gpio(arg, cam); break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGMBUF: /* mmap interface */ - retval = ioctl_get_mbuf(arg, cam); - break; -#endif case VIDIOC_QUERYCAP: retval = ioctl_querycap(arg,cam); break; diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index b13b69fb2af6..7e3e8c4f19b7 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -2044,15 +2044,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct cx231xx_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - /* ----------------------------------------------------------- */ /* RADIO ESPECIFIC IOCTLS */ /* ----------------------------------------------------------- */ @@ -2507,9 +2498,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_g_register = vidioc_g_register, .vidioc_s_register = vidioc_s_register, #endif -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static struct video_device cx231xx_vbi_template; diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 8b2fb8a4375c..796a797b5205 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c @@ -1024,35 +1024,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, - struct video_mbuf *mbuf) -{ - struct cx23885_fh *fh = priv; - struct videobuf_queue *q; - struct v4l2_requestbuffers req; - unsigned int i; - int err; - - q = get_queue(fh); - memset(&req, 0, sizeof(req)); - req.type = q->type; - req.count = 8; - req.memory = V4L2_MEMORY_MMAP; - err = videobuf_reqbufs(q, &req); - if (err < 0) - return err; - - mbuf->frames = req.count; - mbuf->size = 0; - for (i = 0; i < mbuf->frames; i++) { - mbuf->offsets[i] = q->bufs[i]->boff; - mbuf->size += q->bufs[i]->bsize; - } - return 0; -} -#endif - static int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { @@ -1427,9 +1398,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 62cea9549404..9a37b839c67c 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1179,15 +1179,6 @@ static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct cx8800_fh *fh = priv; - - return videobuf_cgmbuf (get_queue(fh), mbuf, 8); -} -#endif - static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct cx8800_fh *fh = priv; @@ -1731,9 +1722,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 908e3bc88303..7be9bbad79ba 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1934,19 +1934,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct em28xx_fh *fh = priv; - - if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); - else - return videobuf_cgmbuf(&fh->vb_vbiq, mbuf, 8); -} -#endif - - /* ----------------------------------------------------------- */ /* RADIO ESPECIFIC IOCTLS */ /* ----------------------------------------------------------- */ @@ -2359,9 +2346,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_register = vidioc_s_register, .vidioc_g_chip_ident = vidioc_g_chip_ident, #endif -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static const struct video_device em28xx_video_template = { diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index aaafa0398fd5..58617fc656c2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -852,8 +852,8 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) #endif default : - ret = v4l_compat_translate_ioctl(file, cmd, - arg, pvr2_v4l2_do_ioctl); + ret = -EINVAL; + break; } pvr2_hdw_commit_ctl(hdw); diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 2ef1668638f9..8ca4d22b4384 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -362,23 +362,6 @@ long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* mmap() functions */ - case VIDIOCGMBUF: - { - /* Tell the user program how much memory is needed for a mmap() */ - struct video_mbuf *vm = arg; - int i; - - memset(vm, 0, sizeof(*vm)); - vm->size = pwc_mbufs * pdev->len_per_image; - vm->frames = pwc_mbufs; /* double buffering should be enough for most applications */ - for (i = 0; i < pwc_mbufs; i++) - vm->offsets[i] = i * pdev->len_per_image; - break; - } -#endif - /* V4L2 Layer */ case VIDIOC_QUERYCAP: { diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index cf03372d1d17..b63f8cafa671 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1097,15 +1097,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) return rc; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidioc_cgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct s2255_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - /* write to the configuration pipe, synchronously */ static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf, int size) @@ -1909,9 +1900,6 @@ static const struct v4l2_ioctl_ops s2255_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidioc_cgmbuf, -#endif .vidioc_s_jpegcomp = vidioc_s_jpegcomp, .vidioc_g_jpegcomp = vidioc_g_jpegcomp, .vidioc_s_parm = vidioc_s_parm, diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index f0b1573137f4..ad22be27bd38 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -2211,14 +2211,6 @@ static int saa7134_overlay(struct file *file, void *f, unsigned int on) return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct saa7134_fh *fh = file->private_data; - return videobuf_cgmbuf(saa7134_queue(fh), mbuf, 8); -} -#endif - static int saa7134_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { @@ -2456,9 +2448,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_streamoff = saa7134_streamoff, .vidioc_g_tuner = saa7134_g_tuner, .vidioc_s_tuner = saa7134_s_tuner, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_crop = saa7134_g_crop, .vidioc_s_crop = saa7134_s_crop, .vidioc_g_fbuf = saa7134_g_fbuf, diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 011c0c386995..20da6ea2cdf0 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1273,9 +1273,6 @@ static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT -/* .vidiocgmbuf = vidiocgmbuf, */ -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 8cf61e8a634f..9005a8d9d5f8 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c @@ -1035,11 +1035,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) return uvc_xu_ctrl_query(chain, arg, 1); default: - if ((ret = v4l_compat_translate_ioctl(file, cmd, arg, - uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) - uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", - cmd); - return ret; + uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); + return -EINVAL; } return ret; diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c deleted file mode 100644 index d4ac751036a2..000000000000 --- a/drivers/media/video/v4l1-compat.c +++ /dev/null @@ -1,1277 +0,0 @@ -/* - * - * Video for Linux Two - * Backward Compatibility Layer - * - * Support subroutines for providing V4L2 drivers with backward - * compatibility with applications using the old API. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * Author: Bill Dirks - * et al. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -static unsigned int debug; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "enable debug messages"); -MODULE_AUTHOR("Bill Dirks"); -MODULE_DESCRIPTION("v4l(1) compatibility layer for v4l2 drivers."); -MODULE_LICENSE("GPL"); - -#define dprintk(fmt, arg...) \ - do { \ - if (debug) \ - printk(KERN_DEBUG "v4l1-compat: " fmt , ## arg);\ - } while (0) - -/* - * I O C T L T R A N S L A T I O N - * - * From here on down is the code for translating the numerous - * ioctl commands from the old API to the new API. - */ - -static int -get_v4l_control(struct file *file, - int cid, - v4l2_kioctl drv) -{ - struct v4l2_queryctrl qctrl2; - struct v4l2_control ctrl2; - int err; - - qctrl2.id = cid; - err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); - if (err < 0) - dprintk("VIDIOC_QUERYCTRL: %d\n", err); - if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { - ctrl2.id = qctrl2.id; - err = drv(file, VIDIOC_G_CTRL, &ctrl2); - if (err < 0) { - dprintk("VIDIOC_G_CTRL: %d\n", err); - return 0; - } - return DIV_ROUND_CLOSEST((ctrl2.value-qctrl2.minimum) * 65535, - qctrl2.maximum - qctrl2.minimum); - } - return 0; -} - -static int -set_v4l_control(struct file *file, - int cid, - int value, - v4l2_kioctl drv) -{ - struct v4l2_queryctrl qctrl2; - struct v4l2_control ctrl2; - int err; - - qctrl2.id = cid; - err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); - if (err < 0) - dprintk("VIDIOC_QUERYCTRL: %d\n", err); - if (err == 0 && - !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED) && - !(qctrl2.flags & V4L2_CTRL_FLAG_GRABBED)) { - if (value < 0) - value = 0; - if (value > 65535) - value = 65535; - if (value && qctrl2.type == V4L2_CTRL_TYPE_BOOLEAN) - value = 65535; - ctrl2.id = qctrl2.id; - ctrl2.value = - (value * (qctrl2.maximum - qctrl2.minimum) - + 32767) - / 65535; - ctrl2.value += qctrl2.minimum; - err = drv(file, VIDIOC_S_CTRL, &ctrl2); - if (err < 0) - dprintk("VIDIOC_S_CTRL: %d\n", err); - } - return 0; -} - -/* ----------------------------------------------------------------- */ - -static const unsigned int palette2pixelformat[] = { - [VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY, - [VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555, - [VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565, - [VIDEO_PALETTE_RGB24] = V4L2_PIX_FMT_BGR24, - [VIDEO_PALETTE_RGB32] = V4L2_PIX_FMT_BGR32, - /* yuv packed pixel */ - [VIDEO_PALETTE_YUYV] = V4L2_PIX_FMT_YUYV, - [VIDEO_PALETTE_YUV422] = V4L2_PIX_FMT_YUYV, - [VIDEO_PALETTE_UYVY] = V4L2_PIX_FMT_UYVY, - /* yuv planar */ - [VIDEO_PALETTE_YUV410P] = V4L2_PIX_FMT_YUV410, - [VIDEO_PALETTE_YUV420] = V4L2_PIX_FMT_YUV420, - [VIDEO_PALETTE_YUV420P] = V4L2_PIX_FMT_YUV420, - [VIDEO_PALETTE_YUV411P] = V4L2_PIX_FMT_YUV411P, - [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, -}; - -static unsigned int __pure -palette_to_pixelformat(unsigned int palette) -{ - if (palette < ARRAY_SIZE(palette2pixelformat)) - return palette2pixelformat[palette]; - else - return 0; -} - -static unsigned int __attribute_const__ -pixelformat_to_palette(unsigned int pixelformat) -{ - int palette = 0; - switch (pixelformat) { - case V4L2_PIX_FMT_GREY: - palette = VIDEO_PALETTE_GREY; - break; - case V4L2_PIX_FMT_RGB555: - palette = VIDEO_PALETTE_RGB555; - break; - case V4L2_PIX_FMT_RGB565: - palette = VIDEO_PALETTE_RGB565; - break; - case V4L2_PIX_FMT_BGR24: - palette = VIDEO_PALETTE_RGB24; - break; - case V4L2_PIX_FMT_BGR32: - palette = VIDEO_PALETTE_RGB32; - break; - /* yuv packed pixel */ - case V4L2_PIX_FMT_YUYV: - palette = VIDEO_PALETTE_YUYV; - break; - case V4L2_PIX_FMT_UYVY: - palette = VIDEO_PALETTE_UYVY; - break; - /* yuv planar */ - case V4L2_PIX_FMT_YUV410: - palette = VIDEO_PALETTE_YUV420; - break; - case V4L2_PIX_FMT_YUV420: - palette = VIDEO_PALETTE_YUV420; - break; - case V4L2_PIX_FMT_YUV411P: - palette = VIDEO_PALETTE_YUV411P; - break; - case V4L2_PIX_FMT_YUV422P: - palette = VIDEO_PALETTE_YUV422P; - break; - } - return palette; -} - -/* ----------------------------------------------------------------- */ - -static int poll_one(struct file *file, struct poll_wqueues *pwq) -{ - int retval = 1; - poll_table *table; - - poll_initwait(pwq); - table = &pwq->pt; - for (;;) { - int mask; - mask = file->f_op->poll(file, table); - if (mask & POLLIN) - break; - table = NULL; - if (signal_pending(current)) { - retval = -ERESTARTSYS; - break; - } - poll_schedule(pwq, TASK_INTERRUPTIBLE); - } - poll_freewait(pwq); - return retval; -} - -static int count_inputs( - struct file *file, - v4l2_kioctl drv) -{ - struct v4l2_input input2; - int i; - - for (i = 0;; i++) { - memset(&input2, 0, sizeof(input2)); - input2.index = i; - if (0 != drv(file, VIDIOC_ENUMINPUT, &input2)) - break; - } - return i; -} - -static int check_size( - struct file *file, - v4l2_kioctl drv, - int *maxw, - int *maxh) -{ - struct v4l2_fmtdesc desc2; - struct v4l2_format fmt2; - - memset(&desc2, 0, sizeof(desc2)); - memset(&fmt2, 0, sizeof(fmt2)); - - desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (0 != drv(file, VIDIOC_ENUM_FMT, &desc2)) - goto done; - - fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - fmt2.fmt.pix.width = 10000; - fmt2.fmt.pix.height = 10000; - fmt2.fmt.pix.pixelformat = desc2.pixelformat; - if (0 != drv(file, VIDIOC_TRY_FMT, &fmt2)) - goto done; - - *maxw = fmt2.fmt.pix.width; - *maxh = fmt2.fmt.pix.height; - -done: - return 0; -} - -/* ----------------------------------------------------------------- */ - -static noinline long v4l1_compat_get_capabilities( - struct video_capability *cap, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - struct v4l2_capability *cap2; - - cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL); - if (!cap2) { - err = -ENOMEM; - return err; - } - memset(cap, 0, sizeof(*cap)); - memset(&fbuf, 0, sizeof(fbuf)); - - err = drv(file, VIDIOC_QUERYCAP, cap2); - if (err < 0) { - dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %ld\n", err); - goto done; - } - if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { - err = drv(file, VIDIOC_G_FBUF, &fbuf); - if (err < 0) { - dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %ld\n", err); - memset(&fbuf, 0, sizeof(fbuf)); - } - err = 0; - } - - memcpy(cap->name, cap2->card, - min(sizeof(cap->name), sizeof(cap2->card))); - cap->name[sizeof(cap->name) - 1] = 0; - if (cap2->capabilities & V4L2_CAP_VIDEO_CAPTURE) - cap->type |= VID_TYPE_CAPTURE; - if (cap2->capabilities & V4L2_CAP_TUNER) - cap->type |= VID_TYPE_TUNER; - if (cap2->capabilities & V4L2_CAP_VBI_CAPTURE) - cap->type |= VID_TYPE_TELETEXT; - if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) - cap->type |= VID_TYPE_OVERLAY; - if (fbuf.capability & V4L2_FBUF_CAP_LIST_CLIPPING) - cap->type |= VID_TYPE_CLIPPING; - - cap->channels = count_inputs(file, drv); - check_size(file, drv, - &cap->maxwidth, &cap->maxheight); - cap->audios = 0; /* FIXME */ - cap->minwidth = 48; /* FIXME */ - cap->minheight = 32; /* FIXME */ - -done: - kfree(cap2); - return err; -} - -static noinline long v4l1_compat_get_frame_buffer( - struct video_buffer *buffer, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - - memset(buffer, 0, sizeof(*buffer)); - memset(&fbuf, 0, sizeof(fbuf)); - - err = drv(file, VIDIOC_G_FBUF, &fbuf); - if (err < 0) { - dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %ld\n", err); - goto done; - } - buffer->base = fbuf.base; - buffer->height = fbuf.fmt.height; - buffer->width = fbuf.fmt.width; - - switch (fbuf.fmt.pixelformat) { - case V4L2_PIX_FMT_RGB332: - buffer->depth = 8; - break; - case V4L2_PIX_FMT_RGB555: - buffer->depth = 15; - break; - case V4L2_PIX_FMT_RGB565: - buffer->depth = 16; - break; - case V4L2_PIX_FMT_BGR24: - buffer->depth = 24; - break; - case V4L2_PIX_FMT_BGR32: - buffer->depth = 32; - break; - default: - buffer->depth = 0; - } - if (fbuf.fmt.bytesperline) { - buffer->bytesperline = fbuf.fmt.bytesperline; - if (!buffer->depth && buffer->width) - buffer->depth = ((fbuf.fmt.bytesperline<<3) - + (buffer->width-1)) - / buffer->width; - } else { - buffer->bytesperline = - (buffer->width * buffer->depth + 7) & 7; - buffer->bytesperline >>= 3; - } -done: - return err; -} - -static noinline long v4l1_compat_set_frame_buffer( - struct video_buffer *buffer, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - - memset(&fbuf, 0, sizeof(fbuf)); - fbuf.base = buffer->base; - fbuf.fmt.height = buffer->height; - fbuf.fmt.width = buffer->width; - switch (buffer->depth) { - case 8: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB332; - break; - case 15: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555; - break; - case 16: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565; - break; - case 24: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24; - break; - case 32: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32; - break; - } - fbuf.fmt.bytesperline = buffer->bytesperline; - err = drv(file, VIDIOC_S_FBUF, &fbuf); - if (err < 0) - dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_win_cap_dimensions( - struct video_window *win, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(win, 0, sizeof(*win)); - - fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) - dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %ld\n", err); - if (err == 0) { - win->x = fmt->fmt.win.w.left; - win->y = fmt->fmt.win.w.top; - win->width = fmt->fmt.win.w.width; - win->height = fmt->fmt.win.w.height; - win->chromakey = fmt->fmt.win.chromakey; - win->clips = NULL; - win->clipcount = 0; - goto done; - } - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - win->x = 0; - win->y = 0; - win->width = fmt->fmt.pix.width; - win->height = fmt->fmt.pix.height; - win->chromakey = 0; - win->clips = NULL; - win->clipcount = 0; -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_set_win_cap_dimensions( - struct video_window *win, - struct file *file, - v4l2_kioctl drv) -{ - long err, err1, err2; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - drv(file, VIDIOC_STREAMOFF, &fmt->type); - err1 = drv(file, VIDIOC_G_FMT, fmt); - if (err1 < 0) - dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %ld\n", err1); - if (err1 == 0) { - fmt->fmt.pix.width = win->width; - fmt->fmt.pix.height = win->height; - fmt->fmt.pix.field = V4L2_FIELD_ANY; - fmt->fmt.pix.bytesperline = 0; - err = drv(file, VIDIOC_S_FMT, fmt); - if (err < 0) - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %ld\n", - err); - win->width = fmt->fmt.pix.width; - win->height = fmt->fmt.pix.height; - } - - memset(fmt, 0, sizeof(*fmt)); - fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - fmt->fmt.win.w.left = win->x; - fmt->fmt.win.w.top = win->y; - fmt->fmt.win.w.width = win->width; - fmt->fmt.win.w.height = win->height; - fmt->fmt.win.chromakey = win->chromakey; - fmt->fmt.win.clips = (void __user *)win->clips; - fmt->fmt.win.clipcount = win->clipcount; - err2 = drv(file, VIDIOC_S_FMT, fmt); - if (err2 < 0) - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %ld\n", err2); - - if (err1 != 0 && err2 != 0) - err = err1; - else - err = 0; - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_turn_preview_on_off( - int *on, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (0 == *on) { - /* dirty hack time. But v4l1 has no STREAMOFF - * equivalent in the API, and this one at - * least comes close ... */ - drv(file, VIDIOC_STREAMOFF, &captype); - } - err = drv(file, VIDIOC_OVERLAY, on); - if (err < 0) - dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_input_info( - struct video_channel *chan, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_input input2; - v4l2_std_id sid; - - memset(&input2, 0, sizeof(input2)); - input2.index = chan->channel; - err = drv(file, VIDIOC_ENUMINPUT, &input2); - if (err < 0) { - dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " - "channel=%d err=%ld\n", chan->channel, err); - goto done; - } - chan->channel = input2.index; - memcpy(chan->name, input2.name, - min(sizeof(chan->name), sizeof(input2.name))); - chan->name[sizeof(chan->name) - 1] = 0; - chan->tuners = (input2.type == V4L2_INPUT_TYPE_TUNER) ? 1 : 0; - chan->flags = (chan->tuners) ? VIDEO_VC_TUNER : 0; - switch (input2.type) { - case V4L2_INPUT_TYPE_TUNER: - chan->type = VIDEO_TYPE_TV; - break; - default: - case V4L2_INPUT_TYPE_CAMERA: - chan->type = VIDEO_TYPE_CAMERA; - break; - } - chan->norm = 0; - /* Note: G_STD might not be present for radio receivers, - * so we should ignore any errors. */ - if (drv(file, VIDIOC_G_STD, &sid) == 0) { - if (sid & V4L2_STD_PAL) - chan->norm = VIDEO_MODE_PAL; - if (sid & V4L2_STD_NTSC) - chan->norm = VIDEO_MODE_NTSC; - if (sid & V4L2_STD_SECAM) - chan->norm = VIDEO_MODE_SECAM; - if (sid == V4L2_STD_ALL) - chan->norm = VIDEO_MODE_AUTO; - } -done: - return err; -} - -static noinline long v4l1_compat_set_input( - struct video_channel *chan, - struct file *file, - v4l2_kioctl drv) -{ - long err; - v4l2_std_id sid = 0; - - err = drv(file, VIDIOC_S_INPUT, &chan->channel); - if (err < 0) - dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %ld\n", err); - switch (chan->norm) { - case VIDEO_MODE_PAL: - sid = V4L2_STD_PAL; - break; - case VIDEO_MODE_NTSC: - sid = V4L2_STD_NTSC; - break; - case VIDEO_MODE_SECAM: - sid = V4L2_STD_SECAM; - break; - case VIDEO_MODE_AUTO: - sid = V4L2_STD_ALL; - break; - } - if (0 != sid) { - err = drv(file, VIDIOC_S_STD, &sid); - if (err < 0) - dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err); - } - return err; -} - -static noinline long v4l1_compat_get_picture( - struct video_picture *pict, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - - pict->brightness = get_v4l_control(file, - V4L2_CID_BRIGHTNESS, drv); - pict->hue = get_v4l_control(file, - V4L2_CID_HUE, drv); - pict->contrast = get_v4l_control(file, - V4L2_CID_CONTRAST, drv); - pict->colour = get_v4l_control(file, - V4L2_CID_SATURATION, drv); - pict->whiteness = get_v4l_control(file, - V4L2_CID_WHITENESS, drv); - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - - if (fmt->fmt.pix.width) - { - pict->depth = ((fmt->fmt.pix.bytesperline << 3) - + (fmt->fmt.pix.width - 1)) - / fmt->fmt.pix.width; - } else { - err = -EINVAL; - goto done; - } - - pict->palette = pixelformat_to_palette( - fmt->fmt.pix.pixelformat); -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_set_picture( - struct video_picture *pict, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - int mem_err = 0, ovl_err = 0; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(&fbuf, 0, sizeof(fbuf)); - - set_v4l_control(file, - V4L2_CID_BRIGHTNESS, pict->brightness, drv); - set_v4l_control(file, - V4L2_CID_HUE, pict->hue, drv); - set_v4l_control(file, - V4L2_CID_CONTRAST, pict->contrast, drv); - set_v4l_control(file, - V4L2_CID_SATURATION, pict->colour, drv); - set_v4l_control(file, - V4L2_CID_WHITENESS, pict->whiteness, drv); - /* - * V4L1 uses this ioctl to set both memory capture and overlay - * pixel format, while V4L2 has two different ioctls for this. - * Some cards may not support one or the other, and may support - * different pixel formats for memory vs overlay. - */ - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - /* If VIDIOC_G_FMT failed, then the driver likely doesn't - support memory capture. Trying to set the memory capture - parameters would be pointless. */ - if (err < 0) { - dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %ld\n", err); - mem_err = -1000; /* didn't even try */ - } else if (fmt->fmt.pix.pixelformat != - palette_to_pixelformat(pict->palette)) { - fmt->fmt.pix.pixelformat = palette_to_pixelformat( - pict->palette); - mem_err = drv(file, VIDIOC_S_FMT, fmt); - if (mem_err < 0) - dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", - mem_err); - } - - err = drv(file, VIDIOC_G_FBUF, &fbuf); - /* If VIDIOC_G_FBUF failed, then the driver likely doesn't - support overlay. Trying to set the overlay parameters - would be quite pointless. */ - if (err < 0) { - dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %ld\n", err); - ovl_err = -1000; /* didn't even try */ - } else if (fbuf.fmt.pixelformat != - palette_to_pixelformat(pict->palette)) { - fbuf.fmt.pixelformat = palette_to_pixelformat( - pict->palette); - ovl_err = drv(file, VIDIOC_S_FBUF, &fbuf); - if (ovl_err < 0) - dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", - ovl_err); - } - if (ovl_err < 0 && mem_err < 0) { - /* ioctl failed, couldn't set either parameter */ - if (mem_err != -1000) - err = mem_err; - else if (ovl_err == -EPERM) - err = 0; - else - err = ovl_err; - } else - err = 0; - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_get_tuner( - struct video_tuner *tun, - struct file *file, - v4l2_kioctl drv) -{ - long err; - int i; - struct v4l2_tuner tun2; - struct v4l2_standard std2; - v4l2_std_id sid; - - memset(&tun2, 0, sizeof(tun2)); - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) { - dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %ld\n", err); - goto done; - } - memcpy(tun->name, tun2.name, - min(sizeof(tun->name), sizeof(tun2.name))); - tun->name[sizeof(tun->name) - 1] = 0; - tun->rangelow = tun2.rangelow; - tun->rangehigh = tun2.rangehigh; - tun->flags = 0; - tun->mode = VIDEO_MODE_AUTO; - - for (i = 0; i < 64; i++) { - memset(&std2, 0, sizeof(std2)); - std2.index = i; - if (0 != drv(file, VIDIOC_ENUMSTD, &std2)) - break; - if (std2.id & V4L2_STD_PAL) - tun->flags |= VIDEO_TUNER_PAL; - if (std2.id & V4L2_STD_NTSC) - tun->flags |= VIDEO_TUNER_NTSC; - if (std2.id & V4L2_STD_SECAM) - tun->flags |= VIDEO_TUNER_SECAM; - } - - /* Note: G_STD might not be present for radio receivers, - * so we should ignore any errors. */ - if (drv(file, VIDIOC_G_STD, &sid) == 0) { - if (sid & V4L2_STD_PAL) - tun->mode = VIDEO_MODE_PAL; - if (sid & V4L2_STD_NTSC) - tun->mode = VIDEO_MODE_NTSC; - if (sid & V4L2_STD_SECAM) - tun->mode = VIDEO_MODE_SECAM; - } - - if (tun2.capability & V4L2_TUNER_CAP_LOW) - tun->flags |= VIDEO_TUNER_LOW; - if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) - tun->flags |= VIDEO_TUNER_STEREO_ON; - tun->signal = tun2.signal; -done: - return err; -} - -static noinline long v4l1_compat_select_tuner( - struct video_tuner *tun, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_tuner t;/*84 bytes on x86_64*/ - memset(&t, 0, sizeof(t)); - - t.index = tun->tuner; - - err = drv(file, VIDIOC_S_TUNER, &t); - if (err < 0) - dprintk("VIDIOCSTUNER / VIDIOC_S_TUNER: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_frequency( - unsigned long *freq, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_frequency freq2; - memset(&freq2, 0, sizeof(freq2)); - - freq2.tuner = 0; - err = drv(file, VIDIOC_G_FREQUENCY, &freq2); - if (err < 0) - dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %ld\n", err); - if (0 == err) - *freq = freq2.frequency; - return err; -} - -static noinline long v4l1_compat_set_frequency( - unsigned long *freq, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_frequency freq2; - memset(&freq2, 0, sizeof(freq2)); - - drv(file, VIDIOC_G_FREQUENCY, &freq2); - freq2.frequency = *freq; - err = drv(file, VIDIOC_S_FREQUENCY, &freq2); - if (err < 0) - dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_audio( - struct video_audio *aud, - struct file *file, - v4l2_kioctl drv) -{ - long err; - int i; - struct v4l2_queryctrl qctrl2; - struct v4l2_audio aud2; - struct v4l2_tuner tun2; - memset(&aud2, 0, sizeof(aud2)); - - err = drv(file, VIDIOC_G_AUDIO, &aud2); - if (err < 0) { - dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %ld\n", err); - goto done; - } - memcpy(aud->name, aud2.name, - min(sizeof(aud->name), sizeof(aud2.name))); - aud->name[sizeof(aud->name) - 1] = 0; - aud->audio = aud2.index; - aud->flags = 0; - i = get_v4l_control(file, V4L2_CID_AUDIO_VOLUME, drv); - if (i >= 0) { - aud->volume = i; - aud->flags |= VIDEO_AUDIO_VOLUME; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_BASS, drv); - if (i >= 0) { - aud->bass = i; - aud->flags |= VIDEO_AUDIO_BASS; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_TREBLE, drv); - if (i >= 0) { - aud->treble = i; - aud->flags |= VIDEO_AUDIO_TREBLE; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_BALANCE, drv); - if (i >= 0) { - aud->balance = i; - aud->flags |= VIDEO_AUDIO_BALANCE; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_MUTE, drv); - if (i >= 0) { - if (i) - aud->flags |= VIDEO_AUDIO_MUTE; - aud->flags |= VIDEO_AUDIO_MUTABLE; - } - aud->step = 1; - qctrl2.id = V4L2_CID_AUDIO_VOLUME; - if (drv(file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && - !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) - aud->step = qctrl2.step; - aud->mode = 0; - - memset(&tun2, 0, sizeof(tun2)); - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) { - dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %ld\n", err); - err = 0; - goto done; - } - - if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) - aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; - else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) - aud->mode = VIDEO_SOUND_STEREO; - else if (tun2.rxsubchans & V4L2_TUNER_SUB_MONO) - aud->mode = VIDEO_SOUND_MONO; -done: - return err; -} - -static noinline long v4l1_compat_set_audio( - struct video_audio *aud, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_audio aud2; - struct v4l2_tuner tun2; - - memset(&aud2, 0, sizeof(aud2)); - memset(&tun2, 0, sizeof(tun2)); - - aud2.index = aud->audio; - err = drv(file, VIDIOC_S_AUDIO, &aud2); - if (err < 0) { - dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %ld\n", err); - goto done; - } - - set_v4l_control(file, V4L2_CID_AUDIO_VOLUME, - aud->volume, drv); - set_v4l_control(file, V4L2_CID_AUDIO_BASS, - aud->bass, drv); - set_v4l_control(file, V4L2_CID_AUDIO_TREBLE, - aud->treble, drv); - set_v4l_control(file, V4L2_CID_AUDIO_BALANCE, - aud->balance, drv); - set_v4l_control(file, V4L2_CID_AUDIO_MUTE, - !!(aud->flags & VIDEO_AUDIO_MUTE), drv); - - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) - dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %ld\n", err); - if (err == 0) { - switch (aud->mode) { - default: - case VIDEO_SOUND_MONO: - case VIDEO_SOUND_LANG1: - tun2.audmode = V4L2_TUNER_MODE_MONO; - break; - case VIDEO_SOUND_STEREO: - tun2.audmode = V4L2_TUNER_MODE_STEREO; - break; - case VIDEO_SOUND_LANG2: - tun2.audmode = V4L2_TUNER_MODE_LANG2; - break; - } - err = drv(file, VIDIOC_S_TUNER, &tun2); - if (err < 0) - dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %ld\n", err); - } - err = 0; -done: - return err; -} - -static noinline long v4l1_compat_capture_frame( - struct video_mmap *mm, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - struct v4l2_buffer buf; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(&buf, 0, sizeof(buf)); - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - if (mm->width != fmt->fmt.pix.width || - mm->height != fmt->fmt.pix.height || - palette_to_pixelformat(mm->format) != - fmt->fmt.pix.pixelformat) { - /* New capture format... */ - fmt->fmt.pix.width = mm->width; - fmt->fmt.pix.height = mm->height; - fmt->fmt.pix.pixelformat = - palette_to_pixelformat(mm->format); - fmt->fmt.pix.field = V4L2_FIELD_ANY; - fmt->fmt.pix.bytesperline = 0; - err = drv(file, VIDIOC_S_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %ld\n", err); - goto done; - } - } - buf.index = mm->frame; - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %ld\n", err); - goto done; - } - err = drv(file, VIDIOC_QBUF, &buf); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %ld\n", err); - goto done; - } - err = drv(file, VIDIOC_STREAMON, &captype); - if (err < 0) - dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %ld\n", err); -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_sync( - int *i, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - struct v4l2_buffer buf; - struct poll_wqueues *pwq; - - memset(&buf, 0, sizeof(buf)); - buf.index = *i; - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) { - /* No such buffer */ - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); - goto done; - } - if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { - /* Buffer is not mapped */ - err = -EINVAL; - goto done; - } - - /* make sure capture actually runs so we don't block forever */ - err = drv(file, VIDIOC_STREAMON, &captype); - if (err < 0) { - dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %ld\n", err); - goto done; - } - - pwq = kmalloc(sizeof(*pwq), GFP_KERNEL); - /* Loop as long as the buffer is queued, but not done */ - while ((buf.flags & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) - == V4L2_BUF_FLAG_QUEUED) { - err = poll_one(file, pwq); - if (err < 0 || /* error or sleep was interrupted */ - err == 0) /* timeout? Shouldn't occur. */ - break; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); - } - kfree(pwq); - if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ - goto done; - do { - err = drv(file, VIDIOC_DQBUF, &buf); - if (err < 0) - dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %ld\n", err); - } while (err == 0 && buf.index != *i); -done: - return err; -} - -static noinline long v4l1_compat_get_vbi_format( - struct vbi_format *fmt, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt2; - - fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); - if (!fmt2) { - err = -ENOMEM; - return err; - } - fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - - err = drv(file, VIDIOC_G_FMT, fmt2); - if (err < 0) { - dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { - err = -EINVAL; - goto done; - } - memset(fmt, 0, sizeof(*fmt)); - fmt->samples_per_line = fmt2->fmt.vbi.samples_per_line; - fmt->sampling_rate = fmt2->fmt.vbi.sampling_rate; - fmt->sample_format = VIDEO_PALETTE_RAW; - fmt->start[0] = fmt2->fmt.vbi.start[0]; - fmt->count[0] = fmt2->fmt.vbi.count[0]; - fmt->start[1] = fmt2->fmt.vbi.start[1]; - fmt->count[1] = fmt2->fmt.vbi.count[1]; - fmt->flags = fmt2->fmt.vbi.flags & 0x03; -done: - kfree(fmt2); - return err; -} - -static noinline long v4l1_compat_set_vbi_format( - struct vbi_format *fmt, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt2 = NULL; - - if (VIDEO_PALETTE_RAW != fmt->sample_format) { - err = -EINVAL; - return err; - } - - fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); - if (!fmt2) { - err = -ENOMEM; - return err; - } - fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; - fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; - fmt2->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; - fmt2->fmt.vbi.start[0] = fmt->start[0]; - fmt2->fmt.vbi.count[0] = fmt->count[0]; - fmt2->fmt.vbi.start[1] = fmt->start[1]; - fmt2->fmt.vbi.count[1] = fmt->count[1]; - fmt2->fmt.vbi.flags = fmt->flags; - err = drv(file, VIDIOC_TRY_FMT, fmt2); - if (err < 0) { - dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %ld\n", err); - goto done; - } - - if (fmt2->fmt.vbi.samples_per_line != fmt->samples_per_line || - fmt2->fmt.vbi.sampling_rate != fmt->sampling_rate || - fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY || - fmt2->fmt.vbi.start[0] != fmt->start[0] || - fmt2->fmt.vbi.count[0] != fmt->count[0] || - fmt2->fmt.vbi.start[1] != fmt->start[1] || - fmt2->fmt.vbi.count[1] != fmt->count[1] || - fmt2->fmt.vbi.flags != fmt->flags) { - err = -EINVAL; - goto done; - } - err = drv(file, VIDIOC_S_FMT, fmt2); - if (err < 0) - dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %ld\n", err); -done: - kfree(fmt2); - return err; -} - -/* - * This function is exported. - */ -long -v4l_compat_translate_ioctl(struct file *file, - int cmd, - void *arg, - v4l2_kioctl drv) -{ - long err; - - switch (cmd) { - case VIDIOCGCAP: /* capability */ - err = v4l1_compat_get_capabilities(arg, file, drv); - break; - case VIDIOCGFBUF: /* get frame buffer */ - err = v4l1_compat_get_frame_buffer(arg, file, drv); - break; - case VIDIOCSFBUF: /* set frame buffer */ - err = v4l1_compat_set_frame_buffer(arg, file, drv); - break; - case VIDIOCGWIN: /* get window or capture dimensions */ - err = v4l1_compat_get_win_cap_dimensions(arg, file, drv); - break; - case VIDIOCSWIN: /* set window and/or capture dimensions */ - err = v4l1_compat_set_win_cap_dimensions(arg, file, drv); - break; - case VIDIOCCAPTURE: /* turn on/off preview */ - err = v4l1_compat_turn_preview_on_off(arg, file, drv); - break; - case VIDIOCGCHAN: /* get input information */ - err = v4l1_compat_get_input_info(arg, file, drv); - break; - case VIDIOCSCHAN: /* set input */ - err = v4l1_compat_set_input(arg, file, drv); - break; - case VIDIOCGPICT: /* get tone controls & partial capture format */ - err = v4l1_compat_get_picture(arg, file, drv); - break; - case VIDIOCSPICT: /* set tone controls & partial capture format */ - err = v4l1_compat_set_picture(arg, file, drv); - break; - case VIDIOCGTUNER: /* get tuner information */ - err = v4l1_compat_get_tuner(arg, file, drv); - break; - case VIDIOCSTUNER: /* select a tuner input */ - err = v4l1_compat_select_tuner(arg, file, drv); - break; - case VIDIOCGFREQ: /* get frequency */ - err = v4l1_compat_get_frequency(arg, file, drv); - break; - case VIDIOCSFREQ: /* set frequency */ - err = v4l1_compat_set_frequency(arg, file, drv); - break; - case VIDIOCGAUDIO: /* get audio properties/controls */ - err = v4l1_compat_get_audio(arg, file, drv); - break; - case VIDIOCSAUDIO: /* set audio controls */ - err = v4l1_compat_set_audio(arg, file, drv); - break; - case VIDIOCMCAPTURE: /* capture a frame */ - err = v4l1_compat_capture_frame(arg, file, drv); - break; - case VIDIOCSYNC: /* wait for a frame */ - err = v4l1_compat_sync(arg, file, drv); - break; - case VIDIOCGVBIFMT: /* query VBI data capture format */ - err = v4l1_compat_get_vbi_format(arg, file, drv); - break; - case VIDIOCSVBIFMT: - err = v4l1_compat_set_vbi_format(arg, file, drv); - break; - default: - err = -ENOIOCTLCMD; - break; - } - - return err; -} -EXPORT_SYMBOL(v4l_compat_translate_ioctl); - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index e30e8dfb6205..425ac1e4a00e 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -22,212 +22,6 @@ #ifdef CONFIG_COMPAT -#ifdef CONFIG_VIDEO_V4L1_COMPAT -struct video_tuner32 { - compat_int_t tuner; - char name[32]; - compat_ulong_t rangelow, rangehigh; - u32 flags; /* It is really u32 in videodev.h */ - u16 mode, signal; -}; - -static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) -{ - if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || - get_user(kp->tuner, &up->tuner) || - copy_from_user(kp->name, up->name, 32) || - get_user(kp->rangelow, &up->rangelow) || - get_user(kp->rangehigh, &up->rangehigh) || - get_user(kp->flags, &up->flags) || - get_user(kp->mode, &up->mode) || - get_user(kp->signal, &up->signal)) - return -EFAULT; - return 0; -} - -static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) -{ - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || - put_user(kp->tuner, &up->tuner) || - copy_to_user(up->name, kp->name, 32) || - put_user(kp->rangelow, &up->rangelow) || - put_user(kp->rangehigh, &up->rangehigh) || - put_user(kp->flags, &up->flags) || - put_user(kp->mode, &up->mode) || - put_user(kp->signal, &up->signal)) - return -EFAULT; - return 0; -} - -struct video_buffer32 { - compat_caddr_t base; - compat_int_t height, width, depth, bytesperline; -}; - -static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) -{ - u32 tmp; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) || - get_user(tmp, &up->base) || - get_user(kp->height, &up->height) || - get_user(kp->width, &up->width) || - get_user(kp->depth, &up->depth) || - get_user(kp->bytesperline, &up->bytesperline)) - return -EFAULT; - - /* This is actually a physical address stored - * as a void pointer. - */ - kp->base = (void *)(unsigned long) tmp; - - return 0; -} - -static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) -{ - u32 tmp = (u32)((unsigned long)kp->base); - - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || - put_user(tmp, &up->base) || - put_user(kp->height, &up->height) || - put_user(kp->width, &up->width) || - put_user(kp->depth, &up->depth) || - put_user(kp->bytesperline, &up->bytesperline)) - return -EFAULT; - return 0; -} - -struct video_clip32 { - s32 x, y, width, height; /* It's really s32 in videodev.h */ - compat_caddr_t next; -}; - -struct video_window32 { - u32 x, y, width, height, chromakey, flags; - compat_caddr_t clips; - compat_int_t clipcount; -}; - -static int get_video_window32(struct video_window *kp, struct video_window32 __user *up) -{ - struct video_clip __user *uclips; - struct video_clip __user *kclips; - compat_caddr_t p; - int nclips; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32))) - return -EFAULT; - - if (get_user(nclips, &up->clipcount)) - return -EFAULT; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)) || - get_user(kp->x, &up->x) || - get_user(kp->y, &up->y) || - get_user(kp->width, &up->width) || - get_user(kp->height, &up->height) || - get_user(kp->chromakey, &up->chromakey) || - get_user(kp->flags, &up->flags) || - get_user(kp->clipcount, &up->clipcount)) - return -EFAULT; - - nclips = kp->clipcount; - kp->clips = NULL; - - if (nclips == 0) - return 0; - if (get_user(p, &up->clips)) - return -EFAULT; - uclips = compat_ptr(p); - - /* If nclips < 0, then it is a clipping bitmap of size - VIDEO_CLIPMAP_SIZE */ - if (nclips < 0) { - if (!access_ok(VERIFY_READ, uclips, VIDEO_CLIPMAP_SIZE)) - return -EFAULT; - kp->clips = compat_alloc_user_space(VIDEO_CLIPMAP_SIZE); - if (copy_in_user(kp->clips, uclips, VIDEO_CLIPMAP_SIZE)) - return -EFAULT; - return 0; - } - - /* Otherwise it is an array of video_clip structs. */ - if (!access_ok(VERIFY_READ, uclips, nclips * sizeof(struct video_clip))) - return -EFAULT; - - kp->clips = compat_alloc_user_space(nclips * sizeof(struct video_clip)); - kclips = kp->clips; - while (nclips--) { - int err; - - err = copy_in_user(&kclips->x, &uclips->x, sizeof(kclips->x)); - err |= copy_in_user(&kclips->y, &uclips->y, sizeof(kclips->y)); - err |= copy_in_user(&kclips->width, &uclips->width, sizeof(kclips->width)); - err |= copy_in_user(&kclips->height, &uclips->height, sizeof(kclips->height)); - kclips->next = NULL; - if (err) - return -EFAULT; - kclips++; - uclips++; - } - return 0; -} - -/* You get back everything except the clips... */ -static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) -{ - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || - put_user(kp->x, &up->x) || - put_user(kp->y, &up->y) || - put_user(kp->width, &up->width) || - put_user(kp->height, &up->height) || - put_user(kp->chromakey, &up->chromakey) || - put_user(kp->flags, &up->flags) || - put_user(kp->clipcount, &up->clipcount)) - return -EFAULT; - return 0; -} - -struct video_code32 { - char loadwhat[16]; /* name or tag of file being passed */ - compat_int_t datasize; - compat_uptr_t data; -}; - -static struct video_code __user *get_microcode32(struct video_code32 *kp) -{ - struct video_code __user *up; - - up = compat_alloc_user_space(sizeof(*up)); - - /* - * NOTE! We don't actually care if these fail. If the - * user address is invalid, the native ioctl will do - * the error handling for us - */ - (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); - (void) put_user(kp->datasize, &up->datasize); - (void) put_user(compat_ptr(kp->data), &up->data); - return up; -} - -#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) -#define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32) -#define VIDIOCGWIN32 _IOR('v', 9, struct video_window32) -#define VIDIOCSWIN32 _IOW('v', 10, struct video_window32) -#define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32) -#define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32) -#define VIDIOCGFREQ32 _IOR('v', 14, u32) -#define VIDIOCSFREQ32 _IOW('v', 15, u32) -#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32) - -#define VIDIOCCAPTURE32 _IOW('v', 8, s32) -#define VIDIOCSYNC32 _IOW('v', 18, s32) -#define VIDIOCSWRITEMODE32 _IOW('v', 25, s32) - -#endif - static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long ret = -ENOIOCTLCMD; @@ -741,13 +535,6 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { union { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - struct video_tuner vt; - struct video_buffer vb; - struct video_window vw; - struct video_code32 vc; - struct video_audio va; -#endif struct v4l2_format v2f; struct v4l2_buffer v2b; struct v4l2_framebuffer v2fb; @@ -763,17 +550,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar /* First, convert the command. */ switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; - case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; - case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; - case VIDIOCSWIN32: cmd = VIDIOCSWIN; break; - case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; - case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; - case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; - case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; - case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; -#endif case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; @@ -800,46 +576,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar } switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCSTUNER: - case VIDIOCGTUNER: - err = get_video_tuner32(&karg.vt, up); - compatible_arg = 0; - break; - - case VIDIOCSFBUF: - err = get_video_buffer32(&karg.vb, up); - compatible_arg = 0; - break; - - case VIDIOCSWIN: - err = get_video_window32(&karg.vw, up); - compatible_arg = 0; - break; - - case VIDIOCGWIN: - case VIDIOCGFBUF: - case VIDIOCGFREQ: - compatible_arg = 0; - break; - - case VIDIOCSMICROCODE: - /* Copy the 32-bit "video_code32" to kernel space */ - if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) - return -EFAULT; - /* Convert the 32-bit version to a 64-bit version in user space */ - up = get_microcode32(&karg.vc); - break; - - case VIDIOCSFREQ: - err = get_user(karg.vx, (u32 __user *)up); - compatible_arg = 0; - break; - - case VIDIOCCAPTURE: - case VIDIOCSYNC: - case VIDIOCSWRITEMODE: -#endif case VIDIOC_OVERLAY: case VIDIOC_STREAMON: case VIDIOC_STREAMOFF: @@ -922,23 +658,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar return err; switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGTUNER: - err = put_video_tuner32(&karg.vt, up); - break; - - case VIDIOCGWIN: - err = put_video_window32(&karg.vw, up); - break; - - case VIDIOCGFBUF: - err = put_video_buffer32(&karg.vb, up); - break; - - case VIDIOCGFREQ: - err = put_user(((u32)karg.vx), (u32 __user *)up); - break; -#endif case VIDIOC_S_INPUT: case VIDIOC_S_OUTPUT: case VIDIOC_G_INPUT: @@ -981,37 +700,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) return ret; switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGCAP: - case VIDIOCGCHAN: - case VIDIOCSCHAN: - case VIDIOCGTUNER32: - case VIDIOCSTUNER32: - case VIDIOCGPICT: - case VIDIOCSPICT: - case VIDIOCCAPTURE32: - case VIDIOCGWIN32: - case VIDIOCSWIN32: - case VIDIOCGFBUF32: - case VIDIOCSFBUF32: - case VIDIOCKEY: - case VIDIOCGFREQ32: - case VIDIOCSFREQ32: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: - case VIDIOCSYNC32: - case VIDIOCMCAPTURE: - case VIDIOCGMBUF: - case VIDIOCGUNIT: - case VIDIOCGCAPTURE: - case VIDIOCSCAPTURE: - case VIDIOCSPLAYMODE: - case VIDIOCSWRITEMODE32: - case VIDIOCGPLAYINFO: - case VIDIOCSMICROCODE32: - case VIDIOCGVBIFMT: - case VIDIOCSVBIFMT: -#endif #ifdef __OLD_VIDIOC_ case VIDIOC_OVERLAY32_OLD: case VIDIOC_S_PARM_OLD: @@ -1096,19 +784,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ret = do_video_ioctl(file, cmd, arg); break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* BTTV specific... */ - case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]): - case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]): - case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int): - case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */ - case _IOR('v' , BASE_VIDIOCPRIVATE+4, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+5, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+6, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): - ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); - break; -#endif default: printk(KERN_WARNING "compat_ioctl32: " "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n", diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index dd9283fcb564..7e47f15f350d 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -18,12 +18,8 @@ #include #define __OLD_VIDIOC_ /* To allow fixing old calls */ -#include #include -#ifdef CONFIG_VIDEO_V4L1 -#include -#endif #include #include #include @@ -183,42 +179,6 @@ static const char *v4l2_memory_names[] = { /* ------------------------------------------------------------------ */ /* debug help functions */ - -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static const char *v4l1_ioctls[] = { - [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", - [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", - [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", - [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", - [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", - [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", - [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", - [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", - [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", - [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", - [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", - [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", - [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", - [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", - [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", - [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", - [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", - [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", - [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", - [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", - [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", - [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", - [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", - [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", - [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", - [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", - [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", - [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", - [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" -}; -#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) -#endif - static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", @@ -310,15 +270,6 @@ void v4l_printk_ioctl(unsigned int cmd) case 'd': type = "v4l2_int"; break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case 'v': - if (_IOC_NR(cmd) >= V4L1_IOCTLS) { - type = "v4l1"; - break; - } - printk("%s", v4l1_ioctls[_IOC_NR(cmd)]); - return; -#endif case 'V': if (_IOC_NR(cmd) >= V4L2_IOCTLS) { type = "v4l2"; @@ -622,20 +573,6 @@ static long __video_do_ioctl(struct file *file, return -EINVAL; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /******************************************************** - All other V4L1 calls are handled by v4l1_compat module. - Those calls will be translated into V4L2 calls, and - __video_do_ioctl will be called again, with one or more - V4L2 ioctls. - ********************************************************/ - if (_IOC_TYPE(cmd) == 'v' && cmd != VIDIOCGMBUF && - _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) { - return v4l_compat_translate_ioctl(file, cmd, arg, - __video_do_ioctl); - } -#endif - if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { v4l_print_ioctl(vfd->name, cmd); @@ -644,29 +581,6 @@ static long __video_do_ioctl(struct file *file, switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /*********************************************************** - Handles calls to the obsoleted V4L1 API - Due to the nature of VIDIOCGMBUF, each driver that supports - V4L1 should implement its own handler for this ioctl. - ***********************************************************/ - - /* --- streaming capture ------------------------------------- */ - case VIDIOCGMBUF: - { - struct video_mbuf *p = arg; - - if (!ops->vidiocgmbuf) - break; - ret = ops->vidiocgmbuf(file, fh, p); - if (!ret) - dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", - p->size, p->frames, - (unsigned long)p->offsets); - break; - } -#endif - /* --- capabilities ------------------------------------------ */ case VIDIOC_QUERYCAP: { diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 9eda7cc03121..e25aca5759fb 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c @@ -1161,16 +1161,6 @@ out: return ret; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int viacam_vidiocgmbuf(struct file *filp, void *priv, - struct video_mbuf *mbuf) -{ - struct via_camera *cam = priv; - - return videobuf_cgmbuf(&cam->vb_queue, mbuf, 6); -} -#endif - /* G/S_PARM */ static int viacam_g_parm(struct file *filp, void *priv, @@ -1251,9 +1241,6 @@ static const struct v4l2_ioctl_ops viacam_ioctl_ops = { .vidioc_s_parm = viacam_s_parm, .vidioc_enum_framesizes = viacam_enum_framesizes, .vidioc_enum_frameintervals = viacam_enum_frameintervals, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = viacam_vidiocgmbuf, -#endif }; /*----------------------------------------------------------------------------*/ diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 8979f91fa8e5..de4fa4eb8844 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -1202,33 +1202,3 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, struct vm_area_struct *vma) return rc; } EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); - -#ifdef CONFIG_VIDEO_V4L1_COMPAT -int videobuf_cgmbuf(struct videobuf_queue *q, - struct video_mbuf *mbuf, int count) -{ - struct v4l2_requestbuffers req; - int rc, i; - - MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); - - memset(&req, 0, sizeof(req)); - req.type = q->type; - req.count = count; - req.memory = V4L2_MEMORY_MMAP; - rc = videobuf_reqbufs(q, &req); - if (rc < 0) - return rc; - - mbuf->frames = req.count; - mbuf->size = 0; - for (i = 0; i < mbuf->frames; i++) { - mbuf->offsets[i] = q->bufs[i]->boff; - mbuf->size += PAGE_ALIGN(q->bufs[i]->bsize); - } - - return 0; -} -EXPORT_SYMBOL_GPL(videobuf_cgmbuf); -#endif - diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index ab684e807034..9d520601c70f 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -570,29 +570,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, } last = first; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - if (size != (vma->vm_end - vma->vm_start)) { - /* look for last buffer to map */ - for (last = first + 1; last < VIDEO_MAX_FRAME; last++) { - if (NULL == q->bufs[last]) - continue; - if (V4L2_MEMORY_MMAP != q->bufs[last]->memory) - continue; - if (q->bufs[last]->map) { - retval = -EBUSY; - goto done; - } - size += PAGE_ALIGN(q->bufs[last]->bsize); - if (size == (vma->vm_end - vma->vm_start)) - break; - } - if (VIDEO_MAX_FRAME == last) { - dprintk(1, "mmap app bug: size invalid [size=0x%lx]\n", - (vma->vm_end - vma->vm_start)); - goto done; - } - } -#endif /* create mapping + update buffer list */ retval = -ENOMEM; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 9797e5a69265..c49c39386bd0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -870,15 +870,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct vivi_dev *dev = video_drvdata(file); - - return videobuf_cgmbuf(&dev->vb_vidq, mbuf, 8); -} -#endif - static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { struct vivi_dev *dev = video_drvdata(file); @@ -1105,9 +1096,6 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = { .vidioc_queryctrl = vidioc_queryctrl, .vidioc_g_ctrl = vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static struct video_device vivi_template = { diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index 3c121fcb8731..27406c31d876 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c @@ -1188,34 +1188,6 @@ int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct cx25821_fh *fh = priv; - struct videobuf_queue *q; - struct v4l2_requestbuffers req; - unsigned int i; - int err; - - q = get_queue(fh); - memset(&req, 0, sizeof(req)); - req.type = q->type; - req.count = 8; - req.memory = V4L2_MEMORY_MMAP; - err = videobuf_reqbufs(q, &req); - if (err < 0) - return err; - - mbuf->frames = req.count; - mbuf->size = 0; - for (i = 0; i < mbuf->frames; i++) { - mbuf->offsets[i] = q->bufs[i]->boff; - mbuf->size += q->bufs[i]->bsize; - } - return 0; -} -#endif - int cx25821_vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct cx25821_fh *fh = priv; @@ -2016,9 +1988,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_log_status = vidioc_log_status, .vidioc_g_priority = cx25821_vidioc_g_priority, .vidioc_s_priority = cx25821_vidioc_s_priority, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = cx25821_vidiocgmbuf, -#endif #ifdef TUNER_FLAG .vidioc_g_tuner = cx25821_vidioc_g_tuner, .vidioc_s_tuner = cx25821_vidioc_s_tuner, diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h index 213f37cea348..f4ee8051b8b3 100644 --- a/drivers/staging/cx25821/cx25821-video.h +++ b/drivers/staging/cx25821/cx25821-video.h @@ -40,11 +40,6 @@ #include #include -#ifdef CONFIG_VIDEO_V4L1_COMPAT -/* Include V4L1 specific functions. Should be removed soon */ -#include -#endif - #define TUNER_FLAG #define VIDEO_DEBUG 0 @@ -134,7 +129,6 @@ extern int cx25821_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap); extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f); -extern int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf); extern int cx25821_vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p); extern int cx25821_vidioc_querybuf(struct file *file, void *priv, diff --git a/drivers/staging/dt3155v4l/dt3155v4l.c b/drivers/staging/dt3155v4l/dt3155v4l.c index b996697e7eb2..15d7efeed292 100644 --- a/drivers/staging/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/dt3155v4l/dt3155v4l.c @@ -876,9 +876,6 @@ static const struct v4l2_ioctl_ops dt3155_ioctl_ops = { .vidioc_s_crop = dt3155_ioc_s_crop, .vidioc_enum_framesizes = dt3155_ioc_enum_framesizes, .vidioc_enum_frameintervals = dt3155_ioc_enum_frameintervals, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = iocgmbuf, -#endif */ }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index c5690b2a8924..0dae427a21ec 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -986,15 +986,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct tm6000_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { struct tm6000_fh *fh = priv; @@ -1438,9 +1429,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static struct video_device tm6000_template = { diff --git a/include/linux/videodev.h b/include/linux/videodev.h index b19eab140977..8a7aead76a38 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -16,24 +16,7 @@ #include #include -#if defined(__MIN_V4L1) && defined (__KERNEL__) - -/* - * Used by those V4L2 core functions that need a minimum V4L1 support, - * in order to allow V4L1 Compatibilty code compilation. - */ - -struct video_mbuf -{ - int size; /* Total memory to map */ - int frames; /* Frames */ - int offsets[VIDEO_MAX_FRAME]; -}; - -#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ - -#else -#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) +#if defined(CONFIG_VIDEO_V4L1) || defined(CONFIG_VIDEO_V4L1_MODULE) || !defined(__KERNEL__) #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ @@ -328,8 +311,7 @@ struct video_code #define VID_PLAY_RESET 13 #define VID_PLAY_END_MARK 14 -#endif /* CONFIG_VIDEO_V4L1_COMPAT */ -#endif /* __MIN_V4L1 */ +#endif /* CONFIG_VIDEO_V4L1 */ #endif /* __LINUX_VIDEODEV_H */ diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 06daa6e8e051..67df37542c68 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -14,12 +14,7 @@ #include #include #include /* need __user */ -#ifdef CONFIG_VIDEO_V4L1_COMPAT -#define __MIN_V4L1 -#include -#else #include -#endif struct v4l2_fh; @@ -113,10 +108,6 @@ struct v4l2_ioctl_ops { int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* buffer type is struct vidio_mbuf * */ - int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p); -#endif int (*vidioc_g_fbuf) (struct file *file, void *fh, struct v4l2_framebuffer *a); int (*vidioc_s_fbuf) (struct file *file, void *fh, @@ -300,22 +291,15 @@ extern void v4l_printk_ioctl(unsigned int cmd); extern const char *v4l2_field_names[]; extern const char *v4l2_type_names[]; -/* Compatibility layer interface -- v4l1-compat module */ -typedef long (*v4l2_kioctl)(struct file *file, - unsigned int cmd, void *arg); -#ifdef CONFIG_VIDEO_V4L1_COMPAT -long v4l_compat_translate_ioctl(struct file *file, - int cmd, void *arg, v4l2_kioctl driver_ioctl); -#else -#define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL) -#endif - #ifdef CONFIG_COMPAT /* 32 Bits compatibility layer for 64 bits processors */ extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg); #endif +typedef long (*v4l2_kioctl)(struct file *file, + unsigned int cmd, void *arg); + /* Include support for obsoleted stuff */ extern long video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, v4l2_kioctl func); diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 1d3835fc26be..90ed895e217d 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h @@ -17,10 +17,6 @@ #define _VIDEOBUF_CORE_H #include -#ifdef CONFIG_VIDEO_V4L1_COMPAT -#define __MIN_V4L1 -#include -#endif #include #define UNSET (-1U) @@ -212,10 +208,6 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b); int videobuf_dqbuf(struct videobuf_queue *q, struct v4l2_buffer *b, int nonblocking); -#ifdef CONFIG_VIDEO_V4L1_COMPAT -int videobuf_cgmbuf(struct videobuf_queue *q, - struct video_mbuf *mbuf, int count); -#endif int videobuf_streamon(struct videobuf_queue *q); int videobuf_streamoff(struct videobuf_queue *q); -- cgit v1.2.3 From 58c66df3e38ffb1d59cc5162bb9e07c859288034 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 27 Dec 2010 07:38:48 -0300 Subject: [media] Remove VIDEO_V4L1 Kconfig option There's no sense on keeping VIDEO_V4L1 Kconfig option just because of two deprecated drivers moved to staging scheduled to die on 2.6.39. Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 14 -------------- drivers/media/video/Kconfig | 5 ----- drivers/staging/se401/Kconfig | 2 +- drivers/staging/usbvideo/Kconfig | 2 +- include/linux/videodev.h | 4 ---- 5 files changed, 2 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 9ea1a6d70f0a..147c92b9b4f6 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -40,20 +40,6 @@ config VIDEO_V4L2_COMMON depends on (I2C || I2C=n) && VIDEO_DEV default (I2C || I2C=n) && VIDEO_DEV -config VIDEO_ALLOW_V4L1 - bool "Enable Video For Linux API 1 (DEPRECATED)" - depends on VIDEO_DEV && VIDEO_V4L2_COMMON - default VIDEO_DEV && VIDEO_V4L2_COMMON - ---help--- - Enables drivers based on the legacy V4L1 API. - - This api were developed to be used at Kernel 2.2 and 2.4, but - lacks support for several video standards. There are several - drivers at kernel that still depends on it. - - If you are unsure as to whether this is required, answer Y. - - # # DVB Core # diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index b3bf04368bf2..78b8c5de1f6b 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -7,11 +7,6 @@ config VIDEO_V4L2 depends on VIDEO_DEV && VIDEO_V4L2_COMMON default VIDEO_DEV && VIDEO_V4L2_COMMON -config VIDEO_V4L1 - tristate - depends on VIDEO_DEV && VIDEO_V4L2_COMMON && VIDEO_ALLOW_V4L1 - default VIDEO_DEV && VIDEO_V4L2_COMMON && VIDEO_ALLOW_V4L1 - config VIDEOBUF_GEN tristate diff --git a/drivers/staging/se401/Kconfig b/drivers/staging/se401/Kconfig index 586fc0432a4b..ee7313e66c79 100644 --- a/drivers/staging/se401/Kconfig +++ b/drivers/staging/se401/Kconfig @@ -1,6 +1,6 @@ config USB_SE401 tristate "USB SE401 Camera support (DEPRECATED)" - depends on VIDEO_V4L1 + depends on VIDEO_DEV && VIDEO_V4L2_COMMON ---help--- Say Y here if you want to connect this type of camera to your computer's USB port. See diff --git a/drivers/staging/usbvideo/Kconfig b/drivers/staging/usbvideo/Kconfig index aae863e8a902..d9fc867d09eb 100644 --- a/drivers/staging/usbvideo/Kconfig +++ b/drivers/staging/usbvideo/Kconfig @@ -3,7 +3,7 @@ config VIDEO_USBVIDEO config USB_VICAM tristate "USB 3com HomeConnect (aka vicam) support (DEPRECATED)" - depends on VIDEO_V4L1 && EXPERIMENTAL + depends on VIDEO_DEV && VIDEO_V4L2_COMMON select VIDEO_USBVIDEO ---help--- Say Y here if you have 3com homeconnect camera (vicam). diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 8a7aead76a38..f11efbef1c05 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -16,8 +16,6 @@ #include #include -#if defined(CONFIG_VIDEO_V4L1) || defined(CONFIG_VIDEO_V4L1_MODULE) || !defined(__KERNEL__) - #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ #define VID_TYPE_TELETEXT 4 /* Does teletext */ @@ -311,8 +309,6 @@ struct video_code #define VID_PLAY_RESET 13 #define VID_PLAY_END_MARK 14 -#endif /* CONFIG_VIDEO_V4L1 */ - #endif /* __LINUX_VIDEODEV_H */ /* -- cgit v1.2.3 From 88ae7624a6fe890e5a8ca57b25420f66e1389f8b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 27 Dec 2010 07:47:54 -0300 Subject: [media] V4L1 removal: Remove linux/videodev.h There's no sense on keeping it on 2.6.38, as nobody is using it anymore, at the kernel tree, and installing it at the userspace API. As two deprecated drivers still need it, move it to their internal directories. Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/feature-removal-schedule.txt | 17 -- drivers/media/video/v4l2-compat-ioctl32.c | 1 - drivers/staging/se401/se401.h | 2 +- drivers/staging/se401/videodev.h | 318 +++++++++++++++++++++++++++++ drivers/staging/usbvideo/usbvideo.h | 2 +- drivers/staging/usbvideo/vicam.c | 2 +- drivers/staging/usbvideo/videodev.h | 318 +++++++++++++++++++++++++++++ fs/compat_ioctl.c | 2 +- include/linux/Kbuild | 1 - include/linux/videodev.h | 318 ----------------------------- include/media/ovcamchip.h | 90 -------- 11 files changed, 640 insertions(+), 431 deletions(-) create mode 100644 drivers/staging/se401/videodev.h create mode 100644 drivers/staging/usbvideo/videodev.h delete mode 100644 include/linux/videodev.h delete mode 100644 include/media/ovcamchip.h (limited to 'include') diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index d66ed2bdf8f1..e348b7e241f1 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -97,23 +97,6 @@ Who: Pavel Machek --------------------------- -What: Video4Linux API 1 ioctls and from Video devices. -When: kernel 2.6.39 -Files: include/linux/videodev.h -Check: include/linux/videodev.h -Why: V4L1 AP1 was replaced by V4L2 API during migration from 2.4 to 2.6 - series. The old API have lots of drawbacks and don't provide enough - means to work with all video and audio standards. The newer API is - already available on the main drivers and should be used instead. - - The userspace libv4l1 library can convert V4L1 calls to V4L2. This - replaces the kernel V4L1 compatibility module which was removed in - 2.6.38. The last V4L1 drivers will either be converted to V4L2 or - removed for 2.6.39 at which point the V4L1 API will cease to exist. -Who: Mauro Carvalho Chehab - ---------------------------- - What: Video4Linux obsolete drivers using V4L1 API When: kernel 2.6.39 Files: drivers/staging/se401/* drivers/staging/usbvideo/* diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 425ac1e4a00e..65e6f133dd35 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -15,7 +15,6 @@ #include #define __OLD_VIDIOC_ /* To allow fixing old calls*/ -#include #include #include #include diff --git a/drivers/staging/se401/se401.h b/drivers/staging/se401/se401.h index bf7d2e9765b0..2758f4716c3d 100644 --- a/drivers/staging/se401/se401.h +++ b/drivers/staging/se401/se401.h @@ -3,7 +3,7 @@ #define __LINUX_se401_H #include -#include +#include "videodev.h" #include #include #include diff --git a/drivers/staging/se401/videodev.h b/drivers/staging/se401/videodev.h new file mode 100644 index 000000000000..f11efbef1c05 --- /dev/null +++ b/drivers/staging/se401/videodev.h @@ -0,0 +1,318 @@ +/* + * Video for Linux version 1 - OBSOLETE + * + * Header file for v4l1 drivers and applications, for + * Linux kernels 2.2.x or 2.4.x. + * + * Provides header for legacy drivers and applications + * + * See http://linuxtv.org for more info + * + */ +#ifndef __LINUX_VIDEODEV_H +#define __LINUX_VIDEODEV_H + +#include +#include +#include + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +struct video_capability +{ + char name[32]; + int type; + int channels; /* Num channels */ + int audios; /* Num audio devices */ + int maxwidth; /* Supported width */ + int maxheight; /* And height */ + int minwidth; /* Supported width */ + int minheight; /* And height */ +}; + + +struct video_channel +{ + int channel; + char name[32]; + int tuners; + __u32 flags; +#define VIDEO_VC_TUNER 1 /* Channel has a tuner */ +#define VIDEO_VC_AUDIO 2 /* Channel has audio */ + __u16 type; +#define VIDEO_TYPE_TV 1 +#define VIDEO_TYPE_CAMERA 2 + __u16 norm; /* Norm set by channel */ +}; + +struct video_tuner +{ + int tuner; + char name[32]; + unsigned long rangelow, rangehigh; /* Tuner range */ + __u32 flags; +#define VIDEO_TUNER_PAL 1 +#define VIDEO_TUNER_NTSC 2 +#define VIDEO_TUNER_SECAM 4 +#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ +#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ +#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ +#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ +#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ + __u16 mode; /* PAL/NTSC/SECAM/OTHER */ +#define VIDEO_MODE_PAL 0 +#define VIDEO_MODE_NTSC 1 +#define VIDEO_MODE_SECAM 2 +#define VIDEO_MODE_AUTO 3 + __u16 signal; /* Signal strength 16bit scale */ +}; + +struct video_picture +{ + __u16 brightness; + __u16 hue; + __u16 colour; + __u16 contrast; + __u16 whiteness; /* Black and white only */ + __u16 depth; /* Capture depth */ + __u16 palette; /* Palette in use */ +#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ +#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ +#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ +#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ +#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ +#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ +#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ +#define VIDEO_PALETTE_YUYV 8 +#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ +#define VIDEO_PALETTE_YUV420 10 +#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ +#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ +#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ +#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ +#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ +#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ +#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ +}; + +struct video_audio +{ + int audio; /* Audio channel */ + __u16 volume; /* If settable */ + __u16 bass, treble; + __u32 flags; +#define VIDEO_AUDIO_MUTE 1 +#define VIDEO_AUDIO_MUTABLE 2 +#define VIDEO_AUDIO_VOLUME 4 +#define VIDEO_AUDIO_BASS 8 +#define VIDEO_AUDIO_TREBLE 16 +#define VIDEO_AUDIO_BALANCE 32 + char name[16]; +#define VIDEO_SOUND_MONO 1 +#define VIDEO_SOUND_STEREO 2 +#define VIDEO_SOUND_LANG1 4 +#define VIDEO_SOUND_LANG2 8 + __u16 mode; + __u16 balance; /* Stereo balance */ + __u16 step; /* Step actual volume uses */ +}; + +struct video_clip +{ + __s32 x,y; + __s32 width, height; + struct video_clip *next; /* For user use/driver use only */ +}; + +struct video_window +{ + __u32 x,y; /* Position of window */ + __u32 width,height; /* Its size */ + __u32 chromakey; + __u32 flags; + struct video_clip __user *clips; /* Set only */ + int clipcount; +#define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ +#define VIDEO_CLIP_BITMAP -1 +/* bitmap is 1024x625, a '1' bit represents a clipped pixel */ +#define VIDEO_CLIPMAP_SIZE (128 * 625) +}; + +struct video_capture +{ + __u32 x,y; /* Offsets into image */ + __u32 width, height; /* Area to capture */ + __u16 decimation; /* Decimation divider */ + __u16 flags; /* Flags for capture */ +#define VIDEO_CAPTURE_ODD 0 /* Temporal */ +#define VIDEO_CAPTURE_EVEN 1 +}; + +struct video_buffer +{ + void *base; + int height,width; + int depth; + int bytesperline; +}; + +struct video_mmap +{ + unsigned int frame; /* Frame (0 - n) for double buffer */ + int height,width; + unsigned int format; /* should be VIDEO_PALETTE_* */ +}; + +struct video_key +{ + __u8 key[8]; + __u32 flags; +}; + +struct video_mbuf +{ + int size; /* Total memory to map */ + int frames; /* Frames */ + int offsets[VIDEO_MAX_FRAME]; +}; + +#define VIDEO_NO_UNIT (-1) + +struct video_unit +{ + int video; /* Video minor */ + int vbi; /* VBI minor */ + int radio; /* Radio minor */ + int audio; /* Audio minor */ + int teletext; /* Teletext minor */ +}; + +struct vbi_format { + __u32 sampling_rate; /* in Hz */ + __u32 samples_per_line; + __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ + __s32 start[2]; /* starting line for each frame */ + __u32 count[2]; /* count of lines for each frame */ + __u32 flags; +#define VBI_UNSYNC 1 /* can distingues between top/bottom field */ +#define VBI_INTERLACED 2 /* lines are interlaced */ +}; + +/* video_info is biased towards hardware mpeg encode/decode */ +/* but it could apply generically to any hardware compressor/decompressor */ +struct video_info +{ + __u32 frame_count; /* frames output since decode/encode began */ + __u32 h_size; /* current unscaled horizontal size */ + __u32 v_size; /* current unscaled veritcal size */ + __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ + __u32 picture_type; /* current picture type */ + __u32 temporal_reference; /* current temporal reference */ + __u8 user_data[256]; /* user data last found in compressed stream */ + /* user_data[0] contains user data flags, user_data[1] has count */ +}; + +/* generic structure for setting playback modes */ +struct video_play_mode +{ + int mode; + int p1; + int p2; +}; + +/* for loading microcode / fpga programming */ +struct video_code +{ + char loadwhat[16]; /* name or tag of file being passed */ + int datasize; + __u8 *data; +}; + +#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ +#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ +#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ +#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ +#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ +#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ +#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ +#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ +#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ +#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ +#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ +#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ +#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ +#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ +#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ +#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ +#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ +#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ +#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ +#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ +#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ +#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ +#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ +#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ +#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ +#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ +#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ +#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ +#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ + + +#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ + +/* VIDIOCSWRITEMODE */ +#define VID_WRITE_MPEG_AUD 0 +#define VID_WRITE_MPEG_VID 1 +#define VID_WRITE_OSD 2 +#define VID_WRITE_TTX 3 +#define VID_WRITE_CC 4 +#define VID_WRITE_MJPEG 5 + +/* VIDIOCSPLAYMODE */ +#define VID_PLAY_VID_OUT_MODE 0 + /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ +#define VID_PLAY_GENLOCK 1 + /* p1: 0 = OFF, 1 = ON */ + /* p2: GENLOCK FINE DELAY value */ +#define VID_PLAY_NORMAL 2 +#define VID_PLAY_PAUSE 3 +#define VID_PLAY_SINGLE_FRAME 4 +#define VID_PLAY_FAST_FORWARD 5 +#define VID_PLAY_SLOW_MOTION 6 +#define VID_PLAY_IMMEDIATE_NORMAL 7 +#define VID_PLAY_SWITCH_CHANNELS 8 +#define VID_PLAY_FREEZE_FRAME 9 +#define VID_PLAY_STILL_MODE 10 +#define VID_PLAY_MASTER_MODE 11 + /* p1: see below */ +#define VID_PLAY_MASTER_NONE 1 +#define VID_PLAY_MASTER_VIDEO 2 +#define VID_PLAY_MASTER_AUDIO 3 +#define VID_PLAY_ACTIVE_SCANLINES 12 + /* p1 = first active; p2 = last active */ +#define VID_PLAY_RESET 13 +#define VID_PLAY_END_MARK 14 + +#endif /* __LINUX_VIDEODEV_H */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/drivers/staging/usbvideo/usbvideo.h b/drivers/staging/usbvideo/usbvideo.h index c66985beb8c9..95638a072b19 100644 --- a/drivers/staging/usbvideo/usbvideo.h +++ b/drivers/staging/usbvideo/usbvideo.h @@ -16,7 +16,7 @@ #ifndef usbvideo_h #define usbvideo_h -#include +#include "videodev.h" #include #include #include diff --git a/drivers/staging/usbvideo/vicam.c b/drivers/staging/usbvideo/vicam.c index dc17cce2fbb6..ecdb121297c9 100644 --- a/drivers/staging/usbvideo/vicam.c +++ b/drivers/staging/usbvideo/vicam.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include "videodev.h" #include #include #include diff --git a/drivers/staging/usbvideo/videodev.h b/drivers/staging/usbvideo/videodev.h new file mode 100644 index 000000000000..f11efbef1c05 --- /dev/null +++ b/drivers/staging/usbvideo/videodev.h @@ -0,0 +1,318 @@ +/* + * Video for Linux version 1 - OBSOLETE + * + * Header file for v4l1 drivers and applications, for + * Linux kernels 2.2.x or 2.4.x. + * + * Provides header for legacy drivers and applications + * + * See http://linuxtv.org for more info + * + */ +#ifndef __LINUX_VIDEODEV_H +#define __LINUX_VIDEODEV_H + +#include +#include +#include + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +struct video_capability +{ + char name[32]; + int type; + int channels; /* Num channels */ + int audios; /* Num audio devices */ + int maxwidth; /* Supported width */ + int maxheight; /* And height */ + int minwidth; /* Supported width */ + int minheight; /* And height */ +}; + + +struct video_channel +{ + int channel; + char name[32]; + int tuners; + __u32 flags; +#define VIDEO_VC_TUNER 1 /* Channel has a tuner */ +#define VIDEO_VC_AUDIO 2 /* Channel has audio */ + __u16 type; +#define VIDEO_TYPE_TV 1 +#define VIDEO_TYPE_CAMERA 2 + __u16 norm; /* Norm set by channel */ +}; + +struct video_tuner +{ + int tuner; + char name[32]; + unsigned long rangelow, rangehigh; /* Tuner range */ + __u32 flags; +#define VIDEO_TUNER_PAL 1 +#define VIDEO_TUNER_NTSC 2 +#define VIDEO_TUNER_SECAM 4 +#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ +#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ +#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ +#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ +#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ + __u16 mode; /* PAL/NTSC/SECAM/OTHER */ +#define VIDEO_MODE_PAL 0 +#define VIDEO_MODE_NTSC 1 +#define VIDEO_MODE_SECAM 2 +#define VIDEO_MODE_AUTO 3 + __u16 signal; /* Signal strength 16bit scale */ +}; + +struct video_picture +{ + __u16 brightness; + __u16 hue; + __u16 colour; + __u16 contrast; + __u16 whiteness; /* Black and white only */ + __u16 depth; /* Capture depth */ + __u16 palette; /* Palette in use */ +#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ +#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ +#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ +#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ +#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ +#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ +#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ +#define VIDEO_PALETTE_YUYV 8 +#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ +#define VIDEO_PALETTE_YUV420 10 +#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ +#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ +#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ +#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ +#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ +#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ +#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ +}; + +struct video_audio +{ + int audio; /* Audio channel */ + __u16 volume; /* If settable */ + __u16 bass, treble; + __u32 flags; +#define VIDEO_AUDIO_MUTE 1 +#define VIDEO_AUDIO_MUTABLE 2 +#define VIDEO_AUDIO_VOLUME 4 +#define VIDEO_AUDIO_BASS 8 +#define VIDEO_AUDIO_TREBLE 16 +#define VIDEO_AUDIO_BALANCE 32 + char name[16]; +#define VIDEO_SOUND_MONO 1 +#define VIDEO_SOUND_STEREO 2 +#define VIDEO_SOUND_LANG1 4 +#define VIDEO_SOUND_LANG2 8 + __u16 mode; + __u16 balance; /* Stereo balance */ + __u16 step; /* Step actual volume uses */ +}; + +struct video_clip +{ + __s32 x,y; + __s32 width, height; + struct video_clip *next; /* For user use/driver use only */ +}; + +struct video_window +{ + __u32 x,y; /* Position of window */ + __u32 width,height; /* Its size */ + __u32 chromakey; + __u32 flags; + struct video_clip __user *clips; /* Set only */ + int clipcount; +#define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ +#define VIDEO_CLIP_BITMAP -1 +/* bitmap is 1024x625, a '1' bit represents a clipped pixel */ +#define VIDEO_CLIPMAP_SIZE (128 * 625) +}; + +struct video_capture +{ + __u32 x,y; /* Offsets into image */ + __u32 width, height; /* Area to capture */ + __u16 decimation; /* Decimation divider */ + __u16 flags; /* Flags for capture */ +#define VIDEO_CAPTURE_ODD 0 /* Temporal */ +#define VIDEO_CAPTURE_EVEN 1 +}; + +struct video_buffer +{ + void *base; + int height,width; + int depth; + int bytesperline; +}; + +struct video_mmap +{ + unsigned int frame; /* Frame (0 - n) for double buffer */ + int height,width; + unsigned int format; /* should be VIDEO_PALETTE_* */ +}; + +struct video_key +{ + __u8 key[8]; + __u32 flags; +}; + +struct video_mbuf +{ + int size; /* Total memory to map */ + int frames; /* Frames */ + int offsets[VIDEO_MAX_FRAME]; +}; + +#define VIDEO_NO_UNIT (-1) + +struct video_unit +{ + int video; /* Video minor */ + int vbi; /* VBI minor */ + int radio; /* Radio minor */ + int audio; /* Audio minor */ + int teletext; /* Teletext minor */ +}; + +struct vbi_format { + __u32 sampling_rate; /* in Hz */ + __u32 samples_per_line; + __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ + __s32 start[2]; /* starting line for each frame */ + __u32 count[2]; /* count of lines for each frame */ + __u32 flags; +#define VBI_UNSYNC 1 /* can distingues between top/bottom field */ +#define VBI_INTERLACED 2 /* lines are interlaced */ +}; + +/* video_info is biased towards hardware mpeg encode/decode */ +/* but it could apply generically to any hardware compressor/decompressor */ +struct video_info +{ + __u32 frame_count; /* frames output since decode/encode began */ + __u32 h_size; /* current unscaled horizontal size */ + __u32 v_size; /* current unscaled veritcal size */ + __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ + __u32 picture_type; /* current picture type */ + __u32 temporal_reference; /* current temporal reference */ + __u8 user_data[256]; /* user data last found in compressed stream */ + /* user_data[0] contains user data flags, user_data[1] has count */ +}; + +/* generic structure for setting playback modes */ +struct video_play_mode +{ + int mode; + int p1; + int p2; +}; + +/* for loading microcode / fpga programming */ +struct video_code +{ + char loadwhat[16]; /* name or tag of file being passed */ + int datasize; + __u8 *data; +}; + +#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ +#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ +#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ +#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ +#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ +#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ +#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ +#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ +#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ +#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ +#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ +#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ +#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ +#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ +#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ +#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ +#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ +#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ +#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ +#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ +#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ +#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ +#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ +#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ +#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ +#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ +#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ +#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ +#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ + + +#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ + +/* VIDIOCSWRITEMODE */ +#define VID_WRITE_MPEG_AUD 0 +#define VID_WRITE_MPEG_VID 1 +#define VID_WRITE_OSD 2 +#define VID_WRITE_TTX 3 +#define VID_WRITE_CC 4 +#define VID_WRITE_MJPEG 5 + +/* VIDIOCSPLAYMODE */ +#define VID_PLAY_VID_OUT_MODE 0 + /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ +#define VID_PLAY_GENLOCK 1 + /* p1: 0 = OFF, 1 = ON */ + /* p2: GENLOCK FINE DELAY value */ +#define VID_PLAY_NORMAL 2 +#define VID_PLAY_PAUSE 3 +#define VID_PLAY_SINGLE_FRAME 4 +#define VID_PLAY_FAST_FORWARD 5 +#define VID_PLAY_SLOW_MOTION 6 +#define VID_PLAY_IMMEDIATE_NORMAL 7 +#define VID_PLAY_SWITCH_CHANNELS 8 +#define VID_PLAY_FREEZE_FRAME 9 +#define VID_PLAY_STILL_MODE 10 +#define VID_PLAY_MASTER_MODE 11 + /* p1: see below */ +#define VID_PLAY_MASTER_NONE 1 +#define VID_PLAY_MASTER_VIDEO 2 +#define VID_PLAY_MASTER_AUDIO 3 +#define VID_PLAY_ACTIVE_SCANLINES 12 + /* p1 = first active; p2 = last active */ +#define VID_PLAY_RESET 13 +#define VID_PLAY_END_MARK 14 + +#endif /* __LINUX_VIDEODEV_H */ + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a60579b007b0..175736c282ab 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 97319a8fc1e0..a354c199ab98 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -367,7 +367,6 @@ header-y += utime.h header-y += utsname.h header-y += veth.h header-y += vhost.h -header-y += videodev.h header-y += videodev2.h header-y += virtio_9p.h header-y += virtio_balloon.h diff --git a/include/linux/videodev.h b/include/linux/videodev.h deleted file mode 100644 index f11efbef1c05..000000000000 --- a/include/linux/videodev.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Video for Linux version 1 - OBSOLETE - * - * Header file for v4l1 drivers and applications, for - * Linux kernels 2.2.x or 2.4.x. - * - * Provides header for legacy drivers and applications - * - * See http://linuxtv.org for more info - * - */ -#ifndef __LINUX_VIDEODEV_H -#define __LINUX_VIDEODEV_H - -#include -#include -#include - -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ - -struct video_capability -{ - char name[32]; - int type; - int channels; /* Num channels */ - int audios; /* Num audio devices */ - int maxwidth; /* Supported width */ - int maxheight; /* And height */ - int minwidth; /* Supported width */ - int minheight; /* And height */ -}; - - -struct video_channel -{ - int channel; - char name[32]; - int tuners; - __u32 flags; -#define VIDEO_VC_TUNER 1 /* Channel has a tuner */ -#define VIDEO_VC_AUDIO 2 /* Channel has audio */ - __u16 type; -#define VIDEO_TYPE_TV 1 -#define VIDEO_TYPE_CAMERA 2 - __u16 norm; /* Norm set by channel */ -}; - -struct video_tuner -{ - int tuner; - char name[32]; - unsigned long rangelow, rangehigh; /* Tuner range */ - __u32 flags; -#define VIDEO_TUNER_PAL 1 -#define VIDEO_TUNER_NTSC 2 -#define VIDEO_TUNER_SECAM 4 -#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ -#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ -#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ -#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ -#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ - __u16 mode; /* PAL/NTSC/SECAM/OTHER */ -#define VIDEO_MODE_PAL 0 -#define VIDEO_MODE_NTSC 1 -#define VIDEO_MODE_SECAM 2 -#define VIDEO_MODE_AUTO 3 - __u16 signal; /* Signal strength 16bit scale */ -}; - -struct video_picture -{ - __u16 brightness; - __u16 hue; - __u16 colour; - __u16 contrast; - __u16 whiteness; /* Black and white only */ - __u16 depth; /* Capture depth */ - __u16 palette; /* Palette in use */ -#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ -#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ -#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ -#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ -#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ -#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ -#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ -#define VIDEO_PALETTE_YUYV 8 -#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ -#define VIDEO_PALETTE_YUV420 10 -#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ -#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ -#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ -#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ -#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ -#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ -#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ -#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ -}; - -struct video_audio -{ - int audio; /* Audio channel */ - __u16 volume; /* If settable */ - __u16 bass, treble; - __u32 flags; -#define VIDEO_AUDIO_MUTE 1 -#define VIDEO_AUDIO_MUTABLE 2 -#define VIDEO_AUDIO_VOLUME 4 -#define VIDEO_AUDIO_BASS 8 -#define VIDEO_AUDIO_TREBLE 16 -#define VIDEO_AUDIO_BALANCE 32 - char name[16]; -#define VIDEO_SOUND_MONO 1 -#define VIDEO_SOUND_STEREO 2 -#define VIDEO_SOUND_LANG1 4 -#define VIDEO_SOUND_LANG2 8 - __u16 mode; - __u16 balance; /* Stereo balance */ - __u16 step; /* Step actual volume uses */ -}; - -struct video_clip -{ - __s32 x,y; - __s32 width, height; - struct video_clip *next; /* For user use/driver use only */ -}; - -struct video_window -{ - __u32 x,y; /* Position of window */ - __u32 width,height; /* Its size */ - __u32 chromakey; - __u32 flags; - struct video_clip __user *clips; /* Set only */ - int clipcount; -#define VIDEO_WINDOW_INTERLACE 1 -#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ -#define VIDEO_CLIP_BITMAP -1 -/* bitmap is 1024x625, a '1' bit represents a clipped pixel */ -#define VIDEO_CLIPMAP_SIZE (128 * 625) -}; - -struct video_capture -{ - __u32 x,y; /* Offsets into image */ - __u32 width, height; /* Area to capture */ - __u16 decimation; /* Decimation divider */ - __u16 flags; /* Flags for capture */ -#define VIDEO_CAPTURE_ODD 0 /* Temporal */ -#define VIDEO_CAPTURE_EVEN 1 -}; - -struct video_buffer -{ - void *base; - int height,width; - int depth; - int bytesperline; -}; - -struct video_mmap -{ - unsigned int frame; /* Frame (0 - n) for double buffer */ - int height,width; - unsigned int format; /* should be VIDEO_PALETTE_* */ -}; - -struct video_key -{ - __u8 key[8]; - __u32 flags; -}; - -struct video_mbuf -{ - int size; /* Total memory to map */ - int frames; /* Frames */ - int offsets[VIDEO_MAX_FRAME]; -}; - -#define VIDEO_NO_UNIT (-1) - -struct video_unit -{ - int video; /* Video minor */ - int vbi; /* VBI minor */ - int radio; /* Radio minor */ - int audio; /* Audio minor */ - int teletext; /* Teletext minor */ -}; - -struct vbi_format { - __u32 sampling_rate; /* in Hz */ - __u32 samples_per_line; - __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ - __s32 start[2]; /* starting line for each frame */ - __u32 count[2]; /* count of lines for each frame */ - __u32 flags; -#define VBI_UNSYNC 1 /* can distingues between top/bottom field */ -#define VBI_INTERLACED 2 /* lines are interlaced */ -}; - -/* video_info is biased towards hardware mpeg encode/decode */ -/* but it could apply generically to any hardware compressor/decompressor */ -struct video_info -{ - __u32 frame_count; /* frames output since decode/encode began */ - __u32 h_size; /* current unscaled horizontal size */ - __u32 v_size; /* current unscaled veritcal size */ - __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ - __u32 picture_type; /* current picture type */ - __u32 temporal_reference; /* current temporal reference */ - __u8 user_data[256]; /* user data last found in compressed stream */ - /* user_data[0] contains user data flags, user_data[1] has count */ -}; - -/* generic structure for setting playback modes */ -struct video_play_mode -{ - int mode; - int p1; - int p2; -}; - -/* for loading microcode / fpga programming */ -struct video_code -{ - char loadwhat[16]; /* name or tag of file being passed */ - int datasize; - __u8 *data; -}; - -#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ -#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ -#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ -#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ -#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ -#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ -#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ -#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ -#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ -#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ -#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ -#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ -#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ -#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ -#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ -#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ -#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ -#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ -#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ -#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ -#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ -#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ -#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ -#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ -#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ -#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ -#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ -#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ -#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ - - -#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ - -/* VIDIOCSWRITEMODE */ -#define VID_WRITE_MPEG_AUD 0 -#define VID_WRITE_MPEG_VID 1 -#define VID_WRITE_OSD 2 -#define VID_WRITE_TTX 3 -#define VID_WRITE_CC 4 -#define VID_WRITE_MJPEG 5 - -/* VIDIOCSPLAYMODE */ -#define VID_PLAY_VID_OUT_MODE 0 - /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ -#define VID_PLAY_GENLOCK 1 - /* p1: 0 = OFF, 1 = ON */ - /* p2: GENLOCK FINE DELAY value */ -#define VID_PLAY_NORMAL 2 -#define VID_PLAY_PAUSE 3 -#define VID_PLAY_SINGLE_FRAME 4 -#define VID_PLAY_FAST_FORWARD 5 -#define VID_PLAY_SLOW_MOTION 6 -#define VID_PLAY_IMMEDIATE_NORMAL 7 -#define VID_PLAY_SWITCH_CHANNELS 8 -#define VID_PLAY_FREEZE_FRAME 9 -#define VID_PLAY_STILL_MODE 10 -#define VID_PLAY_MASTER_MODE 11 - /* p1: see below */ -#define VID_PLAY_MASTER_NONE 1 -#define VID_PLAY_MASTER_VIDEO 2 -#define VID_PLAY_MASTER_AUDIO 3 -#define VID_PLAY_ACTIVE_SCANLINES 12 - /* p1 = first active; p2 = last active */ -#define VID_PLAY_RESET 13 -#define VID_PLAY_END_MARK 14 - -#endif /* __LINUX_VIDEODEV_H */ - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/include/media/ovcamchip.h b/include/media/ovcamchip.h deleted file mode 100644 index 05b9569ef1c8..000000000000 --- a/include/media/ovcamchip.h +++ /dev/null @@ -1,90 +0,0 @@ -/* OmniVision* camera chip driver API - * - * Copyright (c) 1999-2004 Mark McClelland - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. NO WARRANTY OF ANY KIND is expressed or implied. - * - * * OmniVision is a trademark of OmniVision Technologies, Inc. This driver - * is not sponsored or developed by them. - */ - -#ifndef __LINUX_OVCAMCHIP_H -#define __LINUX_OVCAMCHIP_H - -#include -#include - -/* --------------------------------- */ -/* ENUMERATIONS */ -/* --------------------------------- */ - -/* Controls */ -enum { - OVCAMCHIP_CID_CONT, /* Contrast */ - OVCAMCHIP_CID_BRIGHT, /* Brightness */ - OVCAMCHIP_CID_SAT, /* Saturation */ - OVCAMCHIP_CID_HUE, /* Hue */ - OVCAMCHIP_CID_EXP, /* Exposure */ - OVCAMCHIP_CID_FREQ, /* Light frequency */ - OVCAMCHIP_CID_BANDFILT, /* Banding filter */ - OVCAMCHIP_CID_AUTOBRIGHT, /* Auto brightness */ - OVCAMCHIP_CID_AUTOEXP, /* Auto exposure */ - OVCAMCHIP_CID_BACKLIGHT, /* Back light compensation */ - OVCAMCHIP_CID_MIRROR, /* Mirror horizontally */ -}; - -/* Chip types */ -#define NUM_CC_TYPES 9 -enum { - CC_UNKNOWN, - CC_OV76BE, - CC_OV7610, - CC_OV7620, - CC_OV7620AE, - CC_OV6620, - CC_OV6630, - CC_OV6630AE, - CC_OV6630AF, -}; - -/* --------------------------------- */ -/* I2C ADDRESSES */ -/* --------------------------------- */ - -#define OV7xx0_SID (0x42 >> 1) -#define OV6xx0_SID (0xC0 >> 1) - -/* --------------------------------- */ -/* API */ -/* --------------------------------- */ - -struct ovcamchip_control { - __u32 id; - __s32 value; -}; - -struct ovcamchip_window { - int x; - int y; - int width; - int height; - int format; - int quarter; /* Scale width and height down 2x */ - - /* This stuff will be removed eventually */ - int clockdiv; /* Clock divisor setting */ -}; - -/* Commands */ -#define OVCAMCHIP_CMD_Q_SUBTYPE _IOR (0x88, 0x00, int) -#define OVCAMCHIP_CMD_INITIALIZE _IOW (0x88, 0x01, int) -/* You must call OVCAMCHIP_CMD_INITIALIZE before any of commands below! */ -#define OVCAMCHIP_CMD_S_CTRL _IOW (0x88, 0x02, struct ovcamchip_control) -#define OVCAMCHIP_CMD_G_CTRL _IOWR (0x88, 0x03, struct ovcamchip_control) -#define OVCAMCHIP_CMD_S_MODE _IOW (0x88, 0x04, struct ovcamchip_window) -#define OVCAMCHIP_MAX_CMD _IO (0x88, 0x3f) - -#endif -- cgit v1.2.3 From b7a0f2e793a52b306e682a0e2e9a0b6f0f0a730e Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sun, 26 Dec 2010 18:13:30 -0300 Subject: [media] saa7134: Add support for Compro VideoMate Vista M1F Signed-off-by: Pavel Osnova Signed-off-by: Ramiro Morales Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/rc/keymaps/Makefile | 1 + drivers/media/rc/keymaps/rc-videomate-m1f.c | 92 +++++++++++++++++++++++++++++ drivers/media/video/saa7134/saa7134-cards.c | 38 ++++++++++++ drivers/media/video/saa7134/saa7134-input.c | 5 ++ drivers/media/video/saa7134/saa7134.h | 1 + include/media/rc-map.h | 1 + 7 files changed, 139 insertions(+) create mode 100644 drivers/media/rc/keymaps/rc-videomate-m1f.c (limited to 'include') diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 8d9afc7d8014..8db1a94e6986 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -180,3 +180,4 @@ 179 -> Beholder BeholdTV A7 [5ace:7090] 180 -> Avermedia PCI M733A [1461:4155,1461:4255] 181 -> TechoTrend TT-budget T-3000 [13c2:2804] +183 -> Compro VideoMate Vista M1F [185b:c900] diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index 148900f443d2..0659e9f50144 100644 --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-trekstor.o \ rc-tt-1500.o \ rc-twinhan1027.o \ + rc-videomate-m1f.o \ rc-videomate-s350.o \ rc-videomate-tv-pvr.o \ rc-winfast.o \ diff --git a/drivers/media/rc/keymaps/rc-videomate-m1f.c b/drivers/media/rc/keymaps/rc-videomate-m1f.c new file mode 100644 index 000000000000..4994d405c0a1 --- /dev/null +++ b/drivers/media/rc/keymaps/rc-videomate-m1f.c @@ -0,0 +1,92 @@ +/* videomate-m1f.h - Keytable for videomate_m1f Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Pavel Osnova + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct rc_map_table videomate_m1f[] = { + { 0x01, KEY_POWER }, + { 0x31, KEY_TUNER }, + { 0x33, KEY_VIDEO }, + { 0x2f, KEY_RADIO }, + { 0x30, KEY_CAMERA }, + { 0x2d, KEY_NEW }, /* TV record button */ + { 0x17, KEY_CYCLEWINDOWS }, + { 0x2c, KEY_ANGLE }, + { 0x2b, KEY_LANGUAGE }, + { 0x32, KEY_SEARCH }, /* '...' button */ + { 0x11, KEY_UP }, + { 0x13, KEY_LEFT }, + { 0x15, KEY_OK }, + { 0x14, KEY_RIGHT }, + { 0x12, KEY_DOWN }, + { 0x16, KEY_BACKSPACE }, + { 0x02, KEY_ZOOM }, /* WIN key */ + { 0x04, KEY_INFO }, + { 0x05, KEY_VOLUMEUP }, + { 0x03, KEY_MUTE }, + { 0x07, KEY_CHANNELUP }, + { 0x06, KEY_VOLUMEDOWN }, + { 0x08, KEY_CHANNELDOWN }, + { 0x0c, KEY_RECORD }, + { 0x0e, KEY_STOP }, + { 0x0a, KEY_BACK }, + { 0x0b, KEY_PLAY }, + { 0x09, KEY_FORWARD }, + { 0x10, KEY_PREVIOUS }, + { 0x0d, KEY_PAUSE }, + { 0x0f, KEY_NEXT }, + { 0x1e, KEY_1 }, + { 0x1f, KEY_2 }, + { 0x20, KEY_3 }, + { 0x21, KEY_4 }, + { 0x22, KEY_5 }, + { 0x23, KEY_6 }, + { 0x24, KEY_7 }, + { 0x25, KEY_8 }, + { 0x26, KEY_9 }, + { 0x2a, KEY_NUMERIC_STAR }, /* * key */ + { 0x1d, KEY_0 }, + { 0x29, KEY_SUBTITLE }, /* # key */ + { 0x27, KEY_CLEAR }, + { 0x34, KEY_SCREEN }, + { 0x28, KEY_ENTER }, + { 0x19, KEY_RED }, + { 0x1a, KEY_GREEN }, + { 0x1b, KEY_YELLOW }, + { 0x1c, KEY_BLUE }, + { 0x18, KEY_TEXT }, +}; + +static struct rc_map_list videomate_m1f_map = { + .map = { + .scan = videomate_m1f, + .size = ARRAY_SIZE(videomate_m1f), + .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_VIDEOMATE_M1F, + } +}; + +static int __init init_rc_map_videomate_m1f(void) +{ + return rc_map_register(&videomate_m1f_map); +} + +static void __exit exit_rc_map_videomate_m1f(void) +{ + rc_map_unregister(&videomate_m1f_map); +} + +module_init(init_rc_map_videomate_m1f) +module_exit(exit_rc_map_videomate_m1f) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Pavel Osnova "); diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index ff23e6ebdde4..e7aa588c6c5a 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -5538,6 +5538,37 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, } }, }, + [SAA7134_BOARD_VIDEOMATE_M1F] = { + /* Pavel Osnova */ + .name = "Compro VideoMate Vista M1F", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .radio_type = TUNER_TEA5767, + .tuner_addr = ADDR_UNSET, + .radio_addr = 0x60, + .inputs = { { + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + }, { + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + }, { + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + } }, + .radio = { + .name = name_radio, + .amux = LINE1, + }, + .mute = { + .name = name_mute, + .amux = TV, + }, + }, }; @@ -6730,6 +6761,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ .subdevice = 0x7090, .driver_data = SAA7134_BOARD_BEHOLD_A7, + }, { + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7135, + .subvendor = 0x185b, + .subdevice = 0xc900, + .driver_data = SAA7134_BOARD_VIDEOMATE_M1F, }, { /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -7046,6 +7083,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: + case SAA7134_BOARD_VIDEOMATE_M1F: case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_200: case SAA7134_BOARD_VIDEOMATE_DVBT_200A: diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 98678d941847..dc646e65edb7 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -721,6 +721,11 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keyup = 0x020000; polling = 50; /* ms */ break; + case SAA7134_BOARD_VIDEOMATE_M1F: + ir_codes = RC_MAP_VIDEOMATE_M1F; + mask_keycode = 0x0ff00; + mask_keyup = 0x040000; + break; } if (NULL == ir_codes) { printk("%s: Oops: IR config error [card=%d]\n", diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index babfbe7543eb..5b0a347b0b8f 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -326,6 +326,7 @@ struct saa7134_card_ir { #define SAA7134_BOARD_AVERMEDIA_M733A 180 #define SAA7134_BOARD_TECHNOTREND_BUDGET_T3000 181 #define SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG 182 +#define SAA7134_BOARD_VIDEOMATE_M1F 183 #define SAA7134_MAXBOARDS 32 #define SAA7134_INPUT_MAX 8 diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 5d3a45748767..ee9e2f747c76 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -138,6 +138,7 @@ void rc_map_init(void); #define RC_MAP_TREKSTOR "rc-trekstor" #define RC_MAP_TT_1500 "rc-tt-1500" #define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027" +#define RC_MAP_VIDEOMATE_M1F "rc-videomate-m1f" #define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" #define RC_MAP_WINFAST "rc-winfast" -- cgit v1.2.3 From b9218f2f15cdff8991ba041993bf40962c49fdd0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 27 Dec 2010 12:22:46 -0300 Subject: [media] saa6588: rename rds.h to saa6588.h The naming of the media/rds.h header suggested that it was a generic RDS header, when in fact it is just a saa6588 module API that is internal to the kernel. Rename the header and the struct and defines in it to make this clear. Also removed the header include in radio-si470x.h (not used anymore) and from ioctl-number.txt (it's internal to the kernel and never called from userspace). Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/ioctl/ioctl-number.txt | 1 - drivers/media/radio/si470x/radio-si470x.h | 1 - drivers/media/video/bt8xx/bttv-driver.c | 14 ++++----- drivers/media/video/saa6588.c | 14 ++++----- drivers/media/video/saa7134/saa7134-video.c | 14 ++++----- include/media/rds.h | 44 ----------------------------- include/media/saa6588.h | 42 +++++++++++++++++++++++++++ 7 files changed, 63 insertions(+), 67 deletions(-) delete mode 100644 include/media/rds.h create mode 100644 include/media/saa6588.h (limited to 'include') diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index b2400d7296ce..7edf95014e85 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt @@ -155,7 +155,6 @@ Code Seq#(hex) Include File Comments 'Q' all linux/soundcard.h 'R' 00-1F linux/random.h conflict! 'R' 01 linux/rfkill.h conflict! -'R' 01-0F media/rds.h conflict! 'R' C0-DF net/bluetooth/rfcomm.h 'S' all linux/cdrom.h conflict! 'S' 80-81 scsi/scsi_ioctl.h conflict! diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index b9914d7a0c9f..4a4e908db04c 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h @@ -37,7 +37,6 @@ #include #include #include -#include #include diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 961d0805d877..849cd170b821 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -55,7 +55,7 @@ #include #include -#include +#include unsigned int bttv_num; /* number of Bt848s in use */ @@ -3388,7 +3388,7 @@ static int radio_release(struct file *file) { struct bttv_fh *fh = file->private_data; struct bttv *btv = fh->btv; - struct rds_command cmd; + struct saa6588_command cmd; v4l2_prio_close(&btv->prio, fh->prio); file->private_data = NULL; @@ -3396,7 +3396,7 @@ static int radio_release(struct file *file) btv->radio_user--; - bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); + bttv_call_all(btv, core, ioctl, SAA6588_CMD_CLOSE, &cmd); return 0; } @@ -3523,13 +3523,13 @@ static ssize_t radio_read(struct file *file, char __user *data, { struct bttv_fh *fh = file->private_data; struct bttv *btv = fh->btv; - struct rds_command cmd; + struct saa6588_command cmd; cmd.block_count = count/3; cmd.buffer = data; cmd.instance = file; cmd.result = -ENODEV; - bttv_call_all(btv, core, ioctl, RDS_CMD_READ, &cmd); + bttv_call_all(btv, core, ioctl, SAA6588_CMD_READ, &cmd); return cmd.result; } @@ -3538,11 +3538,11 @@ static unsigned int radio_poll(struct file *file, poll_table *wait) { struct bttv_fh *fh = file->private_data; struct bttv *btv = fh->btv; - struct rds_command cmd; + struct saa6588_command cmd; cmd.instance = file; cmd.event_list = wait; cmd.result = -ENODEV; - bttv_call_all(btv, core, ioctl, RDS_CMD_POLL, &cmd); + bttv_call_all(btv, core, ioctl, SAA6588_CMD_POLL, &cmd); return cmd.result; } diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 984c0feb2a4e..99a2ac16f9e5 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include @@ -181,7 +181,7 @@ static int block_to_user_buf(struct saa6588 *s, unsigned char __user *user_buf) return 1; } -static void read_from_buf(struct saa6588 *s, struct rds_command *a) +static void read_from_buf(struct saa6588 *s, struct saa6588_command *a) { unsigned long flags; @@ -392,25 +392,25 @@ static void saa6588_configure(struct saa6588 *s) static long saa6588_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { struct saa6588 *s = to_saa6588(sd); - struct rds_command *a = arg; + struct saa6588_command *a = arg; switch (cmd) { /* --- open() for /dev/radio --- */ - case RDS_CMD_OPEN: + case SAA6588_CMD_OPEN: a->result = 0; /* return error if chip doesn't work ??? */ break; /* --- close() for /dev/radio --- */ - case RDS_CMD_CLOSE: + case SAA6588_CMD_CLOSE: s->data_available_for_read = 1; wake_up_interruptible(&s->read_queue); a->result = 0; break; /* --- read() for /dev/radio --- */ - case RDS_CMD_READ: + case SAA6588_CMD_READ: read_from_buf(s, a); break; /* --- poll() for /dev/radio --- */ - case RDS_CMD_POLL: + case SAA6588_CMD_POLL: a->result = 0; if (s->data_available_for_read) { a->result |= POLLIN | POLLRDNORM; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index ad22be27bd38..ee4ea5f001a8 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -30,7 +30,7 @@ #include "saa7134-reg.h" #include "saa7134.h" #include -#include +#include /* ------------------------------------------------------------------ */ @@ -1459,7 +1459,7 @@ static int video_release(struct file *file) { struct saa7134_fh *fh = file->private_data; struct saa7134_dev *dev = fh->dev; - struct rds_command cmd; + struct saa6588_command cmd; unsigned long flags; /* turn off overlay */ @@ -1494,7 +1494,7 @@ static int video_release(struct file *file) saa_call_all(dev, core, s_power, 0); if (fh->radio) - saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd); + saa_call_all(dev, core, ioctl, SAA6588_CMD_CLOSE, &cmd); /* free stuff */ videobuf_mmap_free(&fh->cap); @@ -1520,14 +1520,14 @@ static ssize_t radio_read(struct file *file, char __user *data, { struct saa7134_fh *fh = file->private_data; struct saa7134_dev *dev = fh->dev; - struct rds_command cmd; + struct saa6588_command cmd; cmd.block_count = count/3; cmd.buffer = data; cmd.instance = file; cmd.result = -ENODEV; - saa_call_all(dev, core, ioctl, RDS_CMD_READ, &cmd); + saa_call_all(dev, core, ioctl, SAA6588_CMD_READ, &cmd); return cmd.result; } @@ -1536,12 +1536,12 @@ static unsigned int radio_poll(struct file *file, poll_table *wait) { struct saa7134_fh *fh = file->private_data; struct saa7134_dev *dev = fh->dev; - struct rds_command cmd; + struct saa6588_command cmd; cmd.instance = file; cmd.event_list = wait; cmd.result = -ENODEV; - saa_call_all(dev, core, ioctl, RDS_CMD_POLL, &cmd); + saa_call_all(dev, core, ioctl, SAA6588_CMD_POLL, &cmd); return cmd.result; } diff --git a/include/media/rds.h b/include/media/rds.h deleted file mode 100644 index a89426667618..000000000000 --- a/include/media/rds.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - - Types and defines needed for RDS. This is included by - saa6588.c and every driver (e.g. bttv-driver.c) that wants - to use the saa6588 module. - - Instead of having a separate rds.h, I'd prefer to include - this stuff in one of the already existing files like tuner.h - - (c) 2005 by Hans J. Koch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef _RDS_H -#define _RDS_H - -struct rds_command { - unsigned int block_count; - int result; - unsigned char __user *buffer; - struct file *instance; - poll_table *event_list; -}; - -#define RDS_CMD_OPEN _IOW('R',1,int) -#define RDS_CMD_CLOSE _IOW('R',2,int) -#define RDS_CMD_READ _IOR('R',3,int) -#define RDS_CMD_POLL _IOR('R',4,int) - -#endif diff --git a/include/media/saa6588.h b/include/media/saa6588.h new file mode 100644 index 000000000000..2c3c4420a4eb --- /dev/null +++ b/include/media/saa6588.h @@ -0,0 +1,42 @@ +/* + + Types and defines needed for RDS. This is included by + saa6588.c and every driver (e.g. bttv-driver.c) that wants + to use the saa6588 module. + + (c) 2005 by Hans J. Koch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef _SAA6588_H +#define _SAA6588_H + +struct saa6588_command { + unsigned int block_count; + int result; + unsigned char __user *buffer; + struct file *instance; + poll_table *event_list; +}; + +/* These ioctls are internal to the kernel */ +#define SAA6588_CMD_OPEN _IOW('R', 1, int) +#define SAA6588_CMD_CLOSE _IOW('R', 2, int) +#define SAA6588_CMD_READ _IOR('R', 3, int) +#define SAA6588_CMD_POLL _IOR('R', 4, int) + +#endif -- cgit v1.2.3 From 66832aef0694807f487a8ccc8871cea4e80d78c5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 27 Dec 2010 12:27:50 -0300 Subject: [media] bt819: the ioctls in the header are internal to the kernel Remove bt819.h from ioctl-number.txt and make a note in the header that these ioctls are for internal use only. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/ioctl/ioctl-number.txt | 1 - include/media/bt819.h | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index 7edf95014e85..d6a63c7b4478 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt @@ -193,7 +193,6 @@ Code Seq#(hex) Include File Comments 'b' 00-FF conflict! bit3 vme host bridge -'b' 00-0F media/bt819.h conflict! 'c' all linux/cm4000_cs.h conflict! 'c' 00-7F linux/comstats.h conflict! 'c' 00-7F linux/coda.h conflict! diff --git a/include/media/bt819.h b/include/media/bt819.h index 38f666bde77a..8025f4bc2bb6 100644 --- a/include/media/bt819.h +++ b/include/media/bt819.h @@ -26,7 +26,10 @@ /* v4l2_device notifications. */ /* Needed to reset the FIFO buffer when changing the input - or the video standard. */ + or the video standard. + + Note: these ioctls that internal to the kernel and are never called + from userspace. */ #define BT819_FIFO_RESET_LOW _IO('b', 0) #define BT819_FIFO_RESET_HIGH _IO('b', 1) -- cgit v1.2.3 From 513521eaee4375a1a0da0b73c7131a165a9fe4d9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 29 Dec 2010 14:25:52 -0300 Subject: [media] v4l2-ctrls: use const char * const * for the menu arrays This prevents checkpatch warnings generated when defining 'static const char *foo[]' arrays. It makes sense to use const char * const * anyway since the pointers in the array are indeed const. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx18/cx18-controls.c | 2 +- drivers/media/video/cx2341x.c | 8 ++-- drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 6 +-- drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 2 +- drivers/media/video/v4l2-common.c | 6 +-- drivers/media/video/v4l2-ctrls.c | 46 +++++++++++----------- include/media/cx2341x.h | 2 +- include/media/v4l2-common.h | 6 +-- include/media/v4l2-ctrls.h | 4 +- 9 files changed, 41 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c index 67043c7b452b..97d7b7e100a3 100644 --- a/drivers/media/video/cx18/cx18-controls.c +++ b/drivers/media/video/cx18/cx18-controls.c @@ -108,7 +108,7 @@ static int cx18_try_ctrl(struct file *file, void *fh, struct v4l2_ext_control *vctrl) { struct v4l2_queryctrl qctrl; - const char **menu_items = NULL; + const char * const *menu_items = NULL; int err; qctrl.id = vctrl->id; diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index e5c3c8da4be3..103ef6bad2e2 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c @@ -853,9 +853,9 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, } EXPORT_SYMBOL(cx2341x_ctrl_query); -const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id) +const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id) { - static const char *mpeg_stream_type_without_ts[] = { + static const char * const mpeg_stream_type_without_ts[] = { "MPEG-2 Program Stream", "", "MPEG-1 System Stream", @@ -952,7 +952,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, for (i = 0; i < ctrls->count; i++) { struct v4l2_ext_control *ctrl = ctrls->controls + i; struct v4l2_queryctrl qctrl; - const char **menu_items = NULL; + const char * const *menu_items = NULL; qctrl.id = ctrl->id; err = cx2341x_ctrl_query(params, &qctrl); @@ -1135,7 +1135,7 @@ EXPORT_SYMBOL(cx2341x_update); static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id) { - const char **menu = cx2341x_ctrl_get_menu(p, id); + const char * const *menu = cx2341x_ctrl_get_menu(p, id); struct v4l2_ext_control ctrl; if (menu == NULL) diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 55ea914c7fcd..7d5a7139a45a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c @@ -203,7 +203,7 @@ int pvr2_ctrl_get_valname(struct pvr2_ctrl *cptr,int val, *blen = 0; LOCK_TAKE(cptr->hdw->big_lock); do { if (cptr->info->type == pvr2_ctl_enum) { - const char **names; + const char * const *names; names = cptr->info->def.type_enum.value_names; if (pvr2_ctrl_range_check(cptr,val) == 0) { if (names[val]) { @@ -367,7 +367,7 @@ static const char *boolNames[] = { static int parse_token(const char *ptr,unsigned int len, int *valptr, - const char **names,unsigned int namecnt) + const char * const *names, unsigned int namecnt) { char buf[33]; unsigned int slen; @@ -559,7 +559,7 @@ int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *cptr, *len = scnprintf(buf,maxlen,"%s",val ? "true" : "false"); ret = 0; } else if (cptr->info->type == pvr2_ctl_enum) { - const char **names; + const char * const *names; names = cptr->info->def.type_enum.value_names; if ((val >= 0) && (val < cptr->info->def.type_enum.count)) { diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index cb4057bb07a0..ac94a8bf883e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -115,7 +115,7 @@ struct pvr2_ctl_info { } type_int; struct { /* enumerated control */ unsigned int count; /* enum value count */ - const char **value_names; /* symbol names */ + const char * const *value_names; /* symbol names */ } type_enum; struct { /* bitmask control */ unsigned int valid_bits; /* bits in use */ diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index b5eb1f3950b1..3f0871b550ad 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -150,7 +150,7 @@ EXPORT_SYMBOL(v4l2_prio_check); struct v4l2_queryctrl and the available menu items. Note that menu_items may be NULL, in that case it is ignored. */ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, - const char **menu_items) + const char * const *menu_items) { if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED) return -EINVAL; @@ -199,7 +199,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill); If menu_items is NULL, then the menu items are retrieved using v4l2_ctrl_get_menu. */ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl, - const char **menu_items) + const char * const *menu_items) { int i; @@ -222,7 +222,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu); Use this if there are 'holes' in the list of valid menu items. */ int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids) { - const char **menu_items = v4l2_ctrl_get_menu(qmenu->id); + const char * const *menu_items = v4l2_ctrl_get_menu(qmenu->id); qmenu->reserved = 0; if (menu_items == NULL || ids == NULL) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 9d2502cd03ff..6c0fadc2beab 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -38,15 +38,15 @@ struct ctrl_helper { the given control ID. The pointer array ends with a NULL pointer. An empty string signifies a menu entry that is invalid. This allows drivers to disable certain options if it is not supported. */ -const char **v4l2_ctrl_get_menu(u32 id) +const char * const *v4l2_ctrl_get_menu(u32 id) { - static const char *mpeg_audio_sampling_freq[] = { + static const char * const mpeg_audio_sampling_freq[] = { "44.1 kHz", "48 kHz", "32 kHz", NULL }; - static const char *mpeg_audio_encoding[] = { + static const char * const mpeg_audio_encoding[] = { "MPEG-1/2 Layer I", "MPEG-1/2 Layer II", "MPEG-1/2 Layer III", @@ -54,7 +54,7 @@ const char **v4l2_ctrl_get_menu(u32 id) "AC-3", NULL }; - static const char *mpeg_audio_l1_bitrate[] = { + static const char * const mpeg_audio_l1_bitrate[] = { "32 kbps", "64 kbps", "96 kbps", @@ -71,7 +71,7 @@ const char **v4l2_ctrl_get_menu(u32 id) "448 kbps", NULL }; - static const char *mpeg_audio_l2_bitrate[] = { + static const char * const mpeg_audio_l2_bitrate[] = { "32 kbps", "48 kbps", "56 kbps", @@ -88,7 +88,7 @@ const char **v4l2_ctrl_get_menu(u32 id) "384 kbps", NULL }; - static const char *mpeg_audio_l3_bitrate[] = { + static const char * const mpeg_audio_l3_bitrate[] = { "32 kbps", "40 kbps", "48 kbps", @@ -105,7 +105,7 @@ const char **v4l2_ctrl_get_menu(u32 id) "320 kbps", NULL }; - static const char *mpeg_audio_ac3_bitrate[] = { + static const char * const mpeg_audio_ac3_bitrate[] = { "32 kbps", "40 kbps", "48 kbps", @@ -127,50 +127,50 @@ const char **v4l2_ctrl_get_menu(u32 id) "640 kbps", NULL }; - static const char *mpeg_audio_mode[] = { + static const char * const mpeg_audio_mode[] = { "Stereo", "Joint Stereo", "Dual", "Mono", NULL }; - static const char *mpeg_audio_mode_extension[] = { + static const char * const mpeg_audio_mode_extension[] = { "Bound 4", "Bound 8", "Bound 12", "Bound 16", NULL }; - static const char *mpeg_audio_emphasis[] = { + static const char * const mpeg_audio_emphasis[] = { "No Emphasis", "50/15 us", "CCITT J17", NULL }; - static const char *mpeg_audio_crc[] = { + static const char * const mpeg_audio_crc[] = { "No CRC", "16-bit CRC", NULL }; - static const char *mpeg_video_encoding[] = { + static const char * const mpeg_video_encoding[] = { "MPEG-1", "MPEG-2", "MPEG-4 AVC", NULL }; - static const char *mpeg_video_aspect[] = { + static const char * const mpeg_video_aspect[] = { "1x1", "4x3", "16x9", "2.21x1", NULL }; - static const char *mpeg_video_bitrate_mode[] = { + static const char * const mpeg_video_bitrate_mode[] = { "Variable Bitrate", "Constant Bitrate", NULL }; - static const char *mpeg_stream_type[] = { + static const char * const mpeg_stream_type[] = { "MPEG-2 Program Stream", "MPEG-2 Transport Stream", "MPEG-1 System Stream", @@ -179,25 +179,25 @@ const char **v4l2_ctrl_get_menu(u32 id) "MPEG-2 SVCD-compatible Stream", NULL }; - static const char *mpeg_stream_vbi_fmt[] = { + static const char * const mpeg_stream_vbi_fmt[] = { "No VBI", "Private packet, IVTV format", NULL }; - static const char *camera_power_line_frequency[] = { + static const char * const camera_power_line_frequency[] = { "Disabled", "50 Hz", "60 Hz", NULL }; - static const char *camera_exposure_auto[] = { + static const char * const camera_exposure_auto[] = { "Auto Mode", "Manual Mode", "Shutter Priority Mode", "Aperture Priority Mode", NULL }; - static const char *colorfx[] = { + static const char * const colorfx[] = { "None", "Black & White", "Sepia", @@ -210,7 +210,7 @@ const char **v4l2_ctrl_get_menu(u32 id) "Vivid", NULL }; - static const char *tune_preemphasis[] = { + static const char * const tune_preemphasis[] = { "No preemphasis", "50 useconds", "75 useconds", @@ -952,7 +952,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, const char *name, enum v4l2_ctrl_type type, s32 min, s32 max, u32 step, s32 def, - u32 flags, const char **qmenu, void *priv) + u32 flags, const char * const *qmenu, void *priv) { struct v4l2_ctrl *ctrl; unsigned sz_extra = 0; @@ -1019,7 +1019,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, bool is_menu; struct v4l2_ctrl *ctrl; const char *name = cfg->name; - const char **qmenu = cfg->qmenu; + const char * const *qmenu = cfg->qmenu; enum v4l2_ctrl_type type = cfg->type; u32 flags = cfg->flags; s32 min = cfg->min; @@ -1075,7 +1075,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 mask, s32 def) { - const char **qmenu = v4l2_ctrl_get_menu(id); + const char * const *qmenu = v4l2_ctrl_get_menu(id); const char *name; enum v4l2_ctrl_type type; s32 min; diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index 8d08ebfe20b7..9635eebaab09 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h @@ -95,7 +95,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, const struct cx2341x_mpeg_params *new); int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, struct v4l2_queryctrl *qctrl); -const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id); +const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id); int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, struct v4l2_ext_controls *ctrls, unsigned int cmd); void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 239125af3ea3..2d65b35cdab2 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -98,12 +98,12 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local); /* Control helper functions */ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, - const char **menu_items); + const char * const *menu_items); const char *v4l2_ctrl_get_name(u32 id); -const char **v4l2_ctrl_get_menu(u32 id); +const char * const *v4l2_ctrl_get_menu(u32 id); int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, - struct v4l2_queryctrl *qctrl, const char **menu_items); + struct v4l2_queryctrl *qctrl, const char * const *menu_items); #define V4L2_CTRL_MENU_IDS_END (0xffffffff) int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 9b7bea928a88..d69ab4aae032 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -112,7 +112,7 @@ struct v4l2_ctrl { u32 step; u32 menu_skip_mask; }; - const char **qmenu; + const char * const *qmenu; unsigned long flags; union { s32 val; @@ -202,7 +202,7 @@ struct v4l2_ctrl_config { s32 def; u32 flags; u32 menu_skip_mask; - const char **qmenu; + const char * const *qmenu; unsigned int is_private:1; unsigned int is_volatile:1; }; -- cgit v1.2.3 From 3153ac9c6208892ee237caccdbe2290f8247e236 Mon Sep 17 00:00:00 2001 From: Alberto Panizzo Date: Thu, 2 Dec 2010 11:53:28 -0300 Subject: [media] V4L2: Add a v4l2-subdev (soc-camera) driver for OmniVision OV2640 sensor Signed-off-by: Alberto Panizzo Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Kconfig | 6 + drivers/media/video/Makefile | 1 + drivers/media/video/ov2640.c | 1205 +++++++++++++++++++++++++++++++++++++++ include/media/v4l2-chip-ident.h | 1 + 4 files changed, 1213 insertions(+) create mode 100644 drivers/media/video/ov2640.c (limited to 'include') diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 78b8c5de1f6b..eb875af05e79 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -794,6 +794,12 @@ config SOC_CAMERA_PLATFORM help This is a generic SoC camera platform driver, useful for testing +config SOC_CAMERA_OV2640 + tristate "ov2640 camera support" + depends on SOC_CAMERA && I2C + help + This is a ov2640 camera driver + config SOC_CAMERA_OV6650 tristate "ov6650 sensor support" depends on SOC_CAMERA && I2C diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 98825e7d8ca4..81e38cb0b846 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -75,6 +75,7 @@ obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o +obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o obj-$(CONFIG_SOC_CAMERA_OV6650) += ov6650.o obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o diff --git a/drivers/media/video/ov2640.c b/drivers/media/video/ov2640.c new file mode 100644 index 000000000000..0cea0cf36679 --- /dev/null +++ b/drivers/media/video/ov2640.c @@ -0,0 +1,1205 @@ +/* + * ov2640 Camera Driver + * + * Copyright (C) 2010 Alberto Panizzo + * + * Based on ov772x, ov9640 drivers and previous non merged implementations. + * + * Copyright 2005-2009 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2006, OmniVision + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define VAL_SET(x, mask, rshift, lshift) \ + ((((x) >> rshift) & mask) << lshift) +/* + * DSP registers + * register offset for BANK_SEL == BANK_SEL_DSP + */ +#define R_BYPASS 0x05 /* Bypass DSP */ +#define R_BYPASS_DSP_BYPAS 0x01 /* Bypass DSP, sensor out directly */ +#define R_BYPASS_USE_DSP 0x00 /* Use the internal DSP */ +#define QS 0x44 /* Quantization Scale Factor */ +#define CTRLI 0x50 +#define CTRLI_LP_DP 0x80 +#define CTRLI_ROUND 0x40 +#define CTRLI_V_DIV_SET(x) VAL_SET(x, 0x3, 0, 3) +#define CTRLI_H_DIV_SET(x) VAL_SET(x, 0x3, 0, 0) +#define HSIZE 0x51 /* H_SIZE[7:0] (real/4) */ +#define HSIZE_SET(x) VAL_SET(x, 0xFF, 2, 0) +#define VSIZE 0x52 /* V_SIZE[7:0] (real/4) */ +#define VSIZE_SET(x) VAL_SET(x, 0xFF, 2, 0) +#define XOFFL 0x53 /* OFFSET_X[7:0] */ +#define XOFFL_SET(x) VAL_SET(x, 0xFF, 0, 0) +#define YOFFL 0x54 /* OFFSET_Y[7:0] */ +#define YOFFL_SET(x) VAL_SET(x, 0xFF, 0, 0) +#define VHYX 0x55 /* Offset and size completion */ +#define VHYX_VSIZE_SET(x) VAL_SET(x, 0x1, (8+2), 7) +#define VHYX_HSIZE_SET(x) VAL_SET(x, 0x1, (8+2), 3) +#define VHYX_YOFF_SET(x) VAL_SET(x, 0x3, 8, 4) +#define VHYX_XOFF_SET(x) VAL_SET(x, 0x3, 8, 0) +#define DPRP 0x56 +#define TEST 0x57 /* Horizontal size completion */ +#define TEST_HSIZE_SET(x) VAL_SET(x, 0x1, (9+2), 7) +#define ZMOW 0x5A /* Zoom: Out Width OUTW[7:0] (real/4) */ +#define ZMOW_OUTW_SET(x) VAL_SET(x, 0xFF, 2, 0) +#define ZMOH 0x5B /* Zoom: Out Height OUTH[7:0] (real/4) */ +#define ZMOH_OUTH_SET(x) VAL_SET(x, 0xFF, 2, 0) +#define ZMHH 0x5C /* Zoom: Speed and H&W completion */ +#define ZMHH_ZSPEED_SET(x) VAL_SET(x, 0x0F, 0, 4) +#define ZMHH_OUTH_SET(x) VAL_SET(x, 0x1, (8+2), 2) +#define ZMHH_OUTW_SET(x) VAL_SET(x, 0x3, (8+2), 0) +#define BPADDR 0x7C /* SDE Indirect Register Access: Address */ +#define BPDATA 0x7D /* SDE Indirect Register Access: Data */ +#define CTRL2 0x86 /* DSP Module enable 2 */ +#define CTRL2_DCW_EN 0x20 +#define CTRL2_SDE_EN 0x10 +#define CTRL2_UV_ADJ_EN 0x08 +#define CTRL2_UV_AVG_EN 0x04 +#define CTRL2_CMX_EN 0x01 +#define CTRL3 0x87 /* DSP Module enable 3 */ +#define CTRL3_BPC_EN 0x80 +#define CTRL3_WPC_EN 0x40 +#define SIZEL 0x8C /* Image Size Completion */ +#define SIZEL_HSIZE8_11_SET(x) VAL_SET(x, 0x1, 11, 6) +#define SIZEL_HSIZE8_SET(x) VAL_SET(x, 0x7, 0, 3) +#define SIZEL_VSIZE8_SET(x) VAL_SET(x, 0x7, 0, 0) +#define HSIZE8 0xC0 /* Image Horizontal Size HSIZE[10:3] */ +#define HSIZE8_SET(x) VAL_SET(x, 0xFF, 3, 0) +#define VSIZE8 0xC1 /* Image Vertical Size VSIZE[10:3] */ +#define VSIZE8_SET(x) VAL_SET(x, 0xFF, 3, 0) +#define CTRL0 0xC2 /* DSP Module enable 0 */ +#define CTRL0_AEC_EN 0x80 +#define CTRL0_AEC_SEL 0x40 +#define CTRL0_STAT_SEL 0x20 +#define CTRL0_VFIRST 0x10 +#define CTRL0_YUV422 0x08 +#define CTRL0_YUV_EN 0x04 +#define CTRL0_RGB_EN 0x02 +#define CTRL0_RAW_EN 0x01 +#define CTRL1 0xC3 /* DSP Module enable 1 */ +#define CTRL1_CIP 0x80 +#define CTRL1_DMY 0x40 +#define CTRL1_RAW_GMA 0x20 +#define CTRL1_DG 0x10 +#define CTRL1_AWB 0x08 +#define CTRL1_AWB_GAIN 0x04 +#define CTRL1_LENC 0x02 +#define CTRL1_PRE 0x01 +#define R_DVP_SP 0xD3 /* DVP output speed control */ +#define R_DVP_SP_AUTO_MODE 0x80 +#define R_DVP_SP_DVP_MASK 0x3F /* DVP PCLK = sysclk (48)/[6:0] (YUV0); + * = sysclk (48)/(2*[6:0]) (RAW);*/ +#define IMAGE_MODE 0xDA /* Image Output Format Select */ +#define IMAGE_MODE_Y8_DVP_EN 0x40 +#define IMAGE_MODE_JPEG_EN 0x10 +#define IMAGE_MODE_YUV422 0x00 +#define IMAGE_MODE_RAW10 0x04 /* (DVP) */ +#define IMAGE_MODE_RGB565 0x08 +#define IMAGE_MODE_HREF_VSYNC 0x02 /* HREF timing select in DVP JPEG output + * mode (0 for HREF is same as sensor) */ +#define IMAGE_MODE_LBYTE_FIRST 0x01 /* Byte swap enable for DVP + * 1: Low byte first UYVY (C2[4] =0) + * VYUY (C2[4] =1) + * 0: High byte first YUYV (C2[4]=0) + * YVYU (C2[4] = 1) */ +#define RESET 0xE0 /* Reset */ +#define RESET_MICROC 0x40 +#define RESET_SCCB 0x20 +#define RESET_JPEG 0x10 +#define RESET_DVP 0x04 +#define RESET_IPU 0x02 +#define RESET_CIF 0x01 +#define REGED 0xED /* Register ED */ +#define REGED_CLK_OUT_DIS 0x10 +#define MS_SP 0xF0 /* SCCB Master Speed */ +#define SS_ID 0xF7 /* SCCB Slave ID */ +#define SS_CTRL 0xF8 /* SCCB Slave Control */ +#define SS_CTRL_ADD_AUTO_INC 0x20 +#define SS_CTRL_EN 0x08 +#define SS_CTRL_DELAY_CLK 0x04 +#define SS_CTRL_ACC_EN 0x02 +#define SS_CTRL_SEN_PASS_THR 0x01 +#define MC_BIST 0xF9 /* Microcontroller misc register */ +#define MC_BIST_RESET 0x80 /* Microcontroller Reset */ +#define MC_BIST_BOOT_ROM_SEL 0x40 +#define MC_BIST_12KB_SEL 0x20 +#define MC_BIST_12KB_MASK 0x30 +#define MC_BIST_512KB_SEL 0x08 +#define MC_BIST_512KB_MASK 0x0C +#define MC_BIST_BUSY_BIT_R 0x02 +#define MC_BIST_MC_RES_ONE_SH_W 0x02 +#define MC_BIST_LAUNCH 0x01 +#define BANK_SEL 0xFF /* Register Bank Select */ +#define BANK_SEL_DSP 0x00 +#define BANK_SEL_SENS 0x01 + +/* + * Sensor registers + * register offset for BANK_SEL == BANK_SEL_SENS + */ +#define GAIN 0x00 /* AGC - Gain control gain setting */ +#define COM1 0x03 /* Common control 1 */ +#define COM1_1_DUMMY_FR 0x40 +#define COM1_3_DUMMY_FR 0x80 +#define COM1_7_DUMMY_FR 0xC0 +#define COM1_VWIN_LSB_UXGA 0x0F +#define COM1_VWIN_LSB_SVGA 0x0A +#define COM1_VWIN_LSB_CIF 0x06 +#define REG04 0x04 /* Register 04 */ +#define REG04_DEF 0x20 /* Always set */ +#define REG04_HFLIP_IMG 0x80 /* Horizontal mirror image ON/OFF */ +#define REG04_VFLIP_IMG 0x40 /* Vertical flip image ON/OFF */ +#define REG04_VREF_EN 0x10 +#define REG04_HREF_EN 0x08 +#define REG04_AEC_SET(x) VAL_SET(x, 0x3, 0, 0) +#define REG08 0x08 /* Frame Exposure One-pin Control Pre-charge Row Num */ +#define COM2 0x09 /* Common control 2 */ +#define COM2_SOFT_SLEEP_MODE 0x10 /* Soft sleep mode */ + /* Output drive capability */ +#define COM2_OCAP_Nx_SET(N) (((N) - 1) & 0x03) /* N = [1x .. 4x] */ +#define PID 0x0A /* Product ID Number MSB */ +#define VER 0x0B /* Product ID Number LSB */ +#define COM3 0x0C /* Common control 3 */ +#define COM3_BAND_50H 0x04 /* 0 For Banding at 60H */ +#define COM3_BAND_AUTO 0x02 /* Auto Banding */ +#define COM3_SING_FR_SNAPSH 0x01 /* 0 For enable live video output after the + * snapshot sequence*/ +#define AEC 0x10 /* AEC[9:2] Exposure Value */ +#define CLKRC 0x11 /* Internal clock */ +#define CLKRC_EN 0x80 +#define CLKRC_DIV_SET(x) (((x) - 1) & 0x1F) /* CLK = XVCLK/(x) */ +#define COM7 0x12 /* Common control 7 */ +#define COM7_SRST 0x80 /* Initiates system reset. All registers are + * set to factory default values after which + * the chip resumes normal operation */ +#define COM7_RES_UXGA 0x00 /* Resolution selectors for UXGA */ +#define COM7_RES_SVGA 0x40 /* SVGA */ +#define COM7_RES_CIF 0x20 /* CIF */ +#define COM7_ZOOM_EN 0x04 /* Enable Zoom mode */ +#define COM7_COLOR_BAR_TEST 0x02 /* Enable Color Bar Test Pattern */ +#define COM8 0x13 /* Common control 8 */ +#define COM8_DEF 0xC0 /* Banding filter ON/OFF */ +#define COM8_BNDF_EN 0x20 /* Banding filter ON/OFF */ +#define COM8_AGC_EN 0x04 /* AGC Auto/Manual control selection */ +#define COM8_AEC_EN 0x01 /* Auto/Manual Exposure control */ +#define COM9 0x14 /* Common control 9 + * Automatic gain ceiling - maximum AGC value [7:5]*/ +#define COM9_AGC_GAIN_2x 0x00 /* 000 : 2x */ +#define COM9_AGC_GAIN_4x 0x20 /* 001 : 4x */ +#define COM9_AGC_GAIN_8x 0x40 /* 010 : 8x */ +#define COM9_AGC_GAIN_16x 0x60 /* 011 : 16x */ +#define COM9_AGC_GAIN_32x 0x80 /* 100 : 32x */ +#define COM9_AGC_GAIN_64x 0xA0 /* 101 : 64x */ +#define COM9_AGC_GAIN_128x 0xC0 /* 110 : 128x */ +#define COM10 0x15 /* Common control 10 */ +#define COM10_PCLK_HREF 0x20 /* PCLK output qualified by HREF */ +#define COM10_PCLK_RISE 0x10 /* Data is updated at the rising edge of + * PCLK (user can latch data at the next + * falling edge of PCLK). + * 0 otherwise. */ +#define COM10_HREF_INV 0x08 /* Invert HREF polarity: + * HREF negative for valid data*/ +#define COM10_VSINC_INV 0x02 /* Invert VSYNC polarity */ +#define HSTART 0x17 /* Horizontal Window start MSB 8 bit */ +#define HEND 0x18 /* Horizontal Window end MSB 8 bit */ +#define VSTART 0x19 /* Vertical Window start MSB 8 bit */ +#define VEND 0x1A /* Vertical Window end MSB 8 bit */ +#define MIDH 0x1C /* Manufacturer ID byte - high */ +#define MIDL 0x1D /* Manufacturer ID byte - low */ +#define AEW 0x24 /* AGC/AEC - Stable operating region (upper limit) */ +#define AEB 0x25 /* AGC/AEC - Stable operating region (lower limit) */ +#define VV 0x26 /* AGC/AEC Fast mode operating region */ +#define VV_HIGH_TH_SET(x) VAL_SET(x, 0xF, 0, 4) +#define VV_LOW_TH_SET(x) VAL_SET(x, 0xF, 0, 0) +#define REG2A 0x2A /* Dummy pixel insert MSB */ +#define FRARL 0x2B /* Dummy pixel insert LSB */ +#define ADDVFL 0x2D /* LSB of insert dummy lines in Vertical direction */ +#define ADDVFH 0x2E /* MSB of insert dummy lines in Vertical direction */ +#define YAVG 0x2F /* Y/G Channel Average value */ +#define REG32 0x32 /* Common Control 32 */ +#define REG32_PCLK_DIV_2 0x80 /* PCLK freq divided by 2 */ +#define REG32_PCLK_DIV_4 0xC0 /* PCLK freq divided by 4 */ +#define ARCOM2 0x34 /* Zoom: Horizontal start point */ +#define REG45 0x45 /* Register 45 */ +#define FLL 0x46 /* Frame Length Adjustment LSBs */ +#define FLH 0x47 /* Frame Length Adjustment MSBs */ +#define COM19 0x48 /* Zoom: Vertical start point */ +#define ZOOMS 0x49 /* Zoom: Vertical start point */ +#define COM22 0x4B /* Flash light control */ +#define COM25 0x4E /* For Banding operations */ +#define BD50 0x4F /* 50Hz Banding AEC 8 LSBs */ +#define BD60 0x50 /* 60Hz Banding AEC 8 LSBs */ +#define REG5D 0x5D /* AVGsel[7:0], 16-zone average weight option */ +#define REG5E 0x5E /* AVGsel[15:8], 16-zone average weight option */ +#define REG5F 0x5F /* AVGsel[23:16], 16-zone average weight option */ +#define REG60 0x60 /* AVGsel[31:24], 16-zone average weight option */ +#define HISTO_LOW 0x61 /* Histogram Algorithm Low Level */ +#define HISTO_HIGH 0x62 /* Histogram Algorithm High Level */ + +/* + * ID + */ +#define MANUFACTURER_ID 0x7FA2 +#define PID_OV2640 0x2642 +#define VERSION(pid, ver) ((pid << 8) | (ver & 0xFF)) + +/* + * Struct + */ +struct regval_list { + u8 reg_num; + u8 value; +}; + +/* Supported resolutions */ +enum ov2640_width { + W_QCIF = 176, + W_QVGA = 320, + W_CIF = 352, + W_VGA = 640, + W_SVGA = 800, + W_XGA = 1024, + W_SXGA = 1280, + W_UXGA = 1600, +}; + +enum ov2640_height { + H_QCIF = 144, + H_QVGA = 240, + H_CIF = 288, + H_VGA = 480, + H_SVGA = 600, + H_XGA = 768, + H_SXGA = 1024, + H_UXGA = 1200, +}; + +struct ov2640_win_size { + char *name; + enum ov2640_width width; + enum ov2640_height height; + const struct regval_list *regs; +}; + + +struct ov2640_priv { + struct v4l2_subdev subdev; + struct ov2640_camera_info *info; + enum v4l2_mbus_pixelcode cfmt_code; + const struct ov2640_win_size *win; + int model; + u16 flag_vflip:1; + u16 flag_hflip:1; +}; + +/* + * Registers settings + */ + +#define ENDMARKER { 0xff, 0xff } + +static const struct regval_list ov2640_init_regs[] = { + { BANK_SEL, BANK_SEL_DSP }, + { 0x2c, 0xff }, + { 0x2e, 0xdf }, + { BANK_SEL, BANK_SEL_SENS }, + { 0x3c, 0x32 }, + { CLKRC, CLKRC_DIV_SET(1) }, + { COM2, COM2_OCAP_Nx_SET(3) }, + { REG04, REG04_DEF | REG04_HREF_EN }, + { COM8, COM8_DEF | COM8_BNDF_EN | COM8_AGC_EN | COM8_AEC_EN }, + { COM9, COM9_AGC_GAIN_8x | 0x08}, + { 0x2c, 0x0c }, + { 0x33, 0x78 }, + { 0x3a, 0x33 }, + { 0x3b, 0xfb }, + { 0x3e, 0x00 }, + { 0x43, 0x11 }, + { 0x16, 0x10 }, + { 0x39, 0x02 }, + { 0x35, 0x88 }, + { 0x22, 0x0a }, + { 0x37, 0x40 }, + { 0x23, 0x00 }, + { ARCOM2, 0xa0 }, + { 0x06, 0x02 }, + { 0x06, 0x88 }, + { 0x07, 0xc0 }, + { 0x0d, 0xb7 }, + { 0x0e, 0x01 }, + { 0x4c, 0x00 }, + { 0x4a, 0x81 }, + { 0x21, 0x99 }, + { AEW, 0x40 }, + { AEB, 0x38 }, + { VV, VV_HIGH_TH_SET(0x08) | VV_LOW_TH_SET(0x02) }, + { 0x5c, 0x00 }, + { 0x63, 0x00 }, + { FLL, 0x22 }, + { COM3, 0x38 | COM3_BAND_AUTO }, + { REG5D, 0x55 }, + { REG5E, 0x7d }, + { REG5F, 0x7d }, + { REG60, 0x55 }, + { HISTO_LOW, 0x70 }, + { HISTO_HIGH, 0x80 }, + { 0x7c, 0x05 }, + { 0x20, 0x80 }, + { 0x28, 0x30 }, + { 0x6c, 0x00 }, + { 0x6d, 0x80 }, + { 0x6e, 0x00 }, + { 0x70, 0x02 }, + { 0x71, 0x94 }, + { 0x73, 0xc1 }, + { 0x3d, 0x34 }, + { COM7, COM7_RES_UXGA | COM7_ZOOM_EN }, + { 0x5a, 0x57 }, + { BD50, 0xbb }, + { BD60, 0x9c }, + { BANK_SEL, BANK_SEL_DSP }, + { 0xe5, 0x7f }, + { MC_BIST, MC_BIST_RESET | MC_BIST_BOOT_ROM_SEL }, + { 0x41, 0x24 }, + { RESET, RESET_JPEG | RESET_DVP }, + { 0x76, 0xff }, + { 0x33, 0xa0 }, + { 0x42, 0x20 }, + { 0x43, 0x18 }, + { 0x4c, 0x00 }, + { CTRL3, CTRL3_BPC_EN | CTRL3_WPC_EN | 0x10 }, + { 0x88, 0x3f }, + { 0xd7, 0x03 }, + { 0xd9, 0x10 }, + { R_DVP_SP , R_DVP_SP_AUTO_MODE | 0x2 }, + { 0xc8, 0x08 }, + { 0xc9, 0x80 }, + { BPADDR, 0x00 }, + { BPDATA, 0x00 }, + { BPADDR, 0x03 }, + { BPDATA, 0x48 }, + { BPDATA, 0x48 }, + { BPADDR, 0x08 }, + { BPDATA, 0x20 }, + { BPDATA, 0x10 }, + { BPDATA, 0x0e }, + { 0x90, 0x00 }, + { 0x91, 0x0e }, + { 0x91, 0x1a }, + { 0x91, 0x31 }, + { 0x91, 0x5a }, + { 0x91, 0x69 }, + { 0x91, 0x75 }, + { 0x91, 0x7e }, + { 0x91, 0x88 }, + { 0x91, 0x8f }, + { 0x91, 0x96 }, + { 0x91, 0xa3 }, + { 0x91, 0xaf }, + { 0x91, 0xc4 }, + { 0x91, 0xd7 }, + { 0x91, 0xe8 }, + { 0x91, 0x20 }, + { 0x92, 0x00 }, + { 0x93, 0x06 }, + { 0x93, 0xe3 }, + { 0x93, 0x03 }, + { 0x93, 0x03 }, + { 0x93, 0x00 }, + { 0x93, 0x02 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x93, 0x00 }, + { 0x96, 0x00 }, + { 0x97, 0x08 }, + { 0x97, 0x19 }, + { 0x97, 0x02 }, + { 0x97, 0x0c }, + { 0x97, 0x24 }, + { 0x97, 0x30 }, + { 0x97, 0x28 }, + { 0x97, 0x26 }, + { 0x97, 0x02 }, + { 0x97, 0x98 }, + { 0x97, 0x80 }, + { 0x97, 0x00 }, + { 0x97, 0x00 }, + { 0xa4, 0x00 }, + { 0xa8, 0x00 }, + { 0xc5, 0x11 }, + { 0xc6, 0x51 }, + { 0xbf, 0x80 }, + { 0xc7, 0x10 }, + { 0xb6, 0x66 }, + { 0xb8, 0xA5 }, + { 0xb7, 0x64 }, + { 0xb9, 0x7C }, + { 0xb3, 0xaf }, + { 0xb4, 0x97 }, + { 0xb5, 0xFF }, + { 0xb0, 0xC5 }, + { 0xb1, 0x94 }, + { 0xb2, 0x0f }, + { 0xc4, 0x5c }, + { 0xa6, 0x00 }, + { 0xa7, 0x20 }, + { 0xa7, 0xd8 }, + { 0xa7, 0x1b }, + { 0xa7, 0x31 }, + { 0xa7, 0x00 }, + { 0xa7, 0x18 }, + { 0xa7, 0x20 }, + { 0xa7, 0xd8 }, + { 0xa7, 0x19 }, + { 0xa7, 0x31 }, + { 0xa7, 0x00 }, + { 0xa7, 0x18 }, + { 0xa7, 0x20 }, + { 0xa7, 0xd8 }, + { 0xa7, 0x19 }, + { 0xa7, 0x31 }, + { 0xa7, 0x00 }, + { 0xa7, 0x18 }, + { 0x7f, 0x00 }, + { 0xe5, 0x1f }, + { 0xe1, 0x77 }, + { 0xdd, 0x7f }, + { CTRL0, CTRL0_YUV422 | CTRL0_YUV_EN | CTRL0_RGB_EN }, + ENDMARKER, +}; + +/* + * Register settings for window size + * The preamble, setup the internal DSP to input an UXGA (1600x1200) image. + * Then the different zooming configurations will setup the output image size. + */ +static const struct regval_list ov2640_size_change_preamble_regs[] = { + { BANK_SEL, BANK_SEL_DSP }, + { RESET, RESET_DVP }, + { HSIZE8, HSIZE8_SET(W_UXGA) }, + { VSIZE8, VSIZE8_SET(H_UXGA) }, + { CTRL2, CTRL2_DCW_EN | CTRL2_SDE_EN | + CTRL2_UV_AVG_EN | CTRL2_CMX_EN | CTRL2_UV_ADJ_EN }, + { HSIZE, HSIZE_SET(W_UXGA) }, + { VSIZE, VSIZE_SET(H_UXGA) }, + { XOFFL, XOFFL_SET(0) }, + { YOFFL, YOFFL_SET(0) }, + { VHYX, VHYX_HSIZE_SET(W_UXGA) | VHYX_VSIZE_SET(H_UXGA) | + VHYX_XOFF_SET(0) | VHYX_YOFF_SET(0)}, + { TEST, TEST_HSIZE_SET(W_UXGA) }, + ENDMARKER, +}; + +#define PER_SIZE_REG_SEQ(x, y, v_div, h_div, pclk_div) \ + { CTRLI, CTRLI_LP_DP | CTRLI_V_DIV_SET(v_div) | \ + CTRLI_H_DIV_SET(h_div)}, \ + { ZMOW, ZMOW_OUTW_SET(x) }, \ + { ZMOH, ZMOH_OUTH_SET(y) }, \ + { ZMHH, ZMHH_OUTW_SET(x) | ZMHH_OUTH_SET(y) }, \ + { R_DVP_SP, pclk_div }, \ + { RESET, 0x00} + +static const struct regval_list ov2640_qcif_regs[] = { + PER_SIZE_REG_SEQ(W_QCIF, H_QCIF, 3, 3, 4), + ENDMARKER, +}; + +static const struct regval_list ov2640_qvga_regs[] = { + PER_SIZE_REG_SEQ(W_QVGA, H_QVGA, 2, 2, 4), + ENDMARKER, +}; + +static const struct regval_list ov2640_cif_regs[] = { + PER_SIZE_REG_SEQ(W_CIF, H_CIF, 2, 2, 8), + ENDMARKER, +}; + +static const struct regval_list ov2640_vga_regs[] = { + PER_SIZE_REG_SEQ(W_VGA, H_VGA, 0, 0, 2), + ENDMARKER, +}; + +static const struct regval_list ov2640_svga_regs[] = { + PER_SIZE_REG_SEQ(W_SVGA, H_SVGA, 1, 1, 2), + ENDMARKER, +}; + +static const struct regval_list ov2640_xga_regs[] = { + PER_SIZE_REG_SEQ(W_XGA, H_XGA, 0, 0, 2), + { CTRLI, 0x00}, + ENDMARKER, +}; + +static const struct regval_list ov2640_sxga_regs[] = { + PER_SIZE_REG_SEQ(W_SXGA, H_SXGA, 0, 0, 2), + { CTRLI, 0x00}, + { R_DVP_SP, 2 | R_DVP_SP_AUTO_MODE }, + ENDMARKER, +}; + +static const struct regval_list ov2640_uxga_regs[] = { + PER_SIZE_REG_SEQ(W_UXGA, H_UXGA, 0, 0, 0), + { CTRLI, 0x00}, + { R_DVP_SP, 0 | R_DVP_SP_AUTO_MODE }, + ENDMARKER, +}; + +#define OV2640_SIZE(n, w, h, r) \ + {.name = n, .width = w , .height = h, .regs = r } + +static const struct ov2640_win_size ov2640_supported_win_sizes[] = { + OV2640_SIZE("QCIF", W_QCIF, H_QCIF, ov2640_qcif_regs), + OV2640_SIZE("QVGA", W_QVGA, H_QVGA, ov2640_qvga_regs), + OV2640_SIZE("CIF", W_CIF, H_CIF, ov2640_cif_regs), + OV2640_SIZE("VGA", W_VGA, H_VGA, ov2640_vga_regs), + OV2640_SIZE("SVGA", W_SVGA, H_SVGA, ov2640_svga_regs), + OV2640_SIZE("XGA", W_XGA, H_XGA, ov2640_xga_regs), + OV2640_SIZE("SXGA", W_SXGA, H_SXGA, ov2640_sxga_regs), + OV2640_SIZE("UXGA", W_UXGA, H_UXGA, ov2640_uxga_regs), +}; + +/* + * Register settings for pixel formats + */ +static const struct regval_list ov2640_format_change_preamble_regs[] = { + { BANK_SEL, BANK_SEL_DSP }, + { R_BYPASS, R_BYPASS_USE_DSP }, + ENDMARKER, +}; + +static const struct regval_list ov2640_yuv422_regs[] = { + { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_YUV422 }, + { 0xD7, 0x01 }, + { 0x33, 0xa0 }, + { 0xe1, 0x67 }, + { RESET, 0x00 }, + { R_BYPASS, R_BYPASS_USE_DSP }, + ENDMARKER, +}; + +static const struct regval_list ov2640_rgb565_regs[] = { + { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_RGB565 }, + { 0xd7, 0x03 }, + { RESET, 0x00 }, + { R_BYPASS, R_BYPASS_USE_DSP }, + ENDMARKER, +}; + +static enum v4l2_mbus_pixelcode ov2640_codes[] = { + V4L2_MBUS_FMT_UYVY8_2X8, + V4L2_MBUS_FMT_RGB565_2X8_LE, +}; + +/* + * Supported controls + */ +static const struct v4l2_queryctrl ov2640_controls[] = { + { + .id = V4L2_CID_VFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Flip Vertically", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, { + .id = V4L2_CID_HFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Flip Horizontally", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, +}; + +/* + * General functions + */ +static struct ov2640_priv *to_ov2640(const struct i2c_client *client) +{ + return container_of(i2c_get_clientdata(client), struct ov2640_priv, + subdev); +} + +static int ov2640_write_array(struct i2c_client *client, + const struct regval_list *vals) +{ + int ret; + + while ((vals->reg_num != 0xff) || (vals->value != 0xff)) { + ret = i2c_smbus_write_byte_data(client, + vals->reg_num, vals->value); + dev_vdbg(&client->dev, "array: 0x%02x, 0x%02x", + vals->reg_num, vals->value); + + if (ret < 0) + return ret; + vals++; + } + return 0; +} + +static int ov2640_mask_set(struct i2c_client *client, + u8 reg, u8 mask, u8 set) +{ + s32 val = i2c_smbus_read_byte_data(client, reg); + if (val < 0) + return val; + + val &= ~mask; + val |= set & mask; + + dev_vdbg(&client->dev, "masks: 0x%02x, 0x%02x", reg, val); + + return i2c_smbus_write_byte_data(client, reg, val); +} + +static int ov2640_reset(struct i2c_client *client) +{ + int ret; + const struct regval_list reset_seq[] = { + {BANK_SEL, BANK_SEL_SENS}, + {COM7, COM7_SRST}, + ENDMARKER, + }; + + ret = ov2640_write_array(client, reset_seq); + if (ret) + goto err; + + msleep(5); +err: + dev_dbg(&client->dev, "%s: (ret %d)", __func__, ret); + return ret; +} + +/* + * soc_camera_ops functions + */ +static int ov2640_s_stream(struct v4l2_subdev *sd, int enable) +{ + return 0; +} + +static int ov2640_set_bus_param(struct soc_camera_device *icd, + unsigned long flags) +{ + struct soc_camera_link *icl = to_soc_camera_link(icd); + unsigned long width_flag = flags & SOCAM_DATAWIDTH_MASK; + + /* Only one width bit may be set */ + if (!is_power_of_2(width_flag)) + return -EINVAL; + + if (icl->set_bus_param) + return icl->set_bus_param(icl, width_flag); + + /* + * Without board specific bus width settings we support only the + * sensors native bus width witch are tested working + */ + if (width_flag & (SOCAM_DATAWIDTH_10 | SOCAM_DATAWIDTH_8)) + return 0; + + return 0; +} + +static unsigned long ov2640_query_bus_param(struct soc_camera_device *icd) +{ + struct soc_camera_link *icl = to_soc_camera_link(icd); + unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER | + SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH | + SOCAM_DATA_ACTIVE_HIGH; + + if (icl->query_bus_param) + flags |= icl->query_bus_param(icl) & SOCAM_DATAWIDTH_MASK; + else + flags |= SOCAM_DATAWIDTH_10; + + return soc_camera_apply_sensor_flags(icl, flags); +} + +static int ov2640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + + switch (ctrl->id) { + case V4L2_CID_VFLIP: + ctrl->value = priv->flag_vflip; + break; + case V4L2_CID_HFLIP: + ctrl->value = priv->flag_hflip; + break; + } + return 0; +} + +static int ov2640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + int ret = 0; + u8 val; + + switch (ctrl->id) { + case V4L2_CID_VFLIP: + val = ctrl->value ? REG04_VFLIP_IMG : 0x00; + priv->flag_vflip = ctrl->value ? 1 : 0; + ret = ov2640_mask_set(client, REG04, REG04_VFLIP_IMG, val); + break; + case V4L2_CID_HFLIP: + val = ctrl->value ? REG04_HFLIP_IMG : 0x00; + priv->flag_hflip = ctrl->value ? 1 : 0; + ret = ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val); + break; + } + + return ret; +} + +static int ov2640_g_chip_ident(struct v4l2_subdev *sd, + struct v4l2_dbg_chip_ident *id) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + + id->ident = priv->model; + id->revision = 0; + + return 0; +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int ov2640_g_register(struct v4l2_subdev *sd, + struct v4l2_dbg_register *reg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret; + + reg->size = 1; + if (reg->reg > 0xff) + return -EINVAL; + + ret = i2c_smbus_read_byte_data(client, reg->reg); + if (ret < 0) + return ret; + + reg->val = ret; + + return 0; +} + +static int ov2640_s_register(struct v4l2_subdev *sd, + struct v4l2_dbg_register *reg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + + if (reg->reg > 0xff || + reg->val > 0xff) + return -EINVAL; + + return i2c_smbus_write_byte_data(client, reg->reg, reg->val); +} +#endif + +/* Select the nearest higher resolution for capture */ +static const struct ov2640_win_size *ov2640_select_win(u32 *width, u32 *height) +{ + int i, default_size = ARRAY_SIZE(ov2640_supported_win_sizes) - 1; + + for (i = 0; i < ARRAY_SIZE(ov2640_supported_win_sizes); i++) { + if (ov2640_supported_win_sizes[i].width >= *width && + ov2640_supported_win_sizes[i].height >= *height) { + *width = ov2640_supported_win_sizes[i].width; + *height = ov2640_supported_win_sizes[i].height; + return &ov2640_supported_win_sizes[i]; + } + } + + *width = ov2640_supported_win_sizes[default_size].width; + *height = ov2640_supported_win_sizes[default_size].height; + return &ov2640_supported_win_sizes[default_size]; +} + +static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 *height, + enum v4l2_mbus_pixelcode code) +{ + struct ov2640_priv *priv = to_ov2640(client); + const struct regval_list *selected_cfmt_regs; + int ret; + + /* select win */ + priv->win = ov2640_select_win(width, height); + + /* select format */ + priv->cfmt_code = 0; + switch (code) { + case V4L2_MBUS_FMT_RGB565_2X8_LE: + dev_dbg(&client->dev, "%s: Selected cfmt RGB565", __func__); + selected_cfmt_regs = ov2640_rgb565_regs; + break; + default: + case V4L2_MBUS_FMT_UYVY8_2X8: + dev_dbg(&client->dev, "%s: Selected cfmt YUV422", __func__); + selected_cfmt_regs = ov2640_yuv422_regs; + } + + /* reset hardware */ + ov2640_reset(client); + + /* initialize the sensor with default data */ + dev_dbg(&client->dev, "%s: Init default", __func__); + ret = ov2640_write_array(client, ov2640_init_regs); + if (ret < 0) + goto err; + + /* select preamble */ + dev_dbg(&client->dev, "%s: Set size to %s", __func__, priv->win->name); + ret = ov2640_write_array(client, ov2640_size_change_preamble_regs); + if (ret < 0) + goto err; + + /* set size win */ + ret = ov2640_write_array(client, priv->win->regs); + if (ret < 0) + goto err; + + /* cfmt preamble */ + dev_dbg(&client->dev, "%s: Set cfmt", __func__); + ret = ov2640_write_array(client, ov2640_format_change_preamble_regs); + if (ret < 0) + goto err; + + /* set cfmt */ + ret = ov2640_write_array(client, selected_cfmt_regs); + if (ret < 0) + goto err; + + priv->cfmt_code = code; + *width = priv->win->width; + *height = priv->win->height; + + return 0; + +err: + dev_err(&client->dev, "%s: Error %d", __func__, ret); + ov2640_reset(client); + priv->win = NULL; + + return ret; +} + +static int ov2640_g_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *mf) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + + if (!priv->win) { + u32 width = W_SVGA, height = H_SVGA; + int ret = ov2640_set_params(client, &width, &height, + V4L2_MBUS_FMT_UYVY8_2X8); + if (ret < 0) + return ret; + } + + mf->width = priv->win->width; + mf->height = priv->win->height; + mf->code = priv->cfmt_code; + + switch (mf->code) { + case V4L2_MBUS_FMT_RGB565_2X8_LE: + mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + default: + case V4L2_MBUS_FMT_UYVY8_2X8: + mf->colorspace = V4L2_COLORSPACE_JPEG; + } + mf->field = V4L2_FIELD_NONE; + + return 0; +} + +static int ov2640_s_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *mf) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret; + + + switch (mf->code) { + case V4L2_MBUS_FMT_RGB565_2X8_LE: + mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + default: + mf->code = V4L2_MBUS_FMT_UYVY8_2X8; + case V4L2_MBUS_FMT_UYVY8_2X8: + mf->colorspace = V4L2_COLORSPACE_JPEG; + } + + ret = ov2640_set_params(client, &mf->width, &mf->height, mf->code); + + return ret; +} + +static int ov2640_try_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *mf) +{ + const struct ov2640_win_size *win; + + /* + * select suitable win + */ + win = ov2640_select_win(&mf->width, &mf->height); + + mf->field = V4L2_FIELD_NONE; + + switch (mf->code) { + case V4L2_MBUS_FMT_RGB565_2X8_LE: + mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + default: + mf->code = V4L2_MBUS_FMT_UYVY8_2X8; + case V4L2_MBUS_FMT_UYVY8_2X8: + mf->colorspace = V4L2_COLORSPACE_JPEG; + } + + return 0; +} + +static int ov2640_enum_fmt(struct v4l2_subdev *sd, unsigned int index, + enum v4l2_mbus_pixelcode *code) +{ + if (index >= ARRAY_SIZE(ov2640_codes)) + return -EINVAL; + + *code = ov2640_codes[index]; + return 0; +} + +static int ov2640_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +{ + a->c.left = 0; + a->c.top = 0; + a->c.width = W_UXGA; + a->c.height = H_UXGA; + a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + return 0; +} + +static int ov2640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +{ + a->bounds.left = 0; + a->bounds.top = 0; + a->bounds.width = W_UXGA; + a->bounds.height = H_UXGA; + a->defrect = a->bounds; + a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + a->pixelaspect.numerator = 1; + a->pixelaspect.denominator = 1; + + return 0; +} + +static int ov2640_video_probe(struct soc_camera_device *icd, + struct i2c_client *client) +{ + struct ov2640_priv *priv = to_ov2640(client); + u8 pid, ver, midh, midl; + const char *devname; + int ret; + + /* + * we must have a parent by now. And it cannot be a wrong one. + * So this entire test is completely redundant. + */ + if (!icd->dev.parent || + to_soc_camera_host(icd->dev.parent)->nr != icd->iface) { + dev_err(&client->dev, "Parent missing or invalid!\n"); + ret = -ENODEV; + goto err; + } + + /* + * check and show product ID and manufacturer ID + */ + i2c_smbus_write_byte_data(client, BANK_SEL, BANK_SEL_SENS); + pid = i2c_smbus_read_byte_data(client, PID); + ver = i2c_smbus_read_byte_data(client, VER); + midh = i2c_smbus_read_byte_data(client, MIDH); + midl = i2c_smbus_read_byte_data(client, MIDL); + + switch (VERSION(pid, ver)) { + case PID_OV2640: + devname = "ov2640"; + priv->model = V4L2_IDENT_OV2640; + break; + default: + dev_err(&client->dev, + "Product ID error %x:%x\n", pid, ver); + ret = -ENODEV; + goto err; + } + + dev_info(&client->dev, + "%s Product ID %0x:%0x Manufacturer ID %x:%x\n", + devname, pid, ver, midh, midl); + + return 0; + +err: + return ret; +} + +static struct soc_camera_ops ov2640_ops = { + .set_bus_param = ov2640_set_bus_param, + .query_bus_param = ov2640_query_bus_param, + .controls = ov2640_controls, + .num_controls = ARRAY_SIZE(ov2640_controls), +}; + +static struct v4l2_subdev_core_ops ov2640_subdev_core_ops = { + .g_ctrl = ov2640_g_ctrl, + .s_ctrl = ov2640_s_ctrl, + .g_chip_ident = ov2640_g_chip_ident, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .g_register = ov2640_g_register, + .s_register = ov2640_s_register, +#endif +}; + +static struct v4l2_subdev_video_ops ov2640_subdev_video_ops = { + .s_stream = ov2640_s_stream, + .g_mbus_fmt = ov2640_g_fmt, + .s_mbus_fmt = ov2640_s_fmt, + .try_mbus_fmt = ov2640_try_fmt, + .cropcap = ov2640_cropcap, + .g_crop = ov2640_g_crop, + .enum_mbus_fmt = ov2640_enum_fmt, +}; + +static struct v4l2_subdev_ops ov2640_subdev_ops = { + .core = &ov2640_subdev_core_ops, + .video = &ov2640_subdev_video_ops, +}; + +/* + * i2c_driver functions + */ +static int ov2640_probe(struct i2c_client *client, + const struct i2c_device_id *did) +{ + struct ov2640_priv *priv; + struct soc_camera_device *icd = client->dev.platform_data; + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + struct soc_camera_link *icl; + int ret; + + if (!icd) { + dev_err(&adapter->dev, "OV2640: missing soc-camera data!\n"); + return -EINVAL; + } + + icl = to_soc_camera_link(icd); + if (!icl) { + dev_err(&adapter->dev, + "OV2640: Missing platform_data for driver\n"); + return -EINVAL; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_err(&adapter->dev, + "OV2640: I2C-Adapter doesn't support SMBUS\n"); + return -EIO; + } + + priv = kzalloc(sizeof(struct ov2640_priv), GFP_KERNEL); + if (!priv) { + dev_err(&adapter->dev, + "Failed to allocate memory for private data!\n"); + return -ENOMEM; + } + + priv->info = icl->priv; + + v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); + + icd->ops = &ov2640_ops; + + ret = ov2640_video_probe(icd, client); + if (ret) { + icd->ops = NULL; + kfree(priv); + } else { + dev_info(&adapter->dev, "OV2640 Probed\n"); + } + + return ret; +} + +static int ov2640_remove(struct i2c_client *client) +{ + struct ov2640_priv *priv = to_ov2640(client); + struct soc_camera_device *icd = client->dev.platform_data; + + icd->ops = NULL; + kfree(priv); + return 0; +} + +static const struct i2c_device_id ov2640_id[] = { + { "ov2640", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ov2640_id); + +static struct i2c_driver ov2640_i2c_driver = { + .driver = { + .name = "ov2640", + }, + .probe = ov2640_probe, + .remove = ov2640_remove, + .id_table = ov2640_id, +}; + +/* + * Module functions + */ +static int __init ov2640_module_init(void) +{ + return i2c_add_driver(&ov2640_i2c_driver); +} + +static void __exit ov2640_module_exit(void) +{ + i2c_del_driver(&ov2640_i2c_driver); +} + +module_init(ov2640_module_init); +module_exit(ov2640_module_exit); + +MODULE_DESCRIPTION("SoC Camera driver for Omni Vision 2640 sensor"); +MODULE_AUTHOR("Alberto Panizzo"); +MODULE_LICENSE("GPL v2"); diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 51e89f2267b8..44fe44ec9ea7 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -74,6 +74,7 @@ enum { V4L2_IDENT_SOI968 = 256, V4L2_IDENT_OV9640 = 257, V4L2_IDENT_OV6650 = 258, + V4L2_IDENT_OV2640 = 259, /* module saa7146: reserved range 300-309 */ V4L2_IDENT_SAA7146 = 300, -- cgit v1.2.3 From 96e442c1b2ef2ba9476e5da2607ba666ce09664d Mon Sep 17 00:00:00 2001 From: Alberto Panizzo Date: Thu, 2 Dec 2010 07:43:37 -0300 Subject: [media] soc_camera: Add the ability to bind regulators to soc_camedra devices In certain machines, camera devices are supplied directly by a number of regulators. This patch add the ability to drive these regulators directly by the soc_camera driver. Signed-off-by: Alberto Panizzo Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/soc_camera.c | 86 ++++++++++++++++++++++++++++++---------- include/media/soc_camera.h | 5 +++ 2 files changed, 70 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index aba4ce92a86b..a66811b43710 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,51 @@ static LIST_HEAD(hosts); static LIST_HEAD(devices); static DEFINE_MUTEX(list_lock); /* Protects the list of hosts */ +static int soc_camera_power_set(struct soc_camera_device *icd, + struct soc_camera_link *icl, + int power_on) +{ + int ret; + + if (power_on) { + ret = regulator_bulk_enable(icl->num_regulators, + icl->regulators); + if (ret < 0) { + dev_err(&icd->dev, "Cannot enable regulators\n"); + return ret; + } + + if (icl->power) + ret = icl->power(icd->pdev, power_on); + if (ret < 0) { + dev_err(&icd->dev, + "Platform failed to power-on the camera.\n"); + + regulator_bulk_disable(icl->num_regulators, + icl->regulators); + return ret; + } + } else { + ret = 0; + if (icl->power) + ret = icl->power(icd->pdev, 0); + if (ret < 0) { + dev_err(&icd->dev, + "Platform failed to power-off the camera.\n"); + return ret; + } + + ret = regulator_bulk_disable(icl->num_regulators, + icl->regulators); + if (ret < 0) { + dev_err(&icd->dev, "Cannot disable regulators\n"); + return ret; + } + } + + return 0; +} + const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( struct soc_camera_device *icd, unsigned int fourcc) { @@ -369,11 +415,9 @@ static int soc_camera_open(struct file *file) }, }; - if (icl->power) { - ret = icl->power(icd->pdev, 1); - if (ret < 0) - goto epower; - } + ret = soc_camera_power_set(icd, icl, 1); + if (ret < 0) + goto epower; /* The camera could have been already on, try to reset */ if (icl->reset) @@ -417,8 +461,7 @@ esfmt: eresume: ici->ops->remove(icd); eiciadd: - if (icl->power) - icl->power(icd->pdev, 0); + soc_camera_power_set(icd, icl, 0); epower: icd->use_count--; module_put(ici->ops->owner); @@ -440,8 +483,7 @@ static int soc_camera_close(struct file *file) ici->ops->remove(icd); - if (icl->power) - icl->power(icd->pdev, 0); + soc_camera_power_set(icd, icl, 0); } if (icd->streamer == file) @@ -908,14 +950,14 @@ static int soc_camera_probe(struct device *dev) dev_info(dev, "Probing %s\n", dev_name(dev)); - if (icl->power) { - ret = icl->power(icd->pdev, 1); - if (ret < 0) { - dev_err(dev, - "Platform failed to power-on the camera.\n"); - goto epower; - } - } + ret = regulator_bulk_get(icd->pdev, icl->num_regulators, + icl->regulators); + if (ret < 0) + goto ereg; + + ret = soc_camera_power_set(icd, icl, 1); + if (ret < 0) + goto epower; /* The camera could have been already on, try to reset */ if (icl->reset) @@ -994,8 +1036,7 @@ static int soc_camera_probe(struct device *dev) ici->ops->remove(icd); - if (icl->power) - icl->power(icd->pdev, 0); + soc_camera_power_set(icd, icl, 0); mutex_unlock(&icd->video_lock); @@ -1017,9 +1058,10 @@ eadddev: evdc: ici->ops->remove(icd); eadd: - if (icl->power) - icl->power(icd->pdev, 0); + soc_camera_power_set(icd, icl, 0); epower: + regulator_bulk_free(icl->num_regulators, icl->regulators); +ereg: return ret; } @@ -1052,6 +1094,8 @@ static int soc_camera_remove(struct device *dev) } soc_camera_free_user_formats(icd); + regulator_bulk_free(icl->num_regulators, icl->regulators); + return 0; } diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 86e3631764ef..9386db829fb7 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -97,6 +97,7 @@ struct soc_camera_host_ops { #define SOCAM_SENSOR_INVERT_DATA (1 << 4) struct i2c_board_info; +struct regulator_bulk_data; struct soc_camera_link { /* Camera bus id, used to match a camera and a bus */ @@ -108,6 +109,10 @@ struct soc_camera_link { const char *module_name; void *priv; + /* Optional regulators that have to be managed on power on/off events */ + struct regulator_bulk_data *regulators; + int num_regulators; + /* * For non-I2C devices platform platform has to provide methods to * add a device to the system and to remove -- cgit v1.2.3