diff options
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r-- | drivers/media/rc/imon.c | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 6811512b4e83..e7dc6b46fdfa 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -988,7 +988,6 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
988 | int retval; | 988 | int retval; |
989 | struct imon_context *ictx = rc->priv; | 989 | struct imon_context *ictx = rc->priv; |
990 | struct device *dev = ictx->dev; | 990 | struct device *dev = ictx->dev; |
991 | bool pad_mouse; | ||
992 | unsigned char ir_proto_packet[] = { | 991 | unsigned char ir_proto_packet[] = { |
993 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 992 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
994 | 993 | ||
@@ -1000,29 +999,20 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1000 | case RC_TYPE_RC6: | 999 | case RC_TYPE_RC6: |
1001 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); | 1000 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); |
1002 | ir_proto_packet[0] = 0x01; | 1001 | ir_proto_packet[0] = 0x01; |
1003 | pad_mouse = false; | ||
1004 | break; | 1002 | break; |
1005 | case RC_TYPE_UNKNOWN: | 1003 | case RC_TYPE_UNKNOWN: |
1006 | case RC_TYPE_OTHER: | 1004 | case RC_TYPE_OTHER: |
1007 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); | 1005 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); |
1008 | if (pad_stabilize && !nomouse) | 1006 | if (!pad_stabilize) |
1009 | pad_mouse = true; | ||
1010 | else { | ||
1011 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1007 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1012 | pad_mouse = false; | ||
1013 | } | ||
1014 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1008 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1015 | rc_type = RC_TYPE_OTHER; | 1009 | rc_type = RC_TYPE_OTHER; |
1016 | break; | 1010 | break; |
1017 | default: | 1011 | default: |
1018 | dev_warn(dev, "Unsupported IR protocol specified, overriding " | 1012 | dev_warn(dev, "Unsupported IR protocol specified, overriding " |
1019 | "to iMON IR protocol\n"); | 1013 | "to iMON IR protocol\n"); |
1020 | if (pad_stabilize && !nomouse) | 1014 | if (!pad_stabilize) |
1021 | pad_mouse = true; | ||
1022 | else { | ||
1023 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1015 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1024 | pad_mouse = false; | ||
1025 | } | ||
1026 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1016 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1027 | rc_type = RC_TYPE_OTHER; | 1017 | rc_type = RC_TYPE_OTHER; |
1028 | break; | 1018 | break; |
@@ -1035,7 +1025,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1035 | goto out; | 1025 | goto out; |
1036 | 1026 | ||
1037 | ictx->rc_type = rc_type; | 1027 | ictx->rc_type = rc_type; |
1038 | ictx->pad_mouse = pad_mouse; | 1028 | ictx->pad_mouse = false; |
1039 | 1029 | ||
1040 | out: | 1030 | out: |
1041 | return retval; | 1031 | return retval; |
@@ -1517,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1517 | spin_unlock_irqrestore(&ictx->kc_lock, flags); | 1507 | spin_unlock_irqrestore(&ictx->kc_lock, flags); |
1518 | return; | 1508 | return; |
1519 | } else { | 1509 | } else { |
1520 | ictx->pad_mouse = 0; | 1510 | ictx->pad_mouse = false; |
1521 | dev_dbg(dev, "mouse mode disabled, passing key value\n"); | 1511 | dev_dbg(dev, "mouse mode disabled, passing key value\n"); |
1522 | } | 1512 | } |
1523 | } | 1513 | } |
@@ -1756,7 +1746,6 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
1756 | printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); | 1746 | printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); |
1757 | 1747 | ||
1758 | ictx->display_type = detected_display_type; | 1748 | ictx->display_type = detected_display_type; |
1759 | ictx->rdev->allowed_protos = allowed_protos; | ||
1760 | ictx->rc_type = allowed_protos; | 1749 | ictx->rc_type = allowed_protos; |
1761 | } | 1750 | } |
1762 | 1751 | ||
@@ -1839,10 +1828,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1839 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ | 1828 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ |
1840 | rdev->change_protocol = imon_ir_change_protocol; | 1829 | rdev->change_protocol = imon_ir_change_protocol; |
1841 | rdev->driver_name = MOD_NAME; | 1830 | rdev->driver_name = MOD_NAME; |
1842 | if (ictx->rc_type == RC_TYPE_RC6) | ||
1843 | rdev->map_name = RC_MAP_IMON_MCE; | ||
1844 | else | ||
1845 | rdev->map_name = RC_MAP_IMON_PAD; | ||
1846 | 1831 | ||
1847 | /* Enable front-panel buttons and/or knobs */ | 1832 | /* Enable front-panel buttons and/or knobs */ |
1848 | memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); | 1833 | memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); |
@@ -1851,11 +1836,18 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1851 | if (ret) | 1836 | if (ret) |
1852 | dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); | 1837 | dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); |
1853 | 1838 | ||
1854 | if (ictx->product == 0xffdc) | 1839 | if (ictx->product == 0xffdc) { |
1855 | imon_get_ffdc_type(ictx); | 1840 | imon_get_ffdc_type(ictx); |
1841 | rdev->allowed_protos = ictx->rc_type; | ||
1842 | } | ||
1856 | 1843 | ||
1857 | imon_set_display_type(ictx); | 1844 | imon_set_display_type(ictx); |
1858 | 1845 | ||
1846 | if (ictx->rc_type == RC_TYPE_RC6) | ||
1847 | rdev->map_name = RC_MAP_IMON_MCE; | ||
1848 | else | ||
1849 | rdev->map_name = RC_MAP_IMON_PAD; | ||
1850 | |||
1859 | ret = rc_register_device(rdev); | 1851 | ret = rc_register_device(rdev); |
1860 | if (ret < 0) { | 1852 | if (ret < 0) { |
1861 | dev_err(ictx->dev, "remote input dev register failed\n"); | 1853 | dev_err(ictx->dev, "remote input dev register failed\n"); |
@@ -2108,18 +2100,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2108 | goto find_endpoint_failed; | 2100 | goto find_endpoint_failed; |
2109 | } | 2101 | } |
2110 | 2102 | ||
2111 | ictx->idev = imon_init_idev(ictx); | ||
2112 | if (!ictx->idev) { | ||
2113 | dev_err(dev, "%s: input device setup failed\n", __func__); | ||
2114 | goto idev_setup_failed; | ||
2115 | } | ||
2116 | |||
2117 | ictx->rdev = imon_init_rdev(ictx); | ||
2118 | if (!ictx->rdev) { | ||
2119 | dev_err(dev, "%s: rc device setup failed\n", __func__); | ||
2120 | goto rdev_setup_failed; | ||
2121 | } | ||
2122 | |||
2123 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, | 2103 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, |
2124 | usb_rcvintpipe(ictx->usbdev_intf0, | 2104 | usb_rcvintpipe(ictx->usbdev_intf0, |
2125 | ictx->rx_endpoint_intf0->bEndpointAddress), | 2105 | ictx->rx_endpoint_intf0->bEndpointAddress), |
@@ -2133,13 +2113,25 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2133 | goto urb_submit_failed; | 2113 | goto urb_submit_failed; |
2134 | } | 2114 | } |
2135 | 2115 | ||
2116 | ictx->idev = imon_init_idev(ictx); | ||
2117 | if (!ictx->idev) { | ||
2118 | dev_err(dev, "%s: input device setup failed\n", __func__); | ||
2119 | goto idev_setup_failed; | ||
2120 | } | ||
2121 | |||
2122 | ictx->rdev = imon_init_rdev(ictx); | ||
2123 | if (!ictx->rdev) { | ||
2124 | dev_err(dev, "%s: rc device setup failed\n", __func__); | ||
2125 | goto rdev_setup_failed; | ||
2126 | } | ||
2127 | |||
2136 | return ictx; | 2128 | return ictx; |
2137 | 2129 | ||
2138 | urb_submit_failed: | ||
2139 | rc_unregister_device(ictx->rdev); | ||
2140 | rdev_setup_failed: | 2130 | rdev_setup_failed: |
2141 | input_unregister_device(ictx->idev); | 2131 | input_unregister_device(ictx->idev); |
2142 | idev_setup_failed: | 2132 | idev_setup_failed: |
2133 | usb_kill_urb(ictx->rx_urb_intf0); | ||
2134 | urb_submit_failed: | ||
2143 | find_endpoint_failed: | 2135 | find_endpoint_failed: |
2144 | mutex_unlock(&ictx->lock); | 2136 | mutex_unlock(&ictx->lock); |
2145 | usb_free_urb(tx_urb); | 2137 | usb_free_urb(tx_urb); |