diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 22:22:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-13 22:22:22 -0500 |
commit | d8c532c40721f7507896d202b8cae3b3642d2b0d (patch) | |
tree | 42b1ce76671eb85324281ed93491432f4523f983 /drivers/media/rc | |
parent | e777d192ffb9f2929d547a2f8a5f65b7db7a9552 (diff) | |
parent | 77c53d0b56264a8fc5844e087ad15fffe20c299d (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:
- Missing MAINTAINERS entries were added for several drivers
- Adds V4L2 support for DMABUF handling, allowing zero-copy buffer
sharing between V4L2 devices and GPU
- Got rid of all warnings when compiling with W=1 on x86
- Add a new driver for Exynos hardware (s3c-camif)
- Several bug fixes, cleanups and driver improvements
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (243 commits)
[media] omap3isp: Replace cpu_is_omap3630() with ISP revision check
[media] omap3isp: Prepare/unprepare clocks before/after enable/disable
[media] omap3isp: preview: Add support for 8-bit formats at the sink pad
[media] omap3isp: Replace printk with dev_*
[media] omap3isp: Find source pad from external entity
[media] omap3isp: Configure CSI-2 phy based on platform data
[media] omap3isp: Add PHY routing configuration
[media] omap3isp: Add CSI configuration registers from control block to ISP resources
[media] omap3isp: Remove unneeded module memory address definitions
[media] omap3isp: Use monotonic timestamps for statistics buffers
[media] uvcvideo: Fix control value clamping for unsigned integer controls
[media] uvcvideo: Mark first output terminal as default video node
[media] uvcvideo: Add VIDIOC_[GS]_PRIORITY support
[media] uvcvideo: Return -ENOTTY for unsupported ioctls
[media] uvcvideo: Set device_caps in VIDIOC_QUERYCAP
[media] uvcvideo: Don't fail when an unsupported format is requested
[media] uvcvideo: Return -EACCES when trying to access a read/write-only control
[media] uvcvideo: Set error_idx properly for extended controls API failures
[media] rtl28xxu: add NOXON DAB/DAB+ USB dongle rev 2
[media] fc2580: write some registers conditionally
...
Diffstat (limited to 'drivers/media/rc')
28 files changed, 232 insertions, 151 deletions
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 49bb356ed14..2d6fb26a017 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_TYPE_OTHER; | 787 | rdev->allowed_protos = 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 d05ac15b5de..22231dd4f62 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c | |||
@@ -329,7 +329,7 @@ static int ene_rx_get_sample_reg(struct ene_device *dev) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | /* Sense current received carrier */ | 331 | /* Sense current received carrier */ |
332 | void ene_rx_sense_carrier(struct ene_device *dev) | 332 | static void ene_rx_sense_carrier(struct ene_device *dev) |
333 | { | 333 | { |
334 | DEFINE_IR_RAW_EVENT(ev); | 334 | DEFINE_IR_RAW_EVENT(ev); |
335 | 335 | ||
@@ -1003,7 +1003,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1003 | dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); | 1003 | dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); |
1004 | rdev = rc_allocate_device(); | 1004 | rdev = rc_allocate_device(); |
1005 | if (!dev || !rdev) | 1005 | if (!dev || !rdev) |
1006 | goto error1; | 1006 | goto failure; |
1007 | 1007 | ||
1008 | /* validate resources */ | 1008 | /* validate resources */ |
1009 | error = -ENODEV; | 1009 | error = -ENODEV; |
@@ -1014,10 +1014,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1014 | 1014 | ||
1015 | if (!pnp_port_valid(pnp_dev, 0) || | 1015 | if (!pnp_port_valid(pnp_dev, 0) || |
1016 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) | 1016 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) |
1017 | goto error; | 1017 | goto failure; |
1018 | 1018 | ||
1019 | if (!pnp_irq_valid(pnp_dev, 0)) | 1019 | if (!pnp_irq_valid(pnp_dev, 0)) |
1020 | goto error; | 1020 | goto failure; |
1021 | 1021 | ||
1022 | spin_lock_init(&dev->hw_lock); | 1022 | spin_lock_init(&dev->hw_lock); |
1023 | 1023 | ||
@@ -1033,7 +1033,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1033 | /* detect hardware version and features */ | 1033 | /* detect hardware version and features */ |
1034 | error = ene_hw_detect(dev); | 1034 | error = ene_hw_detect(dev); |
1035 | if (error) | 1035 | if (error) |
1036 | goto error; | 1036 | goto failure; |
1037 | 1037 | ||
1038 | if (!dev->hw_learning_and_tx_capable && txsim) { | 1038 | if (!dev->hw_learning_and_tx_capable && txsim) { |
1039 | dev->hw_learning_and_tx_capable = true; | 1039 | dev->hw_learning_and_tx_capable = true; |
@@ -1046,7 +1046,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1046 | learning_mode_force = false; | 1046 | learning_mode_force = false; |
1047 | 1047 | ||
1048 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1048 | rdev->driver_type = RC_DRIVER_IR_RAW; |
1049 | rdev->allowed_protos = RC_TYPE_ALL; | 1049 | rdev->allowed_protos = RC_BIT_ALL; |
1050 | rdev->priv = dev; | 1050 | rdev->priv = dev; |
1051 | rdev->open = ene_open; | 1051 | rdev->open = ene_open; |
1052 | rdev->close = ene_close; | 1052 | rdev->close = ene_close; |
@@ -1078,30 +1078,27 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1078 | /* claim the resources */ | 1078 | /* claim the resources */ |
1079 | error = -EBUSY; | 1079 | error = -EBUSY; |
1080 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { | 1080 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { |
1081 | dev->hw_io = -1; | 1081 | goto failure; |
1082 | dev->irq = -1; | ||
1083 | goto error; | ||
1084 | } | 1082 | } |
1085 | 1083 | ||
1086 | dev->irq = pnp_irq(pnp_dev, 0); | 1084 | dev->irq = pnp_irq(pnp_dev, 0); |
1087 | if (request_irq(dev->irq, ene_isr, | 1085 | if (request_irq(dev->irq, ene_isr, |
1088 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { | 1086 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { |
1089 | dev->irq = -1; | 1087 | goto failure2; |
1090 | goto error; | ||
1091 | } | 1088 | } |
1092 | 1089 | ||
1093 | error = rc_register_device(rdev); | 1090 | error = rc_register_device(rdev); |
1094 | if (error < 0) | 1091 | if (error < 0) |
1095 | goto error; | 1092 | goto failure3; |
1096 | 1093 | ||
1097 | pr_notice("driver has been successfully loaded\n"); | 1094 | pr_notice("driver has been successfully loaded\n"); |
1098 | return 0; | 1095 | return 0; |
1099 | error: | 1096 | |
1100 | if (dev && dev->irq >= 0) | 1097 | failure3: |
1101 | free_irq(dev->irq, dev); | 1098 | free_irq(dev->irq, dev); |
1102 | if (dev && dev->hw_io >= 0) | 1099 | failure2: |
1103 | release_region(dev->hw_io, ENE_IO_SIZE); | 1100 | release_region(dev->hw_io, ENE_IO_SIZE); |
1104 | error1: | 1101 | failure: |
1105 | rc_free_device(rdev); | 1102 | rc_free_device(rdev); |
1106 | kfree(dev); | 1103 | kfree(dev); |
1107 | return error; | 1104 | return error; |
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 52fd7696b1b..936c3f79b62 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_TYPE_ALL; | 544 | rdev->allowed_protos = 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; |
@@ -684,12 +684,12 @@ static struct pnp_driver fintek_driver = { | |||
684 | .shutdown = fintek_shutdown, | 684 | .shutdown = fintek_shutdown, |
685 | }; | 685 | }; |
686 | 686 | ||
687 | int fintek_init(void) | 687 | static int fintek_init(void) |
688 | { | 688 | { |
689 | return pnp_register_driver(&fintek_driver); | 689 | return pnp_register_driver(&fintek_driver); |
690 | } | 690 | } |
691 | 691 | ||
692 | void fintek_exit(void) | 692 | static void fintek_exit(void) |
693 | { | 693 | { |
694 | pnp_unregister_driver(&fintek_driver); | 694 | pnp_unregister_driver(&fintek_driver); |
695 | } | 695 | } |
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 04cb272db16..ba1a1eb356c 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c | |||
@@ -95,7 +95,7 @@ static int __devinit gpio_ir_recv_probe(struct platform_device *pdev) | |||
95 | if (pdata->allowed_protos) | 95 | if (pdata->allowed_protos) |
96 | rcdev->allowed_protos = pdata->allowed_protos; | 96 | rcdev->allowed_protos = pdata->allowed_protos; |
97 | else | 97 | else |
98 | rcdev->allowed_protos = RC_TYPE_ALL; | 98 | rcdev->allowed_protos = RC_BIT_ALL; |
99 | rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; | 99 | rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; |
100 | 100 | ||
101 | gpio_dev->rcdev = rcdev; | 101 | gpio_dev->rcdev = rcdev; |
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 51d7057aca0..5a9163da63c 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c | |||
@@ -499,7 +499,7 @@ static int __devinit iguanair_probe(struct usb_interface *intf, | |||
499 | usb_to_input_id(ir->udev, &rc->input_id); | 499 | usb_to_input_id(ir->udev, &rc->input_id); |
500 | rc->dev.parent = &intf->dev; | 500 | rc->dev.parent = &intf->dev; |
501 | rc->driver_type = RC_DRIVER_IR_RAW; | 501 | rc->driver_type = RC_DRIVER_IR_RAW; |
502 | rc->allowed_protos = RC_TYPE_ALL; | 502 | rc->allowed_protos = RC_BIT_ALL; |
503 | rc->priv = ir; | 503 | rc->priv = ir; |
504 | rc->open = iguanair_open; | 504 | rc->open = iguanair_open; |
505 | rc->close = iguanair_close; | 505 | rc->close = iguanair_close; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 5dd0386604f..8f6a28921ed 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -1001,7 +1001,7 @@ static void imon_touch_display_timeout(unsigned long data) | |||
1001 | * it is not, so we must acquire it prior to calling send_packet, which | 1001 | * it is not, so we must acquire it prior to calling send_packet, which |
1002 | * requires that the lock is held. | 1002 | * requires that the lock is held. |
1003 | */ | 1003 | */ |
1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | 1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type) |
1005 | { | 1005 | { |
1006 | int retval; | 1006 | int retval; |
1007 | struct imon_context *ictx = rc->priv; | 1007 | struct imon_context *ictx = rc->priv; |
@@ -1010,31 +1010,27 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1010 | unsigned char ir_proto_packet[] = { | 1010 | unsigned char ir_proto_packet[] = { |
1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
1012 | 1012 | ||
1013 | if (rc_type && !(rc_type & rc->allowed_protos)) | 1013 | if (*rc_type && !(*rc_type & rc->allowed_protos)) |
1014 | dev_warn(dev, "Looks like you're trying to use an IR protocol " | 1014 | dev_warn(dev, "Looks like you're trying to use an IR protocol " |
1015 | "this device does not support\n"); | 1015 | "this device does not support\n"); |
1016 | 1016 | ||
1017 | switch (rc_type) { | 1017 | if (*rc_type & RC_BIT_RC6_MCE) { |
1018 | case RC_TYPE_RC6: | ||
1019 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); | 1018 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); |
1020 | ir_proto_packet[0] = 0x01; | 1019 | ir_proto_packet[0] = 0x01; |
1021 | break; | 1020 | *rc_type = RC_BIT_RC6_MCE; |
1022 | case RC_TYPE_UNKNOWN: | 1021 | } else if (*rc_type & RC_BIT_OTHER) { |
1023 | case RC_TYPE_OTHER: | ||
1024 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); | 1022 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); |
1025 | if (!pad_stabilize) | 1023 | if (!pad_stabilize) |
1026 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1024 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1027 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1025 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1028 | rc_type = RC_TYPE_OTHER; | 1026 | *rc_type = RC_BIT_OTHER; |
1029 | break; | 1027 | } else { |
1030 | default: | ||
1031 | dev_warn(dev, "Unsupported IR protocol specified, overriding " | 1028 | dev_warn(dev, "Unsupported IR protocol specified, overriding " |
1032 | "to iMON IR protocol\n"); | 1029 | "to iMON IR protocol\n"); |
1033 | if (!pad_stabilize) | 1030 | if (!pad_stabilize) |
1034 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1031 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1035 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1032 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1036 | rc_type = RC_TYPE_OTHER; | 1033 | *rc_type = RC_BIT_OTHER; |
1037 | break; | ||
1038 | } | 1034 | } |
1039 | 1035 | ||
1040 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); | 1036 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); |
@@ -1048,7 +1044,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1048 | if (retval) | 1044 | if (retval) |
1049 | goto out; | 1045 | goto out; |
1050 | 1046 | ||
1051 | ictx->rc_type = rc_type; | 1047 | ictx->rc_type = *rc_type; |
1052 | ictx->pad_mouse = false; | 1048 | ictx->pad_mouse = false; |
1053 | 1049 | ||
1054 | out: | 1050 | out: |
@@ -1323,7 +1319,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | |||
1323 | rel_x = buf[2]; | 1319 | rel_x = buf[2]; |
1324 | rel_y = buf[3]; | 1320 | rel_y = buf[3]; |
1325 | 1321 | ||
1326 | if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { | 1322 | if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) { |
1327 | if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { | 1323 | if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { |
1328 | dir = stabilize((int)rel_x, (int)rel_y, | 1324 | dir = stabilize((int)rel_x, (int)rel_y, |
1329 | timeout, threshold); | 1325 | timeout, threshold); |
@@ -1390,7 +1386,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | |||
1390 | buf[0] = 0x01; | 1386 | buf[0] = 0x01; |
1391 | buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; | 1387 | buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; |
1392 | 1388 | ||
1393 | if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { | 1389 | if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) { |
1394 | dir = stabilize((int)rel_x, (int)rel_y, | 1390 | dir = stabilize((int)rel_x, (int)rel_y, |
1395 | timeout, threshold); | 1391 | timeout, threshold); |
1396 | if (!dir) { | 1392 | if (!dir) { |
@@ -1511,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1511 | kc = imon_panel_key_lookup(scancode); | 1507 | kc = imon_panel_key_lookup(scancode); |
1512 | } else { | 1508 | } else { |
1513 | scancode = be32_to_cpu(*((u32 *)buf)); | 1509 | scancode = be32_to_cpu(*((u32 *)buf)); |
1514 | if (ictx->rc_type == RC_TYPE_RC6) { | 1510 | if (ictx->rc_type == RC_BIT_RC6_MCE) { |
1515 | ktype = IMON_KEY_IMON; | 1511 | ktype = IMON_KEY_IMON; |
1516 | if (buf[0] == 0x80) | 1512 | if (buf[0] == 0x80) |
1517 | ktype = IMON_KEY_MCE; | 1513 | ktype = IMON_KEY_MCE; |
@@ -1744,7 +1740,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
1744 | { | 1740 | { |
1745 | u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; | 1741 | u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; |
1746 | u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; | 1742 | u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; |
1747 | u64 allowed_protos = RC_TYPE_OTHER; | 1743 | u64 allowed_protos = RC_BIT_OTHER; |
1748 | 1744 | ||
1749 | switch (ffdc_cfg_byte) { | 1745 | switch (ffdc_cfg_byte) { |
1750 | /* iMON Knob, no display, iMON IR + vol knob */ | 1746 | /* iMON Knob, no display, iMON IR + vol knob */ |
@@ -1775,13 +1771,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
1775 | case 0x9e: | 1771 | case 0x9e: |
1776 | dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); | 1772 | dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); |
1777 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | 1773 | detected_display_type = IMON_DISPLAY_TYPE_VFD; |
1778 | allowed_protos = RC_TYPE_RC6; | 1774 | allowed_protos = RC_BIT_RC6_MCE; |
1779 | break; | 1775 | break; |
1780 | /* iMON LCD, MCE IR */ | 1776 | /* iMON LCD, MCE IR */ |
1781 | case 0x9f: | 1777 | case 0x9f: |
1782 | dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); | 1778 | dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); |
1783 | detected_display_type = IMON_DISPLAY_TYPE_LCD; | 1779 | detected_display_type = IMON_DISPLAY_TYPE_LCD; |
1784 | allowed_protos = RC_TYPE_RC6; | 1780 | allowed_protos = RC_BIT_RC6_MCE; |
1785 | break; | 1781 | break; |
1786 | default: | 1782 | default: |
1787 | dev_info(ictx->dev, "Unknown 0xffdc device, " | 1783 | dev_info(ictx->dev, "Unknown 0xffdc device, " |
@@ -1789,7 +1785,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
1789 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | 1785 | detected_display_type = IMON_DISPLAY_TYPE_VFD; |
1790 | /* We don't know which one it is, allow user to set the | 1786 | /* We don't know which one it is, allow user to set the |
1791 | * RC6 one from userspace if OTHER wasn't correct. */ | 1787 | * RC6 one from userspace if OTHER wasn't correct. */ |
1792 | allowed_protos |= RC_TYPE_RC6; | 1788 | allowed_protos |= RC_BIT_RC6_MCE; |
1793 | break; | 1789 | break; |
1794 | } | 1790 | } |
1795 | 1791 | ||
@@ -1875,7 +1871,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1875 | 1871 | ||
1876 | rdev->priv = ictx; | 1872 | rdev->priv = ictx; |
1877 | rdev->driver_type = RC_DRIVER_SCANCODE; | 1873 | rdev->driver_type = RC_DRIVER_SCANCODE; |
1878 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ | 1874 | rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */ |
1879 | rdev->change_protocol = imon_ir_change_protocol; | 1875 | rdev->change_protocol = imon_ir_change_protocol; |
1880 | rdev->driver_name = MOD_NAME; | 1876 | rdev->driver_name = MOD_NAME; |
1881 | 1877 | ||
@@ -1893,7 +1889,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1893 | 1889 | ||
1894 | imon_set_display_type(ictx); | 1890 | imon_set_display_type(ictx); |
1895 | 1891 | ||
1896 | if (ictx->rc_type == RC_TYPE_RC6) | 1892 | if (ictx->rc_type == RC_BIT_RC6_MCE) |
1897 | rdev->map_name = RC_MAP_IMON_MCE; | 1893 | rdev->map_name = RC_MAP_IMON_MCE; |
1898 | else | 1894 | else |
1899 | rdev->map_name = RC_MAP_IMON_PAD; | 1895 | rdev->map_name = RC_MAP_IMON_PAD; |
diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index 035668e27f6..69edffb9fe9 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->raw->enabled_protocols & RC_TYPE_JVC)) | 50 | if (!(dev->raw->enabled_protocols & RC_BIT_JVC)) |
51 | return 0; | 51 | return 0; |
52 | 52 | ||
53 | if (!is_timing_event(ev)) { | 53 | if (!is_timing_event(ev)) { |
@@ -174,7 +174,7 @@ out: | |||
174 | } | 174 | } |
175 | 175 | ||
176 | static struct ir_raw_handler jvc_handler = { | 176 | static struct ir_raw_handler jvc_handler = { |
177 | .protocols = RC_TYPE_JVC, | 177 | .protocols = RC_BIT_JVC, |
178 | .decode = ir_jvc_decode, | 178 | .decode = ir_jvc_decode, |
179 | }; | 179 | }; |
180 | 180 | ||
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 870c93052fd..9945e5e7f61 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->raw->enabled_protocols & RC_TYPE_LIRC)) | 38 | if (!(dev->raw->enabled_protocols & 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) |
@@ -408,7 +408,7 @@ static int ir_lirc_unregister(struct rc_dev *dev) | |||
408 | } | 408 | } |
409 | 409 | ||
410 | static struct ir_raw_handler lirc_handler = { | 410 | static struct ir_raw_handler lirc_handler = { |
411 | .protocols = RC_TYPE_LIRC, | 411 | .protocols = RC_BIT_LIRC, |
412 | .decode = ir_lirc_decode, | 412 | .decode = ir_lirc_decode, |
413 | .raw_register = ir_lirc_register, | 413 | .raw_register = ir_lirc_register, |
414 | .raw_unregister = ir_lirc_unregister, | 414 | .raw_unregister = ir_lirc_unregister, |
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c index 3784ebf80ec..33fafa4cf7c 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->raw->enabled_protocols & RC_TYPE_MCE_KBD)) | 219 | if (!(dev->raw->enabled_protocols & RC_BIT_MCE_KBD)) |
220 | return 0; | 220 | return 0; |
221 | 221 | ||
222 | if (!is_timing_event(ev)) { | 222 | if (!is_timing_event(ev)) { |
@@ -422,7 +422,7 @@ static int ir_mce_kbd_unregister(struct rc_dev *dev) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | static struct ir_raw_handler mce_kbd_handler = { | 424 | static struct ir_raw_handler mce_kbd_handler = { |
425 | .protocols = RC_TYPE_MCE_KBD, | 425 | .protocols = RC_BIT_MCE_KBD, |
426 | .decode = ir_mce_kbd_decode, | 426 | .decode = ir_mce_kbd_decode, |
427 | .raw_register = ir_mce_kbd_register, | 427 | .raw_register = ir_mce_kbd_register, |
428 | .raw_unregister = ir_mce_kbd_unregister, | 428 | .raw_unregister = ir_mce_kbd_unregister, |
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 2ca509e6e16..a47ee363496 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c | |||
@@ -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->raw->enabled_protocols & RC_TYPE_NEC)) | 55 | if (!(dev->raw->enabled_protocols & RC_BIT_NEC)) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | if (!is_timing_event(ev)) { | 58 | if (!is_timing_event(ev)) { |
@@ -201,7 +201,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | static struct ir_raw_handler nec_handler = { | 203 | static struct ir_raw_handler nec_handler = { |
204 | .protocols = RC_TYPE_NEC, | 204 | .protocols = RC_BIT_NEC, |
205 | .decode = ir_nec_decode, | 205 | .decode = ir_nec_decode, |
206 | }; | 206 | }; |
207 | 207 | ||
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index 9ab663a507a..5b4d1ddeac4 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c | |||
@@ -52,8 +52,8 @@ 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->raw->enabled_protocols & RC_TYPE_RC5)) | 55 | if (!(dev->raw->enabled_protocols & (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)) { |
59 | if (ev.reset) | 59 | if (ev.reset) |
@@ -128,6 +128,10 @@ 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->raw->enabled_protocols & RC_BIT_RC5X)) { | ||
132 | data->state = STATE_INACTIVE; | ||
133 | return 0; | ||
134 | } | ||
131 | xdata = (data->bits & 0x0003F) >> 0; | 135 | xdata = (data->bits & 0x0003F) >> 0; |
132 | command = (data->bits & 0x00FC0) >> 6; | 136 | command = (data->bits & 0x00FC0) >> 6; |
133 | system = (data->bits & 0x1F000) >> 12; | 137 | system = (data->bits & 0x1F000) >> 12; |
@@ -141,6 +145,10 @@ again: | |||
141 | } else { | 145 | } else { |
142 | /* RC5 */ | 146 | /* RC5 */ |
143 | u8 command, system; | 147 | u8 command, system; |
148 | if (!(dev->raw->enabled_protocols & RC_BIT_RC5)) { | ||
149 | data->state = STATE_INACTIVE; | ||
150 | return 0; | ||
151 | } | ||
144 | command = (data->bits & 0x0003F) >> 0; | 152 | command = (data->bits & 0x0003F) >> 0; |
145 | system = (data->bits & 0x007C0) >> 6; | 153 | system = (data->bits & 0x007C0) >> 6; |
146 | toggle = (data->bits & 0x00800) ? 1 : 0; | 154 | toggle = (data->bits & 0x00800) ? 1 : 0; |
@@ -164,7 +172,7 @@ out: | |||
164 | } | 172 | } |
165 | 173 | ||
166 | static struct ir_raw_handler rc5_handler = { | 174 | static struct ir_raw_handler rc5_handler = { |
167 | .protocols = RC_TYPE_RC5, | 175 | .protocols = RC_BIT_RC5 | RC_BIT_RC5X, |
168 | .decode = ir_rc5_decode, | 176 | .decode = ir_rc5_decode, |
169 | }; | 177 | }; |
170 | 178 | ||
diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c index ec8d4a2e2c5..fd807a8308d 100644 --- a/drivers/media/rc/ir-rc5-sz-decoder.c +++ b/drivers/media/rc/ir-rc5-sz-decoder.c | |||
@@ -48,8 +48,8 @@ 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->raw->enabled_protocols & RC_TYPE_RC5_SZ)) | 51 | if (!(dev->raw->enabled_protocols & RC_BIT_RC5_SZ)) |
52 | return 0; | 52 | return 0; |
53 | 53 | ||
54 | if (!is_timing_event(ev)) { | 54 | if (!is_timing_event(ev)) { |
55 | if (ev.reset) | 55 | if (ev.reset) |
@@ -128,7 +128,7 @@ out: | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static struct ir_raw_handler rc5_sz_handler = { | 130 | static struct ir_raw_handler rc5_sz_handler = { |
131 | .protocols = RC_TYPE_RC5_SZ, | 131 | .protocols = RC_BIT_RC5_SZ, |
132 | .decode = ir_rc5_sz_decode, | 132 | .decode = ir_rc5_sz_decode, |
133 | }; | 133 | }; |
134 | 134 | ||
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 4cfdd7fa4bb..e19072ffb36 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c | |||
@@ -89,7 +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->raw->enabled_protocols & RC_TYPE_RC6)) | 92 | if (!(dev->raw->enabled_protocols & |
93 | (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | | ||
94 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE))) | ||
93 | return 0; | 95 | return 0; |
94 | 96 | ||
95 | if (!is_timing_event(ev)) { | 97 | if (!is_timing_event(ev)) { |
@@ -271,7 +273,9 @@ out: | |||
271 | } | 273 | } |
272 | 274 | ||
273 | static struct ir_raw_handler rc6_handler = { | 275 | static struct ir_raw_handler rc6_handler = { |
274 | .protocols = RC_TYPE_RC6, | 276 | .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | |
277 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | | ||
278 | RC_BIT_RC6_MCE, | ||
275 | .decode = ir_rc6_decode, | 279 | .decode = ir_rc6_decode, |
276 | }; | 280 | }; |
277 | 281 | ||
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c index 82e6c1e282d..9e76c7b40af 100644 --- a/drivers/media/rc/ir-rx51.c +++ b/drivers/media/rc/ir-rx51.c | |||
@@ -479,18 +479,7 @@ struct platform_driver lirc_rx51_platform_driver = { | |||
479 | .owner = THIS_MODULE, | 479 | .owner = THIS_MODULE, |
480 | }, | 480 | }, |
481 | }; | 481 | }; |
482 | 482 | module_platform_driver(lirc_rx51_platform_driver); | |
483 | static int __init lirc_rx51_init(void) | ||
484 | { | ||
485 | return platform_driver_register(&lirc_rx51_platform_driver); | ||
486 | } | ||
487 | module_init(lirc_rx51_init); | ||
488 | |||
489 | static void __exit lirc_rx51_exit(void) | ||
490 | { | ||
491 | platform_driver_unregister(&lirc_rx51_platform_driver); | ||
492 | } | ||
493 | module_exit(lirc_rx51_exit); | ||
494 | 483 | ||
495 | MODULE_DESCRIPTION("LIRC TX driver for Nokia RX51"); | 484 | MODULE_DESCRIPTION("LIRC TX driver for Nokia RX51"); |
496 | MODULE_AUTHOR("Nokia Corporation"); | 485 | MODULE_AUTHOR("Nokia Corporation"); |
diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c index 7e54ec57bcf..7e69a3b6537 100644 --- a/drivers/media/rc/ir-sanyo-decoder.c +++ b/drivers/media/rc/ir-sanyo-decoder.c | |||
@@ -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->raw->enabled_protocols & RC_TYPE_SANYO)) | 61 | if (!(dev->raw->enabled_protocols & RC_BIT_SANYO)) |
62 | return 0; | 62 | return 0; |
63 | 63 | ||
64 | if (!is_timing_event(ev)) { | 64 | if (!is_timing_event(ev)) { |
@@ -179,7 +179,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | static struct ir_raw_handler sanyo_handler = { | 181 | static struct ir_raw_handler sanyo_handler = { |
182 | .protocols = RC_TYPE_SANYO, | 182 | .protocols = RC_BIT_SANYO, |
183 | .decode = ir_sanyo_decode, | 183 | .decode = ir_sanyo_decode, |
184 | }; | 184 | }; |
185 | 185 | ||
diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index dab98b37621..fb914342cf4 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c | |||
@@ -45,7 +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->raw->enabled_protocols & RC_TYPE_SONY)) | 48 | if (!(dev->raw->enabled_protocols & |
49 | (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20))) | ||
49 | return 0; | 50 | return 0; |
50 | 51 | ||
51 | if (!is_timing_event(ev)) { | 52 | if (!is_timing_event(ev)) { |
@@ -123,16 +124,28 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
123 | 124 | ||
124 | switch (data->count) { | 125 | switch (data->count) { |
125 | case 12: | 126 | case 12: |
127 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY12)) { | ||
128 | data->state = STATE_INACTIVE; | ||
129 | return 0; | ||
130 | } | ||
126 | device = bitrev8((data->bits << 3) & 0xF8); | 131 | device = bitrev8((data->bits << 3) & 0xF8); |
127 | subdevice = 0; | 132 | subdevice = 0; |
128 | function = bitrev8((data->bits >> 4) & 0xFE); | 133 | function = bitrev8((data->bits >> 4) & 0xFE); |
129 | break; | 134 | break; |
130 | case 15: | 135 | case 15: |
136 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY15)) { | ||
137 | data->state = STATE_INACTIVE; | ||
138 | return 0; | ||
139 | } | ||
131 | device = bitrev8((data->bits >> 0) & 0xFF); | 140 | device = bitrev8((data->bits >> 0) & 0xFF); |
132 | subdevice = 0; | 141 | subdevice = 0; |
133 | function = bitrev8((data->bits >> 7) & 0xFE); | 142 | function = bitrev8((data->bits >> 7) & 0xFE); |
134 | break; | 143 | break; |
135 | case 20: | 144 | case 20: |
145 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY20)) { | ||
146 | data->state = STATE_INACTIVE; | ||
147 | return 0; | ||
148 | } | ||
136 | device = bitrev8((data->bits >> 5) & 0xF8); | 149 | device = bitrev8((data->bits >> 5) & 0xF8); |
137 | subdevice = bitrev8((data->bits >> 0) & 0xFF); | 150 | subdevice = bitrev8((data->bits >> 0) & 0xFF); |
138 | function = bitrev8((data->bits >> 12) & 0xFE); | 151 | function = bitrev8((data->bits >> 12) & 0xFE); |
@@ -157,7 +170,7 @@ out: | |||
157 | } | 170 | } |
158 | 171 | ||
159 | static struct ir_raw_handler sony_handler = { | 172 | static struct ir_raw_handler sony_handler = { |
160 | .protocols = RC_TYPE_SONY, | 173 | .protocols = RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20, |
161 | .decode = ir_sony_decode, | 174 | .decode = ir_sony_decode, |
162 | }; | 175 | }; |
163 | 176 | ||
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 24c77a42fc3..5e5a7f2b818 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_TYPE_ALL; | 1566 | rdev->allowed_protos = 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; |
@@ -1708,12 +1708,12 @@ static struct pnp_driver ite_driver = { | |||
1708 | .shutdown = ite_shutdown, | 1708 | .shutdown = ite_shutdown, |
1709 | }; | 1709 | }; |
1710 | 1710 | ||
1711 | int ite_init(void) | 1711 | static int ite_init(void) |
1712 | { | 1712 | { |
1713 | return pnp_register_driver(&ite_driver); | 1713 | return pnp_register_driver(&ite_driver); |
1714 | } | 1714 | } |
1715 | 1715 | ||
1716 | void ite_exit(void) | 1716 | static void ite_exit(void) |
1717 | { | 1717 | { |
1718 | pnp_unregister_driver(&ite_driver); | 1718 | pnp_unregister_driver(&ite_driver); |
1719 | } | 1719 | } |
diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c index 124c7228ba8..f0da960560b 100644 --- a/drivers/media/rc/keymaps/rc-imon-mce.c +++ b/drivers/media/rc/keymaps/rc-imon-mce.c | |||
@@ -121,7 +121,7 @@ static struct rc_map_list imon_mce_map = { | |||
121 | .scan = imon_mce, | 121 | .scan = imon_mce, |
122 | .size = ARRAY_SIZE(imon_mce), | 122 | .size = ARRAY_SIZE(imon_mce), |
123 | /* its RC6, but w/a hardware decoder */ | 123 | /* its RC6, but w/a hardware decoder */ |
124 | .rc_type = RC_TYPE_RC6, | 124 | .rc_type = RC_TYPE_RC6_MCE, |
125 | .name = RC_MAP_IMON_MCE, | 125 | .name = RC_MAP_IMON_MCE, |
126 | } | 126 | } |
127 | }; | 127 | }; |
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 753e43ec787..ef4006fe4de 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c | |||
@@ -97,7 +97,7 @@ static struct rc_map_list rc6_mce_map = { | |||
97 | .map = { | 97 | .map = { |
98 | .scan = rc6_mce, | 98 | .scan = rc6_mce, |
99 | .size = ARRAY_SIZE(rc6_mce), | 99 | .size = ARRAY_SIZE(rc6_mce), |
100 | .rc_type = RC_TYPE_RC6, | 100 | .rc_type = RC_TYPE_RC6_MCE, |
101 | .name = RC_MAP_RC6_MCE, | 101 | .name = RC_MAP_RC6_MCE, |
102 | } | 102 | } |
103 | }; | 103 | }; |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 850547fe711..b2146cd99fd 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -1205,7 +1205,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) | |||
1205 | rc->dev.parent = dev; | 1205 | rc->dev.parent = dev; |
1206 | rc->priv = ir; | 1206 | rc->priv = ir; |
1207 | rc->driver_type = RC_DRIVER_IR_RAW; | 1207 | rc->driver_type = RC_DRIVER_IR_RAW; |
1208 | rc->allowed_protos = RC_TYPE_ALL; | 1208 | rc->allowed_protos = RC_BIT_ALL; |
1209 | rc->timeout = MS_TO_NS(100); | 1209 | rc->timeout = MS_TO_NS(100); |
1210 | if (!ir->flags.no_tx) { | 1210 | if (!ir->flags.no_tx) { |
1211 | rc->s_tx_mask = mceusb_set_tx_mask; | 1211 | rc->s_tx_mask = mceusb_set_tx_mask; |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 2ea913a44ae..e4ea89a11ee 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
@@ -472,6 +472,7 @@ static void nvt_enable_wake(struct nvt_dev *nvt) | |||
472 | nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); | 472 | nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); |
473 | } | 473 | } |
474 | 474 | ||
475 | #if 0 /* Currently unused */ | ||
475 | /* rx carrier detect only works in learning mode, must be called w/nvt_lock */ | 476 | /* rx carrier detect only works in learning mode, must be called w/nvt_lock */ |
476 | static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | 477 | static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) |
477 | { | 478 | { |
@@ -504,7 +505,7 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | |||
504 | 505 | ||
505 | return carrier; | 506 | return carrier; |
506 | } | 507 | } |
507 | 508 | #endif | |
508 | /* | 509 | /* |
509 | * set carrier frequency | 510 | * set carrier frequency |
510 | * | 511 | * |
@@ -620,7 +621,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt) | |||
620 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | 621 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) |
621 | { | 622 | { |
622 | DEFINE_IR_RAW_EVENT(rawir); | 623 | DEFINE_IR_RAW_EVENT(rawir); |
623 | u32 carrier; | ||
624 | u8 sample; | 624 | u8 sample; |
625 | int i; | 625 | int i; |
626 | 626 | ||
@@ -629,9 +629,6 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
629 | if (debug) | 629 | if (debug) |
630 | nvt_dump_rx_buf(nvt); | 630 | nvt_dump_rx_buf(nvt); |
631 | 631 | ||
632 | if (nvt->carrier_detect_enabled) | ||
633 | carrier = nvt_rx_carrier_detect(nvt); | ||
634 | |||
635 | nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts); | 632 | nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts); |
636 | 633 | ||
637 | init_ir_raw_event(&rawir); | 634 | init_ir_raw_event(&rawir); |
@@ -1045,7 +1042,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
1045 | /* Set up the rc device */ | 1042 | /* Set up the rc device */ |
1046 | rdev->priv = nvt; | 1043 | rdev->priv = nvt; |
1047 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1044 | rdev->driver_type = RC_DRIVER_IR_RAW; |
1048 | rdev->allowed_protos = RC_TYPE_ALL; | 1045 | rdev->allowed_protos = RC_BIT_ALL; |
1049 | rdev->open = nvt_open; | 1046 | rdev->open = nvt_open; |
1050 | rdev->close = nvt_close; | 1047 | rdev->close = nvt_close; |
1051 | rdev->tx_ir = nvt_tx_ir; | 1048 | rdev->tx_ir = nvt_tx_ir; |
@@ -1220,12 +1217,12 @@ static struct pnp_driver nvt_driver = { | |||
1220 | .shutdown = nvt_shutdown, | 1217 | .shutdown = nvt_shutdown, |
1221 | }; | 1218 | }; |
1222 | 1219 | ||
1223 | int nvt_init(void) | 1220 | static int nvt_init(void) |
1224 | { | 1221 | { |
1225 | return pnp_register_driver(&nvt_driver); | 1222 | return pnp_register_driver(&nvt_driver); |
1226 | } | 1223 | } |
1227 | 1224 | ||
1228 | void nvt_exit(void) | 1225 | static void nvt_exit(void) |
1229 | { | 1226 | { |
1230 | pnp_unregister_driver(&nvt_driver); | 1227 | pnp_unregister_driver(&nvt_driver); |
1231 | } | 1228 | } |
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 0d5e0872a2e..7c3674ff5ea 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h | |||
@@ -103,7 +103,6 @@ struct nvt_dev { | |||
103 | 103 | ||
104 | /* rx settings */ | 104 | /* rx settings */ |
105 | bool learning_enabled; | 105 | bool learning_enabled; |
106 | bool carrier_detect_enabled; | ||
107 | 106 | ||
108 | /* track cir wake state */ | 107 | /* track cir wake state */ |
109 | u8 wake_state; | 108 | u8 wake_state; |
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index f9be68132c6..53d02827a47 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_TYPE_ALL; | 198 | rc->allowed_protos = 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 cabc19c1051..601d1ac1c68 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -725,25 +725,36 @@ static struct class ir_input_class = { | |||
725 | .devnode = ir_devnode, | 725 | .devnode = ir_devnode, |
726 | }; | 726 | }; |
727 | 727 | ||
728 | /* | ||
729 | * These are the protocol textual descriptions that are | ||
730 | * used by the sysfs protocols file. Note that the order | ||
731 | * of the entries is relevant. | ||
732 | */ | ||
728 | static struct { | 733 | static struct { |
729 | u64 type; | 734 | u64 type; |
730 | char *name; | 735 | char *name; |
731 | } proto_names[] = { | 736 | } proto_names[] = { |
732 | { RC_TYPE_UNKNOWN, "unknown" }, | 737 | { RC_BIT_NONE, "none" }, |
733 | { RC_TYPE_RC5, "rc-5" }, | 738 | { RC_BIT_OTHER, "other" }, |
734 | { RC_TYPE_NEC, "nec" }, | 739 | { RC_BIT_UNKNOWN, "unknown" }, |
735 | { RC_TYPE_RC6, "rc-6" }, | 740 | { RC_BIT_RC5 | |
736 | { RC_TYPE_JVC, "jvc" }, | 741 | RC_BIT_RC5X, "rc-5" }, |
737 | { RC_TYPE_SONY, "sony" }, | 742 | { RC_BIT_NEC, "nec" }, |
738 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, | 743 | { RC_BIT_RC6_0 | |
739 | { RC_TYPE_SANYO, "sanyo" }, | 744 | RC_BIT_RC6_6A_20 | |
740 | { RC_TYPE_MCE_KBD, "mce_kbd" }, | 745 | RC_BIT_RC6_6A_24 | |
741 | { RC_TYPE_LIRC, "lirc" }, | 746 | RC_BIT_RC6_6A_32 | |
742 | { RC_TYPE_OTHER, "other" }, | 747 | RC_BIT_RC6_MCE, "rc-6" }, |
748 | { RC_BIT_JVC, "jvc" }, | ||
749 | { RC_BIT_SONY12 | | ||
750 | RC_BIT_SONY15 | | ||
751 | RC_BIT_SONY20, "sony" }, | ||
752 | { RC_BIT_RC5_SZ, "rc-5-sz" }, | ||
753 | { RC_BIT_SANYO, "sanyo" }, | ||
754 | { RC_BIT_MCE_KBD, "mce_kbd" }, | ||
755 | { RC_BIT_LIRC, "lirc" }, | ||
743 | }; | 756 | }; |
744 | 757 | ||
745 | #define PROTO_NONE "none" | ||
746 | |||
747 | /** | 758 | /** |
748 | * show_protocols() - shows the current IR protocol(s) | 759 | * show_protocols() - shows the current IR protocol(s) |
749 | * @device: the device descriptor | 760 | * @device: the device descriptor |
@@ -790,6 +801,9 @@ static ssize_t show_protocols(struct device *device, | |||
790 | tmp += sprintf(tmp, "[%s] ", proto_names[i].name); | 801 | tmp += sprintf(tmp, "[%s] ", proto_names[i].name); |
791 | else if (allowed & proto_names[i].type) | 802 | else if (allowed & proto_names[i].type) |
792 | tmp += sprintf(tmp, "%s ", proto_names[i].name); | 803 | tmp += sprintf(tmp, "%s ", proto_names[i].name); |
804 | |||
805 | if (allowed & proto_names[i].type) | ||
806 | allowed &= ~proto_names[i].type; | ||
793 | } | 807 | } |
794 | 808 | ||
795 | if (tmp != buf) | 809 | if (tmp != buf) |
@@ -867,26 +881,20 @@ static ssize_t store_protocols(struct device *device, | |||
867 | disable = false; | 881 | disable = false; |
868 | } | 882 | } |
869 | 883 | ||
870 | if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) { | 884 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { |
871 | tmp += sizeof(PROTO_NONE); | 885 | if (!strcasecmp(tmp, proto_names[i].name)) { |
872 | mask = 0; | 886 | mask = proto_names[i].type; |
873 | count++; | 887 | break; |
874 | } else { | ||
875 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { | ||
876 | if (!strcasecmp(tmp, proto_names[i].name)) { | ||
877 | tmp += strlen(proto_names[i].name); | ||
878 | mask = proto_names[i].type; | ||
879 | break; | ||
880 | } | ||
881 | } | ||
882 | if (i == ARRAY_SIZE(proto_names)) { | ||
883 | IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); | ||
884 | ret = -EINVAL; | ||
885 | goto out; | ||
886 | } | 888 | } |
887 | count++; | ||
888 | } | 889 | } |
889 | 890 | ||
891 | if (i == ARRAY_SIZE(proto_names)) { | ||
892 | IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); | ||
893 | return -EINVAL; | ||
894 | } | ||
895 | |||
896 | count++; | ||
897 | |||
890 | if (enable) | 898 | if (enable) |
891 | type |= mask; | 899 | type |= mask; |
892 | else if (disable) | 900 | else if (disable) |
@@ -902,7 +910,7 @@ static ssize_t store_protocols(struct device *device, | |||
902 | } | 910 | } |
903 | 911 | ||
904 | if (dev->change_protocol) { | 912 | if (dev->change_protocol) { |
905 | rc = dev->change_protocol(dev, type); | 913 | rc = dev->change_protocol(dev, &type); |
906 | if (rc < 0) { | 914 | if (rc < 0) { |
907 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", | 915 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", |
908 | (long long)type); | 916 | (long long)type); |
@@ -1117,7 +1125,8 @@ int rc_register_device(struct rc_dev *dev) | |||
1117 | } | 1125 | } |
1118 | 1126 | ||
1119 | if (dev->change_protocol) { | 1127 | if (dev->change_protocol) { |
1120 | rc = dev->change_protocol(dev, rc_map->rc_type); | 1128 | u64 rc_type = (1 << rc_map->rc_type); |
1129 | rc = dev->change_protocol(dev, &rc_type); | ||
1121 | if (rc < 0) | 1130 | if (rc < 0) |
1122 | goto out_raw; | 1131 | goto out_raw; |
1123 | } | 1132 | } |
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 9f5a17bb5ef..a8887aba9fa 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c | |||
@@ -1082,7 +1082,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) | |||
1082 | rc->dev.parent = dev; | 1082 | rc->dev.parent = dev; |
1083 | rc->priv = rr3; | 1083 | rc->priv = rr3; |
1084 | rc->driver_type = RC_DRIVER_IR_RAW; | 1084 | rc->driver_type = RC_DRIVER_IR_RAW; |
1085 | rc->allowed_protos = RC_TYPE_ALL; | 1085 | rc->allowed_protos = RC_BIT_ALL; |
1086 | rc->timeout = US_TO_NS(2750); | 1086 | rc->timeout = US_TO_NS(2750); |
1087 | rc->tx_ir = redrat3_transmit_ir; | 1087 | rc->tx_ir = redrat3_transmit_ir; |
1088 | rc->s_tx_carrier = redrat3_set_tx_carrier; | 1088 | rc->s_tx_carrier = redrat3_set_tx_carrier; |
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index d6f4bfe0939..c720f12f661 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_TYPE_ALL; | 325 | rdev->allowed_protos = 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 fef05235234..f0921b5483e 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c | |||
@@ -316,7 +316,7 @@ static int __devinit ttusbir_probe(struct usb_interface *intf, | |||
316 | usb_to_input_id(tt->udev, &rc->input_id); | 316 | usb_to_input_id(tt->udev, &rc->input_id); |
317 | rc->dev.parent = &intf->dev; | 317 | rc->dev.parent = &intf->dev; |
318 | rc->driver_type = RC_DRIVER_IR_RAW; | 318 | rc->driver_type = RC_DRIVER_IR_RAW; |
319 | rc->allowed_protos = RC_TYPE_ALL; | 319 | rc->allowed_protos = RC_BIT_ALL; |
320 | rc->priv = tt; | 320 | rc->priv = tt; |
321 | rc->driver_name = DRIVER_NAME; | 321 | rc->driver_name = DRIVER_NAME; |
322 | rc->map_name = RC_MAP_TT_1500; | 322 | rc->map_name = RC_MAP_TT_1500; |
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 7c9b5f33113..7f3c476dde0 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * with minor modifications. | 7 | * with minor modifications. |
8 | * | 8 | * |
9 | * Original Author: David Härdeman <david@hardeman.nu> | 9 | * Original Author: David Härdeman <david@hardeman.nu> |
10 | * Copyright (C) 2012 Sean Young <sean@mess.org> | ||
10 | * Copyright (C) 2009 - 2011 David Härdeman <david@hardeman.nu> | 11 | * Copyright (C) 2009 - 2011 David Härdeman <david@hardeman.nu> |
11 | * | 12 | * |
12 | * Dedicated to my daughter Matilda, without whose loving attention this | 13 | * Dedicated to my daughter Matilda, without whose loving attention this |
@@ -22,9 +23,7 @@ | |||
22 | * o IR Receive | 23 | * o IR Receive |
23 | * o IR Transmit | 24 | * o IR Transmit |
24 | * o Wake-On-CIR functionality | 25 | * o Wake-On-CIR functionality |
25 | * | 26 | * o Carrier detection |
26 | * To do: | ||
27 | * o Learning | ||
28 | * | 27 | * |
29 | * This program is free software; you can redistribute it and/or modify | 28 | * This program is free software; you can redistribute it and/or modify |
30 | * it under the terms of the GNU General Public License as published by | 29 | * it under the terms of the GNU General Public License as published by |
@@ -149,6 +148,12 @@ | |||
149 | #define WBCIR_REGSEL_MASK 0x20 | 148 | #define WBCIR_REGSEL_MASK 0x20 |
150 | /* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */ | 149 | /* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */ |
151 | #define WBCIR_REG_ADDR0 0x00 | 150 | #define WBCIR_REG_ADDR0 0x00 |
151 | /* Enable carrier counter */ | ||
152 | #define WBCIR_CNTR_EN 0x01 | ||
153 | /* Reset carrier counter */ | ||
154 | #define WBCIR_CNTR_R 0x02 | ||
155 | /* Invert TX */ | ||
156 | #define WBCIR_IRTX_INV 0x04 | ||
152 | 157 | ||
153 | /* Valid banks for the SP3 UART */ | 158 | /* Valid banks for the SP3 UART */ |
154 | enum wbcir_bank { | 159 | enum wbcir_bank { |
@@ -184,7 +189,7 @@ enum wbcir_txstate { | |||
184 | }; | 189 | }; |
185 | 190 | ||
186 | /* Misc */ | 191 | /* Misc */ |
187 | #define WBCIR_NAME "winbond-cir" | 192 | #define WBCIR_NAME "Winbond CIR" |
188 | #define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */ | 193 | #define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */ |
189 | #define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */ | 194 | #define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */ |
190 | #define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */ | 195 | #define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */ |
@@ -207,7 +212,8 @@ struct wbcir_data { | |||
207 | /* RX state */ | 212 | /* RX state */ |
208 | enum wbcir_rxstate rxstate; | 213 | enum wbcir_rxstate rxstate; |
209 | struct led_trigger *rxtrigger; | 214 | struct led_trigger *rxtrigger; |
210 | struct ir_raw_event rxev; | 215 | int carrier_report_enabled; |
216 | u32 pulse_duration; | ||
211 | 217 | ||
212 | /* TX state */ | 218 | /* TX state */ |
213 | enum wbcir_txstate txstate; | 219 | enum wbcir_txstate txstate; |
@@ -330,6 +336,30 @@ wbcir_to_rc6cells(u8 val) | |||
330 | *****************************************************************************/ | 336 | *****************************************************************************/ |
331 | 337 | ||
332 | static void | 338 | static void |
339 | wbcir_carrier_report(struct wbcir_data *data) | ||
340 | { | ||
341 | unsigned counter = inb(data->ebase + WBCIR_REG_ECEIR_CNT_LO) | | ||
342 | inb(data->ebase + WBCIR_REG_ECEIR_CNT_HI) << 8; | ||
343 | |||
344 | if (counter > 0 && counter < 0xffff) { | ||
345 | DEFINE_IR_RAW_EVENT(ev); | ||
346 | |||
347 | ev.carrier_report = 1; | ||
348 | ev.carrier = DIV_ROUND_CLOSEST(counter * 1000000u, | ||
349 | data->pulse_duration); | ||
350 | |||
351 | ir_raw_event_store(data->dev, &ev); | ||
352 | } | ||
353 | |||
354 | /* reset and restart the counter */ | ||
355 | data->pulse_duration = 0; | ||
356 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, | ||
357 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
358 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_EN, | ||
359 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
360 | } | ||
361 | |||
362 | static void | ||
333 | wbcir_idle_rx(struct rc_dev *dev, bool idle) | 363 | wbcir_idle_rx(struct rc_dev *dev, bool idle) |
334 | { | 364 | { |
335 | struct wbcir_data *data = dev->priv; | 365 | struct wbcir_data *data = dev->priv; |
@@ -339,9 +369,16 @@ wbcir_idle_rx(struct rc_dev *dev, bool idle) | |||
339 | led_trigger_event(data->rxtrigger, LED_FULL); | 369 | led_trigger_event(data->rxtrigger, LED_FULL); |
340 | } | 370 | } |
341 | 371 | ||
342 | if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) | 372 | if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) { |
373 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | ||
374 | led_trigger_event(data->rxtrigger, LED_OFF); | ||
375 | |||
376 | if (data->carrier_report_enabled) | ||
377 | wbcir_carrier_report(data); | ||
378 | |||
343 | /* Tell hardware to go idle by setting RXINACTIVE */ | 379 | /* Tell hardware to go idle by setting RXINACTIVE */ |
344 | outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR); | 380 | outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR); |
381 | } | ||
345 | } | 382 | } |
346 | 383 | ||
347 | static void | 384 | static void |
@@ -349,21 +386,22 @@ wbcir_irq_rx(struct wbcir_data *data, struct pnp_dev *device) | |||
349 | { | 386 | { |
350 | u8 irdata; | 387 | u8 irdata; |
351 | DEFINE_IR_RAW_EVENT(rawir); | 388 | DEFINE_IR_RAW_EVENT(rawir); |
389 | unsigned duration; | ||
352 | 390 | ||
353 | /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ | 391 | /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ |
354 | while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { | 392 | while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { |
355 | irdata = inb(data->sbase + WBCIR_REG_SP3_RXDATA); | 393 | irdata = inb(data->sbase + WBCIR_REG_SP3_RXDATA); |
356 | if (data->rxstate == WBCIR_RXSTATE_ERROR) | 394 | if (data->rxstate == WBCIR_RXSTATE_ERROR) |
357 | continue; | 395 | continue; |
396 | |||
397 | duration = ((irdata & 0x7F) + 1) * 2; | ||
358 | rawir.pulse = irdata & 0x80 ? false : true; | 398 | rawir.pulse = irdata & 0x80 ? false : true; |
359 | rawir.duration = US_TO_NS(((irdata & 0x7F) + 1) * 10); | 399 | rawir.duration = US_TO_NS(duration); |
360 | ir_raw_event_store_with_filter(data->dev, &rawir); | ||
361 | } | ||
362 | 400 | ||
363 | /* Check if we should go idle */ | 401 | if (rawir.pulse) |
364 | if (data->dev->idle) { | 402 | data->pulse_duration += duration; |
365 | led_trigger_event(data->rxtrigger, LED_OFF); | 403 | |
366 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | 404 | ir_raw_event_store_with_filter(data->dev, &rawir); |
367 | } | 405 | } |
368 | 406 | ||
369 | ir_raw_event_handle(data->dev); | 407 | ir_raw_event_handle(data->dev); |
@@ -492,6 +530,33 @@ wbcir_irq_handler(int irqno, void *cookie) | |||
492 | *****************************************************************************/ | 530 | *****************************************************************************/ |
493 | 531 | ||
494 | static int | 532 | static int |
533 | wbcir_set_carrier_report(struct rc_dev *dev, int enable) | ||
534 | { | ||
535 | struct wbcir_data *data = dev->priv; | ||
536 | unsigned long flags; | ||
537 | |||
538 | spin_lock_irqsave(&data->spinlock, flags); | ||
539 | |||
540 | if (data->carrier_report_enabled == enable) { | ||
541 | spin_unlock_irqrestore(&data->spinlock, flags); | ||
542 | return 0; | ||
543 | } | ||
544 | |||
545 | data->pulse_duration = 0; | ||
546 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, | ||
547 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
548 | |||
549 | if (enable && data->dev->idle) | ||
550 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, | ||
551 | WBCIR_CNTR_EN, WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
552 | |||
553 | data->carrier_report_enabled = enable; | ||
554 | spin_unlock_irqrestore(&data->spinlock, flags); | ||
555 | |||
556 | return 0; | ||
557 | } | ||
558 | |||
559 | static int | ||
495 | wbcir_txcarrier(struct rc_dev *dev, u32 carrier) | 560 | wbcir_txcarrier(struct rc_dev *dev, u32 carrier) |
496 | { | 561 | { |
497 | struct wbcir_data *data = dev->priv; | 562 | struct wbcir_data *data = dev->priv; |
@@ -837,7 +902,7 @@ wbcir_init_hw(struct wbcir_data *data) | |||
837 | 902 | ||
838 | /* Set IRTX_INV */ | 903 | /* Set IRTX_INV */ |
839 | if (invert) | 904 | if (invert) |
840 | outb(0x04, data->ebase + WBCIR_REG_ECEIR_CCTL); | 905 | outb(WBCIR_IRTX_INV, data->ebase + WBCIR_REG_ECEIR_CCTL); |
841 | else | 906 | else |
842 | outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL); | 907 | outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL); |
843 | 908 | ||
@@ -866,8 +931,8 @@ wbcir_init_hw(struct wbcir_data *data) | |||
866 | /* prescaler 1.0, tx/rx fifo lvl 16 */ | 931 | /* prescaler 1.0, tx/rx fifo lvl 16 */ |
867 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); | 932 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); |
868 | 933 | ||
869 | /* Set baud divisor to sample every 10 us */ | 934 | /* Set baud divisor to sample every 2 ns */ |
870 | outb(0x0F, data->sbase + WBCIR_REG_SP3_BGDL); | 935 | outb(0x03, data->sbase + WBCIR_REG_SP3_BGDL); |
871 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); | 936 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); |
872 | 937 | ||
873 | /* Set CEIR mode */ | 938 | /* Set CEIR mode */ |
@@ -876,9 +941,12 @@ wbcir_init_hw(struct wbcir_data *data) | |||
876 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ | 941 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ |
877 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ | 942 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ |
878 | 943 | ||
879 | /* Disable RX demod, enable run-length enc/dec, set freq span */ | 944 | /* |
945 | * Disable RX demod, enable run-length enc/dec, set freq span and | ||
946 | * enable over-sampling | ||
947 | */ | ||
880 | wbcir_select_bank(data, WBCIR_BANK_7); | 948 | wbcir_select_bank(data, WBCIR_BANK_7); |
881 | outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG); | 949 | outb(0xd0, data->sbase + WBCIR_REG_SP3_RCCFG); |
882 | 950 | ||
883 | /* Disable timer */ | 951 | /* Disable timer */ |
884 | wbcir_select_bank(data, WBCIR_BANK_4); | 952 | wbcir_select_bank(data, WBCIR_BANK_4); |
@@ -915,9 +983,8 @@ wbcir_init_hw(struct wbcir_data *data) | |||
915 | 983 | ||
916 | /* Clear RX state */ | 984 | /* Clear RX state */ |
917 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | 985 | data->rxstate = WBCIR_RXSTATE_INACTIVE; |
918 | data->rxev.duration = 0; | ||
919 | ir_raw_event_reset(data->dev); | 986 | ir_raw_event_reset(data->dev); |
920 | ir_raw_event_handle(data->dev); | 987 | ir_raw_event_set_idle(data->dev, true); |
921 | 988 | ||
922 | /* Clear TX state */ | 989 | /* Clear TX state */ |
923 | if (data->txstate == WBCIR_TXSTATE_ACTIVE) { | 990 | if (data->txstate == WBCIR_TXSTATE_ACTIVE) { |
@@ -1007,7 +1074,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1007 | } | 1074 | } |
1008 | 1075 | ||
1009 | data->dev->driver_type = RC_DRIVER_IR_RAW; | 1076 | data->dev->driver_type = RC_DRIVER_IR_RAW; |
1010 | data->dev->driver_name = WBCIR_NAME; | 1077 | data->dev->driver_name = DRVNAME; |
1011 | data->dev->input_name = WBCIR_NAME; | 1078 | data->dev->input_name = WBCIR_NAME; |
1012 | data->dev->input_phys = "wbcir/cir0"; | 1079 | data->dev->input_phys = "wbcir/cir0"; |
1013 | data->dev->input_id.bustype = BUS_HOST; | 1080 | data->dev->input_id.bustype = BUS_HOST; |
@@ -1016,13 +1083,15 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1016 | data->dev->input_id.version = WBCIR_ID_CHIP; | 1083 | data->dev->input_id.version = WBCIR_ID_CHIP; |
1017 | data->dev->map_name = RC_MAP_RC6_MCE; | 1084 | data->dev->map_name = RC_MAP_RC6_MCE; |
1018 | data->dev->s_idle = wbcir_idle_rx; | 1085 | data->dev->s_idle = wbcir_idle_rx; |
1086 | data->dev->s_carrier_report = wbcir_set_carrier_report; | ||
1019 | data->dev->s_tx_mask = wbcir_txmask; | 1087 | data->dev->s_tx_mask = wbcir_txmask; |
1020 | data->dev->s_tx_carrier = wbcir_txcarrier; | 1088 | data->dev->s_tx_carrier = wbcir_txcarrier; |
1021 | data->dev->tx_ir = wbcir_tx; | 1089 | data->dev->tx_ir = wbcir_tx; |
1022 | data->dev->priv = data; | 1090 | data->dev->priv = data; |
1023 | data->dev->dev.parent = &device->dev; | 1091 | data->dev->dev.parent = &device->dev; |
1024 | data->dev->timeout = MS_TO_NS(100); | 1092 | data->dev->timeout = MS_TO_NS(100); |
1025 | data->dev->allowed_protos = RC_TYPE_ALL; | 1093 | data->dev->rx_resolution = US_TO_NS(2); |
1094 | data->dev->allowed_protos = RC_BIT_ALL; | ||
1026 | 1095 | ||
1027 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | 1096 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { |
1028 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | 1097 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", |