diff options
Diffstat (limited to 'drivers/media/IR/imon.c')
-rw-r--r-- | drivers/media/IR/imon.c | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c index 5e2045670004..4bbd45f4284c 100644 --- a/drivers/media/IR/imon.c +++ b/drivers/media/IR/imon.c | |||
@@ -94,6 +94,7 @@ struct imon_context { | |||
94 | 94 | ||
95 | bool display_supported; /* not all controllers do */ | 95 | bool display_supported; /* not all controllers do */ |
96 | bool display_isopen; /* display port has been opened */ | 96 | bool display_isopen; /* display port has been opened */ |
97 | bool rf_device; /* true if iMON 2.4G LT/DT RF device */ | ||
97 | bool rf_isassociating; /* RF remote associating */ | 98 | bool rf_isassociating; /* RF remote associating */ |
98 | bool dev_present_intf0; /* USB device presence, interface 0 */ | 99 | bool dev_present_intf0; /* USB device presence, interface 0 */ |
99 | bool dev_present_intf1; /* USB device presence, interface 1 */ | 100 | bool dev_present_intf1; /* USB device presence, interface 1 */ |
@@ -385,7 +386,7 @@ static int display_open(struct inode *inode, struct file *file) | |||
385 | err("%s: display port is already open", __func__); | 386 | err("%s: display port is already open", __func__); |
386 | retval = -EBUSY; | 387 | retval = -EBUSY; |
387 | } else { | 388 | } else { |
388 | ictx->display_isopen = 1; | 389 | ictx->display_isopen = true; |
389 | file->private_data = ictx; | 390 | file->private_data = ictx; |
390 | dev_dbg(ictx->dev, "display port opened\n"); | 391 | dev_dbg(ictx->dev, "display port opened\n"); |
391 | } | 392 | } |
@@ -422,7 +423,7 @@ static int display_close(struct inode *inode, struct file *file) | |||
422 | err("%s: display is not open", __func__); | 423 | err("%s: display is not open", __func__); |
423 | retval = -EIO; | 424 | retval = -EIO; |
424 | } else { | 425 | } else { |
425 | ictx->display_isopen = 0; | 426 | ictx->display_isopen = false; |
426 | dev_dbg(ictx->dev, "display port closed\n"); | 427 | dev_dbg(ictx->dev, "display port closed\n"); |
427 | if (!ictx->dev_present_intf0) { | 428 | if (!ictx->dev_present_intf0) { |
428 | /* | 429 | /* |
@@ -491,12 +492,12 @@ static int send_packet(struct imon_context *ictx) | |||
491 | } | 492 | } |
492 | 493 | ||
493 | init_completion(&ictx->tx.finished); | 494 | init_completion(&ictx->tx.finished); |
494 | ictx->tx.busy = 1; | 495 | ictx->tx.busy = true; |
495 | smp_rmb(); /* ensure later readers know we're busy */ | 496 | smp_rmb(); /* ensure later readers know we're busy */ |
496 | 497 | ||
497 | retval = usb_submit_urb(ictx->tx_urb, GFP_KERNEL); | 498 | retval = usb_submit_urb(ictx->tx_urb, GFP_KERNEL); |
498 | if (retval) { | 499 | if (retval) { |
499 | ictx->tx.busy = 0; | 500 | ictx->tx.busy = false; |
500 | smp_rmb(); /* ensure later readers know we're not busy */ | 501 | smp_rmb(); /* ensure later readers know we're not busy */ |
501 | err("%s: error submitting urb(%d)", __func__, retval); | 502 | err("%s: error submitting urb(%d)", __func__, retval); |
502 | } else { | 503 | } else { |
@@ -682,7 +683,7 @@ static ssize_t store_associate_remote(struct device *d, | |||
682 | return -ENODEV; | 683 | return -ENODEV; |
683 | 684 | ||
684 | mutex_lock(&ictx->lock); | 685 | mutex_lock(&ictx->lock); |
685 | ictx->rf_isassociating = 1; | 686 | ictx->rf_isassociating = true; |
686 | send_associate_24g(ictx); | 687 | send_associate_24g(ictx); |
687 | mutex_unlock(&ictx->lock); | 688 | mutex_unlock(&ictx->lock); |
688 | 689 | ||
@@ -950,7 +951,7 @@ static void usb_tx_callback(struct urb *urb) | |||
950 | ictx->tx.status = urb->status; | 951 | ictx->tx.status = urb->status; |
951 | 952 | ||
952 | /* notify waiters that write has finished */ | 953 | /* notify waiters that write has finished */ |
953 | ictx->tx.busy = 0; | 954 | ictx->tx.busy = false; |
954 | smp_rmb(); /* ensure later readers know we're not busy */ | 955 | smp_rmb(); /* ensure later readers know we're not busy */ |
955 | complete(&ictx->tx.finished); | 956 | complete(&ictx->tx.finished); |
956 | } | 957 | } |
@@ -1215,7 +1216,7 @@ static bool imon_mouse_event(struct imon_context *ictx, | |||
1215 | { | 1216 | { |
1216 | char rel_x = 0x00, rel_y = 0x00; | 1217 | char rel_x = 0x00, rel_y = 0x00; |
1217 | u8 right_shift = 1; | 1218 | u8 right_shift = 1; |
1218 | bool mouse_input = 1; | 1219 | bool mouse_input = true; |
1219 | int dir = 0; | 1220 | int dir = 0; |
1220 | 1221 | ||
1221 | /* newer iMON device PAD or mouse button */ | 1222 | /* newer iMON device PAD or mouse button */ |
@@ -1246,7 +1247,7 @@ static bool imon_mouse_event(struct imon_context *ictx, | |||
1246 | } else if (ictx->kc == KEY_CHANNELDOWN && (buf[2] & 0x40) != 0x40) { | 1247 | } else if (ictx->kc == KEY_CHANNELDOWN && (buf[2] & 0x40) != 0x40) { |
1247 | dir = -1; | 1248 | dir = -1; |
1248 | } else | 1249 | } else |
1249 | mouse_input = 0; | 1250 | mouse_input = false; |
1250 | 1251 | ||
1251 | if (mouse_input) { | 1252 | if (mouse_input) { |
1252 | dev_dbg(ictx->dev, "sending mouse data via input subsystem\n"); | 1253 | dev_dbg(ictx->dev, "sending mouse data via input subsystem\n"); |
@@ -1450,7 +1451,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1450 | unsigned char *buf = urb->transfer_buffer; | 1451 | unsigned char *buf = urb->transfer_buffer; |
1451 | struct device *dev = ictx->dev; | 1452 | struct device *dev = ictx->dev; |
1452 | u32 kc; | 1453 | u32 kc; |
1453 | bool norelease = 0; | 1454 | bool norelease = false; |
1454 | int i; | 1455 | int i; |
1455 | u64 temp_key; | 1456 | u64 temp_key; |
1456 | u64 panel_key = 0; | 1457 | u64 panel_key = 0; |
@@ -1465,7 +1466,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1465 | idev = ictx->idev; | 1466 | idev = ictx->idev; |
1466 | 1467 | ||
1467 | /* filter out junk data on the older 0xffdc imon devices */ | 1468 | /* filter out junk data on the older 0xffdc imon devices */ |
1468 | if ((buf[0] == 0xff) && (buf[7] == 0xff)) | 1469 | if ((buf[0] == 0xff) && (buf[1] == 0xff) && (buf[2] == 0xff)) |
1469 | return; | 1470 | return; |
1470 | 1471 | ||
1471 | /* Figure out what key was pressed */ | 1472 | /* Figure out what key was pressed */ |
@@ -1517,7 +1518,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1517 | !(buf[1] & 0x1 || buf[1] >> 2 & 0x1))) { | 1518 | !(buf[1] & 0x1 || buf[1] >> 2 & 0x1))) { |
1518 | len = 8; | 1519 | len = 8; |
1519 | imon_pad_to_keys(ictx, buf); | 1520 | imon_pad_to_keys(ictx, buf); |
1520 | norelease = 1; | 1521 | norelease = true; |
1521 | } | 1522 | } |
1522 | 1523 | ||
1523 | if (debug) { | 1524 | if (debug) { |
@@ -1580,7 +1581,7 @@ not_input_data: | |||
1580 | (buf[6] == 0x5E && buf[7] == 0xDF))) { /* DT */ | 1581 | (buf[6] == 0x5E && buf[7] == 0xDF))) { /* DT */ |
1581 | dev_warn(dev, "%s: remote associated refid=%02X\n", | 1582 | dev_warn(dev, "%s: remote associated refid=%02X\n", |
1582 | __func__, buf[1]); | 1583 | __func__, buf[1]); |
1583 | ictx->rf_isassociating = 0; | 1584 | ictx->rf_isassociating = false; |
1584 | } | 1585 | } |
1585 | } | 1586 | } |
1586 | 1587 | ||
@@ -1790,9 +1791,9 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
1790 | int ifnum = iface_desc->desc.bInterfaceNumber; | 1791 | int ifnum = iface_desc->desc.bInterfaceNumber; |
1791 | int num_endpts = iface_desc->desc.bNumEndpoints; | 1792 | int num_endpts = iface_desc->desc.bNumEndpoints; |
1792 | int i, ep_dir, ep_type; | 1793 | int i, ep_dir, ep_type; |
1793 | bool ir_ep_found = 0; | 1794 | bool ir_ep_found = false; |
1794 | bool display_ep_found = 0; | 1795 | bool display_ep_found = false; |
1795 | bool tx_control = 0; | 1796 | bool tx_control = false; |
1796 | 1797 | ||
1797 | /* | 1798 | /* |
1798 | * Scan the endpoint list and set: | 1799 | * Scan the endpoint list and set: |
@@ -1808,13 +1809,13 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
1808 | ep_type == USB_ENDPOINT_XFER_INT) { | 1809 | ep_type == USB_ENDPOINT_XFER_INT) { |
1809 | 1810 | ||
1810 | rx_endpoint = ep; | 1811 | rx_endpoint = ep; |
1811 | ir_ep_found = 1; | 1812 | ir_ep_found = true; |
1812 | dev_dbg(ictx->dev, "%s: found IR endpoint\n", __func__); | 1813 | dev_dbg(ictx->dev, "%s: found IR endpoint\n", __func__); |
1813 | 1814 | ||
1814 | } else if (!display_ep_found && ep_dir == USB_DIR_OUT && | 1815 | } else if (!display_ep_found && ep_dir == USB_DIR_OUT && |
1815 | ep_type == USB_ENDPOINT_XFER_INT) { | 1816 | ep_type == USB_ENDPOINT_XFER_INT) { |
1816 | tx_endpoint = ep; | 1817 | tx_endpoint = ep; |
1817 | display_ep_found = 1; | 1818 | display_ep_found = true; |
1818 | dev_dbg(ictx->dev, "%s: found display endpoint\n", __func__); | 1819 | dev_dbg(ictx->dev, "%s: found display endpoint\n", __func__); |
1819 | } | 1820 | } |
1820 | } | 1821 | } |
@@ -1835,8 +1836,8 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
1835 | * newer iMON devices that use control urb instead of interrupt | 1836 | * newer iMON devices that use control urb instead of interrupt |
1836 | */ | 1837 | */ |
1837 | if (!display_ep_found) { | 1838 | if (!display_ep_found) { |
1838 | tx_control = 1; | 1839 | tx_control = true; |
1839 | display_ep_found = 1; | 1840 | display_ep_found = true; |
1840 | dev_dbg(ictx->dev, "%s: device uses control endpoint, not " | 1841 | dev_dbg(ictx->dev, "%s: device uses control endpoint, not " |
1841 | "interface OUT endpoint\n", __func__); | 1842 | "interface OUT endpoint\n", __func__); |
1842 | } | 1843 | } |
@@ -1847,7 +1848,7 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
1847 | * and without... :\ | 1848 | * and without... :\ |
1848 | */ | 1849 | */ |
1849 | if (ictx->display_type == IMON_DISPLAY_TYPE_NONE) { | 1850 | if (ictx->display_type == IMON_DISPLAY_TYPE_NONE) { |
1850 | display_ep_found = 0; | 1851 | display_ep_found = false; |
1851 | dev_dbg(ictx->dev, "%s: device has no display\n", __func__); | 1852 | dev_dbg(ictx->dev, "%s: device has no display\n", __func__); |
1852 | } | 1853 | } |
1853 | 1854 | ||
@@ -1856,7 +1857,7 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
1856 | * that refers to e.g. /dev/lcd0 (a character device LCD or VFD). | 1857 | * that refers to e.g. /dev/lcd0 (a character device LCD or VFD). |
1857 | */ | 1858 | */ |
1858 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { | 1859 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { |
1859 | display_ep_found = 0; | 1860 | display_ep_found = false; |
1860 | dev_dbg(ictx->dev, "%s: iMON Touch device found\n", __func__); | 1861 | dev_dbg(ictx->dev, "%s: iMON Touch device found\n", __func__); |
1861 | } | 1862 | } |
1862 | 1863 | ||
@@ -1905,9 +1906,10 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
1905 | 1906 | ||
1906 | ictx->dev = dev; | 1907 | ictx->dev = dev; |
1907 | ictx->usbdev_intf0 = usb_get_dev(interface_to_usbdev(intf)); | 1908 | ictx->usbdev_intf0 = usb_get_dev(interface_to_usbdev(intf)); |
1908 | ictx->dev_present_intf0 = 1; | 1909 | ictx->dev_present_intf0 = true; |
1909 | ictx->rx_urb_intf0 = rx_urb; | 1910 | ictx->rx_urb_intf0 = rx_urb; |
1910 | ictx->tx_urb = tx_urb; | 1911 | ictx->tx_urb = tx_urb; |
1912 | ictx->rf_device = false; | ||
1911 | 1913 | ||
1912 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); | 1914 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); |
1913 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); | 1915 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); |
@@ -1979,7 +1981,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf, | |||
1979 | } | 1981 | } |
1980 | 1982 | ||
1981 | ictx->usbdev_intf1 = usb_get_dev(interface_to_usbdev(intf)); | 1983 | ictx->usbdev_intf1 = usb_get_dev(interface_to_usbdev(intf)); |
1982 | ictx->dev_present_intf1 = 1; | 1984 | ictx->dev_present_intf1 = true; |
1983 | ictx->rx_urb_intf1 = rx_urb; | 1985 | ictx->rx_urb_intf1 = rx_urb; |
1984 | 1986 | ||
1985 | ret = -ENODEV; | 1987 | ret = -ENODEV; |
@@ -2047,6 +2049,12 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
2047 | dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR"); | 2049 | dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR"); |
2048 | ictx->display_supported = false; | 2050 | ictx->display_supported = false; |
2049 | break; | 2051 | break; |
2052 | /* iMON 2.4G LT (usb stick), no display, iMON RF */ | ||
2053 | case 0x4e: | ||
2054 | dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF"); | ||
2055 | ictx->display_supported = false; | ||
2056 | ictx->rf_device = true; | ||
2057 | break; | ||
2050 | /* iMON VFD, no IR (does have vol knob tho) */ | 2058 | /* iMON VFD, no IR (does have vol knob tho) */ |
2051 | case 0x35: | 2059 | case 0x35: |
2052 | dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR"); | 2060 | dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR"); |
@@ -2197,15 +2205,6 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2197 | goto fail; | 2205 | goto fail; |
2198 | } | 2206 | } |
2199 | 2207 | ||
2200 | if (product == 0xffdc) { | ||
2201 | /* RF products *also* use 0xffdc... sigh... */ | ||
2202 | sysfs_err = sysfs_create_group(&interface->dev.kobj, | ||
2203 | &imon_rf_attribute_group); | ||
2204 | if (sysfs_err) | ||
2205 | err("%s: Could not create RF sysfs entries(%d)", | ||
2206 | __func__, sysfs_err); | ||
2207 | } | ||
2208 | |||
2209 | } else { | 2208 | } else { |
2210 | /* this is the secondary interface on the device */ | 2209 | /* this is the secondary interface on the device */ |
2211 | ictx = imon_init_intf1(interface, first_if_ctx); | 2210 | ictx = imon_init_intf1(interface, first_if_ctx); |
@@ -2233,6 +2232,14 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2233 | 2232 | ||
2234 | imon_set_display_type(ictx, interface); | 2233 | imon_set_display_type(ictx, interface); |
2235 | 2234 | ||
2235 | if (product == 0xffdc && ictx->rf_device) { | ||
2236 | sysfs_err = sysfs_create_group(&interface->dev.kobj, | ||
2237 | &imon_rf_attribute_group); | ||
2238 | if (sysfs_err) | ||
2239 | err("%s: Could not create RF sysfs entries(%d)", | ||
2240 | __func__, sysfs_err); | ||
2241 | } | ||
2242 | |||
2236 | if (ictx->display_supported) | 2243 | if (ictx->display_supported) |
2237 | imon_init_display(ictx, interface); | 2244 | imon_init_display(ictx, interface); |
2238 | } | 2245 | } |
@@ -2297,7 +2304,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface) | |||
2297 | } | 2304 | } |
2298 | 2305 | ||
2299 | if (ifnum == 0) { | 2306 | if (ifnum == 0) { |
2300 | ictx->dev_present_intf0 = 0; | 2307 | ictx->dev_present_intf0 = false; |
2301 | usb_kill_urb(ictx->rx_urb_intf0); | 2308 | usb_kill_urb(ictx->rx_urb_intf0); |
2302 | input_unregister_device(ictx->idev); | 2309 | input_unregister_device(ictx->idev); |
2303 | if (ictx->display_supported) { | 2310 | if (ictx->display_supported) { |
@@ -2307,7 +2314,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface) | |||
2307 | usb_deregister_dev(interface, &imon_vfd_class); | 2314 | usb_deregister_dev(interface, &imon_vfd_class); |
2308 | } | 2315 | } |
2309 | } else { | 2316 | } else { |
2310 | ictx->dev_present_intf1 = 0; | 2317 | ictx->dev_present_intf1 = false; |
2311 | usb_kill_urb(ictx->rx_urb_intf1); | 2318 | usb_kill_urb(ictx->rx_urb_intf1); |
2312 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) | 2319 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) |
2313 | input_unregister_device(ictx->touch); | 2320 | input_unregister_device(ictx->touch); |