aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-04 12:50:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-04 12:50:07 -0400
commit3c83e61e67256e0bb08c46cc2db43b58fd617251 (patch)
tree0233e1e04e6449c60b01ff5dea8bea85bcf22f08 /drivers/media/rc
parent4a4389abdd9822fdf3cc2ac6ed87eb811fd43acc (diff)
parenta83b93a7480441a47856dc9104bea970e84cda87 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: "The main set of series of patches for media subsystem, including: - document RC sysfs class - added an API to setup scancode to allow waking up systems using the Remote Controller - add API for SDR devices. Drivers are still on staging - some API improvements for getting EDID data from media inputs/outputs - new DVB frontend driver for drx-j (ATSC) - one driver (it913x/it9137) got removed, in favor of an improvement on another driver (af9035) - added a skeleton V4L2 PCI driver at documentation - added a dual flash driver (lm3646) - added a new IR driver (img-ir) - added an IR scancode decoder for the Sharp protocol - some improvements at the usbtv driver, to allow its core to be reused. - added a new SDR driver (rtl2832u_sdr) - added a new tuner driver (msi001) - several improvements at em28xx driver to fix PM support, device removal and to split the V4L2 specific bits into a separate sub-driver - one driver got converted to videobuf2 (s2255drv) - the e4000 tuner driver now follows an improved binding model - some fixes at V4L2 compat32 code - several fixes and enhancements at videobuf2 code - some cleanups at V4L2 API documentation - usual driver enhancements, new board additions and misc fixups" [ NOTE! This merge effective drops commit 4329b93b283c ("of: Reduce indentation in of_graph_get_next_endpoint"). The of_graph_get_next_endpoint() function was moved and renamed by commit fd9fdb78a9bf ("[media] of: move graph helpers from drivers/media/v4l2-core to drivers/of"). It was originally called v4l2_of_get_next_endpoint() and lived in the file drivers/media/v4l2-core/v4l2-of.c. In that original location, it was then fixed to support empty port nodes by commit b9db140c1e46 ("[media] v4l: of: Support empty port nodes"), and that commit clashes badly with the dropped "Reduce intendation" commit. I had to choose one or the other, and decided that the "Support empty port nodes" commit was more important ] * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (426 commits) [media] em28xx-dvb: fix PCTV 461e tuner I2C binding Revert "[media] em28xx-dvb: fix PCTV 461e tuner I2C binding" [media] em28xx: fix PCTV 290e LNA oops [media] em28xx-dvb: fix PCTV 461e tuner I2C binding [media] m88ds3103: fix bug on .set_tone() [media] saa7134: fix WARN_ON during resume [media] v4l2-dv-timings: add module name, description, license [media] videodev2.h: add parenthesis around macro arguments [media] saa6752hs: depends on CRC32 [media] si4713: fix Kconfig dependencies [media] Sensoray 2255 uses videobuf2 [media] adv7180: free an interrupt on failure paths in init_device() [media] e4000: make VIDEO_V4L2 dependency optional [media] af9033: Don't export functions for the hardware filter [media] af9035: use af9033 PID filters [media] af9033: implement PID filter [media] rtl2832_sdr: do not use dynamic stack allocation [media] e4000: fix 32-bit build error [media] em28xx-audio: make sure audio is unmuted on open() [media] DocBook media: v4l2_format_sdr was renamed to v4l2_sdr_format ...
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/Kconfig11
-rw-r--r--drivers/media/rc/Makefile2
-rw-r--r--drivers/media/rc/ati_remote.c2
-rw-r--r--drivers/media/rc/ene_ir.c2
-rw-r--r--drivers/media/rc/fintek-cir.c2
-rw-r--r--drivers/media/rc/gpio-ir-recv.c4
-rw-r--r--drivers/media/rc/iguanair.c31
-rw-r--r--drivers/media/rc/img-ir/Kconfig61
-rw-r--r--drivers/media/rc/img-ir/Makefile11
-rw-r--r--drivers/media/rc/img-ir/img-ir-core.c176
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.c1053
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.h269
-rw-r--r--drivers/media/rc/img-ir/img-ir-jvc.c81
-rw-r--r--drivers/media/rc/img-ir/img-ir-nec.c148
-rw-r--r--drivers/media/rc/img-ir/img-ir-raw.c151
-rw-r--r--drivers/media/rc/img-ir/img-ir-raw.h60
-rw-r--r--drivers/media/rc/img-ir/img-ir-sanyo.c122
-rw-r--r--drivers/media/rc/img-ir/img-ir-sharp.c99
-rw-r--r--drivers/media/rc/img-ir/img-ir-sony.c145
-rw-r--r--drivers/media/rc/img-ir/img-ir.h166
-rw-r--r--drivers/media/rc/imon.c7
-rw-r--r--drivers/media/rc/ir-jvc-decoder.c2
-rw-r--r--drivers/media/rc/ir-lirc-codec.c2
-rw-r--r--drivers/media/rc/ir-mce_kbd-decoder.c2
-rw-r--r--drivers/media/rc/ir-nec-decoder.c11
-rw-r--r--drivers/media/rc/ir-raw.c5
-rw-r--r--drivers/media/rc/ir-rc5-decoder.c10
-rw-r--r--drivers/media/rc/ir-rc5-sz-decoder.c4
-rw-r--r--drivers/media/rc/ir-rc6-decoder.c6
-rw-r--r--drivers/media/rc/ir-sanyo-decoder.c6
-rw-r--r--drivers/media/rc/ir-sharp-decoder.c200
-rw-r--r--drivers/media/rc/ir-sony-decoder.c10
-rw-r--r--drivers/media/rc/ite-cir.c2
-rw-r--r--drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c4
-rw-r--r--drivers/media/rc/keymaps/rc-apac-viewcomp.c4
-rw-r--r--drivers/media/rc/keymaps/rc-asus-pc39.c4
-rw-r--r--drivers/media/rc/keymaps/rc-asus-ps3-100.c4
-rw-r--r--drivers/media/rc/keymaps/rc-ati-tv-wonder-hd-600.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-a16d.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-cardbus.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-dvbt.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-m135a.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c2
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avertv-303.c4
-rw-r--r--drivers/media/rc/keymaps/rc-behold-columbus.c4
-rw-r--r--drivers/media/rc/keymaps/rc-behold.c4
-rw-r--r--drivers/media/rc/keymaps/rc-budget-ci-old.c4
-rw-r--r--drivers/media/rc/keymaps/rc-cinergy-1400.c4
-rw-r--r--drivers/media/rc/keymaps/rc-cinergy.c4
-rw-r--r--drivers/media/rc/keymaps/rc-dib0700-nec.c4
-rw-r--r--drivers/media/rc/keymaps/rc-dib0700-rc5.c4
-rw-r--r--drivers/media/rc/keymaps/rc-dm1105-nec.c4
-rw-r--r--drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c4
-rw-r--r--drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c4
-rw-r--r--drivers/media/rc/keymaps/rc-em-terratec.c4
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv-fm53.c4
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv.c4
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv2.c4
-rw-r--r--drivers/media/rc/keymaps/rc-evga-indtube.c4
-rw-r--r--drivers/media/rc/keymaps/rc-eztv.c4
-rw-r--r--drivers/media/rc/keymaps/rc-flydvb.c4
-rw-r--r--drivers/media/rc/keymaps/rc-flyvideo.c4
-rw-r--r--drivers/media/rc/keymaps/rc-fusionhdtv-mce.c4
-rw-r--r--drivers/media/rc/keymaps/rc-gadmei-rm008z.c4
-rw-r--r--drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c4
-rw-r--r--drivers/media/rc/keymaps/rc-gotview7135.c4
-rw-r--r--drivers/media/rc/keymaps/rc-hauppauge.c4
-rw-r--r--drivers/media/rc/keymaps/rc-iodata-bctv7e.c4
-rw-r--r--drivers/media/rc/keymaps/rc-kaiomy.c4
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-315u.c4
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-pc150u.c2
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c4
-rw-r--r--drivers/media/rc/keymaps/rc-manli.c4
-rw-r--r--drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c4
-rw-r--r--drivers/media/rc/keymaps/rc-msi-tvanywhere.c4
-rw-r--r--drivers/media/rc/keymaps/rc-nebula.c4
-rw-r--r--drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c6
-rw-r--r--drivers/media/rc/keymaps/rc-norwood.c4
-rw-r--r--drivers/media/rc/keymaps/rc-npgtech.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pctv-sedna.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pinnacle-color.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pinnacle-grey.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-002t.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-mk12.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-new.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview.c4
-rw-r--r--drivers/media/rc/keymaps/rc-powercolor-real-angel.c4
-rw-r--r--drivers/media/rc/keymaps/rc-proteus-2309.c4
-rw-r--r--drivers/media/rc/keymaps/rc-purpletv.c4
-rw-r--r--drivers/media/rc/keymaps/rc-pv951.c4
-rw-r--r--drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c4
-rw-r--r--drivers/media/rc/keymaps/rc-tbs-nec.c4
-rw-r--r--drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c4
-rw-r--r--drivers/media/rc/keymaps/rc-tevii-nec.c4
-rw-r--r--drivers/media/rc/keymaps/rc-tivo.c86
-rw-r--r--drivers/media/rc/keymaps/rc-tt-1500.c4
-rw-r--r--drivers/media/rc/keymaps/rc-videomate-s350.c4
-rw-r--r--drivers/media/rc/keymaps/rc-videomate-tv-pvr.c4
-rw-r--r--drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c4
-rw-r--r--drivers/media/rc/keymaps/rc-winfast.c4
-rw-r--r--drivers/media/rc/mceusb.c184
-rw-r--r--drivers/media/rc/nuvoton-cir.c12
-rw-r--r--drivers/media/rc/nuvoton-cir.h1
-rw-r--r--drivers/media/rc/rc-core-priv.h15
-rw-r--r--drivers/media/rc/rc-loopback.c2
-rw-r--r--drivers/media/rc/rc-main.c253
-rw-r--r--drivers/media/rc/redrat3.c2
-rw-r--r--drivers/media/rc/st_rc.c2
-rw-r--r--drivers/media/rc/streamzap.c2
-rw-r--r--drivers/media/rc/ttusbir.c2
-rw-r--r--drivers/media/rc/winbond-cir.c2
113 files changed, 3327 insertions, 369 deletions
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 904f11367c29..8fbd377e6311 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -106,6 +106,15 @@ config IR_SANYO_DECODER
106 uses the Sanyo protocol (Sanyo, Aiwa, Chinon remotes), 106 uses the Sanyo protocol (Sanyo, Aiwa, Chinon remotes),
107 and you need software decoding support. 107 and you need software decoding support.
108 108
109config IR_SHARP_DECODER
110 tristate "Enable IR raw decoder for the Sharp protocol"
111 depends on RC_CORE
112 default y
113
114 ---help---
115 Enable this option if you have an infrared remote control which
116 uses the Sharp protocol, and you need software decoding support.
117
109config IR_MCE_KBD_DECODER 118config IR_MCE_KBD_DECODER
110 tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol" 119 tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol"
111 depends on RC_CORE 120 depends on RC_CORE
@@ -300,6 +309,8 @@ config IR_RX51
300 The driver uses omap DM timers for generating the carrier 309 The driver uses omap DM timers for generating the carrier
301 wave and pulses. 310 wave and pulses.
302 311
312source "drivers/media/rc/img-ir/Kconfig"
313
303config RC_LOOPBACK 314config RC_LOOPBACK
304 tristate "Remote Control Loopback Driver" 315 tristate "Remote Control Loopback Driver"
305 depends on RC_CORE 316 depends on RC_CORE
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index f4eb32c0a455..f8b54ff46601 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o
11obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o 11obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o
12obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o 12obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o
13obj-$(CONFIG_IR_SANYO_DECODER) += ir-sanyo-decoder.o 13obj-$(CONFIG_IR_SANYO_DECODER) += ir-sanyo-decoder.o
14obj-$(CONFIG_IR_SHARP_DECODER) += ir-sharp-decoder.o
14obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o 15obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o
15obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o 16obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o
16 17
@@ -31,3 +32,4 @@ obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o
31obj-$(CONFIG_IR_IGUANA) += iguanair.o 32obj-$(CONFIG_IR_IGUANA) += iguanair.o
32obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o 33obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o
33obj-$(CONFIG_RC_ST) += st_rc.o 34obj-$(CONFIG_RC_ST) += st_rc.o
35obj-$(CONFIG_IR_IMG) += img-ir/
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 4d6a63fe6c5e..2df7c5516013 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -784,7 +784,7 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote)
784 784
785 rdev->priv = ati_remote; 785 rdev->priv = ati_remote;
786 rdev->driver_type = RC_DRIVER_SCANCODE; 786 rdev->driver_type = RC_DRIVER_SCANCODE;
787 rdev->allowed_protos = RC_BIT_OTHER; 787 rc_set_allowed_protocols(rdev, RC_BIT_OTHER);
788 rdev->driver_name = "ati_remote"; 788 rdev->driver_name = "ati_remote";
789 789
790 rdev->open = ati_remote_rc_open; 790 rdev->open = ati_remote_rc_open;
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index c1444f84717d..fc9d23f2ed3f 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1059,7 +1059,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1059 learning_mode_force = false; 1059 learning_mode_force = false;
1060 1060
1061 rdev->driver_type = RC_DRIVER_IR_RAW; 1061 rdev->driver_type = RC_DRIVER_IR_RAW;
1062 rdev->allowed_protos = RC_BIT_ALL; 1062 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
1063 rdev->priv = dev; 1063 rdev->priv = dev;
1064 rdev->open = ene_open; 1064 rdev->open = ene_open;
1065 rdev->close = ene_close; 1065 rdev->close = ene_close;
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index d6fa441655d2..46b66e59438f 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -541,7 +541,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
541 /* Set up the rc device */ 541 /* Set up the rc device */
542 rdev->priv = fintek; 542 rdev->priv = fintek;
543 rdev->driver_type = RC_DRIVER_IR_RAW; 543 rdev->driver_type = RC_DRIVER_IR_RAW;
544 rdev->allowed_protos = RC_BIT_ALL; 544 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
545 rdev->open = fintek_open; 545 rdev->open = fintek_open;
546 rdev->close = fintek_close; 546 rdev->close = fintek_close;
547 rdev->input_name = FINTEK_DESCRIPTION; 547 rdev->input_name = FINTEK_DESCRIPTION;
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 80c611c2e8c2..29b5f89813b4 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -145,9 +145,9 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
145 rcdev->dev.parent = &pdev->dev; 145 rcdev->dev.parent = &pdev->dev;
146 rcdev->driver_name = GPIO_IR_DRIVER_NAME; 146 rcdev->driver_name = GPIO_IR_DRIVER_NAME;
147 if (pdata->allowed_protos) 147 if (pdata->allowed_protos)
148 rcdev->allowed_protos = pdata->allowed_protos; 148 rc_set_allowed_protocols(rcdev, pdata->allowed_protos);
149 else 149 else
150 rcdev->allowed_protos = RC_BIT_ALL; 150 rc_set_allowed_protocols(rcdev, RC_BIT_ALL);
151 rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; 151 rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
152 152
153 gpio_dev->rcdev = rcdev; 153 gpio_dev->rcdev = rcdev;
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index fdae05c4f377..627ddfd61980 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -286,10 +286,10 @@ static int iguanair_receiver(struct iguanair *ir, bool enable)
286} 286}
287 287
288/* 288/*
289 * The iguana ir creates the carrier by busy spinning after each pulse or 289 * The iguanair creates the carrier by busy spinning after each half period.
290 * space. This is counted in CPU cycles, with the CPU running at 24MHz. It is 290 * This is counted in CPU cycles, with the CPU running at 24MHz. It is
291 * broken down into 7-cycles and 4-cyles delays, with a preference for 291 * broken down into 7-cycles and 4-cyles delays, with a preference for
292 * 4-cycle delays. 292 * 4-cycle delays, minus the overhead of the loop itself (cycle_overhead).
293 */ 293 */
294static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier) 294static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier)
295{ 295{
@@ -316,7 +316,14 @@ static int iguanair_set_tx_carrier(struct rc_dev *dev, uint32_t carrier)
316 sevens = (4 - cycles) & 3; 316 sevens = (4 - cycles) & 3;
317 fours = (cycles - sevens * 7) / 4; 317 fours = (cycles - sevens * 7) / 4;
318 318
319 /* magic happens here */ 319 /*
320 * The firmware interprets these values as a relative offset
321 * for a branch. Immediately following the branches, there
322 * 4 instructions of 7 cycles (2 bytes each) and 110
323 * instructions of 4 cycles (1 byte each). A relative branch
324 * of 0 will execute all of them, branch further for less
325 * cycle burning.
326 */
320 ir->packet->busy7 = (4 - sevens) * 2; 327 ir->packet->busy7 = (4 - sevens) * 2;
321 ir->packet->busy4 = 110 - fours; 328 ir->packet->busy4 = 110 - fours;
322 } 329 }
@@ -357,20 +364,14 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, unsigned count)
357 rc = -EINVAL; 364 rc = -EINVAL;
358 goto out; 365 goto out;
359 } 366 }
360 while (periods > 127) { 367 while (periods) {
361 ir->packet->payload[size++] = 127 | space; 368 unsigned p = min(periods, 127u);
362 periods -= 127; 369 ir->packet->payload[size++] = p | space;
370 periods -= p;
363 } 371 }
364
365 ir->packet->payload[size++] = periods | space;
366 space ^= 0x80; 372 space ^= 0x80;
367 } 373 }
368 374
369 if (count == 0) {
370 rc = -EINVAL;
371 goto out;
372 }
373
374 ir->packet->header.start = 0; 375 ir->packet->header.start = 0;
375 ir->packet->header.direction = DIR_OUT; 376 ir->packet->header.direction = DIR_OUT;
376 ir->packet->header.cmd = CMD_SEND; 377 ir->packet->header.cmd = CMD_SEND;
@@ -494,7 +495,7 @@ static int iguanair_probe(struct usb_interface *intf,
494 usb_to_input_id(ir->udev, &rc->input_id); 495 usb_to_input_id(ir->udev, &rc->input_id);
495 rc->dev.parent = &intf->dev; 496 rc->dev.parent = &intf->dev;
496 rc->driver_type = RC_DRIVER_IR_RAW; 497 rc->driver_type = RC_DRIVER_IR_RAW;
497 rc->allowed_protos = RC_BIT_ALL; 498 rc_set_allowed_protocols(rc, RC_BIT_ALL);
498 rc->priv = ir; 499 rc->priv = ir;
499 rc->open = iguanair_open; 500 rc->open = iguanair_open;
500 rc->close = iguanair_close; 501 rc->close = iguanair_close;
diff --git a/drivers/media/rc/img-ir/Kconfig b/drivers/media/rc/img-ir/Kconfig
new file mode 100644
index 000000000000..03ba9fc170fb
--- /dev/null
+++ b/drivers/media/rc/img-ir/Kconfig
@@ -0,0 +1,61 @@
1config IR_IMG
2 tristate "ImgTec IR Decoder"
3 depends on RC_CORE
4 select IR_IMG_HW if !IR_IMG_RAW
5 help
6 Say Y or M here if you want to use the ImgTec infrared decoder
7 functionality found in SoCs such as TZ1090.
8
9config IR_IMG_RAW
10 bool "Raw decoder"
11 depends on IR_IMG
12 help
13 Say Y here to enable the raw mode driver which passes raw IR signal
14 changes to the IR raw decoders for software decoding. This is much
15 less reliable (due to lack of timestamps) and consumes more
16 processing power than using hardware decode, but can be useful for
17 testing, debug, and to make more protocols available.
18
19config IR_IMG_HW
20 bool "Hardware decoder"
21 depends on IR_IMG
22 help
23 Say Y here to enable the hardware decode driver which decodes the IR
24 signals in hardware. This is more reliable, consumes less processing
25 power since only a single interrupt is received for each scancode,
26 and allows an IR scancode to be used as a wake event.
27
28config IR_IMG_NEC
29 bool "NEC protocol support"
30 depends on IR_IMG_HW
31 help
32 Say Y here to enable support for the NEC, extended NEC, and 32-bit
33 NEC protocols in the ImgTec infrared decoder block.
34
35config IR_IMG_JVC
36 bool "JVC protocol support"
37 depends on IR_IMG_HW
38 help
39 Say Y here to enable support for the JVC protocol in the ImgTec
40 infrared decoder block.
41
42config IR_IMG_SONY
43 bool "Sony protocol support"
44 depends on IR_IMG_HW
45 help
46 Say Y here to enable support for the Sony protocol in the ImgTec
47 infrared decoder block.
48
49config IR_IMG_SHARP
50 bool "Sharp protocol support"
51 depends on IR_IMG_HW
52 help
53 Say Y here to enable support for the Sharp protocol in the ImgTec
54 infrared decoder block.
55
56config IR_IMG_SANYO
57 bool "Sanyo protocol support"
58 depends on IR_IMG_HW
59 help
60 Say Y here to enable support for the Sanyo protocol (used by Sanyo,
61 Aiwa, Chinon remotes) in the ImgTec infrared decoder block.
diff --git a/drivers/media/rc/img-ir/Makefile b/drivers/media/rc/img-ir/Makefile
new file mode 100644
index 000000000000..92a459d99509
--- /dev/null
+++ b/drivers/media/rc/img-ir/Makefile
@@ -0,0 +1,11 @@
1img-ir-y := img-ir-core.o
2img-ir-$(CONFIG_IR_IMG_RAW) += img-ir-raw.o
3img-ir-$(CONFIG_IR_IMG_HW) += img-ir-hw.o
4img-ir-$(CONFIG_IR_IMG_NEC) += img-ir-nec.o
5img-ir-$(CONFIG_IR_IMG_JVC) += img-ir-jvc.o
6img-ir-$(CONFIG_IR_IMG_SONY) += img-ir-sony.o
7img-ir-$(CONFIG_IR_IMG_SHARP) += img-ir-sharp.o
8img-ir-$(CONFIG_IR_IMG_SANYO) += img-ir-sanyo.o
9img-ir-objs := $(img-ir-y)
10
11obj-$(CONFIG_IR_IMG) += img-ir.o
diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
new file mode 100644
index 000000000000..6b7834834fb8
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -0,0 +1,176 @@
1/*
2 * ImgTec IR Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 *
6 * This contains core img-ir code for setting up the driver. The two interfaces
7 * (raw and hardware decode) are handled separately.
8 */
9
10#include <linux/clk.h>
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/io.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/slab.h>
17#include <linux/spinlock.h>
18#include "img-ir.h"
19
20static irqreturn_t img_ir_isr(int irq, void *dev_id)
21{
22 struct img_ir_priv *priv = dev_id;
23 u32 irq_status;
24
25 spin_lock(&priv->lock);
26 /* we have to clear irqs before reading */
27 irq_status = img_ir_read(priv, IMG_IR_IRQ_STATUS);
28 img_ir_write(priv, IMG_IR_IRQ_CLEAR, irq_status);
29
30 /* don't handle valid data irqs if we're only interested in matches */
31 irq_status &= img_ir_read(priv, IMG_IR_IRQ_ENABLE);
32
33 /* hand off edge interrupts to raw decode handler */
34 if (irq_status & IMG_IR_IRQ_EDGE && img_ir_raw_enabled(&priv->raw))
35 img_ir_isr_raw(priv, irq_status);
36
37 /* hand off hardware match interrupts to hardware decode handler */
38 if (irq_status & (IMG_IR_IRQ_DATA_MATCH |
39 IMG_IR_IRQ_DATA_VALID |
40 IMG_IR_IRQ_DATA2_VALID) &&
41 img_ir_hw_enabled(&priv->hw))
42 img_ir_isr_hw(priv, irq_status);
43
44 spin_unlock(&priv->lock);
45 return IRQ_HANDLED;
46}
47
48static void img_ir_setup(struct img_ir_priv *priv)
49{
50 /* start off with interrupts disabled */
51 img_ir_write(priv, IMG_IR_IRQ_ENABLE, 0);
52
53 img_ir_setup_raw(priv);
54 img_ir_setup_hw(priv);
55
56 if (!IS_ERR(priv->clk))
57 clk_prepare_enable(priv->clk);
58}
59
60static void img_ir_ident(struct img_ir_priv *priv)
61{
62 u32 core_rev = img_ir_read(priv, IMG_IR_CORE_REV);
63
64 dev_info(priv->dev,
65 "IMG IR Decoder (%d.%d.%d.%d) probed successfully\n",
66 (core_rev & IMG_IR_DESIGNER) >> IMG_IR_DESIGNER_SHIFT,
67 (core_rev & IMG_IR_MAJOR_REV) >> IMG_IR_MAJOR_REV_SHIFT,
68 (core_rev & IMG_IR_MINOR_REV) >> IMG_IR_MINOR_REV_SHIFT,
69 (core_rev & IMG_IR_MAINT_REV) >> IMG_IR_MAINT_REV_SHIFT);
70 dev_info(priv->dev, "Modes:%s%s\n",
71 img_ir_hw_enabled(&priv->hw) ? " hardware" : "",
72 img_ir_raw_enabled(&priv->raw) ? " raw" : "");
73}
74
75static int img_ir_probe(struct platform_device *pdev)
76{
77 struct img_ir_priv *priv;
78 struct resource *res_regs;
79 int irq, error, error2;
80
81 /* Get resources from platform device */
82 irq = platform_get_irq(pdev, 0);
83 if (irq < 0) {
84 dev_err(&pdev->dev, "cannot find IRQ resource\n");
85 return irq;
86 }
87
88 /* Private driver data */
89 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
90 if (!priv) {
91 dev_err(&pdev->dev, "cannot allocate device data\n");
92 return -ENOMEM;
93 }
94 platform_set_drvdata(pdev, priv);
95 priv->dev = &pdev->dev;
96 spin_lock_init(&priv->lock);
97
98 /* Ioremap the registers */
99 res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
100 priv->reg_base = devm_ioremap_resource(&pdev->dev, res_regs);
101 if (IS_ERR(priv->reg_base))
102 return PTR_ERR(priv->reg_base);
103
104 /* Get core clock */
105 priv->clk = devm_clk_get(&pdev->dev, "core");
106 if (IS_ERR(priv->clk))
107 dev_warn(&pdev->dev, "cannot get core clock resource\n");
108 /*
109 * The driver doesn't need to know about the system ("sys") or power
110 * modulation ("mod") clocks yet
111 */
112
113 /* Set up raw & hw decoder */
114 error = img_ir_probe_raw(priv);
115 error2 = img_ir_probe_hw(priv);
116 if (error && error2)
117 return (error == -ENODEV) ? error2 : error;
118
119 /* Get the IRQ */
120 priv->irq = irq;
121 error = request_irq(priv->irq, img_ir_isr, 0, "img-ir", priv);
122 if (error) {
123 dev_err(&pdev->dev, "cannot register IRQ %u\n",
124 priv->irq);
125 error = -EIO;
126 goto err_irq;
127 }
128
129 img_ir_ident(priv);
130 img_ir_setup(priv);
131
132 return 0;
133
134err_irq:
135 img_ir_remove_hw(priv);
136 img_ir_remove_raw(priv);
137 return error;
138}
139
140static int img_ir_remove(struct platform_device *pdev)
141{
142 struct img_ir_priv *priv = platform_get_drvdata(pdev);
143
144 free_irq(priv->irq, img_ir_isr);
145 img_ir_remove_hw(priv);
146 img_ir_remove_raw(priv);
147
148 if (!IS_ERR(priv->clk))
149 clk_disable_unprepare(priv->clk);
150 return 0;
151}
152
153static SIMPLE_DEV_PM_OPS(img_ir_pmops, img_ir_suspend, img_ir_resume);
154
155static const struct of_device_id img_ir_match[] = {
156 { .compatible = "img,ir-rev1" },
157 {}
158};
159MODULE_DEVICE_TABLE(of, img_ir_match);
160
161static struct platform_driver img_ir_driver = {
162 .driver = {
163 .name = "img-ir",
164 .owner = THIS_MODULE,
165 .of_match_table = img_ir_match,
166 .pm = &img_ir_pmops,
167 },
168 .probe = img_ir_probe,
169 .remove = img_ir_remove,
170};
171
172module_platform_driver(img_ir_driver);
173
174MODULE_AUTHOR("Imagination Technologies Ltd.");
175MODULE_DESCRIPTION("ImgTec IR");
176MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
new file mode 100644
index 000000000000..579a52b3edce
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -0,0 +1,1053 @@
1/*
2 * ImgTec IR Hardware Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 *
6 * This ties into the input subsystem using the RC-core. Protocol support is
7 * provided in separate modules which provide the parameters and scancode
8 * translation functions to set up the hardware decoder and interpret the
9 * resulting input.
10 */
11
12#include <linux/bitops.h>
13#include <linux/clk.h>
14#include <linux/interrupt.h>
15#include <linux/spinlock.h>
16#include <linux/timer.h>
17#include <media/rc-core.h>
18#include "img-ir.h"
19
20/* Decoders lock (only modified to preprocess them) */
21static DEFINE_SPINLOCK(img_ir_decoders_lock);
22
23extern struct img_ir_decoder img_ir_nec;
24extern struct img_ir_decoder img_ir_jvc;
25extern struct img_ir_decoder img_ir_sony;
26extern struct img_ir_decoder img_ir_sharp;
27extern struct img_ir_decoder img_ir_sanyo;
28
29static bool img_ir_decoders_preprocessed;
30static struct img_ir_decoder *img_ir_decoders[] = {
31#ifdef CONFIG_IR_IMG_NEC
32 &img_ir_nec,
33#endif
34#ifdef CONFIG_IR_IMG_JVC
35 &img_ir_jvc,
36#endif
37#ifdef CONFIG_IR_IMG_SONY
38 &img_ir_sony,
39#endif
40#ifdef CONFIG_IR_IMG_SHARP
41 &img_ir_sharp,
42#endif
43#ifdef CONFIG_IR_IMG_SANYO
44 &img_ir_sanyo,
45#endif
46 NULL
47};
48
49#define IMG_IR_F_FILTER BIT(RC_FILTER_NORMAL) /* enable filtering */
50#define IMG_IR_F_WAKE BIT(RC_FILTER_WAKEUP) /* enable waking */
51
52/* code type quirks */
53
54#define IMG_IR_QUIRK_CODE_BROKEN 0x1 /* Decode is broken */
55#define IMG_IR_QUIRK_CODE_LEN_INCR 0x2 /* Bit length needs increment */
56
57/* functions for preprocessing timings, ensuring max is set */
58
59static void img_ir_timing_preprocess(struct img_ir_timing_range *range,
60 unsigned int unit)
61{
62 if (range->max < range->min)
63 range->max = range->min;
64 if (unit) {
65 /* multiply by unit and convert to microseconds */
66 range->min = (range->min*unit)/1000;
67 range->max = (range->max*unit + 999)/1000; /* round up */
68 }
69}
70
71static void img_ir_symbol_timing_preprocess(struct img_ir_symbol_timing *timing,
72 unsigned int unit)
73{
74 img_ir_timing_preprocess(&timing->pulse, unit);
75 img_ir_timing_preprocess(&timing->space, unit);
76}
77
78static void img_ir_timings_preprocess(struct img_ir_timings *timings,
79 unsigned int unit)
80{
81 img_ir_symbol_timing_preprocess(&timings->ldr, unit);
82 img_ir_symbol_timing_preprocess(&timings->s00, unit);
83 img_ir_symbol_timing_preprocess(&timings->s01, unit);
84 img_ir_symbol_timing_preprocess(&timings->s10, unit);
85 img_ir_symbol_timing_preprocess(&timings->s11, unit);
86 /* default s10 and s11 to s00 and s01 if no leader */
87 if (unit)
88 /* multiply by unit and convert to microseconds (round up) */
89 timings->ft.ft_min = (timings->ft.ft_min*unit + 999)/1000;
90}
91
92/* functions for filling empty fields with defaults */
93
94static void img_ir_timing_defaults(struct img_ir_timing_range *range,
95 struct img_ir_timing_range *defaults)
96{
97 if (!range->min)
98 range->min = defaults->min;
99 if (!range->max)
100 range->max = defaults->max;
101}
102
103static void img_ir_symbol_timing_defaults(struct img_ir_symbol_timing *timing,
104 struct img_ir_symbol_timing *defaults)
105{
106 img_ir_timing_defaults(&timing->pulse, &defaults->pulse);
107 img_ir_timing_defaults(&timing->space, &defaults->space);
108}
109
110static void img_ir_timings_defaults(struct img_ir_timings *timings,
111 struct img_ir_timings *defaults)
112{
113 img_ir_symbol_timing_defaults(&timings->ldr, &defaults->ldr);
114 img_ir_symbol_timing_defaults(&timings->s00, &defaults->s00);
115 img_ir_symbol_timing_defaults(&timings->s01, &defaults->s01);
116 img_ir_symbol_timing_defaults(&timings->s10, &defaults->s10);
117 img_ir_symbol_timing_defaults(&timings->s11, &defaults->s11);
118 if (!timings->ft.ft_min)
119 timings->ft.ft_min = defaults->ft.ft_min;
120}
121
122/* functions for converting timings to register values */
123
124/**
125 * img_ir_control() - Convert control struct to control register value.
126 * @control: Control data
127 *
128 * Returns: The control register value equivalent of @control.
129 */
130static u32 img_ir_control(const struct img_ir_control *control)
131{
132 u32 ctrl = control->code_type << IMG_IR_CODETYPE_SHIFT;
133 if (control->decoden)
134 ctrl |= IMG_IR_DECODEN;
135 if (control->hdrtog)
136 ctrl |= IMG_IR_HDRTOG;
137 if (control->ldrdec)
138 ctrl |= IMG_IR_LDRDEC;
139 if (control->decodinpol)
140 ctrl |= IMG_IR_DECODINPOL;
141 if (control->bitorien)
142 ctrl |= IMG_IR_BITORIEN;
143 if (control->d1validsel)
144 ctrl |= IMG_IR_D1VALIDSEL;
145 if (control->bitinv)
146 ctrl |= IMG_IR_BITINV;
147 if (control->decodend2)
148 ctrl |= IMG_IR_DECODEND2;
149 if (control->bitoriend2)
150 ctrl |= IMG_IR_BITORIEND2;
151 if (control->bitinvd2)
152 ctrl |= IMG_IR_BITINVD2;
153 return ctrl;
154}
155
156/**
157 * img_ir_timing_range_convert() - Convert microsecond range.
158 * @out: Output timing range in clock cycles with a shift.
159 * @in: Input timing range in microseconds.
160 * @tolerance: Tolerance as a fraction of 128 (roughly percent).
161 * @clock_hz: IR clock rate in Hz.
162 * @shift: Shift of output units.
163 *
164 * Converts min and max from microseconds to IR clock cycles, applies a
165 * tolerance, and shifts for the register, rounding in the right direction.
166 * Note that in and out can safely be the same object.
167 */
168static void img_ir_timing_range_convert(struct img_ir_timing_range *out,
169 const struct img_ir_timing_range *in,
170 unsigned int tolerance,
171 unsigned long clock_hz,
172 unsigned int shift)
173{
174 unsigned int min = in->min;
175 unsigned int max = in->max;
176 /* add a tolerance */
177 min = min - (min*tolerance >> 7);
178 max = max + (max*tolerance >> 7);
179 /* convert from microseconds into clock cycles */
180 min = min*clock_hz / 1000000;
181 max = (max*clock_hz + 999999) / 1000000; /* round up */
182 /* apply shift and copy to output */
183 out->min = min >> shift;
184 out->max = (max + ((1 << shift) - 1)) >> shift; /* round up */
185}
186
187/**
188 * img_ir_symbol_timing() - Convert symbol timing struct to register value.
189 * @timing: Symbol timing data
190 * @tolerance: Timing tolerance where 0-128 represents 0-100%
191 * @clock_hz: Frequency of source clock in Hz
192 * @pd_shift: Shift to apply to symbol period
193 * @w_shift: Shift to apply to symbol width
194 *
195 * Returns: Symbol timing register value based on arguments.
196 */
197static u32 img_ir_symbol_timing(const struct img_ir_symbol_timing *timing,
198 unsigned int tolerance,
199 unsigned long clock_hz,
200 unsigned int pd_shift,
201 unsigned int w_shift)
202{
203 struct img_ir_timing_range hw_pulse, hw_period;
204 /* we calculate period in hw_period, then convert in place */
205 hw_period.min = timing->pulse.min + timing->space.min;
206 hw_period.max = timing->pulse.max + timing->space.max;
207 img_ir_timing_range_convert(&hw_period, &hw_period,
208 tolerance, clock_hz, pd_shift);
209 img_ir_timing_range_convert(&hw_pulse, &timing->pulse,
210 tolerance, clock_hz, w_shift);
211 /* construct register value */
212 return (hw_period.max << IMG_IR_PD_MAX_SHIFT) |
213 (hw_period.min << IMG_IR_PD_MIN_SHIFT) |
214 (hw_pulse.max << IMG_IR_W_MAX_SHIFT) |
215 (hw_pulse.min << IMG_IR_W_MIN_SHIFT);
216}
217
218/**
219 * img_ir_free_timing() - Convert free time timing struct to register value.
220 * @timing: Free symbol timing data
221 * @clock_hz: Source clock frequency in Hz
222 *
223 * Returns: Free symbol timing register value.
224 */
225static u32 img_ir_free_timing(const struct img_ir_free_timing *timing,
226 unsigned long clock_hz)
227{
228 unsigned int minlen, maxlen, ft_min;
229 /* minlen is only 5 bits, and round minlen to multiple of 2 */
230 if (timing->minlen < 30)
231 minlen = timing->minlen & -2;
232 else
233 minlen = 30;
234 /* maxlen has maximum value of 48, and round maxlen to multiple of 2 */
235 if (timing->maxlen < 48)
236 maxlen = (timing->maxlen + 1) & -2;
237 else
238 maxlen = 48;
239 /* convert and shift ft_min, rounding upwards */
240 ft_min = (timing->ft_min*clock_hz + 999999) / 1000000;
241 ft_min = (ft_min + 7) >> 3;
242 /* construct register value */
243 return (maxlen << IMG_IR_MAXLEN_SHIFT) |
244 (minlen << IMG_IR_MINLEN_SHIFT) |
245 (ft_min << IMG_IR_FT_MIN_SHIFT);
246}
247
248/**
249 * img_ir_free_timing_dynamic() - Update free time register value.
250 * @st_ft: Static free time register value from img_ir_free_timing.
251 * @filter: Current filter which may additionally restrict min/max len.
252 *
253 * Returns: Updated free time register value based on the current filter.
254 */
255static u32 img_ir_free_timing_dynamic(u32 st_ft, struct img_ir_filter *filter)
256{
257 unsigned int minlen, maxlen, newminlen, newmaxlen;
258
259 /* round minlen, maxlen to multiple of 2 */
260 newminlen = filter->minlen & -2;
261 newmaxlen = (filter->maxlen + 1) & -2;
262 /* extract min/max len from register */
263 minlen = (st_ft & IMG_IR_MINLEN) >> IMG_IR_MINLEN_SHIFT;
264 maxlen = (st_ft & IMG_IR_MAXLEN) >> IMG_IR_MAXLEN_SHIFT;
265 /* if the new values are more restrictive, update the register value */
266 if (newminlen > minlen) {
267 st_ft &= ~IMG_IR_MINLEN;
268 st_ft |= newminlen << IMG_IR_MINLEN_SHIFT;
269 }
270 if (newmaxlen < maxlen) {
271 st_ft &= ~IMG_IR_MAXLEN;
272 st_ft |= newmaxlen << IMG_IR_MAXLEN_SHIFT;
273 }
274 return st_ft;
275}
276
277/**
278 * img_ir_timings_convert() - Convert timings to register values
279 * @regs: Output timing register values
280 * @timings: Input timing data
281 * @tolerance: Timing tolerance where 0-128 represents 0-100%
282 * @clock_hz: Source clock frequency in Hz
283 */
284static void img_ir_timings_convert(struct img_ir_timing_regvals *regs,
285 const struct img_ir_timings *timings,
286 unsigned int tolerance,
287 unsigned int clock_hz)
288{
289 /* leader symbol timings are divided by 16 */
290 regs->ldr = img_ir_symbol_timing(&timings->ldr, tolerance, clock_hz,
291 4, 4);
292 /* other symbol timings, pd fields only are divided by 2 */
293 regs->s00 = img_ir_symbol_timing(&timings->s00, tolerance, clock_hz,
294 1, 0);
295 regs->s01 = img_ir_symbol_timing(&timings->s01, tolerance, clock_hz,
296 1, 0);
297 regs->s10 = img_ir_symbol_timing(&timings->s10, tolerance, clock_hz,
298 1, 0);
299 regs->s11 = img_ir_symbol_timing(&timings->s11, tolerance, clock_hz,
300 1, 0);
301 regs->ft = img_ir_free_timing(&timings->ft, clock_hz);
302}
303
304/**
305 * img_ir_decoder_preprocess() - Preprocess timings in decoder.
306 * @decoder: Decoder to be preprocessed.
307 *
308 * Ensures that the symbol timing ranges are valid with respect to ordering, and
309 * does some fixed conversion on them.
310 */
311static void img_ir_decoder_preprocess(struct img_ir_decoder *decoder)
312{
313 /* default tolerance */
314 if (!decoder->tolerance)
315 decoder->tolerance = 10; /* percent */
316 /* and convert tolerance to fraction out of 128 */
317 decoder->tolerance = decoder->tolerance * 128 / 100;
318
319 /* fill in implicit fields */
320 img_ir_timings_preprocess(&decoder->timings, decoder->unit);
321
322 /* do the same for repeat timings if applicable */
323 if (decoder->repeat) {
324 img_ir_timings_preprocess(&decoder->rtimings, decoder->unit);
325 img_ir_timings_defaults(&decoder->rtimings, &decoder->timings);
326 }
327}
328
329/**
330 * img_ir_decoder_convert() - Generate internal timings in decoder.
331 * @decoder: Decoder to be converted to internal timings.
332 * @timings: Timing register values.
333 * @clock_hz: IR clock rate in Hz.
334 *
335 * Fills out the repeat timings and timing register values for a specific clock
336 * rate.
337 */
338static void img_ir_decoder_convert(const struct img_ir_decoder *decoder,
339 struct img_ir_reg_timings *reg_timings,
340 unsigned int clock_hz)
341{
342 /* calculate control value */
343 reg_timings->ctrl = img_ir_control(&decoder->control);
344
345 /* fill in implicit fields and calculate register values */
346 img_ir_timings_convert(&reg_timings->timings, &decoder->timings,
347 decoder->tolerance, clock_hz);
348
349 /* do the same for repeat timings if applicable */
350 if (decoder->repeat)
351 img_ir_timings_convert(&reg_timings->rtimings,
352 &decoder->rtimings, decoder->tolerance,
353 clock_hz);
354}
355
356/**
357 * img_ir_write_timings() - Write timings to the hardware now
358 * @priv: IR private data
359 * @regs: Timing register values to write
360 * @type: RC filter type (RC_FILTER_*)
361 *
362 * Write timing register values @regs to the hardware, taking into account the
363 * current filter which may impose restrictions on the length of the expected
364 * data.
365 */
366static void img_ir_write_timings(struct img_ir_priv *priv,
367 struct img_ir_timing_regvals *regs,
368 enum rc_filter_type type)
369{
370 struct img_ir_priv_hw *hw = &priv->hw;
371
372 /* filter may be more restrictive to minlen, maxlen */
373 u32 ft = regs->ft;
374 if (hw->flags & BIT(type))
375 ft = img_ir_free_timing_dynamic(regs->ft, &hw->filters[type]);
376 /* write to registers */
377 img_ir_write(priv, IMG_IR_LEAD_SYMB_TIMING, regs->ldr);
378 img_ir_write(priv, IMG_IR_S00_SYMB_TIMING, regs->s00);
379 img_ir_write(priv, IMG_IR_S01_SYMB_TIMING, regs->s01);
380 img_ir_write(priv, IMG_IR_S10_SYMB_TIMING, regs->s10);
381 img_ir_write(priv, IMG_IR_S11_SYMB_TIMING, regs->s11);
382 img_ir_write(priv, IMG_IR_FREE_SYMB_TIMING, ft);
383 dev_dbg(priv->dev, "timings: ldr=%#x, s=[%#x, %#x, %#x, %#x], ft=%#x\n",
384 regs->ldr, regs->s00, regs->s01, regs->s10, regs->s11, ft);
385}
386
387static void img_ir_write_filter(struct img_ir_priv *priv,
388 struct img_ir_filter *filter)
389{
390 if (filter) {
391 dev_dbg(priv->dev, "IR filter=%016llx & %016llx\n",
392 (unsigned long long)filter->data,
393 (unsigned long long)filter->mask);
394 img_ir_write(priv, IMG_IR_IRQ_MSG_DATA_LW, (u32)filter->data);
395 img_ir_write(priv, IMG_IR_IRQ_MSG_DATA_UP, (u32)(filter->data
396 >> 32));
397 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_LW, (u32)filter->mask);
398 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_UP, (u32)(filter->mask
399 >> 32));
400 } else {
401 dev_dbg(priv->dev, "IR clearing filter\n");
402 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_LW, 0);
403 img_ir_write(priv, IMG_IR_IRQ_MSG_MASK_UP, 0);
404 }
405}
406
407/* caller must have lock */
408static void _img_ir_set_filter(struct img_ir_priv *priv,
409 struct img_ir_filter *filter)
410{
411 struct img_ir_priv_hw *hw = &priv->hw;
412 u32 irq_en, irq_on;
413
414 irq_en = img_ir_read(priv, IMG_IR_IRQ_ENABLE);
415 if (filter) {
416 /* Only use the match interrupt */
417 hw->filters[RC_FILTER_NORMAL] = *filter;
418 hw->flags |= IMG_IR_F_FILTER;
419 irq_on = IMG_IR_IRQ_DATA_MATCH;
420 irq_en &= ~(IMG_IR_IRQ_DATA_VALID | IMG_IR_IRQ_DATA2_VALID);
421 } else {
422 /* Only use the valid interrupt */
423 hw->flags &= ~IMG_IR_F_FILTER;
424 irq_en &= ~IMG_IR_IRQ_DATA_MATCH;
425 irq_on = IMG_IR_IRQ_DATA_VALID | IMG_IR_IRQ_DATA2_VALID;
426 }
427 irq_en |= irq_on;
428
429 img_ir_write_filter(priv, filter);
430 /* clear any interrupts we're enabling so we don't handle old ones */
431 img_ir_write(priv, IMG_IR_IRQ_CLEAR, irq_on);
432 img_ir_write(priv, IMG_IR_IRQ_ENABLE, irq_en);
433}
434
435/* caller must have lock */
436static void _img_ir_set_wake_filter(struct img_ir_priv *priv,
437 struct img_ir_filter *filter)
438{
439 struct img_ir_priv_hw *hw = &priv->hw;
440 if (filter) {
441 /* Enable wake, and copy filter for later */
442 hw->filters[RC_FILTER_WAKEUP] = *filter;
443 hw->flags |= IMG_IR_F_WAKE;
444 } else {
445 /* Disable wake */
446 hw->flags &= ~IMG_IR_F_WAKE;
447 }
448}
449
450/* Callback for setting scancode filter */
451static int img_ir_set_filter(struct rc_dev *dev, enum rc_filter_type type,
452 struct rc_scancode_filter *sc_filter)
453{
454 struct img_ir_priv *priv = dev->priv;
455 struct img_ir_priv_hw *hw = &priv->hw;
456 struct img_ir_filter filter, *filter_ptr = &filter;
457 int ret = 0;
458
459 dev_dbg(priv->dev, "IR scancode %sfilter=%08x & %08x\n",
460 type == RC_FILTER_WAKEUP ? "wake " : "",
461 sc_filter->data,
462 sc_filter->mask);
463
464 spin_lock_irq(&priv->lock);
465
466 /* filtering can always be disabled */
467 if (!sc_filter->mask) {
468 filter_ptr = NULL;
469 goto set_unlock;
470 }
471
472 /* current decoder must support scancode filtering */
473 if (!hw->decoder || !hw->decoder->filter) {
474 ret = -EINVAL;
475 goto unlock;
476 }
477
478 /* convert scancode filter to raw filter */
479 filter.minlen = 0;
480 filter.maxlen = ~0;
481 ret = hw->decoder->filter(sc_filter, &filter, hw->enabled_protocols);
482 if (ret)
483 goto unlock;
484 dev_dbg(priv->dev, "IR raw %sfilter=%016llx & %016llx\n",
485 type == RC_FILTER_WAKEUP ? "wake " : "",
486 (unsigned long long)filter.data,
487 (unsigned long long)filter.mask);
488
489set_unlock:
490 /* apply raw filters */
491 switch (type) {
492 case RC_FILTER_NORMAL:
493 _img_ir_set_filter(priv, filter_ptr);
494 break;
495 case RC_FILTER_WAKEUP:
496 _img_ir_set_wake_filter(priv, filter_ptr);
497 break;
498 default:
499 ret = -EINVAL;
500 }
501
502unlock:
503 spin_unlock_irq(&priv->lock);
504 return ret;
505}
506
507/**
508 * img_ir_set_decoder() - Set the current decoder.
509 * @priv: IR private data.
510 * @decoder: Decoder to use with immediate effect.
511 * @proto: Protocol bitmap (or 0 to use decoder->type).
512 */
513static void img_ir_set_decoder(struct img_ir_priv *priv,
514 const struct img_ir_decoder *decoder,
515 u64 proto)
516{
517 struct img_ir_priv_hw *hw = &priv->hw;
518 struct rc_dev *rdev = hw->rdev;
519 u32 ir_status, irq_en;
520 spin_lock_irq(&priv->lock);
521
522 /* switch off and disable interrupts */
523 img_ir_write(priv, IMG_IR_CONTROL, 0);
524 irq_en = img_ir_read(priv, IMG_IR_IRQ_ENABLE);
525 img_ir_write(priv, IMG_IR_IRQ_ENABLE, irq_en & IMG_IR_IRQ_EDGE);
526 img_ir_write(priv, IMG_IR_IRQ_CLEAR, IMG_IR_IRQ_ALL & ~IMG_IR_IRQ_EDGE);
527
528 /* ack any data already detected */
529 ir_status = img_ir_read(priv, IMG_IR_STATUS);
530 if (ir_status & (IMG_IR_RXDVAL | IMG_IR_RXDVALD2)) {
531 ir_status &= ~(IMG_IR_RXDVAL | IMG_IR_RXDVALD2);
532 img_ir_write(priv, IMG_IR_STATUS, ir_status);
533 img_ir_read(priv, IMG_IR_DATA_LW);
534 img_ir_read(priv, IMG_IR_DATA_UP);
535 }
536
537 /* stop the end timer and switch back to normal mode */
538 del_timer_sync(&hw->end_timer);
539 hw->mode = IMG_IR_M_NORMAL;
540
541 /* clear the wakeup scancode filter */
542 rdev->scancode_filters[RC_FILTER_WAKEUP].data = 0;
543 rdev->scancode_filters[RC_FILTER_WAKEUP].mask = 0;
544
545 /* clear raw filters */
546 _img_ir_set_filter(priv, NULL);
547 _img_ir_set_wake_filter(priv, NULL);
548
549 /* clear the enabled protocols */
550 hw->enabled_protocols = 0;
551
552 /* switch decoder */
553 hw->decoder = decoder;
554 if (!decoder)
555 goto unlock;
556
557 /* set the enabled protocols */
558 if (!proto)
559 proto = decoder->type;
560 hw->enabled_protocols = proto;
561
562 /* write the new timings */
563 img_ir_decoder_convert(decoder, &hw->reg_timings, hw->clk_hz);
564 img_ir_write_timings(priv, &hw->reg_timings.timings, RC_FILTER_NORMAL);
565
566 /* set up and enable */
567 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl);
568
569
570unlock:
571 spin_unlock_irq(&priv->lock);
572}
573
574/**
575 * img_ir_decoder_compatable() - Find whether a decoder will work with a device.
576 * @priv: IR private data.
577 * @dec: Decoder to check.
578 *
579 * Returns: true if @dec is compatible with the device @priv refers to.
580 */
581static bool img_ir_decoder_compatible(struct img_ir_priv *priv,
582 const struct img_ir_decoder *dec)
583{
584 unsigned int ct;
585
586 /* don't accept decoders using code types which aren't supported */
587 ct = dec->control.code_type;
588 if (priv->hw.ct_quirks[ct] & IMG_IR_QUIRK_CODE_BROKEN)
589 return false;
590
591 return true;
592}
593
594/**
595 * img_ir_allowed_protos() - Get allowed protocols from global decoder list.
596 * @priv: IR private data.
597 *
598 * Returns: Mask of protocols supported by the device @priv refers to.
599 */
600static u64 img_ir_allowed_protos(struct img_ir_priv *priv)
601{
602 u64 protos = 0;
603 struct img_ir_decoder **decp;
604
605 for (decp = img_ir_decoders; *decp; ++decp) {
606 const struct img_ir_decoder *dec = *decp;
607 if (img_ir_decoder_compatible(priv, dec))
608 protos |= dec->type;
609 }
610 return protos;
611}
612
613/* Callback for changing protocol using sysfs */
614static int img_ir_change_protocol(struct rc_dev *dev, u64 *ir_type)
615{
616 struct img_ir_priv *priv = dev->priv;
617 struct img_ir_priv_hw *hw = &priv->hw;
618 struct rc_dev *rdev = hw->rdev;
619 struct img_ir_decoder **decp;
620 u64 wakeup_protocols;
621
622 if (!*ir_type) {
623 /* disable all protocols */
624 img_ir_set_decoder(priv, NULL, 0);
625 goto success;
626 }
627 for (decp = img_ir_decoders; *decp; ++decp) {
628 const struct img_ir_decoder *dec = *decp;
629 if (!img_ir_decoder_compatible(priv, dec))
630 continue;
631 if (*ir_type & dec->type) {
632 *ir_type &= dec->type;
633 img_ir_set_decoder(priv, dec, *ir_type);
634 goto success;
635 }
636 }
637 return -EINVAL;
638
639success:
640 /*
641 * Only allow matching wakeup protocols for now, and only if filtering
642 * is supported.
643 */
644 wakeup_protocols = *ir_type;
645 if (!hw->decoder || !hw->decoder->filter)
646 wakeup_protocols = 0;
647 rc_set_allowed_wakeup_protocols(rdev, wakeup_protocols);
648 rc_set_enabled_wakeup_protocols(rdev, wakeup_protocols);
649 return 0;
650}
651
652/* Changes ir-core protocol device attribute */
653static void img_ir_set_protocol(struct img_ir_priv *priv, u64 proto)
654{
655 struct rc_dev *rdev = priv->hw.rdev;
656
657 spin_lock_irq(&rdev->rc_map.lock);
658 rdev->rc_map.rc_type = __ffs64(proto);
659 spin_unlock_irq(&rdev->rc_map.lock);
660
661 mutex_lock(&rdev->lock);
662 rc_set_enabled_protocols(rdev, proto);
663 rc_set_allowed_wakeup_protocols(rdev, proto);
664 rc_set_enabled_wakeup_protocols(rdev, proto);
665 mutex_unlock(&rdev->lock);
666}
667
668/* Set up IR decoders */
669static void img_ir_init_decoders(void)
670{
671 struct img_ir_decoder **decp;
672
673 spin_lock(&img_ir_decoders_lock);
674 if (!img_ir_decoders_preprocessed) {
675 for (decp = img_ir_decoders; *decp; ++decp)
676 img_ir_decoder_preprocess(*decp);
677 img_ir_decoders_preprocessed = true;
678 }
679 spin_unlock(&img_ir_decoders_lock);
680}
681
682#ifdef CONFIG_PM_SLEEP
683/**
684 * img_ir_enable_wake() - Switch to wake mode.
685 * @priv: IR private data.
686 *
687 * Returns: non-zero if the IR can wake the system.
688 */
689static int img_ir_enable_wake(struct img_ir_priv *priv)
690{
691 struct img_ir_priv_hw *hw = &priv->hw;
692 int ret = 0;
693
694 spin_lock_irq(&priv->lock);
695 if (hw->flags & IMG_IR_F_WAKE) {
696 /* interrupt only on a match */
697 hw->suspend_irqen = img_ir_read(priv, IMG_IR_IRQ_ENABLE);
698 img_ir_write(priv, IMG_IR_IRQ_ENABLE, IMG_IR_IRQ_DATA_MATCH);
699 img_ir_write_filter(priv, &hw->filters[RC_FILTER_WAKEUP]);
700 img_ir_write_timings(priv, &hw->reg_timings.timings,
701 RC_FILTER_WAKEUP);
702 hw->mode = IMG_IR_M_WAKE;
703 ret = 1;
704 }
705 spin_unlock_irq(&priv->lock);
706 return ret;
707}
708
709/**
710 * img_ir_disable_wake() - Switch out of wake mode.
711 * @priv: IR private data
712 *
713 * Returns: 1 if the hardware should be allowed to wake from a sleep state.
714 * 0 otherwise.
715 */
716static int img_ir_disable_wake(struct img_ir_priv *priv)
717{
718 struct img_ir_priv_hw *hw = &priv->hw;
719 int ret = 0;
720
721 spin_lock_irq(&priv->lock);
722 if (hw->flags & IMG_IR_F_WAKE) {
723 /* restore normal filtering */
724 if (hw->flags & IMG_IR_F_FILTER) {
725 img_ir_write(priv, IMG_IR_IRQ_ENABLE,
726 (hw->suspend_irqen & IMG_IR_IRQ_EDGE) |
727 IMG_IR_IRQ_DATA_MATCH);
728 img_ir_write_filter(priv,
729 &hw->filters[RC_FILTER_NORMAL]);
730 } else {
731 img_ir_write(priv, IMG_IR_IRQ_ENABLE,
732 (hw->suspend_irqen & IMG_IR_IRQ_EDGE) |
733 IMG_IR_IRQ_DATA_VALID |
734 IMG_IR_IRQ_DATA2_VALID);
735 img_ir_write_filter(priv, NULL);
736 }
737 img_ir_write_timings(priv, &hw->reg_timings.timings,
738 RC_FILTER_NORMAL);
739 hw->mode = IMG_IR_M_NORMAL;
740 ret = 1;
741 }
742 spin_unlock_irq(&priv->lock);
743 return ret;
744}
745#endif /* CONFIG_PM_SLEEP */
746
747/* lock must be held */
748static void img_ir_begin_repeat(struct img_ir_priv *priv)
749{
750 struct img_ir_priv_hw *hw = &priv->hw;
751 if (hw->mode == IMG_IR_M_NORMAL) {
752 /* switch to repeat timings */
753 img_ir_write(priv, IMG_IR_CONTROL, 0);
754 hw->mode = IMG_IR_M_REPEATING;
755 img_ir_write_timings(priv, &hw->reg_timings.rtimings,
756 RC_FILTER_NORMAL);
757 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl);
758 }
759}
760
761/* lock must be held */
762static void img_ir_end_repeat(struct img_ir_priv *priv)
763{
764 struct img_ir_priv_hw *hw = &priv->hw;
765 if (hw->mode == IMG_IR_M_REPEATING) {
766 /* switch to normal timings */
767 img_ir_write(priv, IMG_IR_CONTROL, 0);
768 hw->mode = IMG_IR_M_NORMAL;
769 img_ir_write_timings(priv, &hw->reg_timings.timings,
770 RC_FILTER_NORMAL);
771 img_ir_write(priv, IMG_IR_CONTROL, hw->reg_timings.ctrl);
772 }
773}
774
775/* lock must be held */
776static void img_ir_handle_data(struct img_ir_priv *priv, u32 len, u64 raw)
777{
778 struct img_ir_priv_hw *hw = &priv->hw;
779 const struct img_ir_decoder *dec = hw->decoder;
780 int ret = IMG_IR_SCANCODE;
781 int scancode;
782 if (dec->scancode)
783 ret = dec->scancode(len, raw, &scancode, hw->enabled_protocols);
784 else if (len >= 32)
785 scancode = (u32)raw;
786 else if (len < 32)
787 scancode = (u32)raw & ((1 << len)-1);
788 dev_dbg(priv->dev, "data (%u bits) = %#llx\n",
789 len, (unsigned long long)raw);
790 if (ret == IMG_IR_SCANCODE) {
791 dev_dbg(priv->dev, "decoded scan code %#x\n", scancode);
792 rc_keydown(hw->rdev, scancode, 0);
793 img_ir_end_repeat(priv);
794 } else if (ret == IMG_IR_REPEATCODE) {
795 if (hw->mode == IMG_IR_M_REPEATING) {
796 dev_dbg(priv->dev, "decoded repeat code\n");
797 rc_repeat(hw->rdev);
798 } else {
799 dev_dbg(priv->dev, "decoded unexpected repeat code, ignoring\n");
800 }
801 } else {
802 dev_dbg(priv->dev, "decode failed (%d)\n", ret);
803 return;
804 }
805
806
807 if (dec->repeat) {
808 unsigned long interval;
809
810 img_ir_begin_repeat(priv);
811
812 /* update timer, but allowing for 1/8th tolerance */
813 interval = dec->repeat + (dec->repeat >> 3);
814 mod_timer(&hw->end_timer,
815 jiffies + msecs_to_jiffies(interval));
816 }
817}
818
819/* timer function to end waiting for repeat. */
820static void img_ir_end_timer(unsigned long arg)
821{
822 struct img_ir_priv *priv = (struct img_ir_priv *)arg;
823
824 spin_lock_irq(&priv->lock);
825 img_ir_end_repeat(priv);
826 spin_unlock_irq(&priv->lock);
827}
828
829#ifdef CONFIG_COMMON_CLK
830static void img_ir_change_frequency(struct img_ir_priv *priv,
831 struct clk_notifier_data *change)
832{
833 struct img_ir_priv_hw *hw = &priv->hw;
834
835 dev_dbg(priv->dev, "clk changed %lu HZ -> %lu HZ\n",
836 change->old_rate, change->new_rate);
837
838 spin_lock_irq(&priv->lock);
839 if (hw->clk_hz == change->new_rate)
840 goto unlock;
841 hw->clk_hz = change->new_rate;
842 /* refresh current timings */
843 if (hw->decoder) {
844 img_ir_decoder_convert(hw->decoder, &hw->reg_timings,
845 hw->clk_hz);
846 switch (hw->mode) {
847 case IMG_IR_M_NORMAL:
848 img_ir_write_timings(priv, &hw->reg_timings.timings,
849 RC_FILTER_NORMAL);
850 break;
851 case IMG_IR_M_REPEATING:
852 img_ir_write_timings(priv, &hw->reg_timings.rtimings,
853 RC_FILTER_NORMAL);
854 break;
855#ifdef CONFIG_PM_SLEEP
856 case IMG_IR_M_WAKE:
857 img_ir_write_timings(priv, &hw->reg_timings.timings,
858 RC_FILTER_WAKEUP);
859 break;
860#endif
861 }
862 }
863unlock:
864 spin_unlock_irq(&priv->lock);
865}
866
867static int img_ir_clk_notify(struct notifier_block *self, unsigned long action,
868 void *data)
869{
870 struct img_ir_priv *priv = container_of(self, struct img_ir_priv,
871 hw.clk_nb);
872 switch (action) {
873 case POST_RATE_CHANGE:
874 img_ir_change_frequency(priv, data);
875 break;
876 default:
877 break;
878 }
879 return NOTIFY_OK;
880}
881#endif /* CONFIG_COMMON_CLK */
882
883/* called with priv->lock held */
884void img_ir_isr_hw(struct img_ir_priv *priv, u32 irq_status)
885{
886 struct img_ir_priv_hw *hw = &priv->hw;
887 u32 ir_status, len, lw, up;
888 unsigned int ct;
889
890 /* use the current decoder */
891 if (!hw->decoder)
892 return;
893
894 ir_status = img_ir_read(priv, IMG_IR_STATUS);
895 if (!(ir_status & (IMG_IR_RXDVAL | IMG_IR_RXDVALD2)))
896 return;
897 ir_status &= ~(IMG_IR_RXDVAL | IMG_IR_RXDVALD2);
898 img_ir_write(priv, IMG_IR_STATUS, ir_status);
899
900 len = (ir_status & IMG_IR_RXDLEN) >> IMG_IR_RXDLEN_SHIFT;
901 /* some versions report wrong length for certain code types */
902 ct = hw->decoder->control.code_type;
903 if (hw->ct_quirks[ct] & IMG_IR_QUIRK_CODE_LEN_INCR)
904 ++len;
905
906 lw = img_ir_read(priv, IMG_IR_DATA_LW);
907 up = img_ir_read(priv, IMG_IR_DATA_UP);
908 img_ir_handle_data(priv, len, (u64)up << 32 | lw);
909}
910
911void img_ir_setup_hw(struct img_ir_priv *priv)
912{
913 struct img_ir_decoder **decp;
914
915 if (!priv->hw.rdev)
916 return;
917
918 /* Use the first available decoder (or disable stuff if NULL) */
919 for (decp = img_ir_decoders; *decp; ++decp) {
920 const struct img_ir_decoder *dec = *decp;
921 if (img_ir_decoder_compatible(priv, dec)) {
922 img_ir_set_protocol(priv, dec->type);
923 img_ir_set_decoder(priv, dec, 0);
924 return;
925 }
926 }
927 img_ir_set_decoder(priv, NULL, 0);
928}
929
930/**
931 * img_ir_probe_hw_caps() - Probe capabilities of the hardware.
932 * @priv: IR private data.
933 */
934static void img_ir_probe_hw_caps(struct img_ir_priv *priv)
935{
936 struct img_ir_priv_hw *hw = &priv->hw;
937 /*
938 * When a version of the block becomes available without these quirks,
939 * they'll have to depend on the core revision.
940 */
941 hw->ct_quirks[IMG_IR_CODETYPE_PULSELEN]
942 |= IMG_IR_QUIRK_CODE_LEN_INCR;
943 hw->ct_quirks[IMG_IR_CODETYPE_BIPHASE]
944 |= IMG_IR_QUIRK_CODE_BROKEN;
945 hw->ct_quirks[IMG_IR_CODETYPE_2BITPULSEPOS]
946 |= IMG_IR_QUIRK_CODE_BROKEN;
947}
948
949int img_ir_probe_hw(struct img_ir_priv *priv)
950{
951 struct img_ir_priv_hw *hw = &priv->hw;
952 struct rc_dev *rdev;
953 int error;
954
955 /* Ensure hardware decoders have been preprocessed */
956 img_ir_init_decoders();
957
958 /* Probe hardware capabilities */
959 img_ir_probe_hw_caps(priv);
960
961 /* Set up the end timer */
962 setup_timer(&hw->end_timer, img_ir_end_timer, (unsigned long)priv);
963
964 /* Register a clock notifier */
965 if (!IS_ERR(priv->clk)) {
966 hw->clk_hz = clk_get_rate(priv->clk);
967#ifdef CONFIG_COMMON_CLK
968 hw->clk_nb.notifier_call = img_ir_clk_notify;
969 error = clk_notifier_register(priv->clk, &hw->clk_nb);
970 if (error)
971 dev_warn(priv->dev,
972 "failed to register clock notifier\n");
973#endif
974 } else {
975 hw->clk_hz = 32768;
976 }
977
978 /* Allocate hardware decoder */
979 hw->rdev = rdev = rc_allocate_device();
980 if (!rdev) {
981 dev_err(priv->dev, "cannot allocate input device\n");
982 error = -ENOMEM;
983 goto err_alloc_rc;
984 }
985 rdev->priv = priv;
986 rdev->map_name = RC_MAP_EMPTY;
987 rc_set_allowed_protocols(rdev, img_ir_allowed_protos(priv));
988 rdev->input_name = "IMG Infrared Decoder";
989 rdev->s_filter = img_ir_set_filter;
990
991 /* Register hardware decoder */
992 error = rc_register_device(rdev);
993 if (error) {
994 dev_err(priv->dev, "failed to register IR input device\n");
995 goto err_register_rc;
996 }
997
998 /*
999 * Set this after rc_register_device as no protocols have been
1000 * registered yet.
1001 */
1002 rdev->change_protocol = img_ir_change_protocol;
1003
1004 device_init_wakeup(priv->dev, 1);
1005
1006 return 0;
1007
1008err_register_rc:
1009 img_ir_set_decoder(priv, NULL, 0);
1010 hw->rdev = NULL;
1011 rc_free_device(rdev);
1012err_alloc_rc:
1013#ifdef CONFIG_COMMON_CLK
1014 if (!IS_ERR(priv->clk))
1015 clk_notifier_unregister(priv->clk, &hw->clk_nb);
1016#endif
1017 return error;
1018}
1019
1020void img_ir_remove_hw(struct img_ir_priv *priv)
1021{
1022 struct img_ir_priv_hw *hw = &priv->hw;
1023 struct rc_dev *rdev = hw->rdev;
1024 if (!rdev)
1025 return;
1026 img_ir_set_decoder(priv, NULL, 0);
1027 hw->rdev = NULL;
1028 rc_unregister_device(rdev);
1029#ifdef CONFIG_COMMON_CLK
1030 if (!IS_ERR(priv->clk))
1031 clk_notifier_unregister(priv->clk, &hw->clk_nb);
1032#endif
1033}
1034
1035#ifdef CONFIG_PM_SLEEP
1036int img_ir_suspend(struct device *dev)
1037{
1038 struct img_ir_priv *priv = dev_get_drvdata(dev);
1039
1040 if (device_may_wakeup(dev) && img_ir_enable_wake(priv))
1041 enable_irq_wake(priv->irq);
1042 return 0;
1043}
1044
1045int img_ir_resume(struct device *dev)
1046{
1047 struct img_ir_priv *priv = dev_get_drvdata(dev);
1048
1049 if (device_may_wakeup(dev) && img_ir_disable_wake(priv))
1050 disable_irq_wake(priv->irq);
1051 return 0;
1052}
1053#endif /* CONFIG_PM_SLEEP */
diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h
new file mode 100644
index 000000000000..6c9a94a81190
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-hw.h
@@ -0,0 +1,269 @@
1/*
2 * ImgTec IR Hardware Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 */
6
7#ifndef _IMG_IR_HW_H_
8#define _IMG_IR_HW_H_
9
10#include <linux/kernel.h>
11#include <media/rc-core.h>
12
13/* constants */
14
15#define IMG_IR_CODETYPE_PULSELEN 0x0 /* Sony */
16#define IMG_IR_CODETYPE_PULSEDIST 0x1 /* NEC, Toshiba, Micom, Sharp */
17#define IMG_IR_CODETYPE_BIPHASE 0x2 /* RC-5/6 */
18#define IMG_IR_CODETYPE_2BITPULSEPOS 0x3 /* RC-MM */
19
20
21/* Timing information */
22
23/**
24 * struct img_ir_control - Decoder control settings
25 * @decoden: Primary decoder enable
26 * @code_type: Decode type (see IMG_IR_CODETYPE_*)
27 * @hdrtog: Detect header toggle symbol after leader symbol
28 * @ldrdec: Don't discard leader if maximum width reached
29 * @decodinpol: Decoder input polarity (1=active high)
30 * @bitorien: Bit orientation (1=MSB first)
31 * @d1validsel: Decoder 2 takes over if it detects valid data
32 * @bitinv: Bit inversion switch (1=don't invert)
33 * @decodend2: Secondary decoder enable (no leader symbol)
34 * @bitoriend2: Bit orientation (1=MSB first)
35 * @bitinvd2: Secondary decoder bit inversion switch (1=don't invert)
36 */
37struct img_ir_control {
38 unsigned decoden:1;
39 unsigned code_type:2;
40 unsigned hdrtog:1;
41 unsigned ldrdec:1;
42 unsigned decodinpol:1;
43 unsigned bitorien:1;
44 unsigned d1validsel:1;
45 unsigned bitinv:1;
46 unsigned decodend2:1;
47 unsigned bitoriend2:1;
48 unsigned bitinvd2:1;
49};
50
51/**
52 * struct img_ir_timing_range - range of timing values
53 * @min: Minimum timing value
54 * @max: Maximum timing value (if < @min, this will be set to @min during
55 * preprocessing step, so it is normally not explicitly initialised
56 * and is taken care of by the tolerance)
57 */
58struct img_ir_timing_range {
59 u16 min;
60 u16 max;
61};
62
63/**
64 * struct img_ir_symbol_timing - timing data for a symbol
65 * @pulse: Timing range for the length of the pulse in this symbol
66 * @space: Timing range for the length of the space in this symbol
67 */
68struct img_ir_symbol_timing {
69 struct img_ir_timing_range pulse;
70 struct img_ir_timing_range space;
71};
72
73/**
74 * struct img_ir_free_timing - timing data for free time symbol
75 * @minlen: Minimum number of bits of data
76 * @maxlen: Maximum number of bits of data
77 * @ft_min: Minimum free time after message
78 */
79struct img_ir_free_timing {
80 /* measured in bits */
81 u8 minlen;
82 u8 maxlen;
83 u16 ft_min;
84};
85
86/**
87 * struct img_ir_timings - Timing values.
88 * @ldr: Leader symbol timing data
89 * @s00: Zero symbol timing data for primary decoder
90 * @s01: One symbol timing data for primary decoder
91 * @s10: Zero symbol timing data for secondary (no leader symbol) decoder
92 * @s11: One symbol timing data for secondary (no leader symbol) decoder
93 * @ft: Free time symbol timing data
94 */
95struct img_ir_timings {
96 struct img_ir_symbol_timing ldr, s00, s01, s10, s11;
97 struct img_ir_free_timing ft;
98};
99
100/**
101 * struct img_ir_filter - Filter IR events.
102 * @data: Data to match.
103 * @mask: Mask of bits to compare.
104 * @minlen: Additional minimum number of bits.
105 * @maxlen: Additional maximum number of bits.
106 */
107struct img_ir_filter {
108 u64 data;
109 u64 mask;
110 u8 minlen;
111 u8 maxlen;
112};
113
114/**
115 * struct img_ir_timing_regvals - Calculated timing register values.
116 * @ldr: Leader symbol timing register value
117 * @s00: Zero symbol timing register value for primary decoder
118 * @s01: One symbol timing register value for primary decoder
119 * @s10: Zero symbol timing register value for secondary decoder
120 * @s11: One symbol timing register value for secondary decoder
121 * @ft: Free time symbol timing register value
122 */
123struct img_ir_timing_regvals {
124 u32 ldr, s00, s01, s10, s11, ft;
125};
126
127#define IMG_IR_SCANCODE 0 /* new scancode */
128#define IMG_IR_REPEATCODE 1 /* repeat the previous code */
129
130/**
131 * struct img_ir_decoder - Decoder settings for an IR protocol.
132 * @type: Protocol types bitmap.
133 * @tolerance: Timing tolerance as a percentage (default 10%).
134 * @unit: Unit of timings in nanoseconds (default 1 us).
135 * @timings: Primary timings
136 * @rtimings: Additional override timings while waiting for repeats.
137 * @repeat: Maximum repeat interval (always in milliseconds).
138 * @control: Control flags.
139 *
140 * @scancode: Pointer to function to convert the IR data into a scancode (it
141 * must be safe to execute in interrupt context).
142 * Returns IMG_IR_SCANCODE to emit new scancode.
143 * Returns IMG_IR_REPEATCODE to repeat previous code.
144 * Returns -errno (e.g. -EINVAL) on error.
145 * @filter: Pointer to function to convert scancode filter to raw hardware
146 * filter. The minlen and maxlen fields will have been initialised
147 * to the maximum range.
148 */
149struct img_ir_decoder {
150 /* core description */
151 u64 type;
152 unsigned int tolerance;
153 unsigned int unit;
154 struct img_ir_timings timings;
155 struct img_ir_timings rtimings;
156 unsigned int repeat;
157 struct img_ir_control control;
158
159 /* scancode logic */
160 int (*scancode)(int len, u64 raw, int *scancode, u64 protocols);
161 int (*filter)(const struct rc_scancode_filter *in,
162 struct img_ir_filter *out, u64 protocols);
163};
164
165/**
166 * struct img_ir_reg_timings - Reg values for decoder timings at clock rate.
167 * @ctrl: Processed control register value.
168 * @timings: Processed primary timings.
169 * @rtimings: Processed repeat timings.
170 */
171struct img_ir_reg_timings {
172 u32 ctrl;
173 struct img_ir_timing_regvals timings;
174 struct img_ir_timing_regvals rtimings;
175};
176
177int img_ir_register_decoder(struct img_ir_decoder *dec);
178void img_ir_unregister_decoder(struct img_ir_decoder *dec);
179
180struct img_ir_priv;
181
182#ifdef CONFIG_IR_IMG_HW
183
184enum img_ir_mode {
185 IMG_IR_M_NORMAL,
186 IMG_IR_M_REPEATING,
187#ifdef CONFIG_PM_SLEEP
188 IMG_IR_M_WAKE,
189#endif
190};
191
192/**
193 * struct img_ir_priv_hw - Private driver data for hardware decoder.
194 * @ct_quirks: Quirk bits for each code type.
195 * @rdev: Remote control device
196 * @clk_nb: Notifier block for clock notify events.
197 * @end_timer: Timer until repeat timeout.
198 * @decoder: Current decoder settings.
199 * @enabled_protocols: Currently enabled protocols.
200 * @clk_hz: Current core clock rate in Hz.
201 * @reg_timings: Timing reg values for decoder at clock rate.
202 * @flags: IMG_IR_F_*.
203 * @filters: HW filters (derived from scancode filters).
204 * @mode: Current decode mode.
205 * @suspend_irqen: Saved IRQ enable mask over suspend.
206 */
207struct img_ir_priv_hw {
208 unsigned int ct_quirks[4];
209 struct rc_dev *rdev;
210 struct notifier_block clk_nb;
211 struct timer_list end_timer;
212 const struct img_ir_decoder *decoder;
213 u64 enabled_protocols;
214 unsigned long clk_hz;
215 struct img_ir_reg_timings reg_timings;
216 unsigned int flags;
217 struct img_ir_filter filters[RC_FILTER_MAX];
218
219 enum img_ir_mode mode;
220 u32 suspend_irqen;
221};
222
223static inline bool img_ir_hw_enabled(struct img_ir_priv_hw *hw)
224{
225 return hw->rdev;
226};
227
228void img_ir_isr_hw(struct img_ir_priv *priv, u32 irq_status);
229void img_ir_setup_hw(struct img_ir_priv *priv);
230int img_ir_probe_hw(struct img_ir_priv *priv);
231void img_ir_remove_hw(struct img_ir_priv *priv);
232
233#ifdef CONFIG_PM_SLEEP
234int img_ir_suspend(struct device *dev);
235int img_ir_resume(struct device *dev);
236#else
237#define img_ir_suspend NULL
238#define img_ir_resume NULL
239#endif
240
241#else
242
243struct img_ir_priv_hw {
244};
245
246static inline bool img_ir_hw_enabled(struct img_ir_priv_hw *hw)
247{
248 return false;
249};
250static inline void img_ir_isr_hw(struct img_ir_priv *priv, u32 irq_status)
251{
252}
253static inline void img_ir_setup_hw(struct img_ir_priv *priv)
254{
255}
256static inline int img_ir_probe_hw(struct img_ir_priv *priv)
257{
258 return -ENODEV;
259}
260static inline void img_ir_remove_hw(struct img_ir_priv *priv)
261{
262}
263
264#define img_ir_suspend NULL
265#define img_ir_resume NULL
266
267#endif /* CONFIG_IR_IMG_HW */
268
269#endif /* _IMG_IR_HW_H_ */
diff --git a/drivers/media/rc/img-ir/img-ir-jvc.c b/drivers/media/rc/img-ir/img-ir-jvc.c
new file mode 100644
index 000000000000..10209d200efb
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-jvc.c
@@ -0,0 +1,81 @@
1/*
2 * ImgTec IR Decoder setup for JVC protocol.
3 *
4 * Copyright 2012-2014 Imagination Technologies Ltd.
5 */
6
7#include "img-ir-hw.h"
8
9/* Convert JVC data to a scancode */
10static int img_ir_jvc_scancode(int len, u64 raw, int *scancode, u64 protocols)
11{
12 unsigned int cust, data;
13
14 if (len != 16)
15 return -EINVAL;
16
17 cust = (raw >> 0) & 0xff;
18 data = (raw >> 8) & 0xff;
19
20 *scancode = cust << 8 | data;
21 return IMG_IR_SCANCODE;
22}
23
24/* Convert JVC scancode to JVC data filter */
25static int img_ir_jvc_filter(const struct rc_scancode_filter *in,
26 struct img_ir_filter *out, u64 protocols)
27{
28 unsigned int cust, data;
29 unsigned int cust_m, data_m;
30
31 cust = (in->data >> 8) & 0xff;
32 cust_m = (in->mask >> 8) & 0xff;
33 data = (in->data >> 0) & 0xff;
34 data_m = (in->mask >> 0) & 0xff;
35
36 out->data = cust | data << 8;
37 out->mask = cust_m | data_m << 8;
38
39 return 0;
40}
41
42/*
43 * JVC decoder
44 * See also http://www.sbprojects.com/knowledge/ir/jvc.php
45 * http://support.jvc.com/consumer/support/documents/RemoteCodes.pdf
46 */
47struct img_ir_decoder img_ir_jvc = {
48 .type = RC_BIT_JVC,
49 .control = {
50 .decoden = 1,
51 .code_type = IMG_IR_CODETYPE_PULSEDIST,
52 },
53 /* main timings */
54 .unit = 527500, /* 527.5 us */
55 .timings = {
56 /* leader symbol */
57 .ldr = {
58 .pulse = { 16 /* 8.44 ms */ },
59 .space = { 8 /* 4.22 ms */ },
60 },
61 /* 0 symbol */
62 .s00 = {
63 .pulse = { 1 /* 527.5 us +-60 us */ },
64 .space = { 1 /* 527.5 us */ },
65 },
66 /* 1 symbol */
67 .s01 = {
68 .pulse = { 1 /* 527.5 us +-60 us */ },
69 .space = { 3 /* 1.5825 ms +-40 us */ },
70 },
71 /* free time */
72 .ft = {
73 .minlen = 16,
74 .maxlen = 16,
75 .ft_min = 10, /* 5.275 ms */
76 },
77 },
78 /* scancode logic */
79 .scancode = img_ir_jvc_scancode,
80 .filter = img_ir_jvc_filter,
81};
diff --git a/drivers/media/rc/img-ir/img-ir-nec.c b/drivers/media/rc/img-ir/img-ir-nec.c
new file mode 100644
index 000000000000..e7a731bc3a9b
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-nec.c
@@ -0,0 +1,148 @@
1/*
2 * ImgTec IR Decoder setup for NEC protocol.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 */
6
7#include "img-ir-hw.h"
8
9/* Convert NEC data to a scancode */
10static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols)
11{
12 unsigned int addr, addr_inv, data, data_inv;
13 /* a repeat code has no data */
14 if (!len)
15 return IMG_IR_REPEATCODE;
16 if (len != 32)
17 return -EINVAL;
18 /* raw encoding: ddDDaaAA */
19 addr = (raw >> 0) & 0xff;
20 addr_inv = (raw >> 8) & 0xff;
21 data = (raw >> 16) & 0xff;
22 data_inv = (raw >> 24) & 0xff;
23 if ((data_inv ^ data) != 0xff) {
24 /* 32-bit NEC (used by Apple and TiVo remotes) */
25 /* scan encoding: aaAAddDD */
26 *scancode = addr_inv << 24 |
27 addr << 16 |
28 data_inv << 8 |
29 data;
30 } else if ((addr_inv ^ addr) != 0xff) {
31 /* Extended NEC */
32 /* scan encoding: AAaaDD */
33 *scancode = addr << 16 |
34 addr_inv << 8 |
35 data;
36 } else {
37 /* Normal NEC */
38 /* scan encoding: AADD */
39 *scancode = addr << 8 |
40 data;
41 }
42 return IMG_IR_SCANCODE;
43}
44
45/* Convert NEC scancode to NEC data filter */
46static int img_ir_nec_filter(const struct rc_scancode_filter *in,
47 struct img_ir_filter *out, u64 protocols)
48{
49 unsigned int addr, addr_inv, data, data_inv;
50 unsigned int addr_m, addr_inv_m, data_m, data_inv_m;
51
52 data = in->data & 0xff;
53 data_m = in->mask & 0xff;
54
55 if ((in->data | in->mask) & 0xff000000) {
56 /* 32-bit NEC (used by Apple and TiVo remotes) */
57 /* scan encoding: aaAAddDD */
58 addr_inv = (in->data >> 24) & 0xff;
59 addr_inv_m = (in->mask >> 24) & 0xff;
60 addr = (in->data >> 16) & 0xff;
61 addr_m = (in->mask >> 16) & 0xff;
62 data_inv = (in->data >> 8) & 0xff;
63 data_inv_m = (in->mask >> 8) & 0xff;
64 } else if ((in->data | in->mask) & 0x00ff0000) {
65 /* Extended NEC */
66 /* scan encoding AAaaDD */
67 addr = (in->data >> 16) & 0xff;
68 addr_m = (in->mask >> 16) & 0xff;
69 addr_inv = (in->data >> 8) & 0xff;
70 addr_inv_m = (in->mask >> 8) & 0xff;
71 data_inv = data ^ 0xff;
72 data_inv_m = data_m;
73 } else {
74 /* Normal NEC */
75 /* scan encoding: AADD */
76 addr = (in->data >> 8) & 0xff;
77 addr_m = (in->mask >> 8) & 0xff;
78 addr_inv = addr ^ 0xff;
79 addr_inv_m = addr_m;
80 data_inv = data ^ 0xff;
81 data_inv_m = data_m;
82 }
83
84 /* raw encoding: ddDDaaAA */
85 out->data = data_inv << 24 |
86 data << 16 |
87 addr_inv << 8 |
88 addr;
89 out->mask = data_inv_m << 24 |
90 data_m << 16 |
91 addr_inv_m << 8 |
92 addr_m;
93 return 0;
94}
95
96/*
97 * NEC decoder
98 * See also http://www.sbprojects.com/knowledge/ir/nec.php
99 * http://wiki.altium.com/display/ADOH/NEC+Infrared+Transmission+Protocol
100 */
101struct img_ir_decoder img_ir_nec = {
102 .type = RC_BIT_NEC,
103 .control = {
104 .decoden = 1,
105 .code_type = IMG_IR_CODETYPE_PULSEDIST,
106 },
107 /* main timings */
108 .unit = 562500, /* 562.5 us */
109 .timings = {
110 /* leader symbol */
111 .ldr = {
112 .pulse = { 16 /* 9ms */ },
113 .space = { 8 /* 4.5ms */ },
114 },
115 /* 0 symbol */
116 .s00 = {
117 .pulse = { 1 /* 562.5 us */ },
118 .space = { 1 /* 562.5 us */ },
119 },
120 /* 1 symbol */
121 .s01 = {
122 .pulse = { 1 /* 562.5 us */ },
123 .space = { 3 /* 1687.5 us */ },
124 },
125 /* free time */
126 .ft = {
127 .minlen = 32,
128 .maxlen = 32,
129 .ft_min = 10, /* 5.625 ms */
130 },
131 },
132 /* repeat codes */
133 .repeat = 108, /* 108 ms */
134 .rtimings = {
135 /* leader symbol */
136 .ldr = {
137 .space = { 4 /* 2.25 ms */ },
138 },
139 /* free time */
140 .ft = {
141 .minlen = 0, /* repeat code has no data */
142 .maxlen = 0,
143 },
144 },
145 /* scancode logic */
146 .scancode = img_ir_nec_scancode,
147 .filter = img_ir_nec_filter,
148};
diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c
new file mode 100644
index 000000000000..cfb01d9e571a
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-raw.c
@@ -0,0 +1,151 @@
1/*
2 * ImgTec IR Raw Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 *
6 * This ties into the input subsystem using the RC-core in raw mode. Raw IR
7 * signal edges are reported and decoded by generic software decoders.
8 */
9
10#include <linux/spinlock.h>
11#include <media/rc-core.h>
12#include "img-ir.h"
13
14#define ECHO_TIMEOUT_MS 150 /* ms between echos */
15
16/* must be called with priv->lock held */
17static void img_ir_refresh_raw(struct img_ir_priv *priv, u32 irq_status)
18{
19 struct img_ir_priv_raw *raw = &priv->raw;
20 struct rc_dev *rc_dev = priv->raw.rdev;
21 int multiple;
22 u32 ir_status;
23
24 /* find whether both rise and fall was detected */
25 multiple = ((irq_status & IMG_IR_IRQ_EDGE) == IMG_IR_IRQ_EDGE);
26 /*
27 * If so, we need to see if the level has actually changed.
28 * If it's just noise that we didn't have time to process,
29 * there's no point reporting it.
30 */
31 ir_status = img_ir_read(priv, IMG_IR_STATUS) & IMG_IR_IRRXD;
32 if (multiple && ir_status == raw->last_status)
33 return;
34 raw->last_status = ir_status;
35
36 /* report the edge to the IR raw decoders */
37 if (ir_status) /* low */
38 ir_raw_event_store_edge(rc_dev, IR_SPACE);
39 else /* high */
40 ir_raw_event_store_edge(rc_dev, IR_PULSE);
41 ir_raw_event_handle(rc_dev);
42}
43
44/* called with priv->lock held */
45void img_ir_isr_raw(struct img_ir_priv *priv, u32 irq_status)
46{
47 struct img_ir_priv_raw *raw = &priv->raw;
48
49 /* check not removing */
50 if (!raw->rdev)
51 return;
52
53 img_ir_refresh_raw(priv, irq_status);
54
55 /* start / push back the echo timer */
56 mod_timer(&raw->timer, jiffies + msecs_to_jiffies(ECHO_TIMEOUT_MS));
57}
58
59/*
60 * Echo timer callback function.
61 * The raw decoders expect to get a final sample even if there are no edges, in
62 * order to be assured of the final space. If there are no edges for a certain
63 * time we use this timer to emit a final sample to satisfy them.
64 */
65static void img_ir_echo_timer(unsigned long arg)
66{
67 struct img_ir_priv *priv = (struct img_ir_priv *)arg;
68
69 spin_lock_irq(&priv->lock);
70
71 /* check not removing */
72 if (priv->raw.rdev)
73 /*
74 * It's safe to pass irq_status=0 since it's only used to check
75 * for double edges.
76 */
77 img_ir_refresh_raw(priv, 0);
78
79 spin_unlock_irq(&priv->lock);
80}
81
82void img_ir_setup_raw(struct img_ir_priv *priv)
83{
84 u32 irq_en;
85
86 if (!priv->raw.rdev)
87 return;
88
89 /* clear and enable edge interrupts */
90 spin_lock_irq(&priv->lock);
91 irq_en = img_ir_read(priv, IMG_IR_IRQ_ENABLE);
92 irq_en |= IMG_IR_IRQ_EDGE;
93 img_ir_write(priv, IMG_IR_IRQ_CLEAR, IMG_IR_IRQ_EDGE);
94 img_ir_write(priv, IMG_IR_IRQ_ENABLE, irq_en);
95 spin_unlock_irq(&priv->lock);
96}
97
98int img_ir_probe_raw(struct img_ir_priv *priv)
99{
100 struct img_ir_priv_raw *raw = &priv->raw;
101 struct rc_dev *rdev;
102 int error;
103
104 /* Set up the echo timer */
105 setup_timer(&raw->timer, img_ir_echo_timer, (unsigned long)priv);
106
107 /* Allocate raw decoder */
108 raw->rdev = rdev = rc_allocate_device();
109 if (!rdev) {
110 dev_err(priv->dev, "cannot allocate raw input device\n");
111 return -ENOMEM;
112 }
113 rdev->priv = priv;
114 rdev->map_name = RC_MAP_EMPTY;
115 rdev->input_name = "IMG Infrared Decoder Raw";
116 rdev->driver_type = RC_DRIVER_IR_RAW;
117
118 /* Register raw decoder */
119 error = rc_register_device(rdev);
120 if (error) {
121 dev_err(priv->dev, "failed to register raw IR input device\n");
122 rc_free_device(rdev);
123 raw->rdev = NULL;
124 return error;
125 }
126
127 return 0;
128}
129
130void img_ir_remove_raw(struct img_ir_priv *priv)
131{
132 struct img_ir_priv_raw *raw = &priv->raw;
133 struct rc_dev *rdev = raw->rdev;
134 u32 irq_en;
135
136 if (!rdev)
137 return;
138
139 /* switch off and disable raw (edge) interrupts */
140 spin_lock_irq(&priv->lock);
141 raw->rdev = NULL;
142 irq_en = img_ir_read(priv, IMG_IR_IRQ_ENABLE);
143 irq_en &= ~IMG_IR_IRQ_EDGE;
144 img_ir_write(priv, IMG_IR_IRQ_ENABLE, irq_en);
145 img_ir_write(priv, IMG_IR_IRQ_CLEAR, IMG_IR_IRQ_EDGE);
146 spin_unlock_irq(&priv->lock);
147
148 rc_unregister_device(rdev);
149
150 del_timer_sync(&raw->timer);
151}
diff --git a/drivers/media/rc/img-ir/img-ir-raw.h b/drivers/media/rc/img-ir/img-ir-raw.h
new file mode 100644
index 000000000000..9802ffd51b9a
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-raw.h
@@ -0,0 +1,60 @@
1/*
2 * ImgTec IR Raw Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 */
6
7#ifndef _IMG_IR_RAW_H_
8#define _IMG_IR_RAW_H_
9
10struct img_ir_priv;
11
12#ifdef CONFIG_IR_IMG_RAW
13
14/**
15 * struct img_ir_priv_raw - Private driver data for raw decoder.
16 * @rdev: Raw remote control device
17 * @timer: Timer to echo samples to keep soft decoders happy.
18 * @last_status: Last raw status bits.
19 */
20struct img_ir_priv_raw {
21 struct rc_dev *rdev;
22 struct timer_list timer;
23 u32 last_status;
24};
25
26static inline bool img_ir_raw_enabled(struct img_ir_priv_raw *raw)
27{
28 return raw->rdev;
29};
30
31void img_ir_isr_raw(struct img_ir_priv *priv, u32 irq_status);
32void img_ir_setup_raw(struct img_ir_priv *priv);
33int img_ir_probe_raw(struct img_ir_priv *priv);
34void img_ir_remove_raw(struct img_ir_priv *priv);
35
36#else
37
38struct img_ir_priv_raw {
39};
40static inline bool img_ir_raw_enabled(struct img_ir_priv_raw *raw)
41{
42 return false;
43};
44static inline void img_ir_isr_raw(struct img_ir_priv *priv, u32 irq_status)
45{
46}
47static inline void img_ir_setup_raw(struct img_ir_priv *priv)
48{
49}
50static inline int img_ir_probe_raw(struct img_ir_priv *priv)
51{
52 return -ENODEV;
53}
54static inline void img_ir_remove_raw(struct img_ir_priv *priv)
55{
56}
57
58#endif /* CONFIG_IR_IMG_RAW */
59
60#endif /* _IMG_IR_RAW_H_ */
diff --git a/drivers/media/rc/img-ir/img-ir-sanyo.c b/drivers/media/rc/img-ir/img-ir-sanyo.c
new file mode 100644
index 000000000000..c2c763e08a41
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-sanyo.c
@@ -0,0 +1,122 @@
1/*
2 * ImgTec IR Decoder setup for Sanyo protocol.
3 *
4 * Copyright 2012-2014 Imagination Technologies Ltd.
5 *
6 * From ir-sanyo-decoder.c:
7 *
8 * This protocol uses the NEC protocol timings. However, data is formatted as:
9 * 13 bits Custom Code
10 * 13 bits NOT(Custom Code)
11 * 8 bits Key data
12 * 8 bits NOT(Key data)
13 *
14 * According with LIRC, this protocol is used on Sanyo, Aiwa and Chinon
15 * Information for this protocol is available at the Sanyo LC7461 datasheet.
16 */
17
18#include "img-ir-hw.h"
19
20/* Convert Sanyo data to a scancode */
21static int img_ir_sanyo_scancode(int len, u64 raw, int *scancode, u64 protocols)
22{
23 unsigned int addr, addr_inv, data, data_inv;
24 /* a repeat code has no data */
25 if (!len)
26 return IMG_IR_REPEATCODE;
27 if (len != 42)
28 return -EINVAL;
29 addr = (raw >> 0) & 0x1fff;
30 addr_inv = (raw >> 13) & 0x1fff;
31 data = (raw >> 26) & 0xff;
32 data_inv = (raw >> 34) & 0xff;
33 /* Validate data */
34 if ((data_inv ^ data) != 0xff)
35 return -EINVAL;
36 /* Validate address */
37 if ((addr_inv ^ addr) != 0x1fff)
38 return -EINVAL;
39
40 /* Normal Sanyo */
41 *scancode = addr << 8 | data;
42 return IMG_IR_SCANCODE;
43}
44
45/* Convert Sanyo scancode to Sanyo data filter */
46static int img_ir_sanyo_filter(const struct rc_scancode_filter *in,
47 struct img_ir_filter *out, u64 protocols)
48{
49 unsigned int addr, addr_inv, data, data_inv;
50 unsigned int addr_m, data_m;
51
52 data = in->data & 0xff;
53 data_m = in->mask & 0xff;
54 data_inv = data ^ 0xff;
55
56 if (in->data & 0xff700000)
57 return -EINVAL;
58
59 addr = (in->data >> 8) & 0x1fff;
60 addr_m = (in->mask >> 8) & 0x1fff;
61 addr_inv = addr ^ 0x1fff;
62
63 out->data = (u64)data_inv << 34 |
64 (u64)data << 26 |
65 addr_inv << 13 |
66 addr;
67 out->mask = (u64)data_m << 34 |
68 (u64)data_m << 26 |
69 addr_m << 13 |
70 addr_m;
71 return 0;
72}
73
74/* Sanyo decoder */
75struct img_ir_decoder img_ir_sanyo = {
76 .type = RC_BIT_SANYO,
77 .control = {
78 .decoden = 1,
79 .code_type = IMG_IR_CODETYPE_PULSEDIST,
80 },
81 /* main timings */
82 .unit = 562500, /* 562.5 us */
83 .timings = {
84 /* leader symbol */
85 .ldr = {
86 .pulse = { 16 /* 9ms */ },
87 .space = { 8 /* 4.5ms */ },
88 },
89 /* 0 symbol */
90 .s00 = {
91 .pulse = { 1 /* 562.5 us */ },
92 .space = { 1 /* 562.5 us */ },
93 },
94 /* 1 symbol */
95 .s01 = {
96 .pulse = { 1 /* 562.5 us */ },
97 .space = { 3 /* 1687.5 us */ },
98 },
99 /* free time */
100 .ft = {
101 .minlen = 42,
102 .maxlen = 42,
103 .ft_min = 10, /* 5.625 ms */
104 },
105 },
106 /* repeat codes */
107 .repeat = 108, /* 108 ms */
108 .rtimings = {
109 /* leader symbol */
110 .ldr = {
111 .space = { 4 /* 2.25 ms */ },
112 },
113 /* free time */
114 .ft = {
115 .minlen = 0, /* repeat code has no data */
116 .maxlen = 0,
117 },
118 },
119 /* scancode logic */
120 .scancode = img_ir_sanyo_scancode,
121 .filter = img_ir_sanyo_filter,
122};
diff --git a/drivers/media/rc/img-ir/img-ir-sharp.c b/drivers/media/rc/img-ir/img-ir-sharp.c
new file mode 100644
index 000000000000..3397cc5a6794
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-sharp.c
@@ -0,0 +1,99 @@
1/*
2 * ImgTec IR Decoder setup for Sharp protocol.
3 *
4 * Copyright 2012-2014 Imagination Technologies Ltd.
5 */
6
7#include "img-ir-hw.h"
8
9/* Convert Sharp data to a scancode */
10static int img_ir_sharp_scancode(int len, u64 raw, int *scancode, u64 protocols)
11{
12 unsigned int addr, cmd, exp, chk;
13
14 if (len != 15)
15 return -EINVAL;
16
17 addr = (raw >> 0) & 0x1f;
18 cmd = (raw >> 5) & 0xff;
19 exp = (raw >> 13) & 0x1;
20 chk = (raw >> 14) & 0x1;
21
22 /* validate data */
23 if (!exp)
24 return -EINVAL;
25 if (chk)
26 /* probably the second half of the message */
27 return -EINVAL;
28
29 *scancode = addr << 8 | cmd;
30 return IMG_IR_SCANCODE;
31}
32
33/* Convert Sharp scancode to Sharp data filter */
34static int img_ir_sharp_filter(const struct rc_scancode_filter *in,
35 struct img_ir_filter *out, u64 protocols)
36{
37 unsigned int addr, cmd, exp = 0, chk = 0;
38 unsigned int addr_m, cmd_m, exp_m = 0, chk_m = 0;
39
40 addr = (in->data >> 8) & 0x1f;
41 addr_m = (in->mask >> 8) & 0x1f;
42 cmd = (in->data >> 0) & 0xff;
43 cmd_m = (in->mask >> 0) & 0xff;
44 if (cmd_m) {
45 /* if filtering commands, we can only match the first part */
46 exp = 1;
47 exp_m = 1;
48 chk = 0;
49 chk_m = 1;
50 }
51
52 out->data = addr |
53 cmd << 5 |
54 exp << 13 |
55 chk << 14;
56 out->mask = addr_m |
57 cmd_m << 5 |
58 exp_m << 13 |
59 chk_m << 14;
60
61 return 0;
62}
63
64/*
65 * Sharp decoder
66 * See also http://www.sbprojects.com/knowledge/ir/sharp.php
67 */
68struct img_ir_decoder img_ir_sharp = {
69 .type = RC_BIT_SHARP,
70 .control = {
71 .decoden = 0,
72 .decodend2 = 1,
73 .code_type = IMG_IR_CODETYPE_PULSEDIST,
74 .d1validsel = 1,
75 },
76 /* main timings */
77 .tolerance = 20, /* 20% */
78 .timings = {
79 /* 0 symbol */
80 .s10 = {
81 .pulse = { 320 /* 320 us */ },
82 .space = { 680 /* 1 ms period */ },
83 },
84 /* 1 symbol */
85 .s11 = {
86 .pulse = { 320 /* 320 us */ },
87 .space = { 1680 /* 2 ms period */ },
88 },
89 /* free time */
90 .ft = {
91 .minlen = 15,
92 .maxlen = 15,
93 .ft_min = 5000, /* 5 ms */
94 },
95 },
96 /* scancode logic */
97 .scancode = img_ir_sharp_scancode,
98 .filter = img_ir_sharp_filter,
99};
diff --git a/drivers/media/rc/img-ir/img-ir-sony.c b/drivers/media/rc/img-ir/img-ir-sony.c
new file mode 100644
index 000000000000..993409a51a71
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir-sony.c
@@ -0,0 +1,145 @@
1/*
2 * ImgTec IR Decoder setup for Sony (SIRC) protocol.
3 *
4 * Copyright 2012-2014 Imagination Technologies Ltd.
5 */
6
7#include "img-ir-hw.h"
8
9/* Convert Sony data to a scancode */
10static int img_ir_sony_scancode(int len, u64 raw, int *scancode, u64 protocols)
11{
12 unsigned int dev, subdev, func;
13
14 switch (len) {
15 case 12:
16 if (!(protocols & RC_BIT_SONY12))
17 return -EINVAL;
18 func = raw & 0x7f; /* first 7 bits */
19 raw >>= 7;
20 dev = raw & 0x1f; /* next 5 bits */
21 subdev = 0;
22 break;
23 case 15:
24 if (!(protocols & RC_BIT_SONY15))
25 return -EINVAL;
26 func = raw & 0x7f; /* first 7 bits */
27 raw >>= 7;
28 dev = raw & 0xff; /* next 8 bits */
29 subdev = 0;
30 break;
31 case 20:
32 if (!(protocols & RC_BIT_SONY20))
33 return -EINVAL;
34 func = raw & 0x7f; /* first 7 bits */
35 raw >>= 7;
36 dev = raw & 0x1f; /* next 5 bits */
37 raw >>= 5;
38 subdev = raw & 0xff; /* next 8 bits */
39 break;
40 default:
41 return -EINVAL;
42 }
43 *scancode = dev << 16 | subdev << 8 | func;
44 return IMG_IR_SCANCODE;
45}
46
47/* Convert NEC scancode to NEC data filter */
48static int img_ir_sony_filter(const struct rc_scancode_filter *in,
49 struct img_ir_filter *out, u64 protocols)
50{
51 unsigned int dev, subdev, func;
52 unsigned int dev_m, subdev_m, func_m;
53 unsigned int len = 0;
54
55 dev = (in->data >> 16) & 0xff;
56 dev_m = (in->mask >> 16) & 0xff;
57 subdev = (in->data >> 8) & 0xff;
58 subdev_m = (in->mask >> 8) & 0xff;
59 func = (in->data >> 0) & 0x7f;
60 func_m = (in->mask >> 0) & 0x7f;
61
62 if (subdev & subdev_m) {
63 /* can't encode subdev and higher device bits */
64 if (dev & dev_m & 0xe0)
65 return -EINVAL;
66 /* subdevice (extended) bits only in 20 bit encoding */
67 if (!(protocols & RC_BIT_SONY20))
68 return -EINVAL;
69 len = 20;
70 dev_m &= 0x1f;
71 } else if (dev & dev_m & 0xe0) {
72 /* upper device bits only in 15 bit encoding */
73 if (!(protocols & RC_BIT_SONY15))
74 return -EINVAL;
75 len = 15;
76 subdev_m = 0;
77 } else {
78 /*
79 * The hardware mask cannot distinguish high device bits and low
80 * extended bits, so logically AND those bits of the masks
81 * together.
82 */
83 subdev_m &= (dev_m >> 5) | 0xf8;
84 dev_m &= 0x1f;
85 }
86
87 /* ensure there aren't any bits straying between fields */
88 dev &= dev_m;
89 subdev &= subdev_m;
90
91 /* write the hardware filter */
92 out->data = func |
93 dev << 7 |
94 subdev << 15;
95 out->mask = func_m |
96 dev_m << 7 |
97 subdev_m << 15;
98
99 if (len) {
100 out->minlen = len;
101 out->maxlen = len;
102 }
103 return 0;
104}
105
106/*
107 * Sony SIRC decoder
108 * See also http://www.sbprojects.com/knowledge/ir/sirc.php
109 * http://picprojects.org.uk/projects/sirc/sonysirc.pdf
110 */
111struct img_ir_decoder img_ir_sony = {
112 .type = RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20,
113 .control = {
114 .decoden = 1,
115 .code_type = IMG_IR_CODETYPE_PULSELEN,
116 },
117 /* main timings */
118 .unit = 600000, /* 600 us */
119 .timings = {
120 /* leader symbol */
121 .ldr = {
122 .pulse = { 4 /* 2.4 ms */ },
123 .space = { 1 /* 600 us */ },
124 },
125 /* 0 symbol */
126 .s00 = {
127 .pulse = { 1 /* 600 us */ },
128 .space = { 1 /* 600 us */ },
129 },
130 /* 1 symbol */
131 .s01 = {
132 .pulse = { 2 /* 1.2 ms */ },
133 .space = { 1 /* 600 us */ },
134 },
135 /* free time */
136 .ft = {
137 .minlen = 12,
138 .maxlen = 20,
139 .ft_min = 10, /* 6 ms */
140 },
141 },
142 /* scancode logic */
143 .scancode = img_ir_sony_scancode,
144 .filter = img_ir_sony_filter,
145};
diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
new file mode 100644
index 000000000000..afb189394af9
--- /dev/null
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -0,0 +1,166 @@
1/*
2 * ImgTec IR Decoder found in PowerDown Controller.
3 *
4 * Copyright 2010-2014 Imagination Technologies Ltd.
5 */
6
7#ifndef _IMG_IR_H_
8#define _IMG_IR_H_
9
10#include <linux/io.h>
11#include <linux/spinlock.h>
12
13#include "img-ir-raw.h"
14#include "img-ir-hw.h"
15
16/* registers */
17
18/* relative to the start of the IR block of registers */
19#define IMG_IR_CONTROL 0x00
20#define IMG_IR_STATUS 0x04
21#define IMG_IR_DATA_LW 0x08
22#define IMG_IR_DATA_UP 0x0c
23#define IMG_IR_LEAD_SYMB_TIMING 0x10
24#define IMG_IR_S00_SYMB_TIMING 0x14
25#define IMG_IR_S01_SYMB_TIMING 0x18
26#define IMG_IR_S10_SYMB_TIMING 0x1c
27#define IMG_IR_S11_SYMB_TIMING 0x20
28#define IMG_IR_FREE_SYMB_TIMING 0x24
29#define IMG_IR_POW_MOD_PARAMS 0x28
30#define IMG_IR_POW_MOD_ENABLE 0x2c
31#define IMG_IR_IRQ_MSG_DATA_LW 0x30
32#define IMG_IR_IRQ_MSG_DATA_UP 0x34
33#define IMG_IR_IRQ_MSG_MASK_LW 0x38
34#define IMG_IR_IRQ_MSG_MASK_UP 0x3c
35#define IMG_IR_IRQ_ENABLE 0x40
36#define IMG_IR_IRQ_STATUS 0x44
37#define IMG_IR_IRQ_CLEAR 0x48
38#define IMG_IR_IRCORE_ID 0xf0
39#define IMG_IR_CORE_REV 0xf4
40#define IMG_IR_CORE_DES1 0xf8
41#define IMG_IR_CORE_DES2 0xfc
42
43
44/* field masks */
45
46/* IMG_IR_CONTROL */
47#define IMG_IR_DECODEN 0x40000000
48#define IMG_IR_CODETYPE 0x30000000
49#define IMG_IR_CODETYPE_SHIFT 28
50#define IMG_IR_HDRTOG 0x08000000
51#define IMG_IR_LDRDEC 0x04000000
52#define IMG_IR_DECODINPOL 0x02000000 /* active high */
53#define IMG_IR_BITORIEN 0x01000000 /* MSB first */
54#define IMG_IR_D1VALIDSEL 0x00008000
55#define IMG_IR_BITINV 0x00000040 /* don't invert */
56#define IMG_IR_DECODEND2 0x00000010
57#define IMG_IR_BITORIEND2 0x00000002 /* MSB first */
58#define IMG_IR_BITINVD2 0x00000001 /* don't invert */
59
60/* IMG_IR_STATUS */
61#define IMG_IR_RXDVALD2 0x00001000
62#define IMG_IR_IRRXD 0x00000400
63#define IMG_IR_TOGSTATE 0x00000200
64#define IMG_IR_RXDVAL 0x00000040
65#define IMG_IR_RXDLEN 0x0000003f
66#define IMG_IR_RXDLEN_SHIFT 0
67
68/* IMG_IR_LEAD_SYMB_TIMING, IMG_IR_Sxx_SYMB_TIMING */
69#define IMG_IR_PD_MAX 0xff000000
70#define IMG_IR_PD_MAX_SHIFT 24
71#define IMG_IR_PD_MIN 0x00ff0000
72#define IMG_IR_PD_MIN_SHIFT 16
73#define IMG_IR_W_MAX 0x0000ff00
74#define IMG_IR_W_MAX_SHIFT 8
75#define IMG_IR_W_MIN 0x000000ff
76#define IMG_IR_W_MIN_SHIFT 0
77
78/* IMG_IR_FREE_SYMB_TIMING */
79#define IMG_IR_MAXLEN 0x0007e000
80#define IMG_IR_MAXLEN_SHIFT 13
81#define IMG_IR_MINLEN 0x00001f00
82#define IMG_IR_MINLEN_SHIFT 8
83#define IMG_IR_FT_MIN 0x000000ff
84#define IMG_IR_FT_MIN_SHIFT 0
85
86/* IMG_IR_POW_MOD_PARAMS */
87#define IMG_IR_PERIOD_LEN 0x3f000000
88#define IMG_IR_PERIOD_LEN_SHIFT 24
89#define IMG_IR_PERIOD_DUTY 0x003f0000
90#define IMG_IR_PERIOD_DUTY_SHIFT 16
91#define IMG_IR_STABLE_STOP 0x00003f00
92#define IMG_IR_STABLE_STOP_SHIFT 8
93#define IMG_IR_STABLE_START 0x0000003f
94#define IMG_IR_STABLE_START_SHIFT 0
95
96/* IMG_IR_POW_MOD_ENABLE */
97#define IMG_IR_POWER_OUT_EN 0x00000002
98#define IMG_IR_POWER_MOD_EN 0x00000001
99
100/* IMG_IR_IRQ_ENABLE, IMG_IR_IRQ_STATUS, IMG_IR_IRQ_CLEAR */
101#define IMG_IR_IRQ_DEC2_ERR 0x00000080
102#define IMG_IR_IRQ_DEC_ERR 0x00000040
103#define IMG_IR_IRQ_ACT_LEVEL 0x00000020
104#define IMG_IR_IRQ_FALL_EDGE 0x00000010
105#define IMG_IR_IRQ_RISE_EDGE 0x00000008
106#define IMG_IR_IRQ_DATA_MATCH 0x00000004
107#define IMG_IR_IRQ_DATA2_VALID 0x00000002
108#define IMG_IR_IRQ_DATA_VALID 0x00000001
109#define IMG_IR_IRQ_ALL 0x000000ff
110#define IMG_IR_IRQ_EDGE (IMG_IR_IRQ_FALL_EDGE | IMG_IR_IRQ_RISE_EDGE)
111
112/* IMG_IR_CORE_ID */
113#define IMG_IR_CORE_ID 0x00ff0000
114#define IMG_IR_CORE_ID_SHIFT 16
115#define IMG_IR_CORE_CONFIG 0x0000ffff
116#define IMG_IR_CORE_CONFIG_SHIFT 0
117
118/* IMG_IR_CORE_REV */
119#define IMG_IR_DESIGNER 0xff000000
120#define IMG_IR_DESIGNER_SHIFT 24
121#define IMG_IR_MAJOR_REV 0x00ff0000
122#define IMG_IR_MAJOR_REV_SHIFT 16
123#define IMG_IR_MINOR_REV 0x0000ff00
124#define IMG_IR_MINOR_REV_SHIFT 8
125#define IMG_IR_MAINT_REV 0x000000ff
126#define IMG_IR_MAINT_REV_SHIFT 0
127
128struct device;
129struct clk;
130
131/**
132 * struct img_ir_priv - Private driver data.
133 * @dev: Platform device.
134 * @irq: IRQ number.
135 * @clk: Input clock.
136 * @reg_base: Iomem base address of IR register block.
137 * @lock: Protects IR registers and variables in this struct.
138 * @raw: Driver data for raw decoder.
139 * @hw: Driver data for hardware decoder.
140 */
141struct img_ir_priv {
142 struct device *dev;
143 int irq;
144 struct clk *clk;
145 void __iomem *reg_base;
146 spinlock_t lock;
147
148 struct img_ir_priv_raw raw;
149 struct img_ir_priv_hw hw;
150};
151
152/* Hardware access */
153
154static inline void img_ir_write(struct img_ir_priv *priv,
155 unsigned int reg_offs, unsigned int data)
156{
157 iowrite32(data, priv->reg_base + reg_offs);
158}
159
160static inline unsigned int img_ir_read(struct img_ir_priv *priv,
161 unsigned int reg_offs)
162{
163 return ioread32(priv->reg_base + reg_offs);
164}
165
166#endif /* _IMG_IR_H_ */
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 822b9f47ca72..6f24e77b1488 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1017,7 +1017,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
1017 unsigned char ir_proto_packet[] = { 1017 unsigned char ir_proto_packet[] = {
1018 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 1018 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
1019 1019
1020 if (*rc_type && !(*rc_type & rc->allowed_protos)) 1020 if (*rc_type && !rc_protocols_allowed(rc, *rc_type))
1021 dev_warn(dev, "Looks like you're trying to use an IR protocol " 1021 dev_warn(dev, "Looks like you're trying to use an IR protocol "
1022 "this device does not support\n"); 1022 "this device does not support\n");
1023 1023
@@ -1867,7 +1867,8 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1867 1867
1868 rdev->priv = ictx; 1868 rdev->priv = ictx;
1869 rdev->driver_type = RC_DRIVER_SCANCODE; 1869 rdev->driver_type = RC_DRIVER_SCANCODE;
1870 rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */ 1870 /* iMON PAD or MCE */
1871 rc_set_allowed_protocols(rdev, RC_BIT_OTHER | RC_BIT_RC6_MCE);
1871 rdev->change_protocol = imon_ir_change_protocol; 1872 rdev->change_protocol = imon_ir_change_protocol;
1872 rdev->driver_name = MOD_NAME; 1873 rdev->driver_name = MOD_NAME;
1873 1874
@@ -1880,7 +1881,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1880 1881
1881 if (ictx->product == 0xffdc) { 1882 if (ictx->product == 0xffdc) {
1882 imon_get_ffdc_type(ictx); 1883 imon_get_ffdc_type(ictx);
1883 rdev->allowed_protos = ictx->rc_type; 1884 rc_set_allowed_protocols(rdev, ictx->rc_type);
1884 } 1885 }
1885 1886
1886 imon_set_display_type(ictx); 1887 imon_set_display_type(ictx);
diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c
index 3948138ca870..4ea62a1dcfda 100644
--- a/drivers/media/rc/ir-jvc-decoder.c
+++ b/drivers/media/rc/ir-jvc-decoder.c
@@ -47,7 +47,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
47{ 47{
48 struct jvc_dec *data = &dev->raw->jvc; 48 struct jvc_dec *data = &dev->raw->jvc;
49 49
50 if (!(dev->enabled_protocols & RC_BIT_JVC)) 50 if (!rc_protocols_enabled(dev, RC_BIT_JVC))
51 return 0; 51 return 0;
52 52
53 if (!is_timing_event(ev)) { 53 if (!is_timing_event(ev)) {
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index ed2c8a1ed8ca..d731da6c414d 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -35,7 +35,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
35 struct lirc_codec *lirc = &dev->raw->lirc; 35 struct lirc_codec *lirc = &dev->raw->lirc;
36 int sample; 36 int sample;
37 37
38 if (!(dev->enabled_protocols & RC_BIT_LIRC)) 38 if (!rc_protocols_enabled(dev, RC_BIT_LIRC))
39 return 0; 39 return 0;
40 40
41 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) 41 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c
index 9f3c9b59f30c..0c55f794c8cf 100644
--- a/drivers/media/rc/ir-mce_kbd-decoder.c
+++ b/drivers/media/rc/ir-mce_kbd-decoder.c
@@ -216,7 +216,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
216 u32 scancode; 216 u32 scancode;
217 unsigned long delay; 217 unsigned long delay;
218 218
219 if (!(dev->enabled_protocols & RC_BIT_MCE_KBD)) 219 if (!rc_protocols_enabled(dev, RC_BIT_MCE_KBD))
220 return 0; 220 return 0;
221 221
222 if (!is_timing_event(ev)) { 222 if (!is_timing_event(ev)) {
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index 9a9009411439..9de1791d2494 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -1,6 +1,6 @@
1/* ir-nec-decoder.c - handle NEC IR Pulse/Space protocol 1/* ir-nec-decoder.c - handle NEC IR Pulse/Space protocol
2 * 2 *
3 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2010 by Mauro Carvalho Chehab
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
52 u8 address, not_address, command, not_command; 52 u8 address, not_address, command, not_command;
53 bool send_32bits = false; 53 bool send_32bits = false;
54 54
55 if (!(dev->enabled_protocols & RC_BIT_NEC)) 55 if (!rc_protocols_enabled(dev, RC_BIT_NEC))
56 return 0; 56 return 0;
57 57
58 if (!is_timing_event(ev)) { 58 if (!is_timing_event(ev)) {
@@ -172,7 +172,10 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
172 if (send_32bits) { 172 if (send_32bits) {
173 /* NEC transport, but modified protocol, used by at 173 /* NEC transport, but modified protocol, used by at
174 * least Apple and TiVo remotes */ 174 * least Apple and TiVo remotes */
175 scancode = data->bits; 175 scancode = not_address << 24 |
176 address << 16 |
177 not_command << 8 |
178 command;
176 IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode); 179 IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
177 } else if ((address ^ not_address) != 0xff) { 180 } else if ((address ^ not_address) != 0xff) {
178 /* Extended NEC */ 181 /* Extended NEC */
@@ -222,6 +225,6 @@ module_init(ir_nec_decode_init);
222module_exit(ir_nec_decode_exit); 225module_exit(ir_nec_decode_exit);
223 226
224MODULE_LICENSE("GPL"); 227MODULE_LICENSE("GPL");
225MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 228MODULE_AUTHOR("Mauro Carvalho Chehab");
226MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); 229MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
227MODULE_DESCRIPTION("NEC IR protocol decoder"); 230MODULE_DESCRIPTION("NEC IR protocol decoder");
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index 5c42750c7b71..763c9d131d0f 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -1,6 +1,6 @@
1/* ir-raw.c - handle IR pulse/space events 1/* ir-raw.c - handle IR pulse/space events
2 * 2 *
3 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2010 by Mauro Carvalho Chehab
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ int ir_raw_event_register(struct rc_dev *dev)
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 dev->raw->dev = dev; 258 dev->raw->dev = dev;
259 dev->enabled_protocols = ~0; 259 rc_set_enabled_protocols(dev, ~0);
260 rc = kfifo_alloc(&dev->raw->kfifo, 260 rc = kfifo_alloc(&dev->raw->kfifo,
261 sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE, 261 sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE,
262 GFP_KERNEL); 262 GFP_KERNEL);
@@ -352,6 +352,7 @@ void ir_raw_init(void)
352 load_jvc_decode(); 352 load_jvc_decode();
353 load_sony_decode(); 353 load_sony_decode();
354 load_sanyo_decode(); 354 load_sanyo_decode();
355 load_sharp_decode();
355 load_mce_kbd_decode(); 356 load_mce_kbd_decode();
356 load_lirc_codec(); 357 load_lirc_codec();
357 358
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c
index 4e53a319c5d8..4295d9b250c8 100644
--- a/drivers/media/rc/ir-rc5-decoder.c
+++ b/drivers/media/rc/ir-rc5-decoder.c
@@ -1,6 +1,6 @@
1/* ir-rc5-decoder.c - handle RC5(x) IR Pulse/Space protocol 1/* ir-rc5-decoder.c - handle RC5(x) IR Pulse/Space protocol
2 * 2 *
3 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2010 by Mauro Carvalho Chehab
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
52 u8 toggle; 52 u8 toggle;
53 u32 scancode; 53 u32 scancode;
54 54
55 if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X))) 55 if (!rc_protocols_enabled(dev, RC_BIT_RC5 | RC_BIT_RC5X))
56 return 0; 56 return 0;
57 57
58 if (!is_timing_event(ev)) { 58 if (!is_timing_event(ev)) {
@@ -128,7 +128,7 @@ again:
128 if (data->wanted_bits == RC5X_NBITS) { 128 if (data->wanted_bits == RC5X_NBITS) {
129 /* RC5X */ 129 /* RC5X */
130 u8 xdata, command, system; 130 u8 xdata, command, system;
131 if (!(dev->enabled_protocols & RC_BIT_RC5X)) { 131 if (!rc_protocols_enabled(dev, RC_BIT_RC5X)) {
132 data->state = STATE_INACTIVE; 132 data->state = STATE_INACTIVE;
133 return 0; 133 return 0;
134 } 134 }
@@ -145,7 +145,7 @@ again:
145 } else { 145 } else {
146 /* RC5 */ 146 /* RC5 */
147 u8 command, system; 147 u8 command, system;
148 if (!(dev->enabled_protocols & RC_BIT_RC5)) { 148 if (!rc_protocols_enabled(dev, RC_BIT_RC5)) {
149 data->state = STATE_INACTIVE; 149 data->state = STATE_INACTIVE;
150 return 0; 150 return 0;
151 } 151 }
@@ -193,6 +193,6 @@ module_init(ir_rc5_decode_init);
193module_exit(ir_rc5_decode_exit); 193module_exit(ir_rc5_decode_exit);
194 194
195MODULE_LICENSE("GPL"); 195MODULE_LICENSE("GPL");
196MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 196MODULE_AUTHOR("Mauro Carvalho Chehab");
197MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); 197MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
198MODULE_DESCRIPTION("RC5(x) IR protocol decoder"); 198MODULE_DESCRIPTION("RC5(x) IR protocol decoder");
diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c
index 865fe84fd854..dc18b7434db8 100644
--- a/drivers/media/rc/ir-rc5-sz-decoder.c
+++ b/drivers/media/rc/ir-rc5-sz-decoder.c
@@ -1,6 +1,6 @@
1/* ir-rc5-sz-decoder.c - handle RC5 Streamzap IR Pulse/Space protocol 1/* ir-rc5-sz-decoder.c - handle RC5 Streamzap IR Pulse/Space protocol
2 * 2 *
3 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2010 by Mauro Carvalho Chehab
4 * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> 4 * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
@@ -48,7 +48,7 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev)
48 u8 toggle, command, system; 48 u8 toggle, command, system;
49 u32 scancode; 49 u32 scancode;
50 50
51 if (!(dev->enabled_protocols & RC_BIT_RC5_SZ)) 51 if (!rc_protocols_enabled(dev, RC_BIT_RC5_SZ))
52 return 0; 52 return 0;
53 53
54 if (!is_timing_event(ev)) { 54 if (!is_timing_event(ev)) {
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c
index 7cba7d33a3fa..cfbd64e3999c 100644
--- a/drivers/media/rc/ir-rc6-decoder.c
+++ b/drivers/media/rc/ir-rc6-decoder.c
@@ -89,9 +89,9 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
89 u32 scancode; 89 u32 scancode;
90 u8 toggle; 90 u8 toggle;
91 91
92 if (!(dev->enabled_protocols & 92 if (!rc_protocols_enabled(dev, RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 |
93 (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | 93 RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 |
94 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE))) 94 RC_BIT_RC6_MCE))
95 return 0; 95 return 0;
96 96
97 if (!is_timing_event(ev)) { 97 if (!is_timing_event(ev)) {
diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c
index 0a06205b5677..eb715f04dc27 100644
--- a/drivers/media/rc/ir-sanyo-decoder.c
+++ b/drivers/media/rc/ir-sanyo-decoder.c
@@ -1,6 +1,6 @@
1/* ir-sanyo-decoder.c - handle SANYO IR Pulse/Space protocol 1/* ir-sanyo-decoder.c - handle SANYO IR Pulse/Space protocol
2 * 2 *
3 * Copyright (C) 2011 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2011 by Mauro Carvalho Chehab
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
58 u32 scancode; 58 u32 scancode;
59 u8 address, command, not_command; 59 u8 address, command, not_command;
60 60
61 if (!(dev->enabled_protocols & RC_BIT_SANYO)) 61 if (!rc_protocols_enabled(dev, RC_BIT_SANYO))
62 return 0; 62 return 0;
63 63
64 if (!is_timing_event(ev)) { 64 if (!is_timing_event(ev)) {
@@ -200,6 +200,6 @@ module_init(ir_sanyo_decode_init);
200module_exit(ir_sanyo_decode_exit); 200module_exit(ir_sanyo_decode_exit);
201 201
202MODULE_LICENSE("GPL"); 202MODULE_LICENSE("GPL");
203MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 203MODULE_AUTHOR("Mauro Carvalho Chehab");
204MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); 204MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
205MODULE_DESCRIPTION("SANYO IR protocol decoder"); 205MODULE_DESCRIPTION("SANYO IR protocol decoder");
diff --git a/drivers/media/rc/ir-sharp-decoder.c b/drivers/media/rc/ir-sharp-decoder.c
new file mode 100644
index 000000000000..66d20394ceaa
--- /dev/null
+++ b/drivers/media/rc/ir-sharp-decoder.c
@@ -0,0 +1,200 @@
1/* ir-sharp-decoder.c - handle Sharp IR Pulse/Space protocol
2 *
3 * Copyright (C) 2013-2014 Imagination Technologies Ltd.
4 *
5 * Based on NEC decoder:
6 * Copyright (C) 2010 by Mauro Carvalho Chehab
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/bitrev.h>
19#include <linux/module.h>
20#include "rc-core-priv.h"
21
22#define SHARP_NBITS 15
23#define SHARP_UNIT 40000 /* ns */
24#define SHARP_BIT_PULSE (8 * SHARP_UNIT) /* 320us */
25#define SHARP_BIT_0_PERIOD (25 * SHARP_UNIT) /* 1ms (680us space) */
26#define SHARP_BIT_1_PERIOD (50 * SHARP_UNIT) /* 2ms (1680ms space) */
27#define SHARP_ECHO_SPACE (1000 * SHARP_UNIT) /* 40 ms */
28#define SHARP_TRAILER_SPACE (125 * SHARP_UNIT) /* 5 ms (even longer) */
29
30enum sharp_state {
31 STATE_INACTIVE,
32 STATE_BIT_PULSE,
33 STATE_BIT_SPACE,
34 STATE_TRAILER_PULSE,
35 STATE_ECHO_SPACE,
36 STATE_TRAILER_SPACE,
37};
38
39/**
40 * ir_sharp_decode() - Decode one Sharp pulse or space
41 * @dev: the struct rc_dev descriptor of the device
42 * @duration: the struct ir_raw_event descriptor of the pulse/space
43 *
44 * This function returns -EINVAL if the pulse violates the state machine
45 */
46static int ir_sharp_decode(struct rc_dev *dev, struct ir_raw_event ev)
47{
48 struct sharp_dec *data = &dev->raw->sharp;
49 u32 msg, echo, address, command, scancode;
50
51 if (!rc_protocols_enabled(dev, RC_BIT_SHARP))
52 return 0;
53
54 if (!is_timing_event(ev)) {
55 if (ev.reset)
56 data->state = STATE_INACTIVE;
57 return 0;
58 }
59
60 IR_dprintk(2, "Sharp decode started at state %d (%uus %s)\n",
61 data->state, TO_US(ev.duration), TO_STR(ev.pulse));
62
63 switch (data->state) {
64
65 case STATE_INACTIVE:
66 if (!ev.pulse)
67 break;
68
69 if (!eq_margin(ev.duration, SHARP_BIT_PULSE,
70 SHARP_BIT_PULSE / 2))
71 break;
72
73 data->count = 0;
74 data->pulse_len = ev.duration;
75 data->state = STATE_BIT_SPACE;
76 return 0;
77
78 case STATE_BIT_PULSE:
79 if (!ev.pulse)
80 break;
81
82 if (!eq_margin(ev.duration, SHARP_BIT_PULSE,
83 SHARP_BIT_PULSE / 2))
84 break;
85
86 data->pulse_len = ev.duration;
87 data->state = STATE_BIT_SPACE;
88 return 0;
89
90 case STATE_BIT_SPACE:
91 if (ev.pulse)
92 break;
93
94 data->bits <<= 1;
95 if (eq_margin(data->pulse_len + ev.duration, SHARP_BIT_1_PERIOD,
96 SHARP_BIT_PULSE * 2))
97 data->bits |= 1;
98 else if (!eq_margin(data->pulse_len + ev.duration,
99 SHARP_BIT_0_PERIOD, SHARP_BIT_PULSE * 2))
100 break;
101 data->count++;
102
103 if (data->count == SHARP_NBITS ||
104 data->count == SHARP_NBITS * 2)
105 data->state = STATE_TRAILER_PULSE;
106 else
107 data->state = STATE_BIT_PULSE;
108
109 return 0;
110
111 case STATE_TRAILER_PULSE:
112 if (!ev.pulse)
113 break;
114
115 if (!eq_margin(ev.duration, SHARP_BIT_PULSE,
116 SHARP_BIT_PULSE / 2))
117 break;
118
119 if (data->count == SHARP_NBITS) {
120 /* exp,chk bits should be 1,0 */
121 if ((data->bits & 0x3) != 0x2)
122 break;
123 data->state = STATE_ECHO_SPACE;
124 } else {
125 data->state = STATE_TRAILER_SPACE;
126 }
127 return 0;
128
129 case STATE_ECHO_SPACE:
130 if (ev.pulse)
131 break;
132
133 if (!eq_margin(ev.duration, SHARP_ECHO_SPACE,
134 SHARP_ECHO_SPACE / 4))
135 break;
136
137 data->state = STATE_BIT_PULSE;
138
139 return 0;
140
141 case STATE_TRAILER_SPACE:
142 if (ev.pulse)
143 break;
144
145 if (!geq_margin(ev.duration, SHARP_TRAILER_SPACE,
146 SHARP_BIT_PULSE / 2))
147 break;
148
149 /* Validate - command, ext, chk should be inverted in 2nd */
150 msg = (data->bits >> 15) & 0x7fff;
151 echo = data->bits & 0x7fff;
152 if ((msg ^ echo) != 0x3ff) {
153 IR_dprintk(1,
154 "Sharp checksum error: received 0x%04x, 0x%04x\n",
155 msg, echo);
156 break;
157 }
158
159 address = bitrev8((msg >> 7) & 0xf8);
160 command = bitrev8((msg >> 2) & 0xff);
161
162 scancode = address << 8 | command;
163 IR_dprintk(1, "Sharp scancode 0x%04x\n", scancode);
164
165 rc_keydown(dev, scancode, 0);
166 data->state = STATE_INACTIVE;
167 return 0;
168 }
169
170 IR_dprintk(1, "Sharp decode failed at count %d state %d (%uus %s)\n",
171 data->count, data->state, TO_US(ev.duration),
172 TO_STR(ev.pulse));
173 data->state = STATE_INACTIVE;
174 return -EINVAL;
175}
176
177static struct ir_raw_handler sharp_handler = {
178 .protocols = RC_BIT_SHARP,
179 .decode = ir_sharp_decode,
180};
181
182static int __init ir_sharp_decode_init(void)
183{
184 ir_raw_handler_register(&sharp_handler);
185
186 pr_info("IR Sharp protocol handler initialized\n");
187 return 0;
188}
189
190static void __exit ir_sharp_decode_exit(void)
191{
192 ir_raw_handler_unregister(&sharp_handler);
193}
194
195module_init(ir_sharp_decode_init);
196module_exit(ir_sharp_decode_exit);
197
198MODULE_LICENSE("GPL");
199MODULE_AUTHOR("James Hogan <james.hogan@imgtec.com>");
200MODULE_DESCRIPTION("Sharp IR protocol decoder");
diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c
index 29ab9c2db060..599c19a73360 100644
--- a/drivers/media/rc/ir-sony-decoder.c
+++ b/drivers/media/rc/ir-sony-decoder.c
@@ -45,8 +45,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
45 u32 scancode; 45 u32 scancode;
46 u8 device, subdevice, function; 46 u8 device, subdevice, function;
47 47
48 if (!(dev->enabled_protocols & 48 if (!rc_protocols_enabled(dev, RC_BIT_SONY12 | RC_BIT_SONY15 |
49 (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20))) 49 RC_BIT_SONY20))
50 return 0; 50 return 0;
51 51
52 if (!is_timing_event(ev)) { 52 if (!is_timing_event(ev)) {
@@ -124,7 +124,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
124 124
125 switch (data->count) { 125 switch (data->count) {
126 case 12: 126 case 12:
127 if (!(dev->enabled_protocols & RC_BIT_SONY12)) { 127 if (!rc_protocols_enabled(dev, RC_BIT_SONY12)) {
128 data->state = STATE_INACTIVE; 128 data->state = STATE_INACTIVE;
129 return 0; 129 return 0;
130 } 130 }
@@ -133,7 +133,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
133 function = bitrev8((data->bits >> 4) & 0xFE); 133 function = bitrev8((data->bits >> 4) & 0xFE);
134 break; 134 break;
135 case 15: 135 case 15:
136 if (!(dev->enabled_protocols & RC_BIT_SONY15)) { 136 if (!rc_protocols_enabled(dev, RC_BIT_SONY15)) {
137 data->state = STATE_INACTIVE; 137 data->state = STATE_INACTIVE;
138 return 0; 138 return 0;
139 } 139 }
@@ -142,7 +142,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
142 function = bitrev8((data->bits >> 7) & 0xFE); 142 function = bitrev8((data->bits >> 7) & 0xFE);
143 break; 143 break;
144 case 20: 144 case 20:
145 if (!(dev->enabled_protocols & RC_BIT_SONY20)) { 145 if (!rc_protocols_enabled(dev, RC_BIT_SONY20)) {
146 data->state = STATE_INACTIVE; 146 data->state = STATE_INACTIVE;
147 return 0; 147 return 0;
148 } 148 }
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 63b42252166a..ab24cc6d3655 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1563,7 +1563,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1563 /* set up ir-core props */ 1563 /* set up ir-core props */
1564 rdev->priv = itdev; 1564 rdev->priv = itdev;
1565 rdev->driver_type = RC_DRIVER_IR_RAW; 1565 rdev->driver_type = RC_DRIVER_IR_RAW;
1566 rdev->allowed_protos = RC_BIT_ALL; 1566 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
1567 rdev->open = ite_open; 1567 rdev->open = ite_open;
1568 rdev->close = ite_close; 1568 rdev->close = ite_close;
1569 rdev->s_idle = ite_s_idle; 1569 rdev->s_idle = ite_s_idle;
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 b0e42df7ff82..01d901fbfc8b 100644
--- a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c
+++ b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -87,4 +87,4 @@ module_init(init_rc_map_adstech_dvb_t_pci)
87module_exit(exit_rc_map_adstech_dvb_t_pci) 87module_exit(exit_rc_map_adstech_dvb_t_pci)
88 88
89MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 90MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-apac-viewcomp.c b/drivers/media/rc/keymaps/rc-apac-viewcomp.c
index 8c92ff95f94d..bf9efa007e1c 100644
--- a/drivers/media/rc/keymaps/rc-apac-viewcomp.c
+++ b/drivers/media/rc/keymaps/rc-apac-viewcomp.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -78,4 +78,4 @@ module_init(init_rc_map_apac_viewcomp)
78module_exit(exit_rc_map_apac_viewcomp) 78module_exit(exit_rc_map_apac_viewcomp)
79 79
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 81MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-asus-pc39.c b/drivers/media/rc/keymaps/rc-asus-pc39.c
index 2caf2117759b..9e674ba5dd4f 100644
--- a/drivers/media/rc/keymaps/rc-asus-pc39.c
+++ b/drivers/media/rc/keymaps/rc-asus-pc39.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -89,4 +89,4 @@ module_init(init_rc_map_asus_pc39)
89module_exit(exit_rc_map_asus_pc39) 89module_exit(exit_rc_map_asus_pc39)
90 90
91MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
92MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 92MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-asus-ps3-100.c b/drivers/media/rc/keymaps/rc-asus-ps3-100.c
index ba76609c5936..e45de35f528f 100644
--- a/drivers/media/rc/keymaps/rc-asus-ps3-100.c
+++ b/drivers/media/rc/keymaps/rc-asus-ps3-100.c
@@ -1,6 +1,6 @@
1/* asus-ps3-100.h - Keytable for asus_ps3_100 Remote Controller 1/* asus-ps3-100.h - Keytable for asus_ps3_100 Remote Controller
2 * 2 *
3 * Copyright (c) 2012 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (c) 2012 by Mauro Carvalho Chehab
4 * 4 *
5 * Based on a previous patch from Remi Schwartz <remi.schwartz@gmail.com> 5 * Based on a previous patch from Remi Schwartz <remi.schwartz@gmail.com>
6 * 6 *
@@ -88,4 +88,4 @@ module_init(init_rc_map_asus_ps3_100)
88module_exit(exit_rc_map_asus_ps3_100) 88module_exit(exit_rc_map_asus_ps3_100)
89 89
90MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 91MODULE_AUTHOR("Mauro Carvalho Chehab");
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 2031224a2027..91392d4cfd6d 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
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -67,4 +67,4 @@ module_init(init_rc_map_ati_tv_wonder_hd_600)
67module_exit(exit_rc_map_ati_tv_wonder_hd_600) 67module_exit(exit_rc_map_ati_tv_wonder_hd_600)
68 68
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 70MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avermedia-a16d.c b/drivers/media/rc/keymaps/rc-avermedia-a16d.c
index 894939ac17f2..ff30a71d623e 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-a16d.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-a16d.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -73,4 +73,4 @@ module_init(init_rc_map_avermedia_a16d)
73module_exit(exit_rc_map_avermedia_a16d) 73module_exit(exit_rc_map_avermedia_a16d)
74 74
75MODULE_LICENSE("GPL"); 75MODULE_LICENSE("GPL");
76MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 76MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c
index d2aaf5b9e39f..d7471a6de9b4 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-cardbus.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-cardbus.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -95,4 +95,4 @@ module_init(init_rc_map_avermedia_cardbus)
95module_exit(exit_rc_map_avermedia_cardbus) 95module_exit(exit_rc_map_avermedia_cardbus)
96 96
97MODULE_LICENSE("GPL"); 97MODULE_LICENSE("GPL");
98MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 98MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
index dc2baf062398..e2417d6331fe 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -76,4 +76,4 @@ module_init(init_rc_map_avermedia_dvbt)
76module_exit(exit_rc_map_avermedia_dvbt) 76module_exit(exit_rc_map_avermedia_dvbt)
77 77
78MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
79MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 79MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
index 04269d31fa19..843598a5f1b5 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
@@ -1,6 +1,6 @@
1/* avermedia-m135a.c - Keytable for Avermedia M135A Remote Controllers 1/* avermedia-m135a.c - Keytable for Avermedia M135A Remote Controllers
2 * 2 *
3 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (c) 2010 by Mauro Carvalho Chehab
4 * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br> 4 * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
@@ -145,4 +145,4 @@ module_init(init_rc_map_avermedia_m135a)
145module_exit(exit_rc_map_avermedia_m135a) 145module_exit(exit_rc_map_avermedia_m135a)
146 146
147MODULE_LICENSE("GPL"); 147MODULE_LICENSE("GPL");
148MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 148MODULE_AUTHOR("Mauro Carvalho Chehab");
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 e83b1a1939bf..b24e7481ac21 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c
@@ -93,4 +93,4 @@ module_init(init_rc_map_avermedia_m733a_rm_k6)
93module_exit(exit_rc_map_avermedia_m733a_rm_k6) 93module_exit(exit_rc_map_avermedia_m733a_rm_k6)
94 94
95MODULE_LICENSE("GPL"); 95MODULE_LICENSE("GPL");
96MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 96MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avermedia.c b/drivers/media/rc/keymaps/rc-avermedia.c
index c6063dfcd507..3f68fbecc188 100644
--- a/drivers/media/rc/keymaps/rc-avermedia.c
+++ b/drivers/media/rc/keymaps/rc-avermedia.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -84,4 +84,4 @@ module_init(init_rc_map_avermedia)
84module_exit(exit_rc_map_avermedia) 84module_exit(exit_rc_map_avermedia)
85 85
86MODULE_LICENSE("GPL"); 86MODULE_LICENSE("GPL");
87MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 87MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-avertv-303.c b/drivers/media/rc/keymaps/rc-avertv-303.c
index 14f78451e64e..c35bc5b835c4 100644
--- a/drivers/media/rc/keymaps/rc-avertv-303.c
+++ b/drivers/media/rc/keymaps/rc-avertv-303.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -83,4 +83,4 @@ module_init(init_rc_map_avertv_303)
83module_exit(exit_rc_map_avertv_303) 83module_exit(exit_rc_map_avertv_303)
84 84
85MODULE_LICENSE("GPL"); 85MODULE_LICENSE("GPL");
86MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 86MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-behold-columbus.c b/drivers/media/rc/keymaps/rc-behold-columbus.c
index 086b4b1f19e1..1fc344e9daa7 100644
--- a/drivers/media/rc/keymaps/rc-behold-columbus.c
+++ b/drivers/media/rc/keymaps/rc-behold-columbus.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -106,4 +106,4 @@ module_init(init_rc_map_behold_columbus)
106module_exit(exit_rc_map_behold_columbus) 106module_exit(exit_rc_map_behold_columbus)
107 107
108MODULE_LICENSE("GPL"); 108MODULE_LICENSE("GPL");
109MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 109MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-behold.c b/drivers/media/rc/keymaps/rc-behold.c
index 0877e3480941..d6519f8ac95a 100644
--- a/drivers/media/rc/keymaps/rc-behold.c
+++ b/drivers/media/rc/keymaps/rc-behold.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -139,4 +139,4 @@ module_init(init_rc_map_behold)
139module_exit(exit_rc_map_behold) 139module_exit(exit_rc_map_behold)
140 140
141MODULE_LICENSE("GPL"); 141MODULE_LICENSE("GPL");
142MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 142MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-budget-ci-old.c b/drivers/media/rc/keymaps/rc-budget-ci-old.c
index 8311e092c098..b196a5f436a3 100644
--- a/drivers/media/rc/keymaps/rc-budget-ci-old.c
+++ b/drivers/media/rc/keymaps/rc-budget-ci-old.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -91,4 +91,4 @@ module_init(init_rc_map_budget_ci_old)
91module_exit(exit_rc_map_budget_ci_old) 91module_exit(exit_rc_map_budget_ci_old)
92 92
93MODULE_LICENSE("GPL"); 93MODULE_LICENSE("GPL");
94MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 94MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-cinergy-1400.c b/drivers/media/rc/keymaps/rc-cinergy-1400.c
index 0c87fbaf99ab..a099c080bf8c 100644
--- a/drivers/media/rc/keymaps/rc-cinergy-1400.c
+++ b/drivers/media/rc/keymaps/rc-cinergy-1400.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -82,4 +82,4 @@ module_init(init_rc_map_cinergy_1400)
82module_exit(exit_rc_map_cinergy_1400) 82module_exit(exit_rc_map_cinergy_1400)
83 83
84MODULE_LICENSE("GPL"); 84MODULE_LICENSE("GPL");
85MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 85MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-cinergy.c b/drivers/media/rc/keymaps/rc-cinergy.c
index 309e9e3fb6f3..b0f4328bdd6f 100644
--- a/drivers/media/rc/keymaps/rc-cinergy.c
+++ b/drivers/media/rc/keymaps/rc-cinergy.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -76,4 +76,4 @@ module_init(init_rc_map_cinergy)
76module_exit(exit_rc_map_cinergy) 76module_exit(exit_rc_map_cinergy)
77 77
78MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
79MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 79MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c
index 492a05ade7e1..a0fa543c9f9e 100644
--- a/drivers/media/rc/keymaps/rc-dib0700-nec.c
+++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c
@@ -1,6 +1,6 @@
1/* rc-dvb0700-big.c - Keytable for devices in dvb0700 1/* rc-dvb0700-big.c - Keytable for devices in dvb0700
2 * 2 *
3 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (c) 2010 by Mauro Carvalho Chehab
4 * 4 *
5 * TODO: This table is a real mess, as it merges RC codes from several 5 * TODO: This table is a real mess, as it merges RC codes from several
6 * devices into a big table. It also has both RC-5 and NEC codes inside. 6 * devices into a big table. It also has both RC-5 and NEC codes inside.
@@ -122,4 +122,4 @@ module_init(init_rc_map)
122module_exit(exit_rc_map) 122module_exit(exit_rc_map)
123 123
124MODULE_LICENSE("GPL"); 124MODULE_LICENSE("GPL");
125MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 125MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dib0700-rc5.c b/drivers/media/rc/keymaps/rc-dib0700-rc5.c
index 454ea596a7ee..907941145eb7 100644
--- a/drivers/media/rc/keymaps/rc-dib0700-rc5.c
+++ b/drivers/media/rc/keymaps/rc-dib0700-rc5.c
@@ -1,6 +1,6 @@
1/* rc-dvb0700-big.c - Keytable for devices in dvb0700 1/* rc-dvb0700-big.c - Keytable for devices in dvb0700
2 * 2 *
3 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (c) 2010 by Mauro Carvalho Chehab
4 * 4 *
5 * TODO: This table is a real mess, as it merges RC codes from several 5 * TODO: This table is a real mess, as it merges RC codes from several
6 * devices into a big table. It also has both RC-5 and NEC codes inside. 6 * devices into a big table. It also has both RC-5 and NEC codes inside.
@@ -233,4 +233,4 @@ module_init(init_rc_map)
233module_exit(exit_rc_map) 233module_exit(exit_rc_map)
234 234
235MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
236MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 236MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dm1105-nec.c b/drivers/media/rc/keymaps/rc-dm1105-nec.c
index 67fc9fb0c007..46e7ae414cc8 100644
--- a/drivers/media/rc/keymaps/rc-dm1105-nec.c
+++ b/drivers/media/rc/keymaps/rc-dm1105-nec.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -74,4 +74,4 @@ module_init(init_rc_map_dm1105_nec)
74module_exit(exit_rc_map_dm1105_nec) 74module_exit(exit_rc_map_dm1105_nec)
75 75
76MODULE_LICENSE("GPL"); 76MODULE_LICENSE("GPL");
77MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 77MODULE_AUTHOR("Mauro Carvalho Chehab");
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 91ea91de9179..d2826b46fea2 100644
--- a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c
+++ b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -76,4 +76,4 @@ module_init(init_rc_map_dntv_live_dvb_t)
76module_exit(exit_rc_map_dntv_live_dvb_t) 76module_exit(exit_rc_map_dntv_live_dvb_t)
77 77
78MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
79MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 79MODULE_AUTHOR("Mauro Carvalho Chehab");
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 fd680d4d3eb6..0d74769467b5 100644
--- a/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c
+++ b/drivers/media/rc/keymaps/rc-dntv-live-dvbt-pro.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -95,4 +95,4 @@ module_init(init_rc_map_dntv_live_dvbt_pro)
95module_exit(exit_rc_map_dntv_live_dvbt_pro) 95module_exit(exit_rc_map_dntv_live_dvbt_pro)
96 96
97MODULE_LICENSE("GPL"); 97MODULE_LICENSE("GPL");
98MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 98MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-em-terratec.c b/drivers/media/rc/keymaps/rc-em-terratec.c
index d1fcd64c0f90..7f1e06be175b 100644
--- a/drivers/media/rc/keymaps/rc-em-terratec.c
+++ b/drivers/media/rc/keymaps/rc-em-terratec.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -67,4 +67,4 @@ module_init(init_rc_map_em_terratec)
67module_exit(exit_rc_map_em_terratec) 67module_exit(exit_rc_map_em_terratec)
68 68
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 70MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
index 2fe45e41fe49..4fc3904daf06 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -79,4 +79,4 @@ module_init(init_rc_map_encore_enltv_fm53)
79module_exit(exit_rc_map_encore_enltv_fm53) 79module_exit(exit_rc_map_encore_enltv_fm53)
80 80
81MODULE_LICENSE("GPL"); 81MODULE_LICENSE("GPL");
82MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 82MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv.c b/drivers/media/rc/keymaps/rc-encore-enltv.c
index 223de75a6d1c..f1914e23d203 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -110,4 +110,4 @@ module_init(init_rc_map_encore_enltv)
110module_exit(exit_rc_map_encore_enltv) 110module_exit(exit_rc_map_encore_enltv)
111 111
112MODULE_LICENSE("GPL"); 112MODULE_LICENSE("GPL");
113MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 113MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c
index 669cbff22b7e..9c6c55240d18 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv2.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -88,4 +88,4 @@ module_init(init_rc_map_encore_enltv2)
88module_exit(exit_rc_map_encore_enltv2) 88module_exit(exit_rc_map_encore_enltv2)
89 89
90MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 91MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-evga-indtube.c b/drivers/media/rc/keymaps/rc-evga-indtube.c
index 2c647fc25916..2370d2a3deb6 100644
--- a/drivers/media/rc/keymaps/rc-evga-indtube.c
+++ b/drivers/media/rc/keymaps/rc-evga-indtube.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -59,4 +59,4 @@ module_init(init_rc_map_evga_indtube)
59module_exit(exit_rc_map_evga_indtube) 59module_exit(exit_rc_map_evga_indtube)
60 60
61MODULE_LICENSE("GPL"); 61MODULE_LICENSE("GPL");
62MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 62MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-eztv.c b/drivers/media/rc/keymaps/rc-eztv.c
index 76921445c1d9..b5c96ed84376 100644
--- a/drivers/media/rc/keymaps/rc-eztv.c
+++ b/drivers/media/rc/keymaps/rc-eztv.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -94,4 +94,4 @@ module_init(init_rc_map_eztv)
94module_exit(exit_rc_map_eztv) 94module_exit(exit_rc_map_eztv)
95 95
96MODULE_LICENSE("GPL"); 96MODULE_LICENSE("GPL");
97MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 97MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-flydvb.c b/drivers/media/rc/keymaps/rc-flydvb.c
index 3a6bba311b08..25cb89fac03c 100644
--- a/drivers/media/rc/keymaps/rc-flydvb.c
+++ b/drivers/media/rc/keymaps/rc-flydvb.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -75,4 +75,4 @@ module_init(init_rc_map_flydvb)
75module_exit(exit_rc_map_flydvb) 75module_exit(exit_rc_map_flydvb)
76 76
77MODULE_LICENSE("GPL"); 77MODULE_LICENSE("GPL");
78MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 78MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-flyvideo.c b/drivers/media/rc/keymaps/rc-flyvideo.c
index bf9da584643b..e71377dd0534 100644
--- a/drivers/media/rc/keymaps/rc-flyvideo.c
+++ b/drivers/media/rc/keymaps/rc-flyvideo.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -68,4 +68,4 @@ module_init(init_rc_map_flyvideo)
68module_exit(exit_rc_map_flyvideo) 68module_exit(exit_rc_map_flyvideo)
69 69
70MODULE_LICENSE("GPL"); 70MODULE_LICENSE("GPL");
71MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 71MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c
index 2f0970fe7832..cf0608dc83d5 100644
--- a/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c
+++ b/drivers/media/rc/keymaps/rc-fusionhdtv-mce.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -96,4 +96,4 @@ module_init(init_rc_map_fusionhdtv_mce)
96module_exit(exit_rc_map_fusionhdtv_mce) 96module_exit(exit_rc_map_fusionhdtv_mce)
97 97
98MODULE_LICENSE("GPL"); 98MODULE_LICENSE("GPL");
99MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 99MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c
index 0e98ec467c34..03575bdb2eca 100644
--- a/drivers/media/rc/keymaps/rc-gadmei-rm008z.c
+++ b/drivers/media/rc/keymaps/rc-gadmei-rm008z.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -79,4 +79,4 @@ module_init(init_rc_map_gadmei_rm008z)
79module_exit(exit_rc_map_gadmei_rm008z) 79module_exit(exit_rc_map_gadmei_rm008z)
80 80
81MODULE_LICENSE("GPL"); 81MODULE_LICENSE("GPL");
82MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 82MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c
index a2e2faa1d1b3..b2ab13b0dcb1 100644
--- a/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c
+++ b/drivers/media/rc/keymaps/rc-genius-tvgo-a11mce.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -82,4 +82,4 @@ module_init(init_rc_map_genius_tvgo_a11mce)
82module_exit(exit_rc_map_genius_tvgo_a11mce) 82module_exit(exit_rc_map_genius_tvgo_a11mce)
83 83
84MODULE_LICENSE("GPL"); 84MODULE_LICENSE("GPL");
85MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 85MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-gotview7135.c b/drivers/media/rc/keymaps/rc-gotview7135.c
index 864614e19314..229a36ac7f0a 100644
--- a/drivers/media/rc/keymaps/rc-gotview7135.c
+++ b/drivers/media/rc/keymaps/rc-gotview7135.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -77,4 +77,4 @@ module_init(init_rc_map_gotview7135)
77module_exit(exit_rc_map_gotview7135) 77module_exit(exit_rc_map_gotview7135)
78 78
79MODULE_LICENSE("GPL"); 79MODULE_LICENSE("GPL");
80MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 80MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-hauppauge.c b/drivers/media/rc/keymaps/rc-hauppauge.c
index 929bbbc16393..36d57f7c532b 100644
--- a/drivers/media/rc/keymaps/rc-hauppauge.c
+++ b/drivers/media/rc/keymaps/rc-hauppauge.c
@@ -8,7 +8,7 @@
8 * - Hauppauge Black; 8 * - Hauppauge Black;
9 * - DSR-0112 remote bundled with Haupauge MiniStick. 9 * - DSR-0112 remote bundled with Haupauge MiniStick.
10 * 10 *
11 * Copyright (c) 2010-2011 by Mauro Carvalho Chehab <mchehab@redhat.com> 11 * Copyright (c) 2010-2011 by Mauro Carvalho Chehab
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 14 * it under the terms of the GNU General Public License as published by
@@ -290,4 +290,4 @@ module_init(init_rc_map_rc5_hauppauge_new)
290module_exit(exit_rc_map_rc5_hauppauge_new) 290module_exit(exit_rc_map_rc5_hauppauge_new)
291 291
292MODULE_LICENSE("GPL"); 292MODULE_LICENSE("GPL");
293MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 293MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c
index 34540dfc3df5..9ee154cb0c6b 100644
--- a/drivers/media/rc/keymaps/rc-iodata-bctv7e.c
+++ b/drivers/media/rc/keymaps/rc-iodata-bctv7e.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -86,4 +86,4 @@ module_init(init_rc_map_iodata_bctv7e)
86module_exit(exit_rc_map_iodata_bctv7e) 86module_exit(exit_rc_map_iodata_bctv7e)
87 87
88MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
89MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 89MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-kaiomy.c b/drivers/media/rc/keymaps/rc-kaiomy.c
index 4264a787c150..60803a732c08 100644
--- a/drivers/media/rc/keymaps/rc-kaiomy.c
+++ b/drivers/media/rc/keymaps/rc-kaiomy.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -85,4 +85,4 @@ module_init(init_rc_map_kaiomy)
85module_exit(exit_rc_map_kaiomy) 85module_exit(exit_rc_map_kaiomy)
86 86
87MODULE_LICENSE("GPL"); 87MODULE_LICENSE("GPL");
88MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 88MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-kworld-315u.c b/drivers/media/rc/keymaps/rc-kworld-315u.c
index e48cd267dda6..ba087eed1ed9 100644
--- a/drivers/media/rc/keymaps/rc-kworld-315u.c
+++ b/drivers/media/rc/keymaps/rc-kworld-315u.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -81,4 +81,4 @@ module_init(init_rc_map_kworld_315u)
81module_exit(exit_rc_map_kworld_315u) 81module_exit(exit_rc_map_kworld_315u)
82 82
83MODULE_LICENSE("GPL"); 83MODULE_LICENSE("GPL");
84MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 84MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-kworld-pc150u.c b/drivers/media/rc/keymaps/rc-kworld-pc150u.c
index 233bb5ee087f..b92e571f4def 100644
--- a/drivers/media/rc/keymaps/rc-kworld-pc150u.c
+++ b/drivers/media/rc/keymaps/rc-kworld-pc150u.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (c) 2010 by Kyle Strickland 5 * Copyright (c) 2010 by Kyle Strickland
6 * (based on kworld-plus-tv-analog.c by 6 * (based on kworld-plus-tv-analog.c by
7 * Mauro Carvalho Chehab <mchehab@redhat.com>) 7 * Mauro Carvalho Chehab)
8 * 8 *
9 * 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
10 * 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
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 32998d6b787d..edc868564f99 100644
--- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
+++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -97,4 +97,4 @@ module_init(init_rc_map_kworld_plus_tv_analog)
97module_exit(exit_rc_map_kworld_plus_tv_analog) 97module_exit(exit_rc_map_kworld_plus_tv_analog)
98 98
99MODULE_LICENSE("GPL"); 99MODULE_LICENSE("GPL");
100MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 100MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-manli.c b/drivers/media/rc/keymaps/rc-manli.c
index e7038bb71bf6..92424ef2aaa6 100644
--- a/drivers/media/rc/keymaps/rc-manli.c
+++ b/drivers/media/rc/keymaps/rc-manli.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -132,4 +132,4 @@ module_init(init_rc_map_manli)
132module_exit(exit_rc_map_manli) 132module_exit(exit_rc_map_manli)
133 133
134MODULE_LICENSE("GPL"); 134MODULE_LICENSE("GPL");
135MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 135MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
index c393d8a50bca..fd7a55c56167 100644
--- a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
+++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -121,4 +121,4 @@ module_init(init_rc_map_msi_tvanywhere_plus)
121module_exit(exit_rc_map_msi_tvanywhere_plus) 121module_exit(exit_rc_map_msi_tvanywhere_plus)
122 122
123MODULE_LICENSE("GPL"); 123MODULE_LICENSE("GPL");
124MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 124MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c
index a7003d3a3c8a..4233a8d4d63e 100644
--- a/drivers/media/rc/keymaps/rc-msi-tvanywhere.c
+++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -67,4 +67,4 @@ module_init(init_rc_map_msi_tvanywhere)
67module_exit(exit_rc_map_msi_tvanywhere) 67module_exit(exit_rc_map_msi_tvanywhere)
68 68
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 70MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-nebula.c b/drivers/media/rc/keymaps/rc-nebula.c
index 3f0ddd7afd30..8ec881adb7cf 100644
--- a/drivers/media/rc/keymaps/rc-nebula.c
+++ b/drivers/media/rc/keymaps/rc-nebula.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -94,4 +94,4 @@ module_init(init_rc_map_nebula)
94module_exit(exit_rc_map_nebula) 94module_exit(exit_rc_map_nebula)
95 95
96MODULE_LICENSE("GPL"); 96MODULE_LICENSE("GPL");
97MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 97MODULE_AUTHOR("Mauro Carvalho Chehab");
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 8d4dae2e2ece..292bbad35d21 100644
--- a/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c
+++ b/drivers/media/rc/keymaps/rc-nec-terratec-cinergy-xs.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15 15
16/* Terratec Cinergy Hybrid T USB XS FM 16/* Terratec Cinergy Hybrid T USB XS FM
17 Mauro Carvalho Chehab <mchehab@redhat.com> 17 Mauro Carvalho Chehab
18 */ 18 */
19 19
20static struct rc_map_table nec_terratec_cinergy_xs[] = { 20static struct rc_map_table nec_terratec_cinergy_xs[] = {
@@ -155,4 +155,4 @@ module_init(init_rc_map_nec_terratec_cinergy_xs)
155module_exit(exit_rc_map_nec_terratec_cinergy_xs) 155module_exit(exit_rc_map_nec_terratec_cinergy_xs)
156 156
157MODULE_LICENSE("GPL"); 157MODULE_LICENSE("GPL");
158MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 158MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-norwood.c b/drivers/media/rc/keymaps/rc-norwood.c
index 9e65f07157ab..ca1b82a2c54f 100644
--- a/drivers/media/rc/keymaps/rc-norwood.c
+++ b/drivers/media/rc/keymaps/rc-norwood.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -83,4 +83,4 @@ module_init(init_rc_map_norwood)
83module_exit(exit_rc_map_norwood) 83module_exit(exit_rc_map_norwood)
84 84
85MODULE_LICENSE("GPL"); 85MODULE_LICENSE("GPL");
86MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 86MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-npgtech.c b/drivers/media/rc/keymaps/rc-npgtech.c
index 65d0cfc3c33b..1fb946024512 100644
--- a/drivers/media/rc/keymaps/rc-npgtech.c
+++ b/drivers/media/rc/keymaps/rc-npgtech.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -78,4 +78,4 @@ module_init(init_rc_map_npgtech)
78module_exit(exit_rc_map_npgtech) 78module_exit(exit_rc_map_npgtech)
79 79
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 81MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pctv-sedna.c b/drivers/media/rc/keymaps/rc-pctv-sedna.c
index bf2cbdfe2e32..5ef01ab3fd50 100644
--- a/drivers/media/rc/keymaps/rc-pctv-sedna.c
+++ b/drivers/media/rc/keymaps/rc-pctv-sedna.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -78,4 +78,4 @@ module_init(init_rc_map_pctv_sedna)
78module_exit(exit_rc_map_pctv_sedna) 78module_exit(exit_rc_map_pctv_sedna)
79 79
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 81MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pinnacle-color.c b/drivers/media/rc/keymaps/rc-pinnacle-color.c
index b46cd8fe6438..a218b471a4ca 100644
--- a/drivers/media/rc/keymaps/rc-pinnacle-color.c
+++ b/drivers/media/rc/keymaps/rc-pinnacle-color.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -92,4 +92,4 @@ module_init(init_rc_map_pinnacle_color)
92module_exit(exit_rc_map_pinnacle_color) 92module_exit(exit_rc_map_pinnacle_color)
93 93
94MODULE_LICENSE("GPL"); 94MODULE_LICENSE("GPL");
95MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 95MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pinnacle-grey.c b/drivers/media/rc/keymaps/rc-pinnacle-grey.c
index d525df9ad868..4a3f467a47a2 100644
--- a/drivers/media/rc/keymaps/rc-pinnacle-grey.c
+++ b/drivers/media/rc/keymaps/rc-pinnacle-grey.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -87,4 +87,4 @@ module_init(init_rc_map_pinnacle_grey)
87module_exit(exit_rc_map_pinnacle_grey) 87module_exit(exit_rc_map_pinnacle_grey)
88 88
89MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 90MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
index a4603d035374..e89cc10b68bf 100644
--- a/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
+++ b/drivers/media/rc/keymaps/rc-pinnacle-pctv-hd.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -68,4 +68,4 @@ module_init(init_rc_map_pinnacle_pctv_hd)
68module_exit(exit_rc_map_pinnacle_pctv_hd) 68module_exit(exit_rc_map_pinnacle_pctv_hd)
69 69
70MODULE_LICENSE("GPL"); 70MODULE_LICENSE("GPL");
71MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 71MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pixelview-002t.c b/drivers/media/rc/keymaps/rc-pixelview-002t.c
index 33eb64333c6f..d967c3816fdc 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-002t.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-002t.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -75,4 +75,4 @@ module_init(init_rc_map_pixelview)
75module_exit(exit_rc_map_pixelview) 75module_exit(exit_rc_map_pixelview)
76 76
77MODULE_LICENSE("GPL"); 77MODULE_LICENSE("GPL");
78MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 78MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pixelview-mk12.c b/drivers/media/rc/keymaps/rc-pixelview-mk12.c
index 21f4dd25c2ec..224d0efaa6e5 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-mk12.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-mk12.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -81,4 +81,4 @@ module_init(init_rc_map_pixelview)
81module_exit(exit_rc_map_pixelview) 81module_exit(exit_rc_map_pixelview)
82 82
83MODULE_LICENSE("GPL"); 83MODULE_LICENSE("GPL");
84MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 84MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c
index f944ad2cac2b..781d788d6b6d 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-new.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-new.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -81,4 +81,4 @@ module_init(init_rc_map_pixelview_new)
81module_exit(exit_rc_map_pixelview_new) 81module_exit(exit_rc_map_pixelview_new)
82 82
83MODULE_LICENSE("GPL"); 83MODULE_LICENSE("GPL");
84MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 84MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pixelview.c b/drivers/media/rc/keymaps/rc-pixelview.c
index a6020eea7b95..39e6feaa35a3 100644
--- a/drivers/media/rc/keymaps/rc-pixelview.c
+++ b/drivers/media/rc/keymaps/rc-pixelview.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -80,4 +80,4 @@ module_init(init_rc_map_pixelview)
80module_exit(exit_rc_map_pixelview) 80module_exit(exit_rc_map_pixelview)
81 81
82MODULE_LICENSE("GPL"); 82MODULE_LICENSE("GPL");
83MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 83MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c
index e74c571a5e44..e96fa3ab9f4b 100644
--- a/drivers/media/rc/keymaps/rc-powercolor-real-angel.c
+++ b/drivers/media/rc/keymaps/rc-powercolor-real-angel.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -79,4 +79,4 @@ module_init(init_rc_map_powercolor_real_angel)
79module_exit(exit_rc_map_powercolor_real_angel) 79module_exit(exit_rc_map_powercolor_real_angel)
80 80
81MODULE_LICENSE("GPL"); 81MODULE_LICENSE("GPL");
82MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 82MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-proteus-2309.c b/drivers/media/rc/keymaps/rc-proteus-2309.c
index adee8035ce96..eef626ee02df 100644
--- a/drivers/media/rc/keymaps/rc-proteus-2309.c
+++ b/drivers/media/rc/keymaps/rc-proteus-2309.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -67,4 +67,4 @@ module_init(init_rc_map_proteus_2309)
67module_exit(exit_rc_map_proteus_2309) 67module_exit(exit_rc_map_proteus_2309)
68 68
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 70MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-purpletv.c b/drivers/media/rc/keymaps/rc-purpletv.c
index 722597a20e4a..cec6fe466829 100644
--- a/drivers/media/rc/keymaps/rc-purpletv.c
+++ b/drivers/media/rc/keymaps/rc-purpletv.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -79,4 +79,4 @@ module_init(init_rc_map_purpletv)
79module_exit(exit_rc_map_purpletv) 79module_exit(exit_rc_map_purpletv)
80 80
81MODULE_LICENSE("GPL"); 81MODULE_LICENSE("GPL");
82MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 82MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-pv951.c b/drivers/media/rc/keymaps/rc-pv951.c
index 0105d63c07a9..5ac89ce8c053 100644
--- a/drivers/media/rc/keymaps/rc-pv951.c
+++ b/drivers/media/rc/keymaps/rc-pv951.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -76,4 +76,4 @@ module_init(init_rc_map_pv951)
76module_exit(exit_rc_map_pv951) 76module_exit(exit_rc_map_pv951)
77 77
78MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
79MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 79MODULE_AUTHOR("Mauro Carvalho Chehab");
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 073694d50f49..9f778bd091db 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
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -76,4 +76,4 @@ module_init(init_rc_map_real_audio_220_32_keys)
76module_exit(exit_rc_map_real_audio_220_32_keys) 76module_exit(exit_rc_map_real_audio_220_32_keys)
77 77
78MODULE_LICENSE("GPL"); 78MODULE_LICENSE("GPL");
79MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 79MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-tbs-nec.c b/drivers/media/rc/keymaps/rc-tbs-nec.c
index 5039be782bc5..24ce2a252502 100644
--- a/drivers/media/rc/keymaps/rc-tbs-nec.c
+++ b/drivers/media/rc/keymaps/rc-tbs-nec.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -73,4 +73,4 @@ module_init(init_rc_map_tbs_nec)
73module_exit(exit_rc_map_tbs_nec) 73module_exit(exit_rc_map_tbs_nec)
74 74
75MODULE_LICENSE("GPL"); 75MODULE_LICENSE("GPL");
76MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 76MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c
index 53629fb0151f..97eb83ab5a35 100644
--- a/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c
+++ b/drivers/media/rc/keymaps/rc-terratec-cinergy-xs.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -90,4 +90,4 @@ module_init(init_rc_map_terratec_cinergy_xs)
90module_exit(exit_rc_map_terratec_cinergy_xs) 90module_exit(exit_rc_map_terratec_cinergy_xs)
91 91
92MODULE_LICENSE("GPL"); 92MODULE_LICENSE("GPL");
93MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 93MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-tevii-nec.c b/drivers/media/rc/keymaps/rc-tevii-nec.c
index f2c3b75d8580..38e0c0875596 100644
--- a/drivers/media/rc/keymaps/rc-tevii-nec.c
+++ b/drivers/media/rc/keymaps/rc-tevii-nec.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -86,4 +86,4 @@ module_init(init_rc_map_tevii_nec)
86module_exit(exit_rc_map_tevii_nec) 86module_exit(exit_rc_map_tevii_nec)
87 87
88MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
89MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 89MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-tivo.c b/drivers/media/rc/keymaps/rc-tivo.c
index 454e06295692..5cc1b456e329 100644
--- a/drivers/media/rc/keymaps/rc-tivo.c
+++ b/drivers/media/rc/keymaps/rc-tivo.c
@@ -15,62 +15,62 @@
15 * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle, 15 * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle,
16 * which also ships with a TiVo-branded IR transceiver, supported by the mceusb 16 * which also ships with a TiVo-branded IR transceiver, supported by the mceusb
17 * driver. Note that the remote uses an NEC-ish protocol, but instead of having 17 * driver. Note that the remote uses an NEC-ish protocol, but instead of having
18 * a command/not_command pair, it has a vendor ID of 0xa10c, but some keys, the 18 * a command/not_command pair, it has a vendor ID of 0x3085, but some keys, the
19 * NEC extended checksums do pass, so the table presently has the intended 19 * NEC extended checksums do pass, so the table presently has the intended
20 * values and the checksum-passed versions for those keys. 20 * values and the checksum-passed versions for those keys.
21 */ 21 */
22static struct rc_map_table tivo[] = { 22static struct rc_map_table tivo[] = {
23 { 0xa10c900f, KEY_MEDIA }, /* TiVo Button */ 23 { 0x3085f009, KEY_MEDIA }, /* TiVo Button */
24 { 0xa10c0807, KEY_POWER2 }, /* TV Power */ 24 { 0x3085e010, KEY_POWER2 }, /* TV Power */
25 { 0xa10c8807, KEY_TV }, /* Live TV/Swap */ 25 { 0x3085e011, KEY_TV }, /* Live TV/Swap */
26 { 0xa10c2c03, KEY_VIDEO_NEXT }, /* TV Input */ 26 { 0x3085c034, KEY_VIDEO_NEXT }, /* TV Input */
27 { 0xa10cc807, KEY_INFO }, 27 { 0x3085e013, KEY_INFO },
28 { 0xa10cfa05, KEY_CYCLEWINDOWS }, /* Window */ 28 { 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */
29 { 0x0085305f, KEY_CYCLEWINDOWS }, 29 { 0x0085305f, KEY_CYCLEWINDOWS },
30 { 0xa10c6c03, KEY_EPG }, /* Guide */ 30 { 0x3085c036, KEY_EPG }, /* Guide */
31 31
32 { 0xa10c2807, KEY_UP }, 32 { 0x3085e014, KEY_UP },
33 { 0xa10c6807, KEY_DOWN }, 33 { 0x3085e016, KEY_DOWN },
34 { 0xa10ce807, KEY_LEFT }, 34 { 0x3085e017, KEY_LEFT },
35 { 0xa10ca807, KEY_RIGHT }, 35 { 0x3085e015, KEY_RIGHT },
36 36
37 { 0xa10c1807, KEY_SCROLLDOWN }, /* Red Thumbs Down */ 37 { 0x3085e018, KEY_SCROLLDOWN }, /* Red Thumbs Down */
38 { 0xa10c9807, KEY_SELECT }, 38 { 0x3085e019, KEY_SELECT },
39 { 0xa10c5807, KEY_SCROLLUP }, /* Green Thumbs Up */ 39 { 0x3085e01a, KEY_SCROLLUP }, /* Green Thumbs Up */
40 40
41 { 0xa10c3807, KEY_VOLUMEUP }, 41 { 0x3085e01c, KEY_VOLUMEUP },
42 { 0xa10cb807, KEY_VOLUMEDOWN }, 42 { 0x3085e01d, KEY_VOLUMEDOWN },
43 { 0xa10cd807, KEY_MUTE }, 43 { 0x3085e01b, KEY_MUTE },
44 { 0xa10c040b, KEY_RECORD }, 44 { 0x3085d020, KEY_RECORD },
45 { 0xa10c7807, KEY_CHANNELUP }, 45 { 0x3085e01e, KEY_CHANNELUP },
46 { 0xa10cf807, KEY_CHANNELDOWN }, 46 { 0x3085e01f, KEY_CHANNELDOWN },
47 { 0x0085301f, KEY_CHANNELDOWN }, 47 { 0x0085301f, KEY_CHANNELDOWN },
48 48
49 { 0xa10c840b, KEY_PLAY }, 49 { 0x3085d021, KEY_PLAY },
50 { 0xa10cc40b, KEY_PAUSE }, 50 { 0x3085d023, KEY_PAUSE },
51 { 0xa10ca40b, KEY_SLOW }, 51 { 0x3085d025, KEY_SLOW },
52 { 0xa10c440b, KEY_REWIND }, 52 { 0x3085d022, KEY_REWIND },
53 { 0xa10c240b, KEY_FASTFORWARD }, 53 { 0x3085d024, KEY_FASTFORWARD },
54 { 0xa10c640b, KEY_PREVIOUS }, 54 { 0x3085d026, KEY_PREVIOUS },
55 { 0xa10ce40b, KEY_NEXT }, /* ->| */ 55 { 0x3085d027, KEY_NEXT }, /* ->| */
56 56
57 { 0xa10c220d, KEY_ZOOM }, /* Aspect */ 57 { 0x3085b044, KEY_ZOOM }, /* Aspect */
58 { 0xa10c120d, KEY_STOP }, 58 { 0x3085b048, KEY_STOP },
59 { 0xa10c520d, KEY_DVD }, /* DVD Menu */ 59 { 0x3085b04a, KEY_DVD }, /* DVD Menu */
60 60
61 { 0xa10c140b, KEY_NUMERIC_1 }, 61 { 0x3085d028, KEY_NUMERIC_1 },
62 { 0xa10c940b, KEY_NUMERIC_2 }, 62 { 0x3085d029, KEY_NUMERIC_2 },
63 { 0xa10c540b, KEY_NUMERIC_3 }, 63 { 0x3085d02a, KEY_NUMERIC_3 },
64 { 0xa10cd40b, KEY_NUMERIC_4 }, 64 { 0x3085d02b, KEY_NUMERIC_4 },
65 { 0xa10c340b, KEY_NUMERIC_5 }, 65 { 0x3085d02c, KEY_NUMERIC_5 },
66 { 0xa10cb40b, KEY_NUMERIC_6 }, 66 { 0x3085d02d, KEY_NUMERIC_6 },
67 { 0xa10c740b, KEY_NUMERIC_7 }, 67 { 0x3085d02e, KEY_NUMERIC_7 },
68 { 0xa10cf40b, KEY_NUMERIC_8 }, 68 { 0x3085d02f, KEY_NUMERIC_8 },
69 { 0x0085302f, KEY_NUMERIC_8 }, 69 { 0x0085302f, KEY_NUMERIC_8 },
70 { 0xa10c0c03, KEY_NUMERIC_9 }, 70 { 0x3085c030, KEY_NUMERIC_9 },
71 { 0xa10c8c03, KEY_NUMERIC_0 }, 71 { 0x3085c031, KEY_NUMERIC_0 },
72 { 0xa10ccc03, KEY_ENTER }, 72 { 0x3085c033, KEY_ENTER },
73 { 0xa10c4c03, KEY_CLEAR }, 73 { 0x3085c032, KEY_CLEAR },
74}; 74};
75 75
76static struct rc_map_list tivo_map = { 76static struct rc_map_list tivo_map = {
diff --git a/drivers/media/rc/keymaps/rc-tt-1500.c b/drivers/media/rc/keymaps/rc-tt-1500.c
index 80217ffc91db..c766d3b2b6b0 100644
--- a/drivers/media/rc/keymaps/rc-tt-1500.c
+++ b/drivers/media/rc/keymaps/rc-tt-1500.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -80,4 +80,4 @@ module_init(init_rc_map_tt_1500)
80module_exit(exit_rc_map_tt_1500) 80module_exit(exit_rc_map_tt_1500)
81 81
82MODULE_LICENSE("GPL"); 82MODULE_LICENSE("GPL");
83MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 83MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-videomate-s350.c b/drivers/media/rc/keymaps/rc-videomate-s350.c
index 8bfc3e8d909d..8a354775a2d8 100644
--- a/drivers/media/rc/keymaps/rc-videomate-s350.c
+++ b/drivers/media/rc/keymaps/rc-videomate-s350.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -83,4 +83,4 @@ module_init(init_rc_map_videomate_s350)
83module_exit(exit_rc_map_videomate_s350) 83module_exit(exit_rc_map_videomate_s350)
84 84
85MODULE_LICENSE("GPL"); 85MODULE_LICENSE("GPL");
86MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 86MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c
index 390ce9431b35..eb0cda7766c4 100644
--- a/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c
+++ b/drivers/media/rc/keymaps/rc-videomate-tv-pvr.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -85,4 +85,4 @@ module_init(init_rc_map_videomate_tv_pvr)
85module_exit(exit_rc_map_videomate_tv_pvr) 85module_exit(exit_rc_map_videomate_tv_pvr)
86 86
87MODULE_LICENSE("GPL"); 87MODULE_LICENSE("GPL");
88MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 88MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c
index 2852bf705064..c1dd598e828e 100644
--- a/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c
+++ b/drivers/media/rc/keymaps/rc-winfast-usbii-deluxe.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -80,4 +80,4 @@ module_init(init_rc_map_winfast_usbii_deluxe)
80module_exit(exit_rc_map_winfast_usbii_deluxe) 80module_exit(exit_rc_map_winfast_usbii_deluxe)
81 81
82MODULE_LICENSE("GPL"); 82MODULE_LICENSE("GPL");
83MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 83MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-winfast.c b/drivers/media/rc/keymaps/rc-winfast.c
index 2df1cba23600..8a779da1e973 100644
--- a/drivers/media/rc/keymaps/rc-winfast.c
+++ b/drivers/media/rc/keymaps/rc-winfast.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * Copyright (c) 2010 by Mauro Carvalho Chehab
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -100,4 +100,4 @@ module_init(init_rc_map_winfast)
100module_exit(exit_rc_map_winfast) 100module_exit(exit_rc_map_winfast)
101 101
102MODULE_LICENSE("GPL"); 102MODULE_LICENSE("GPL");
103MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 103MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index a25bb1581e46..5d8f3d40d820 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -84,7 +84,7 @@
84#define MCE_PORT_IR 0x4 /* (0x4 << 5) | MCE_CMD = 0x9f */ 84#define MCE_PORT_IR 0x4 /* (0x4 << 5) | MCE_CMD = 0x9f */
85#define MCE_PORT_SYS 0x7 /* (0x7 << 5) | MCE_CMD = 0xff */ 85#define MCE_PORT_SYS 0x7 /* (0x7 << 5) | MCE_CMD = 0xff */
86#define MCE_PORT_SER 0x6 /* 0xc0 thru 0xdf flush & 0x1f bytes */ 86#define MCE_PORT_SER 0x6 /* 0xc0 thru 0xdf flush & 0x1f bytes */
87#define MCE_PORT_MASK 0xe0 /* Mask out command bits */ 87#define MCE_PORT_MASK 0xe0 /* Mask out command bits */
88 88
89/* Command port headers */ 89/* Command port headers */
90#define MCE_CMD_PORT_IR 0x9f /* IR-related cmd/rsp */ 90#define MCE_CMD_PORT_IR 0x9f /* IR-related cmd/rsp */
@@ -153,19 +153,6 @@
153#define MCE_COMMAND_IRDATA 0x80 153#define MCE_COMMAND_IRDATA 0x80
154#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ 154#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */
155 155
156/* module parameters */
157#ifdef CONFIG_USB_DEBUG
158static bool debug = 1;
159#else
160static bool debug;
161#endif
162
163#define mce_dbg(dev, fmt, ...) \
164 do { \
165 if (debug) \
166 dev_info(dev, fmt, ## __VA_ARGS__); \
167 } while (0)
168
169/* general constants */ 156/* general constants */
170#define SEND_FLAG_IN_PROGRESS 1 157#define SEND_FLAG_IN_PROGRESS 1
171#define SEND_FLAG_COMPLETE 2 158#define SEND_FLAG_COMPLETE 2
@@ -541,16 +528,13 @@ static int mceusb_cmd_datasize(u8 cmd, u8 subcmd)
541static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, 528static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
542 int offset, int len, bool out) 529 int offset, int len, bool out)
543{ 530{
544 char codes[USB_BUFLEN * 3 + 1]; 531#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
545 char inout[9]; 532 char *inout;
546 u8 cmd, subcmd, data1, data2, data3, data4; 533 u8 cmd, subcmd, data1, data2, data3, data4;
547 struct device *dev = ir->dev; 534 struct device *dev = ir->dev;
548 int i, start, skip = 0; 535 int start, skip = 0;
549 u32 carrier, period; 536 u32 carrier, period;
550 537
551 if (!debug)
552 return;
553
554 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ 538 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */
555 if (ir->flags.microsoft_gen1 && !out && !offset) 539 if (ir->flags.microsoft_gen1 && !out && !offset)
556 skip = 2; 540 skip = 2;
@@ -558,16 +542,10 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
558 if (len <= skip) 542 if (len <= skip)
559 return; 543 return;
560 544
561 for (i = 0; i < len && i < USB_BUFLEN; i++) 545 dev_dbg(dev, "%cx data: %*ph (length=%d)",
562 snprintf(codes + i * 3, 4, "%02x ", buf[i + offset] & 0xff); 546 (out ? 't' : 'r'), min(len, USB_BUFLEN), buf, len);
563
564 dev_info(dev, "%sx data: %s(length=%d)\n",
565 (out ? "t" : "r"), codes, len);
566 547
567 if (out) 548 inout = out ? "Request" : "Got";
568 strcpy(inout, "Request\0");
569 else
570 strcpy(inout, "Got\0");
571 549
572 start = offset + skip; 550 start = offset + skip;
573 cmd = buf[start] & 0xff; 551 cmd = buf[start] & 0xff;
@@ -583,50 +561,50 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
583 break; 561 break;
584 if ((subcmd == MCE_CMD_PORT_SYS) && 562 if ((subcmd == MCE_CMD_PORT_SYS) &&
585 (data1 == MCE_CMD_RESUME)) 563 (data1 == MCE_CMD_RESUME))
586 dev_info(dev, "Device resume requested\n"); 564 dev_dbg(dev, "Device resume requested");
587 else 565 else
588 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 566 dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
589 cmd, subcmd); 567 cmd, subcmd);
590 break; 568 break;
591 case MCE_CMD_PORT_SYS: 569 case MCE_CMD_PORT_SYS:
592 switch (subcmd) { 570 switch (subcmd) {
593 case MCE_RSP_EQEMVER: 571 case MCE_RSP_EQEMVER:
594 if (!out) 572 if (!out)
595 dev_info(dev, "Emulator interface version %x\n", 573 dev_dbg(dev, "Emulator interface version %x",
596 data1); 574 data1);
597 break; 575 break;
598 case MCE_CMD_G_REVISION: 576 case MCE_CMD_G_REVISION:
599 if (len == 2) 577 if (len == 2)
600 dev_info(dev, "Get hw/sw rev?\n"); 578 dev_dbg(dev, "Get hw/sw rev?");
601 else 579 else
602 dev_info(dev, "hw/sw rev 0x%02x 0x%02x " 580 dev_dbg(dev, "hw/sw rev 0x%02x 0x%02x 0x%02x 0x%02x",
603 "0x%02x 0x%02x\n", data1, data2, 581 data1, data2,
604 buf[start + 4], buf[start + 5]); 582 buf[start + 4], buf[start + 5]);
605 break; 583 break;
606 case MCE_CMD_RESUME: 584 case MCE_CMD_RESUME:
607 dev_info(dev, "Device resume requested\n"); 585 dev_dbg(dev, "Device resume requested");
608 break; 586 break;
609 case MCE_RSP_CMD_ILLEGAL: 587 case MCE_RSP_CMD_ILLEGAL:
610 dev_info(dev, "Illegal PORT_SYS command\n"); 588 dev_dbg(dev, "Illegal PORT_SYS command");
611 break; 589 break;
612 case MCE_RSP_EQWAKEVERSION: 590 case MCE_RSP_EQWAKEVERSION:
613 if (!out) 591 if (!out)
614 dev_info(dev, "Wake version, proto: 0x%02x, " 592 dev_dbg(dev, "Wake version, proto: 0x%02x, "
615 "payload: 0x%02x, address: 0x%02x, " 593 "payload: 0x%02x, address: 0x%02x, "
616 "version: 0x%02x\n", 594 "version: 0x%02x",
617 data1, data2, data3, data4); 595 data1, data2, data3, data4);
618 break; 596 break;
619 case MCE_RSP_GETPORTSTATUS: 597 case MCE_RSP_GETPORTSTATUS:
620 if (!out) 598 if (!out)
621 /* We use data1 + 1 here, to match hw labels */ 599 /* We use data1 + 1 here, to match hw labels */
622 dev_info(dev, "TX port %d: blaster is%s connected\n", 600 dev_dbg(dev, "TX port %d: blaster is%s connected",
623 data1 + 1, data4 ? " not" : ""); 601 data1 + 1, data4 ? " not" : "");
624 break; 602 break;
625 case MCE_CMD_FLASHLED: 603 case MCE_CMD_FLASHLED:
626 dev_info(dev, "Attempting to flash LED\n"); 604 dev_dbg(dev, "Attempting to flash LED");
627 break; 605 break;
628 default: 606 default:
629 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 607 dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
630 cmd, subcmd); 608 cmd, subcmd);
631 break; 609 break;
632 } 610 }
@@ -634,13 +612,13 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
634 case MCE_CMD_PORT_IR: 612 case MCE_CMD_PORT_IR:
635 switch (subcmd) { 613 switch (subcmd) {
636 case MCE_CMD_SIG_END: 614 case MCE_CMD_SIG_END:
637 dev_info(dev, "End of signal\n"); 615 dev_dbg(dev, "End of signal");
638 break; 616 break;
639 case MCE_CMD_PING: 617 case MCE_CMD_PING:
640 dev_info(dev, "Ping\n"); 618 dev_dbg(dev, "Ping");
641 break; 619 break;
642 case MCE_CMD_UNKNOWN: 620 case MCE_CMD_UNKNOWN:
643 dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", 621 dev_dbg(dev, "Resp to 9f 05 of 0x%02x 0x%02x",
644 data1, data2); 622 data1, data2);
645 break; 623 break;
646 case MCE_RSP_EQIRCFS: 624 case MCE_RSP_EQIRCFS:
@@ -649,51 +627,51 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
649 if (!period) 627 if (!period)
650 break; 628 break;
651 carrier = (1000 * 1000) / period; 629 carrier = (1000 * 1000) / period;
652 dev_info(dev, "%s carrier of %u Hz (period %uus)\n", 630 dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
653 inout, carrier, period); 631 inout, carrier, period);
654 break; 632 break;
655 case MCE_CMD_GETIRCFS: 633 case MCE_CMD_GETIRCFS:
656 dev_info(dev, "Get carrier mode and freq\n"); 634 dev_dbg(dev, "Get carrier mode and freq");
657 break; 635 break;
658 case MCE_RSP_EQIRTXPORTS: 636 case MCE_RSP_EQIRTXPORTS:
659 dev_info(dev, "%s transmit blaster mask of 0x%02x\n", 637 dev_dbg(dev, "%s transmit blaster mask of 0x%02x",
660 inout, data1); 638 inout, data1);
661 break; 639 break;
662 case MCE_RSP_EQIRTIMEOUT: 640 case MCE_RSP_EQIRTIMEOUT:
663 /* value is in units of 50us, so x*50/1000 ms */ 641 /* value is in units of 50us, so x*50/1000 ms */
664 period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000; 642 period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000;
665 dev_info(dev, "%s receive timeout of %d ms\n", 643 dev_dbg(dev, "%s receive timeout of %d ms",
666 inout, period); 644 inout, period);
667 break; 645 break;
668 case MCE_CMD_GETIRTIMEOUT: 646 case MCE_CMD_GETIRTIMEOUT:
669 dev_info(dev, "Get receive timeout\n"); 647 dev_dbg(dev, "Get receive timeout");
670 break; 648 break;
671 case MCE_CMD_GETIRTXPORTS: 649 case MCE_CMD_GETIRTXPORTS:
672 dev_info(dev, "Get transmit blaster mask\n"); 650 dev_dbg(dev, "Get transmit blaster mask");
673 break; 651 break;
674 case MCE_RSP_EQIRRXPORTEN: 652 case MCE_RSP_EQIRRXPORTEN:
675 dev_info(dev, "%s %s-range receive sensor in use\n", 653 dev_dbg(dev, "%s %s-range receive sensor in use",
676 inout, data1 == 0x02 ? "short" : "long"); 654 inout, data1 == 0x02 ? "short" : "long");
677 break; 655 break;
678 case MCE_CMD_GETIRRXPORTEN: 656 case MCE_CMD_GETIRRXPORTEN:
679 /* aka MCE_RSP_EQIRRXCFCNT */ 657 /* aka MCE_RSP_EQIRRXCFCNT */
680 if (out) 658 if (out)
681 dev_info(dev, "Get receive sensor\n"); 659 dev_dbg(dev, "Get receive sensor");
682 else if (ir->learning_enabled) 660 else if (ir->learning_enabled)
683 dev_info(dev, "RX pulse count: %d\n", 661 dev_dbg(dev, "RX pulse count: %d",
684 ((data1 << 8) | data2)); 662 ((data1 << 8) | data2));
685 break; 663 break;
686 case MCE_RSP_EQIRNUMPORTS: 664 case MCE_RSP_EQIRNUMPORTS:
687 if (out) 665 if (out)
688 break; 666 break;
689 dev_info(dev, "Num TX ports: %x, num RX ports: %x\n", 667 dev_dbg(dev, "Num TX ports: %x, num RX ports: %x",
690 data1, data2); 668 data1, data2);
691 break; 669 break;
692 case MCE_RSP_CMD_ILLEGAL: 670 case MCE_RSP_CMD_ILLEGAL:
693 dev_info(dev, "Illegal PORT_IR command\n"); 671 dev_dbg(dev, "Illegal PORT_IR command");
694 break; 672 break;
695 default: 673 default:
696 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 674 dev_dbg(dev, "Unknown command 0x%02x 0x%02x",
697 cmd, subcmd); 675 cmd, subcmd);
698 break; 676 break;
699 } 677 }
@@ -703,10 +681,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
703 } 681 }
704 682
705 if (cmd == MCE_IRDATA_TRAILER) 683 if (cmd == MCE_IRDATA_TRAILER)
706 dev_info(dev, "End of raw IR data\n"); 684 dev_dbg(dev, "End of raw IR data");
707 else if ((cmd != MCE_CMD_PORT_IR) && 685 else if ((cmd != MCE_CMD_PORT_IR) &&
708 ((cmd & MCE_PORT_MASK) == MCE_COMMAND_IRDATA)) 686 ((cmd & MCE_PORT_MASK) == MCE_COMMAND_IRDATA))
709 dev_info(dev, "Raw IR data, %d pulse/space samples\n", ir->rem); 687 dev_dbg(dev, "Raw IR data, %d pulse/space samples", ir->rem);
688#endif
710} 689}
711 690
712static void mce_async_callback(struct urb *urb) 691static void mce_async_callback(struct urb *urb)
@@ -718,10 +697,25 @@ static void mce_async_callback(struct urb *urb)
718 return; 697 return;
719 698
720 ir = urb->context; 699 ir = urb->context;
721 if (ir) { 700
701 switch (urb->status) {
702 /* success */
703 case 0:
722 len = urb->actual_length; 704 len = urb->actual_length;
723 705
724 mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true); 706 mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true);
707 break;
708
709 case -ECONNRESET:
710 case -ENOENT:
711 case -EILSEQ:
712 case -ESHUTDOWN:
713 break;
714
715 case -EPIPE:
716 default:
717 dev_err(ir->dev, "Error: request urb status = %d", urb->status);
718 break;
725 } 719 }
726 720
727 /* the transfer buffer and urb were allocated in mce_request_packet */ 721 /* the transfer buffer and urb were allocated in mce_request_packet */
@@ -770,17 +764,17 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
770 return; 764 return;
771 } 765 }
772 766
773 mce_dbg(dev, "receive request called (size=%#x)\n", size); 767 dev_dbg(dev, "receive request called (size=%#x)", size);
774 768
775 async_urb->transfer_buffer_length = size; 769 async_urb->transfer_buffer_length = size;
776 async_urb->dev = ir->usbdev; 770 async_urb->dev = ir->usbdev;
777 771
778 res = usb_submit_urb(async_urb, GFP_ATOMIC); 772 res = usb_submit_urb(async_urb, GFP_ATOMIC);
779 if (res) { 773 if (res) {
780 mce_dbg(dev, "receive request FAILED! (res=%d)\n", res); 774 dev_err(dev, "receive request FAILED! (res=%d)", res);
781 return; 775 return;
782 } 776 }
783 mce_dbg(dev, "receive request complete (res=%d)\n", res); 777 dev_dbg(dev, "receive request complete (res=%d)", res);
784} 778}
785 779
786static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size) 780static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size)
@@ -895,8 +889,7 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
895 ir->carrier = carrier; 889 ir->carrier = carrier;
896 cmdbuf[2] = MCE_CMD_SIG_END; 890 cmdbuf[2] = MCE_CMD_SIG_END;
897 cmdbuf[3] = MCE_IRDATA_TRAILER; 891 cmdbuf[3] = MCE_IRDATA_TRAILER;
898 mce_dbg(ir->dev, "%s: disabling carrier " 892 dev_dbg(ir->dev, "disabling carrier modulation");
899 "modulation\n", __func__);
900 mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); 893 mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
901 return carrier; 894 return carrier;
902 } 895 }
@@ -907,8 +900,8 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier)
907 ir->carrier = carrier; 900 ir->carrier = carrier;
908 cmdbuf[2] = prescaler; 901 cmdbuf[2] = prescaler;
909 cmdbuf[3] = divisor; 902 cmdbuf[3] = divisor;
910 mce_dbg(ir->dev, "%s: requesting %u HZ " 903 dev_dbg(ir->dev, "requesting %u HZ carrier",
911 "carrier\n", __func__, carrier); 904 carrier);
912 905
913 /* Transmit new carrier to mce device */ 906 /* Transmit new carrier to mce device */
914 mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); 907 mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
@@ -998,7 +991,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
998 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 991 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
999 * US_TO_NS(MCE_TIME_UNIT); 992 * US_TO_NS(MCE_TIME_UNIT);
1000 993
1001 mce_dbg(ir->dev, "Storing %s with duration %d\n", 994 dev_dbg(ir->dev, "Storing %s with duration %d",
1002 rawir.pulse ? "pulse" : "space", 995 rawir.pulse ? "pulse" : "space",
1003 rawir.duration); 996 rawir.duration);
1004 997
@@ -1032,7 +1025,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
1032 ir->parser_state = CMD_HEADER; 1025 ir->parser_state = CMD_HEADER;
1033 } 1026 }
1034 if (event) { 1027 if (event) {
1035 mce_dbg(ir->dev, "processed IR data, calling ir_raw_event_handle\n"); 1028 dev_dbg(ir->dev, "processed IR data");
1036 ir_raw_event_handle(ir->rc); 1029 ir_raw_event_handle(ir->rc);
1037 } 1030 }
1038} 1031}
@@ -1055,7 +1048,7 @@ static void mceusb_dev_recv(struct urb *urb)
1055 1048
1056 if (ir->send_flags == RECV_FLAG_IN_PROGRESS) { 1049 if (ir->send_flags == RECV_FLAG_IN_PROGRESS) {
1057 ir->send_flags = SEND_FLAG_COMPLETE; 1050 ir->send_flags = SEND_FLAG_COMPLETE;
1058 mce_dbg(ir->dev, "setup answer received %d bytes\n", 1051 dev_dbg(ir->dev, "setup answer received %d bytes\n",
1059 buf_len); 1052 buf_len);
1060 } 1053 }
1061 1054
@@ -1067,13 +1060,14 @@ static void mceusb_dev_recv(struct urb *urb)
1067 1060
1068 case -ECONNRESET: 1061 case -ECONNRESET:
1069 case -ENOENT: 1062 case -ENOENT:
1063 case -EILSEQ:
1070 case -ESHUTDOWN: 1064 case -ESHUTDOWN:
1071 usb_unlink_urb(urb); 1065 usb_unlink_urb(urb);
1072 return; 1066 return;
1073 1067
1074 case -EPIPE: 1068 case -EPIPE:
1075 default: 1069 default:
1076 mce_dbg(ir->dev, "Error: urb status = %d\n", urb->status); 1070 dev_err(ir->dev, "Error: urb status = %d", urb->status);
1077 break; 1071 break;
1078 } 1072 }
1079 1073
@@ -1095,7 +1089,7 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
1095 1089
1096 data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL); 1090 data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL);
1097 if (!data) { 1091 if (!data) {
1098 dev_err(dev, "%s: memory allocation failed!\n", __func__); 1092 dev_err(dev, "%s: memory allocation failed!", __func__);
1099 return; 1093 return;
1100 } 1094 }
1101 1095
@@ -1106,28 +1100,28 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
1106 ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), 1100 ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0),
1107 USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, 1101 USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0,
1108 data, USB_CTRL_MSG_SZ, HZ * 3); 1102 data, USB_CTRL_MSG_SZ, HZ * 3);
1109 mce_dbg(dev, "%s - ret = %d\n", __func__, ret); 1103 dev_dbg(dev, "set address - ret = %d", ret);
1110 mce_dbg(dev, "%s - data[0] = %d, data[1] = %d\n", 1104 dev_dbg(dev, "set address - data[0] = %d, data[1] = %d",
1111 __func__, data[0], data[1]); 1105 data[0], data[1]);
1112 1106
1113 /* set feature: bit rate 38400 bps */ 1107 /* set feature: bit rate 38400 bps */
1114 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1108 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1115 USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, 1109 USB_REQ_SET_FEATURE, USB_TYPE_VENDOR,
1116 0xc04e, 0x0000, NULL, 0, HZ * 3); 1110 0xc04e, 0x0000, NULL, 0, HZ * 3);
1117 1111
1118 mce_dbg(dev, "%s - ret = %d\n", __func__, ret); 1112 dev_dbg(dev, "set feature - ret = %d", ret);
1119 1113
1120 /* bRequest 4: set char length to 8 bits */ 1114 /* bRequest 4: set char length to 8 bits */
1121 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1115 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1122 4, USB_TYPE_VENDOR, 1116 4, USB_TYPE_VENDOR,
1123 0x0808, 0x0000, NULL, 0, HZ * 3); 1117 0x0808, 0x0000, NULL, 0, HZ * 3);
1124 mce_dbg(dev, "%s - retB = %d\n", __func__, ret); 1118 dev_dbg(dev, "set char length - retB = %d", ret);
1125 1119
1126 /* bRequest 2: set handshaking to use DTR/DSR */ 1120 /* bRequest 2: set handshaking to use DTR/DSR */
1127 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), 1121 ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0),
1128 2, USB_TYPE_VENDOR, 1122 2, USB_TYPE_VENDOR,
1129 0x0000, 0x0100, NULL, 0, HZ * 3); 1123 0x0000, 0x0100, NULL, 0, HZ * 3);
1130 mce_dbg(dev, "%s - retC = %d\n", __func__, ret); 1124 dev_dbg(dev, "set handshake - retC = %d", ret);
1131 1125
1132 /* device resume */ 1126 /* device resume */
1133 mce_async_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME)); 1127 mce_async_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME));
@@ -1198,7 +1192,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1198 1192
1199 rc = rc_allocate_device(); 1193 rc = rc_allocate_device();
1200 if (!rc) { 1194 if (!rc) {
1201 dev_err(dev, "remote dev allocation failed\n"); 1195 dev_err(dev, "remote dev allocation failed");
1202 goto out; 1196 goto out;
1203 } 1197 }
1204 1198
@@ -1217,7 +1211,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1217 rc->dev.parent = dev; 1211 rc->dev.parent = dev;
1218 rc->priv = ir; 1212 rc->priv = ir;
1219 rc->driver_type = RC_DRIVER_IR_RAW; 1213 rc->driver_type = RC_DRIVER_IR_RAW;
1220 rc->allowed_protos = RC_BIT_ALL; 1214 rc_set_allowed_protocols(rc, RC_BIT_ALL);
1221 rc->timeout = MS_TO_NS(100); 1215 rc->timeout = MS_TO_NS(100);
1222 if (!ir->flags.no_tx) { 1216 if (!ir->flags.no_tx) {
1223 rc->s_tx_mask = mceusb_set_tx_mask; 1217 rc->s_tx_mask = mceusb_set_tx_mask;
@@ -1230,7 +1224,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1230 1224
1231 ret = rc_register_device(rc); 1225 ret = rc_register_device(rc);
1232 if (ret < 0) { 1226 if (ret < 0) {
1233 dev_err(dev, "remote dev registration failed\n"); 1227 dev_err(dev, "remote dev registration failed");
1234 goto out; 1228 goto out;
1235 } 1229 }
1236 1230
@@ -1258,7 +1252,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1258 bool tx_mask_normal; 1252 bool tx_mask_normal;
1259 int ir_intfnum; 1253 int ir_intfnum;
1260 1254
1261 mce_dbg(&intf->dev, "%s called\n", __func__); 1255 dev_dbg(&intf->dev, "%s called", __func__);
1262 1256
1263 idesc = intf->cur_altsetting; 1257 idesc = intf->cur_altsetting;
1264 1258
@@ -1286,8 +1280,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1286 ep_in = ep; 1280 ep_in = ep;
1287 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; 1281 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
1288 ep_in->bInterval = 1; 1282 ep_in->bInterval = 1;
1289 mce_dbg(&intf->dev, "acceptable inbound endpoint " 1283 dev_dbg(&intf->dev, "acceptable inbound endpoint found");
1290 "found\n");
1291 } 1284 }
1292 1285
1293 if ((ep_out == NULL) 1286 if ((ep_out == NULL)
@@ -1301,12 +1294,11 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1301 ep_out = ep; 1294 ep_out = ep;
1302 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; 1295 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
1303 ep_out->bInterval = 1; 1296 ep_out->bInterval = 1;
1304 mce_dbg(&intf->dev, "acceptable outbound endpoint " 1297 dev_dbg(&intf->dev, "acceptable outbound endpoint found");
1305 "found\n");
1306 } 1298 }
1307 } 1299 }
1308 if (ep_in == NULL) { 1300 if (ep_in == NULL) {
1309 mce_dbg(&intf->dev, "inbound and/or endpoint not found\n"); 1301 dev_dbg(&intf->dev, "inbound and/or endpoint not found");
1310 return -ENODEV; 1302 return -ENODEV;
1311 } 1303 }
1312 1304
@@ -1357,7 +1349,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1357 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 1349 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1358 1350
1359 /* flush buffers on the device */ 1351 /* flush buffers on the device */
1360 mce_dbg(&intf->dev, "Flushing receive buffers\n"); 1352 dev_dbg(&intf->dev, "Flushing receive buffers\n");
1361 mce_flush_rx_buffer(ir, maxp); 1353 mce_flush_rx_buffer(ir, maxp);
1362 1354
1363 /* figure out which firmware/emulator version this hardware has */ 1355 /* figure out which firmware/emulator version this hardware has */
@@ -1382,10 +1374,9 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1382 device_set_wakeup_capable(ir->dev, true); 1374 device_set_wakeup_capable(ir->dev, true);
1383 device_set_wakeup_enable(ir->dev, true); 1375 device_set_wakeup_enable(ir->dev, true);
1384 1376
1385 dev_info(&intf->dev, "Registered %s with mce emulator interface " 1377 dev_info(&intf->dev, "Registered %s with mce emulator interface version %x",
1386 "version %x\n", name, ir->emver); 1378 name, ir->emver);
1387 dev_info(&intf->dev, "%x tx ports (0x%x cabled) and " 1379 dev_info(&intf->dev, "%x tx ports (0x%x cabled) and %x rx sensors (0x%x active)",
1388 "%x rx sensors (0x%x active)\n",
1389 ir->num_txports, ir->txports_cabled, 1380 ir->num_txports, ir->txports_cabled,
1390 ir->num_rxports, ir->rxports_active); 1381 ir->num_rxports, ir->rxports_active);
1391 1382
@@ -1399,7 +1390,7 @@ urb_in_alloc_fail:
1399buf_in_alloc_fail: 1390buf_in_alloc_fail:
1400 kfree(ir); 1391 kfree(ir);
1401mem_alloc_fail: 1392mem_alloc_fail:
1402 dev_err(&intf->dev, "%s: device setup failed!\n", __func__); 1393 dev_err(&intf->dev, "%s: device setup failed!", __func__);
1403 1394
1404 return -ENOMEM; 1395 return -ENOMEM;
1405} 1396}
@@ -1427,7 +1418,7 @@ static void mceusb_dev_disconnect(struct usb_interface *intf)
1427static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message) 1418static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message)
1428{ 1419{
1429 struct mceusb_dev *ir = usb_get_intfdata(intf); 1420 struct mceusb_dev *ir = usb_get_intfdata(intf);
1430 dev_info(ir->dev, "suspend\n"); 1421 dev_info(ir->dev, "suspend");
1431 usb_kill_urb(ir->urb_in); 1422 usb_kill_urb(ir->urb_in);
1432 return 0; 1423 return 0;
1433} 1424}
@@ -1435,7 +1426,7 @@ static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message)
1435static int mceusb_dev_resume(struct usb_interface *intf) 1426static int mceusb_dev_resume(struct usb_interface *intf)
1436{ 1427{
1437 struct mceusb_dev *ir = usb_get_intfdata(intf); 1428 struct mceusb_dev *ir = usb_get_intfdata(intf);
1438 dev_info(ir->dev, "resume\n"); 1429 dev_info(ir->dev, "resume");
1439 if (usb_submit_urb(ir->urb_in, GFP_ATOMIC)) 1430 if (usb_submit_urb(ir->urb_in, GFP_ATOMIC))
1440 return -EIO; 1431 return -EIO;
1441 return 0; 1432 return 0;
@@ -1457,6 +1448,3 @@ MODULE_DESCRIPTION(DRIVER_DESC);
1457MODULE_AUTHOR(DRIVER_AUTHOR); 1448MODULE_AUTHOR(DRIVER_AUTHOR);
1458MODULE_LICENSE("GPL"); 1449MODULE_LICENSE("GPL");
1459MODULE_DEVICE_TABLE(usb, mceusb_dev_table); 1450MODULE_DEVICE_TABLE(usb, mceusb_dev_table);
1460
1461module_param(debug, bool, S_IRUGO | S_IWUSR);
1462MODULE_PARM_DESC(debug, "Debug enabled or not");
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 21ee0dc1b7ec..d244e1a83f43 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -330,9 +330,6 @@ static void nvt_cir_wake_ldev_init(struct nvt_dev *nvt)
330 /* Enable CIR Wake via PSOUT# (Pin60) */ 330 /* Enable CIR Wake via PSOUT# (Pin60) */
331 nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE); 331 nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE);
332 332
333 /* enable cir interrupt of mouse/keyboard IRQ event */
334 nvt_set_reg_bit(nvt, CIR_INTR_MOUSE_IRQ_BIT, CR_ACPI_IRQ_EVENTS);
335
336 /* enable pme interrupt of cir wakeup event */ 333 /* enable pme interrupt of cir wakeup event */
337 nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2); 334 nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2);
338 335
@@ -456,7 +453,6 @@ static void nvt_enable_wake(struct nvt_dev *nvt)
456 453
457 nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI); 454 nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI);
458 nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE); 455 nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE);
459 nvt_set_reg_bit(nvt, CIR_INTR_MOUSE_IRQ_BIT, CR_ACPI_IRQ_EVENTS);
460 nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2); 456 nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2);
461 457
462 nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); 458 nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
@@ -989,6 +985,12 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
989 goto exit_free_dev_rdev; 985 goto exit_free_dev_rdev;
990 986
991 ret = -ENODEV; 987 ret = -ENODEV;
988 /* activate pnp device */
989 if (pnp_activate_dev(pdev) < 0) {
990 dev_err(&pdev->dev, "Could not activate PNP device!\n");
991 goto exit_free_dev_rdev;
992 }
993
992 /* validate pnp resources */ 994 /* validate pnp resources */
993 if (!pnp_port_valid(pdev, 0) || 995 if (!pnp_port_valid(pdev, 0) ||
994 pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) { 996 pnp_port_len(pdev, 0) < CIR_IOREG_LENGTH) {
@@ -1042,7 +1044,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1042 /* Set up the rc device */ 1044 /* Set up the rc device */
1043 rdev->priv = nvt; 1045 rdev->priv = nvt;
1044 rdev->driver_type = RC_DRIVER_IR_RAW; 1046 rdev->driver_type = RC_DRIVER_IR_RAW;
1045 rdev->allowed_protos = RC_BIT_ALL; 1047 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
1046 rdev->open = nvt_open; 1048 rdev->open = nvt_open;
1047 rdev->close = nvt_close; 1049 rdev->close = nvt_close;
1048 rdev->tx_ir = nvt_tx_ir; 1050 rdev->tx_ir = nvt_tx_ir;
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
index 07e83108df0f..e1cf23c3875b 100644
--- a/drivers/media/rc/nuvoton-cir.h
+++ b/drivers/media/rc/nuvoton-cir.h
@@ -363,7 +363,6 @@ struct nvt_dev {
363#define LOGICAL_DEV_ENABLE 0x01 363#define LOGICAL_DEV_ENABLE 0x01
364 364
365#define CIR_WAKE_ENABLE_BIT 0x08 365#define CIR_WAKE_ENABLE_BIT 0x08
366#define CIR_INTR_MOUSE_IRQ_BIT 0x80
367#define PME_INTR_CIR_PASS_BIT 0x08 366#define PME_INTR_CIR_PASS_BIT 0x08
368 367
369/* w83677hg CIR pin config */ 368/* w83677hg CIR pin config */
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index 70a180bb0bd0..da536c93c978 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Remote Controller core raw events header 2 * Remote Controller core raw events header
3 * 3 *
4 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 4 * Copyright (C) 2010 by Mauro Carvalho Chehab
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License as published by
@@ -88,6 +88,12 @@ struct ir_raw_event_ctrl {
88 unsigned count; 88 unsigned count;
89 u64 bits; 89 u64 bits;
90 } sanyo; 90 } sanyo;
91 struct sharp_dec {
92 int state;
93 unsigned count;
94 u32 bits;
95 unsigned int pulse_len;
96 } sharp;
91 struct mce_kbd_dec { 97 struct mce_kbd_dec {
92 struct input_dev *idev; 98 struct input_dev *idev;
93 struct timer_list rx_timeout; 99 struct timer_list rx_timeout;
@@ -204,6 +210,13 @@ static inline void load_sony_decode(void) { }
204static inline void load_sanyo_decode(void) { } 210static inline void load_sanyo_decode(void) { }
205#endif 211#endif
206 212
213/* from ir-sharp-decoder.c */
214#ifdef CONFIG_IR_SHARP_DECODER_MODULE
215#define load_sharp_decode() request_module_nowait("ir-sharp-decoder")
216#else
217static inline void load_sharp_decode(void) { }
218#endif
219
207/* from ir-mce_kbd-decoder.c */ 220/* from ir-mce_kbd-decoder.c */
208#ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE 221#ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE
209#define load_mce_kbd_decode() request_module_nowait("ir-mce_kbd-decoder") 222#define load_mce_kbd_decode() request_module_nowait("ir-mce_kbd-decoder")
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index 53d02827a472..0a88e0cf964f 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -195,7 +195,7 @@ static int __init loop_init(void)
195 rc->map_name = RC_MAP_EMPTY; 195 rc->map_name = RC_MAP_EMPTY;
196 rc->priv = &loopdev; 196 rc->priv = &loopdev;
197 rc->driver_type = RC_DRIVER_IR_RAW; 197 rc->driver_type = RC_DRIVER_IR_RAW;
198 rc->allowed_protos = RC_BIT_ALL; 198 rc_set_allowed_protocols(rc, RC_BIT_ALL);
199 rc->timeout = 100 * 1000 * 1000; /* 100 ms */ 199 rc->timeout = 100 * 1000 * 1000; /* 100 ms */
200 rc->min_timeout = 1; 200 rc->min_timeout = 1;
201 rc->max_timeout = UINT_MAX; 201 rc->max_timeout = UINT_MAX;
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 02e2f38c9c85..99697aae92ff 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1,6 +1,6 @@
1/* rc-main.c - Remote Controller core module 1/* rc-main.c - Remote Controller core module
2 * 2 *
3 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 3 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
24 24
25/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */ 25/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */
26#define IRRCV_NUM_DEVICES 256 26#define IRRCV_NUM_DEVICES 256
27DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES); 27static DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES);
28 28
29/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ 29/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
30#define IR_TAB_MIN_SIZE 256 30#define IR_TAB_MIN_SIZE 256
@@ -62,7 +62,7 @@ struct rc_map *rc_map_get(const char *name)
62 map = seek_rc_map(name); 62 map = seek_rc_map(name);
63#ifdef MODULE 63#ifdef MODULE
64 if (!map) { 64 if (!map) {
65 int rc = request_module(name); 65 int rc = request_module("%s", name);
66 if (rc < 0) { 66 if (rc < 0) {
67 printk(KERN_ERR "Couldn't load IR keymap %s\n", name); 67 printk(KERN_ERR "Couldn't load IR keymap %s\n", name);
68 return NULL; 68 return NULL;
@@ -633,6 +633,7 @@ EXPORT_SYMBOL_GPL(rc_repeat);
633static void ir_do_keydown(struct rc_dev *dev, int scancode, 633static void ir_do_keydown(struct rc_dev *dev, int scancode,
634 u32 keycode, u8 toggle) 634 u32 keycode, u8 toggle)
635{ 635{
636 struct rc_scancode_filter *filter;
636 bool new_event = !dev->keypressed || 637 bool new_event = !dev->keypressed ||
637 dev->last_scancode != scancode || 638 dev->last_scancode != scancode ||
638 dev->last_toggle != toggle; 639 dev->last_toggle != toggle;
@@ -640,6 +641,11 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode,
640 if (new_event && dev->keypressed) 641 if (new_event && dev->keypressed)
641 ir_do_keyup(dev, false); 642 ir_do_keyup(dev, false);
642 643
644 /* Generic scancode filtering */
645 filter = &dev->scancode_filters[RC_FILTER_NORMAL];
646 if (filter->mask && ((scancode ^ filter->data) & filter->mask))
647 return;
648
643 input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); 649 input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode);
644 650
645 if (new_event && keycode != KEY_RESERVED) { 651 if (new_event && keycode != KEY_RESERVED) {
@@ -653,9 +659,10 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode,
653 "key 0x%04x, scancode 0x%04x\n", 659 "key 0x%04x, scancode 0x%04x\n",
654 dev->input_name, keycode, scancode); 660 dev->input_name, keycode, scancode);
655 input_report_key(dev->input_dev, keycode, 1); 661 input_report_key(dev->input_dev, keycode, 1);
662
663 led_trigger_event(led_feedback, LED_FULL);
656 } 664 }
657 665
658 led_trigger_event(led_feedback, LED_FULL);
659 input_sync(dev->input_dev); 666 input_sync(dev->input_dev);
660} 667}
661 668
@@ -790,18 +797,44 @@ static struct {
790 RC_BIT_SONY20, "sony" }, 797 RC_BIT_SONY20, "sony" },
791 { RC_BIT_RC5_SZ, "rc-5-sz" }, 798 { RC_BIT_RC5_SZ, "rc-5-sz" },
792 { RC_BIT_SANYO, "sanyo" }, 799 { RC_BIT_SANYO, "sanyo" },
800 { RC_BIT_SHARP, "sharp" },
793 { RC_BIT_MCE_KBD, "mce_kbd" }, 801 { RC_BIT_MCE_KBD, "mce_kbd" },
794 { RC_BIT_LIRC, "lirc" }, 802 { RC_BIT_LIRC, "lirc" },
795}; 803};
796 804
797/** 805/**
798 * show_protocols() - shows the current IR protocol(s) 806 * struct rc_filter_attribute - Device attribute relating to a filter type.
807 * @attr: Device attribute.
808 * @type: Filter type.
809 * @mask: false for filter value, true for filter mask.
810 */
811struct rc_filter_attribute {
812 struct device_attribute attr;
813 enum rc_filter_type type;
814 bool mask;
815};
816#define to_rc_filter_attr(a) container_of(a, struct rc_filter_attribute, attr)
817
818#define RC_PROTO_ATTR(_name, _mode, _show, _store, _type) \
819 struct rc_filter_attribute dev_attr_##_name = { \
820 .attr = __ATTR(_name, _mode, _show, _store), \
821 .type = (_type), \
822 }
823#define RC_FILTER_ATTR(_name, _mode, _show, _store, _type, _mask) \
824 struct rc_filter_attribute dev_attr_##_name = { \
825 .attr = __ATTR(_name, _mode, _show, _store), \
826 .type = (_type), \
827 .mask = (_mask), \
828 }
829
830/**
831 * show_protocols() - shows the current/wakeup IR protocol(s)
799 * @device: the device descriptor 832 * @device: the device descriptor
800 * @mattr: the device attribute struct (unused) 833 * @mattr: the device attribute struct (unused)
801 * @buf: a pointer to the output buffer 834 * @buf: a pointer to the output buffer
802 * 835 *
803 * This routine is a callback routine for input read the IR protocol type(s). 836 * This routine is a callback routine for input read the IR protocol type(s).
804 * it is trigged by reading /sys/class/rc/rc?/protocols. 837 * it is trigged by reading /sys/class/rc/rc?/[wakeup_]protocols.
805 * It returns the protocol names of supported protocols. 838 * It returns the protocol names of supported protocols.
806 * Enabled protocols are printed in brackets. 839 * Enabled protocols are printed in brackets.
807 * 840 *
@@ -812,6 +845,7 @@ static ssize_t show_protocols(struct device *device,
812 struct device_attribute *mattr, char *buf) 845 struct device_attribute *mattr, char *buf)
813{ 846{
814 struct rc_dev *dev = to_rc_dev(device); 847 struct rc_dev *dev = to_rc_dev(device);
848 struct rc_filter_attribute *fattr = to_rc_filter_attr(mattr);
815 u64 allowed, enabled; 849 u64 allowed, enabled;
816 char *tmp = buf; 850 char *tmp = buf;
817 int i; 851 int i;
@@ -822,9 +856,10 @@ static ssize_t show_protocols(struct device *device,
822 856
823 mutex_lock(&dev->lock); 857 mutex_lock(&dev->lock);
824 858
825 enabled = dev->enabled_protocols; 859 enabled = dev->enabled_protocols[fattr->type];
826 if (dev->driver_type == RC_DRIVER_SCANCODE) 860 if (dev->driver_type == RC_DRIVER_SCANCODE ||
827 allowed = dev->allowed_protos; 861 fattr->type == RC_FILTER_WAKEUP)
862 allowed = dev->allowed_protocols[fattr->type];
828 else if (dev->raw) 863 else if (dev->raw)
829 allowed = ir_raw_get_allowed_protocols(); 864 allowed = ir_raw_get_allowed_protocols();
830 else { 865 else {
@@ -856,14 +891,14 @@ static ssize_t show_protocols(struct device *device,
856} 891}
857 892
858/** 893/**
859 * store_protocols() - changes the current IR protocol(s) 894 * store_protocols() - changes the current/wakeup IR protocol(s)
860 * @device: the device descriptor 895 * @device: the device descriptor
861 * @mattr: the device attribute struct (unused) 896 * @mattr: the device attribute struct (unused)
862 * @buf: a pointer to the input buffer 897 * @buf: a pointer to the input buffer
863 * @len: length of the input buffer 898 * @len: length of the input buffer
864 * 899 *
865 * This routine is for changing the IR protocol type. 900 * This routine is for changing the IR protocol type.
866 * It is trigged by writing to /sys/class/rc/rc?/protocols. 901 * It is trigged by writing to /sys/class/rc/rc?/[wakeup_]protocols.
867 * Writing "+proto" will add a protocol to the list of enabled protocols. 902 * Writing "+proto" will add a protocol to the list of enabled protocols.
868 * Writing "-proto" will remove a protocol from the list of enabled protocols. 903 * Writing "-proto" will remove a protocol from the list of enabled protocols.
869 * Writing "proto" will enable only "proto". 904 * Writing "proto" will enable only "proto".
@@ -880,12 +915,15 @@ static ssize_t store_protocols(struct device *device,
880 size_t len) 915 size_t len)
881{ 916{
882 struct rc_dev *dev = to_rc_dev(device); 917 struct rc_dev *dev = to_rc_dev(device);
918 struct rc_filter_attribute *fattr = to_rc_filter_attr(mattr);
883 bool enable, disable; 919 bool enable, disable;
884 const char *tmp; 920 const char *tmp;
885 u64 type; 921 u64 old_type, type;
886 u64 mask; 922 u64 mask;
887 int rc, i, count = 0; 923 int rc, i, count = 0;
888 ssize_t ret; 924 ssize_t ret;
925 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
926 struct rc_scancode_filter local_filter, *filter;
889 927
890 /* Device is being removed */ 928 /* Device is being removed */
891 if (!dev) 929 if (!dev)
@@ -898,7 +936,8 @@ static ssize_t store_protocols(struct device *device,
898 ret = -EINVAL; 936 ret = -EINVAL;
899 goto out; 937 goto out;
900 } 938 }
901 type = dev->enabled_protocols; 939 old_type = dev->enabled_protocols[fattr->type];
940 type = old_type;
902 941
903 while ((tmp = strsep((char **) &data, " \n")) != NULL) { 942 while ((tmp = strsep((char **) &data, " \n")) != NULL) {
904 if (!*tmp) 943 if (!*tmp)
@@ -946,8 +985,10 @@ static ssize_t store_protocols(struct device *device,
946 goto out; 985 goto out;
947 } 986 }
948 987
949 if (dev->change_protocol) { 988 change_protocol = (fattr->type == RC_FILTER_NORMAL)
950 rc = dev->change_protocol(dev, &type); 989 ? dev->change_protocol : dev->change_wakeup_protocol;
990 if (change_protocol) {
991 rc = change_protocol(dev, &type);
951 if (rc < 0) { 992 if (rc < 0) {
952 IR_dprintk(1, "Error setting protocols to 0x%llx\n", 993 IR_dprintk(1, "Error setting protocols to 0x%llx\n",
953 (long long)type); 994 (long long)type);
@@ -956,10 +997,40 @@ static ssize_t store_protocols(struct device *device,
956 } 997 }
957 } 998 }
958 999
959 dev->enabled_protocols = type; 1000 dev->enabled_protocols[fattr->type] = type;
960 IR_dprintk(1, "Current protocol(s): 0x%llx\n", 1001 IR_dprintk(1, "Current protocol(s): 0x%llx\n",
961 (long long)type); 1002 (long long)type);
962 1003
1004 /*
1005 * If the protocol is changed the filter needs updating.
1006 * Try setting the same filter with the new protocol (if any).
1007 * Fall back to clearing the filter.
1008 */
1009 filter = &dev->scancode_filters[fattr->type];
1010 if (old_type != type && filter->mask) {
1011 local_filter = *filter;
1012 if (!type) {
1013 /* no protocol => clear filter */
1014 ret = -1;
1015 } else if (!dev->s_filter) {
1016 /* generic filtering => accept any filter */
1017 ret = 0;
1018 } else {
1019 /* hardware filtering => try setting, otherwise clear */
1020 ret = dev->s_filter(dev, fattr->type, &local_filter);
1021 }
1022 if (ret < 0) {
1023 /* clear the filter */
1024 local_filter.data = 0;
1025 local_filter.mask = 0;
1026 if (dev->s_filter)
1027 dev->s_filter(dev, fattr->type, &local_filter);
1028 }
1029
1030 /* commit the new filter */
1031 *filter = local_filter;
1032 }
1033
963 ret = len; 1034 ret = len;
964 1035
965out: 1036out:
@@ -967,6 +1038,115 @@ out:
967 return ret; 1038 return ret;
968} 1039}
969 1040
1041/**
1042 * show_filter() - shows the current scancode filter value or mask
1043 * @device: the device descriptor
1044 * @attr: the device attribute struct
1045 * @buf: a pointer to the output buffer
1046 *
1047 * This routine is a callback routine to read a scancode filter value or mask.
1048 * It is trigged by reading /sys/class/rc/rc?/[wakeup_]filter[_mask].
1049 * It prints the current scancode filter value or mask of the appropriate filter
1050 * type in hexadecimal into @buf and returns the size of the buffer.
1051 *
1052 * Bits of the filter value corresponding to set bits in the filter mask are
1053 * compared against input scancodes and non-matching scancodes are discarded.
1054 *
1055 * dev->lock is taken to guard against races between device registration,
1056 * store_filter and show_filter.
1057 */
1058static ssize_t show_filter(struct device *device,
1059 struct device_attribute *attr,
1060 char *buf)
1061{
1062 struct rc_dev *dev = to_rc_dev(device);
1063 struct rc_filter_attribute *fattr = to_rc_filter_attr(attr);
1064 u32 val;
1065
1066 /* Device is being removed */
1067 if (!dev)
1068 return -EINVAL;
1069
1070 mutex_lock(&dev->lock);
1071 if (fattr->mask)
1072 val = dev->scancode_filters[fattr->type].mask;
1073 else
1074 val = dev->scancode_filters[fattr->type].data;
1075 mutex_unlock(&dev->lock);
1076
1077 return sprintf(buf, "%#x\n", val);
1078}
1079
1080/**
1081 * store_filter() - changes the scancode filter value
1082 * @device: the device descriptor
1083 * @attr: the device attribute struct
1084 * @buf: a pointer to the input buffer
1085 * @len: length of the input buffer
1086 *
1087 * This routine is for changing a scancode filter value or mask.
1088 * It is trigged by writing to /sys/class/rc/rc?/[wakeup_]filter[_mask].
1089 * Returns -EINVAL if an invalid filter value for the current protocol was
1090 * specified or if scancode filtering is not supported by the driver, otherwise
1091 * returns @len.
1092 *
1093 * Bits of the filter value corresponding to set bits in the filter mask are
1094 * compared against input scancodes and non-matching scancodes are discarded.
1095 *
1096 * dev->lock is taken to guard against races between device registration,
1097 * store_filter and show_filter.
1098 */
1099static ssize_t store_filter(struct device *device,
1100 struct device_attribute *attr,
1101 const char *buf,
1102 size_t count)
1103{
1104 struct rc_dev *dev = to_rc_dev(device);
1105 struct rc_filter_attribute *fattr = to_rc_filter_attr(attr);
1106 struct rc_scancode_filter local_filter, *filter;
1107 int ret;
1108 unsigned long val;
1109
1110 /* Device is being removed */
1111 if (!dev)
1112 return -EINVAL;
1113
1114 ret = kstrtoul(buf, 0, &val);
1115 if (ret < 0)
1116 return ret;
1117
1118 /* Scancode filter not supported (but still accept 0) */
1119 if (!dev->s_filter && fattr->type != RC_FILTER_NORMAL)
1120 return val ? -EINVAL : count;
1121
1122 mutex_lock(&dev->lock);
1123
1124 /* Tell the driver about the new filter */
1125 filter = &dev->scancode_filters[fattr->type];
1126 local_filter = *filter;
1127 if (fattr->mask)
1128 local_filter.mask = val;
1129 else
1130 local_filter.data = val;
1131 if (!dev->enabled_protocols[fattr->type] && local_filter.mask) {
1132 /* refuse to set a filter unless a protocol is enabled */
1133 ret = -EINVAL;
1134 goto unlock;
1135 }
1136 if (dev->s_filter) {
1137 ret = dev->s_filter(dev, fattr->type, &local_filter);
1138 if (ret < 0)
1139 goto unlock;
1140 }
1141
1142 /* Success, commit the new filter */
1143 *filter = local_filter;
1144
1145unlock:
1146 mutex_unlock(&dev->lock);
1147 return (ret < 0) ? ret : count;
1148}
1149
970static void rc_dev_release(struct device *device) 1150static void rc_dev_release(struct device *device)
971{ 1151{
972} 1152}
@@ -996,11 +1176,26 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
996/* 1176/*
997 * Static device attribute struct with the sysfs attributes for IR's 1177 * Static device attribute struct with the sysfs attributes for IR's
998 */ 1178 */
999static DEVICE_ATTR(protocols, S_IRUGO | S_IWUSR, 1179static RC_PROTO_ATTR(protocols, S_IRUGO | S_IWUSR,
1000 show_protocols, store_protocols); 1180 show_protocols, store_protocols, RC_FILTER_NORMAL);
1181static RC_PROTO_ATTR(wakeup_protocols, S_IRUGO | S_IWUSR,
1182 show_protocols, store_protocols, RC_FILTER_WAKEUP);
1183static RC_FILTER_ATTR(filter, S_IRUGO|S_IWUSR,
1184 show_filter, store_filter, RC_FILTER_NORMAL, false);
1185static RC_FILTER_ATTR(filter_mask, S_IRUGO|S_IWUSR,
1186 show_filter, store_filter, RC_FILTER_NORMAL, true);
1187static RC_FILTER_ATTR(wakeup_filter, S_IRUGO|S_IWUSR,
1188 show_filter, store_filter, RC_FILTER_WAKEUP, false);
1189static RC_FILTER_ATTR(wakeup_filter_mask, S_IRUGO|S_IWUSR,
1190 show_filter, store_filter, RC_FILTER_WAKEUP, true);
1001 1191
1002static struct attribute *rc_dev_attrs[] = { 1192static struct attribute *rc_dev_attrs[] = {
1003 &dev_attr_protocols.attr, 1193 &dev_attr_protocols.attr.attr,
1194 &dev_attr_wakeup_protocols.attr.attr,
1195 &dev_attr_filter.attr.attr,
1196 &dev_attr_filter_mask.attr.attr,
1197 &dev_attr_wakeup_filter.attr.attr,
1198 &dev_attr_wakeup_filter_mask.attr.attr,
1004 NULL, 1199 NULL,
1005}; 1200};
1006 1201
@@ -1091,14 +1286,6 @@ int rc_register_device(struct rc_dev *dev)
1091 if (dev->close) 1286 if (dev->close)
1092 dev->input_dev->close = ir_close; 1287 dev->input_dev->close = ir_close;
1093 1288
1094 /*
1095 * Take the lock here, as the device sysfs node will appear
1096 * when device_add() is called, which may trigger an ir-keytable udev
1097 * rule, which will in turn call show_protocols and access
1098 * dev->enabled_protocols before it has been initialized.
1099 */
1100 mutex_lock(&dev->lock);
1101
1102 do { 1289 do {
1103 devno = find_first_zero_bit(ir_core_dev_number, 1290 devno = find_first_zero_bit(ir_core_dev_number,
1104 IRRCV_NUM_DEVICES); 1291 IRRCV_NUM_DEVICES);
@@ -1107,6 +1294,14 @@ int rc_register_device(struct rc_dev *dev)
1107 return -ENOMEM; 1294 return -ENOMEM;
1108 } while (test_and_set_bit(devno, ir_core_dev_number)); 1295 } while (test_and_set_bit(devno, ir_core_dev_number));
1109 1296
1297 /*
1298 * Take the lock here, as the device sysfs node will appear
1299 * when device_add() is called, which may trigger an ir-keytable udev
1300 * rule, which will in turn call show_protocols and access
1301 * dev->enabled_protocols before it has been initialized.
1302 */
1303 mutex_lock(&dev->lock);
1304
1110 dev->devno = devno; 1305 dev->devno = devno;
1111 dev_set_name(&dev->dev, "rc%ld", dev->devno); 1306 dev_set_name(&dev->dev, "rc%ld", dev->devno);
1112 dev_set_drvdata(&dev->dev, dev); 1307 dev_set_drvdata(&dev->dev, dev);
@@ -1172,7 +1367,7 @@ int rc_register_device(struct rc_dev *dev)
1172 rc = dev->change_protocol(dev, &rc_type); 1367 rc = dev->change_protocol(dev, &rc_type);
1173 if (rc < 0) 1368 if (rc < 0)
1174 goto out_raw; 1369 goto out_raw;
1175 dev->enabled_protocols = rc_type; 1370 dev->enabled_protocols[RC_FILTER_NORMAL] = rc_type;
1176 } 1371 }
1177 1372
1178 mutex_unlock(&dev->lock); 1373 mutex_unlock(&dev->lock);
@@ -1260,5 +1455,5 @@ int rc_core_debug; /* ir_debug level (0,1,2) */
1260EXPORT_SYMBOL_GPL(rc_core_debug); 1455EXPORT_SYMBOL_GPL(rc_core_debug);
1261module_param_named(debug, rc_core_debug, int, 0644); 1456module_param_named(debug, rc_core_debug, int, 0644);
1262 1457
1263MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 1458MODULE_AUTHOR("Mauro Carvalho Chehab");
1264MODULE_LICENSE("GPL"); 1459MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index a5d4f883d053..47cd373e2295 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -922,7 +922,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
922 rc->dev.parent = dev; 922 rc->dev.parent = dev;
923 rc->priv = rr3; 923 rc->priv = rr3;
924 rc->driver_type = RC_DRIVER_IR_RAW; 924 rc->driver_type = RC_DRIVER_IR_RAW;
925 rc->allowed_protos = RC_BIT_ALL; 925 rc_set_allowed_protocols(rc, RC_BIT_ALL);
926 rc->timeout = US_TO_NS(2750); 926 rc->timeout = US_TO_NS(2750);
927 rc->tx_ir = redrat3_transmit_ir; 927 rc->tx_ir = redrat3_transmit_ir;
928 rc->s_tx_carrier = redrat3_set_tx_carrier; 928 rc->s_tx_carrier = redrat3_set_tx_carrier;
diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 8f0cddb9e8f2..22e4c1f28ab4 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -287,7 +287,7 @@ static int st_rc_probe(struct platform_device *pdev)
287 st_rc_hardware_init(rc_dev); 287 st_rc_hardware_init(rc_dev);
288 288
289 rdev->driver_type = RC_DRIVER_IR_RAW; 289 rdev->driver_type = RC_DRIVER_IR_RAW;
290 rdev->allowed_protos = RC_BIT_ALL; 290 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
291 /* rx sampling rate is 10Mhz */ 291 /* rx sampling rate is 10Mhz */
292 rdev->rx_resolution = 100; 292 rdev->rx_resolution = 100;
293 rdev->timeout = US_TO_NS(MAX_SYMB_TIME); 293 rdev->timeout = US_TO_NS(MAX_SYMB_TIME);
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index d7b11e6a9982..f4e0bc3d382c 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -322,7 +322,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
322 rdev->dev.parent = dev; 322 rdev->dev.parent = dev;
323 rdev->priv = sz; 323 rdev->priv = sz;
324 rdev->driver_type = RC_DRIVER_IR_RAW; 324 rdev->driver_type = RC_DRIVER_IR_RAW;
325 rdev->allowed_protos = RC_BIT_ALL; 325 rc_set_allowed_protocols(rdev, RC_BIT_ALL);
326 rdev->driver_name = DRIVER_NAME; 326 rdev->driver_name = DRIVER_NAME;
327 rdev->map_name = RC_MAP_STREAMZAP; 327 rdev->map_name = RC_MAP_STREAMZAP;
328 328
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index d8de2056a4f6..c5be38e2a2fe 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -318,7 +318,7 @@ static int ttusbir_probe(struct usb_interface *intf,
318 usb_to_input_id(tt->udev, &rc->input_id); 318 usb_to_input_id(tt->udev, &rc->input_id);
319 rc->dev.parent = &intf->dev; 319 rc->dev.parent = &intf->dev;
320 rc->driver_type = RC_DRIVER_IR_RAW; 320 rc->driver_type = RC_DRIVER_IR_RAW;
321 rc->allowed_protos = RC_BIT_ALL; 321 rc_set_allowed_protocols(rc, RC_BIT_ALL);
322 rc->priv = tt; 322 rc->priv = tt;
323 rc->driver_name = DRIVER_NAME; 323 rc->driver_name = DRIVER_NAME;
324 rc->map_name = RC_MAP_TT_1500; 324 rc->map_name = RC_MAP_TT_1500;
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 904baf4eec28..a8b981f5ce2e 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1082,7 +1082,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1082 data->dev->dev.parent = &device->dev; 1082 data->dev->dev.parent = &device->dev;
1083 data->dev->timeout = MS_TO_NS(100); 1083 data->dev->timeout = MS_TO_NS(100);
1084 data->dev->rx_resolution = US_TO_NS(2); 1084 data->dev->rx_resolution = US_TO_NS(2);
1085 data->dev->allowed_protos = RC_BIT_ALL; 1085 rc_set_allowed_protocols(data->dev, RC_BIT_ALL);
1086 1086
1087 err = rc_register_device(data->dev); 1087 err = rc_register_device(data->dev);
1088 if (err) 1088 if (err)