aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2011-02-25 15:27:14 -0500
committerTony Lindgren <tony@atomide.com>2011-02-25 15:27:14 -0500
commit02fa9f0451ac639a687bfc145eefe58703ff220e (patch)
treefe984acc78f22f6eb8fb98efaba8b1ac2f3ad8d9 /drivers/media/rc
parentcbc9438075ca9dee3f39a2e7310f81c304b40359 (diff)
parent51c404b2c514930e98e81e0b9294f19892a4f871 (diff)
Merge branch 'patches_for_2.6.38rc' of git://git.pwsan.com/linux-2.6 into devel-fixes
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/ir-lirc-codec.c6
-rw-r--r--drivers/media/rc/keymaps/rc-rc6-mce.c6
-rw-r--r--drivers/media/rc/mceusb.c9
-rw-r--r--drivers/media/rc/nuvoton-cir.c6
-rw-r--r--drivers/media/rc/rc-main.c28
-rw-r--r--drivers/media/rc/streamzap.c14
6 files changed, 45 insertions, 24 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index f011c5d9dea1..1c5cc65ea1e1 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -1,4 +1,4 @@
1/* ir-lirc-codec.c - ir-core to classic lirc interface bridge 1/* ir-lirc-codec.c - rc-core to classic lirc interface bridge
2 * 2 *
3 * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> 3 * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com>
4 * 4 *
@@ -47,6 +47,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
47 /* Carrier reports */ 47 /* Carrier reports */
48 if (ev.carrier_report) { 48 if (ev.carrier_report) {
49 sample = LIRC_FREQUENCY(ev.carrier); 49 sample = LIRC_FREQUENCY(ev.carrier);
50 IR_dprintk(2, "carrier report (freq: %d)\n", sample);
50 51
51 /* Packet end */ 52 /* Packet end */
52 } else if (ev.timeout) { 53 } else if (ev.timeout) {
@@ -62,6 +63,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
62 return 0; 63 return 0;
63 64
64 sample = LIRC_TIMEOUT(ev.duration / 1000); 65 sample = LIRC_TIMEOUT(ev.duration / 1000);
66 IR_dprintk(2, "timeout report (duration: %d)\n", sample);
65 67
66 /* Normal sample */ 68 /* Normal sample */
67 } else { 69 } else {
@@ -85,6 +87,8 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
85 87
86 sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) : 88 sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) :
87 LIRC_SPACE(ev.duration / 1000); 89 LIRC_SPACE(ev.duration / 1000);
90 IR_dprintk(2, "delivering %uus %s to lirc_dev\n",
91 TO_US(ev.duration), TO_STR(ev.pulse));
88 } 92 }
89 93
90 lirc_buffer_write(dev->raw->lirc.drv->rbuf, 94 lirc_buffer_write(dev->raw->lirc.drv->rbuf,
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c
index 3bf3337875d1..2f5dc0622b94 100644
--- a/drivers/media/rc/keymaps/rc-rc6-mce.c
+++ b/drivers/media/rc/keymaps/rc-rc6-mce.c
@@ -3,6 +3,9 @@
3 * 3 *
4 * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> 4 * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com>
5 * 5 *
6 * See http://mediacenterguides.com/book/export/html/31 for details on
7 * key mappings.
8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
@@ -60,6 +63,9 @@ static struct rc_map_table rc6_mce[] = {
60 { 0x800f0426, KEY_EPG }, /* Guide */ 63 { 0x800f0426, KEY_EPG }, /* Guide */
61 { 0x800f0427, KEY_ZOOM }, /* Aspect */ 64 { 0x800f0427, KEY_ZOOM }, /* Aspect */
62 65
66 { 0x800f0432, KEY_MODE }, /* Visualization */
67 { 0x800f0433, KEY_PRESENTATION }, /* Slide Show */
68 { 0x800f0434, KEY_EJECTCD },
63 { 0x800f043a, KEY_BRIGHTNESSUP }, 69 { 0x800f043a, KEY_BRIGHTNESSUP },
64 70
65 { 0x800f0446, KEY_TV }, 71 { 0x800f0446, KEY_TV },
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 079353e5d558..6df0a4980645 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -816,7 +816,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
816 switch (ir->buf_in[index]) { 816 switch (ir->buf_in[index]) {
817 /* 2-byte return value commands */ 817 /* 2-byte return value commands */
818 case MCE_CMD_S_TIMEOUT: 818 case MCE_CMD_S_TIMEOUT:
819 ir->rc->timeout = MS_TO_NS((hi << 8 | lo) / 2); 819 ir->rc->timeout = US_TO_NS((hi << 8 | lo) / 2);
820 break; 820 break;
821 821
822 /* 1-byte return value commands */ 822 /* 1-byte return value commands */
@@ -855,9 +855,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
855 break; 855 break;
856 case PARSE_IRDATA: 856 case PARSE_IRDATA:
857 ir->rem--; 857 ir->rem--;
858 init_ir_raw_event(&rawir);
858 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); 859 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0);
859 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 860 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
860 * MS_TO_US(MCE_TIME_UNIT); 861 * US_TO_NS(MCE_TIME_UNIT);
861 862
862 dev_dbg(ir->dev, "Storing %s with duration %d\n", 863 dev_dbg(ir->dev, "Storing %s with duration %d\n",
863 rawir.pulse ? "pulse" : "space", 864 rawir.pulse ? "pulse" : "space",
@@ -883,6 +884,8 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
883 i, ir->rem + 1, false); 884 i, ir->rem + 1, false);
884 if (ir->rem) 885 if (ir->rem)
885 ir->parser_state = PARSE_IRDATA; 886 ir->parser_state = PARSE_IRDATA;
887 else
888 ir_raw_event_reset(ir->rc);
886 break; 889 break;
887 } 890 }
888 891
@@ -1060,7 +1063,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1060 rc->priv = ir; 1063 rc->priv = ir;
1061 rc->driver_type = RC_DRIVER_IR_RAW; 1064 rc->driver_type = RC_DRIVER_IR_RAW;
1062 rc->allowed_protos = RC_TYPE_ALL; 1065 rc->allowed_protos = RC_TYPE_ALL;
1063 rc->timeout = MS_TO_NS(1000); 1066 rc->timeout = US_TO_NS(1000);
1064 if (!ir->flags.no_tx) { 1067 if (!ir->flags.no_tx) {
1065 rc->s_tx_mask = mceusb_set_tx_mask; 1068 rc->s_tx_mask = mceusb_set_tx_mask;
1066 rc->s_tx_carrier = mceusb_set_tx_carrier; 1069 rc->s_tx_carrier = mceusb_set_tx_carrier;
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index dd4caf8ef80b..273d9d674792 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -460,7 +460,7 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt)
460 return 0; 460 return 0;
461 } 461 }
462 462
463 carrier = (count * 1000000) / duration; 463 carrier = MS_TO_NS(count) / duration;
464 464
465 if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) 465 if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER))
466 nvt_dbg("WTF? Carrier frequency out of range!"); 466 nvt_dbg("WTF? Carrier frequency out of range!");
@@ -612,8 +612,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
612 sample = nvt->buf[i]; 612 sample = nvt->buf[i];
613 613
614 rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); 614 rawir.pulse = ((sample & BUF_PULSE_BIT) != 0);
615 rawir.duration = (sample & BUF_LEN_MASK) 615 rawir.duration = US_TO_NS((sample & BUF_LEN_MASK)
616 * SAMPLE_PERIOD * 1000; 616 * SAMPLE_PERIOD);
617 617
618 if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { 618 if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) {
619 if (nvt->rawir.pulse == rawir.pulse) 619 if (nvt->rawir.pulse == rawir.pulse)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 72be8a02118c..512a2f4ada0e 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -458,21 +458,27 @@ static int ir_getkeycode(struct input_dev *idev,
458 index = ir_lookup_by_scancode(rc_map, scancode); 458 index = ir_lookup_by_scancode(rc_map, scancode);
459 } 459 }
460 460
461 if (index >= rc_map->len) { 461 if (index < rc_map->len) {
462 if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) 462 entry = &rc_map->scan[index];
463 IR_dprintk(1, "unknown key for scancode 0x%04x\n", 463
464 scancode); 464 ke->index = index;
465 ke->keycode = entry->keycode;
466 ke->len = sizeof(entry->scancode);
467 memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));
468
469 } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) {
470 /*
471 * We do not really know the valid range of scancodes
472 * so let's respond with KEY_RESERVED to anything we
473 * do not have mapping for [yet].
474 */
475 ke->index = index;
476 ke->keycode = KEY_RESERVED;
477 } else {
465 retval = -EINVAL; 478 retval = -EINVAL;
466 goto out; 479 goto out;
467 } 480 }
468 481
469 entry = &rc_map->scan[index];
470
471 ke->index = index;
472 ke->keycode = entry->keycode;
473 ke->len = sizeof(entry->scancode);
474 memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));
475
476 retval = 0; 482 retval = 0;
477 483
478out: 484out:
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index 6e2911c2abfb..e435d94c0776 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -164,7 +164,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
164 sz->signal_start.tv_usec - 164 sz->signal_start.tv_usec -
165 sz->signal_last.tv_usec); 165 sz->signal_last.tv_usec);
166 rawir.duration -= sz->sum; 166 rawir.duration -= sz->sum;
167 rawir.duration *= 1000; 167 rawir.duration = US_TO_NS(rawir.duration);
168 rawir.duration &= IR_MAX_DURATION; 168 rawir.duration &= IR_MAX_DURATION;
169 } 169 }
170 sz_push(sz, rawir); 170 sz_push(sz, rawir);
@@ -177,7 +177,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
177 rawir.duration = ((int) value) * SZ_RESOLUTION; 177 rawir.duration = ((int) value) * SZ_RESOLUTION;
178 rawir.duration += SZ_RESOLUTION / 2; 178 rawir.duration += SZ_RESOLUTION / 2;
179 sz->sum += rawir.duration; 179 sz->sum += rawir.duration;
180 rawir.duration *= 1000; 180 rawir.duration = US_TO_NS(rawir.duration);
181 rawir.duration &= IR_MAX_DURATION; 181 rawir.duration &= IR_MAX_DURATION;
182 sz_push(sz, rawir); 182 sz_push(sz, rawir);
183} 183}
@@ -197,7 +197,7 @@ static void sz_push_full_space(struct streamzap_ir *sz,
197 rawir.duration = ((int) value) * SZ_RESOLUTION; 197 rawir.duration = ((int) value) * SZ_RESOLUTION;
198 rawir.duration += SZ_RESOLUTION / 2; 198 rawir.duration += SZ_RESOLUTION / 2;
199 sz->sum += rawir.duration; 199 sz->sum += rawir.duration;
200 rawir.duration *= 1000; 200 rawir.duration = US_TO_NS(rawir.duration);
201 sz_push(sz, rawir); 201 sz_push(sz, rawir);
202} 202}
203 203
@@ -273,6 +273,7 @@ static void streamzap_callback(struct urb *urb)
273 if (sz->timeout_enabled) 273 if (sz->timeout_enabled)
274 sz_push(sz, rawir); 274 sz_push(sz, rawir);
275 ir_raw_event_handle(sz->rdev); 275 ir_raw_event_handle(sz->rdev);
276 ir_raw_event_reset(sz->rdev);
276 } else { 277 } else {
277 sz_push_full_space(sz, sz->buf_in[i]); 278 sz_push_full_space(sz, sz->buf_in[i]);
278 } 279 }
@@ -290,6 +291,7 @@ static void streamzap_callback(struct urb *urb)
290 } 291 }
291 } 292 }
292 293
294 ir_raw_event_handle(sz->rdev);
293 usb_submit_urb(urb, GFP_ATOMIC); 295 usb_submit_urb(urb, GFP_ATOMIC);
294 296
295 return; 297 return;
@@ -430,13 +432,13 @@ static int __devinit streamzap_probe(struct usb_interface *intf,
430 sz->decoder_state = PulseSpace; 432 sz->decoder_state = PulseSpace;
431 /* FIXME: don't yet have a way to set this */ 433 /* FIXME: don't yet have a way to set this */
432 sz->timeout_enabled = true; 434 sz->timeout_enabled = true;
433 sz->rdev->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & 435 sz->rdev->timeout = ((US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION) &
434 IR_MAX_DURATION) | 0x03000000); 436 IR_MAX_DURATION) | 0x03000000);
435 #if 0 437 #if 0
436 /* not yet supported, depends on patches from maxim */ 438 /* not yet supported, depends on patches from maxim */
437 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ 439 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */
438 sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; 440 sz->min_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION);
439 sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; 441 sz->max_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION);
440 #endif 442 #endif
441 443
442 do_gettimeofday(&sz->signal_start); 444 do_gettimeofday(&sz->signal_start);