aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/imon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r--drivers/media/rc/imon.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 79f4f58c2ea4..8d4b35d1ae56 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -88,7 +88,6 @@ static ssize_t lcd_write(struct file *file, const char *buf,
88 88
89struct imon_context { 89struct imon_context {
90 struct device *dev; 90 struct device *dev;
91 struct ir_dev_props *props;
92 /* Newer devices have two interfaces */ 91 /* Newer devices have two interfaces */
93 struct usb_device *usbdev_intf0; 92 struct usb_device *usbdev_intf0;
94 struct usb_device *usbdev_intf1; 93 struct usb_device *usbdev_intf1;
@@ -123,7 +122,7 @@ struct imon_context {
123 u16 vendor; /* usb vendor ID */ 122 u16 vendor; /* usb vendor ID */
124 u16 product; /* usb product ID */ 123 u16 product; /* usb product ID */
125 124
126 struct input_dev *rdev; /* input device for remote */ 125 struct rc_dev *rdev; /* rc-core device for remote */
127 struct input_dev *idev; /* input device for panel & IR mouse */ 126 struct input_dev *idev; /* input device for panel & IR mouse */
128 struct input_dev *touch; /* input device for touchscreen */ 127 struct input_dev *touch; /* input device for touchscreen */
129 128
@@ -984,16 +983,16 @@ static void imon_touch_display_timeout(unsigned long data)
984 * really just RC-6), but only one or the other at a time, as the signals 983 * really just RC-6), but only one or the other at a time, as the signals
985 * are decoded onboard the receiver. 984 * are decoded onboard the receiver.
986 */ 985 */
987int imon_ir_change_protocol(void *priv, u64 ir_type) 986static int imon_ir_change_protocol(struct rc_dev *rc, u64 ir_type)
988{ 987{
989 int retval; 988 int retval;
990 struct imon_context *ictx = priv; 989 struct imon_context *ictx = rc->priv;
991 struct device *dev = ictx->dev; 990 struct device *dev = ictx->dev;
992 bool pad_mouse; 991 bool pad_mouse;
993 unsigned char ir_proto_packet[] = { 992 unsigned char ir_proto_packet[] = {
994 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 993 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
995 994
996 if (ir_type && !(ir_type & ictx->props->allowed_protos)) 995 if (ir_type && !(ir_type & rc->allowed_protos))
997 dev_warn(dev, "Looks like you're trying to use an IR protocol " 996 dev_warn(dev, "Looks like you're trying to use an IR protocol "
998 "this device does not support\n"); 997 "this device does not support\n");
999 998
@@ -1757,7 +1756,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1757 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); 1756 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
1758 1757
1759 ictx->display_type = detected_display_type; 1758 ictx->display_type = detected_display_type;
1760 ictx->props->allowed_protos = allowed_protos; 1759 ictx->rdev->allowed_protos = allowed_protos;
1761 ictx->ir_type = allowed_protos; 1760 ictx->ir_type = allowed_protos;
1762} 1761}
1763 1762
@@ -1811,18 +1810,15 @@ static void imon_set_display_type(struct imon_context *ictx)
1811 ictx->display_type = configured_display_type; 1810 ictx->display_type = configured_display_type;
1812} 1811}
1813 1812
1814static struct input_dev *imon_init_rdev(struct imon_context *ictx) 1813static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1815{ 1814{
1816 struct input_dev *rdev; 1815 struct rc_dev *rdev;
1817 struct ir_dev_props *props;
1818 int ret; 1816 int ret;
1819 char *ir_codes = NULL;
1820 const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00, 1817 const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
1821 0x00, 0x00, 0x00, 0x88 }; 1818 0x00, 0x00, 0x00, 0x88 };
1822 1819
1823 rdev = input_allocate_device(); 1820 rdev = rc_allocate_device();
1824 props = kzalloc(sizeof(*props), GFP_KERNEL); 1821 if (!rdev) {
1825 if (!rdev || !props) {
1826 dev_err(ictx->dev, "remote control dev allocation failed\n"); 1822 dev_err(ictx->dev, "remote control dev allocation failed\n");
1827 goto out; 1823 goto out;
1828 } 1824 }
@@ -1833,18 +1829,20 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
1833 sizeof(ictx->phys_rdev)); 1829 sizeof(ictx->phys_rdev));
1834 strlcat(ictx->phys_rdev, "/input0", sizeof(ictx->phys_rdev)); 1830 strlcat(ictx->phys_rdev, "/input0", sizeof(ictx->phys_rdev));
1835 1831
1836 rdev->name = ictx->name_rdev; 1832 rdev->input_name = ictx->name_rdev;
1837 rdev->phys = ictx->phys_rdev; 1833 rdev->input_phys = ictx->phys_rdev;
1838 usb_to_input_id(ictx->usbdev_intf0, &rdev->id); 1834 usb_to_input_id(ictx->usbdev_intf0, &rdev->input_id);
1839 rdev->dev.parent = ictx->dev; 1835 rdev->dev.parent = ictx->dev;
1840 rdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
1841 input_set_drvdata(rdev, ictx);
1842 1836
1843 props->priv = ictx; 1837 rdev->priv = ictx;
1844 props->driver_type = RC_DRIVER_SCANCODE; 1838 rdev->driver_type = RC_DRIVER_SCANCODE;
1845 props->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */ 1839 rdev->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; /* iMON PAD or MCE */
1846 props->change_protocol = imon_ir_change_protocol; 1840 rdev->change_protocol = imon_ir_change_protocol;
1847 ictx->props = props; 1841 rdev->driver_name = MOD_NAME;
1842 if (ictx->ir_type == IR_TYPE_RC6)
1843 rdev->map_name = RC_MAP_IMON_MCE;
1844 else
1845 rdev->map_name = RC_MAP_IMON_PAD;
1848 1846
1849 /* Enable front-panel buttons and/or knobs */ 1847 /* Enable front-panel buttons and/or knobs */
1850 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); 1848 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
@@ -1858,12 +1856,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
1858 1856
1859 imon_set_display_type(ictx); 1857 imon_set_display_type(ictx);
1860 1858
1861 if (ictx->ir_type == IR_TYPE_RC6) 1859 ret = rc_register_device(rdev);
1862 ir_codes = RC_MAP_IMON_MCE;
1863 else
1864 ir_codes = RC_MAP_IMON_PAD;
1865
1866 ret = ir_input_register(rdev, ir_codes, props, MOD_NAME);
1867 if (ret < 0) { 1860 if (ret < 0) {
1868 dev_err(ictx->dev, "remote input dev register failed\n"); 1861 dev_err(ictx->dev, "remote input dev register failed\n");
1869 goto out; 1862 goto out;
@@ -1872,8 +1865,7 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
1872 return rdev; 1865 return rdev;
1873 1866
1874out: 1867out:
1875 kfree(props); 1868 rc_free_device(rdev);
1876 input_free_device(rdev);
1877 return NULL; 1869 return NULL;
1878} 1870}
1879 1871
@@ -2144,7 +2136,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
2144 return ictx; 2136 return ictx;
2145 2137
2146urb_submit_failed: 2138urb_submit_failed:
2147 ir_input_unregister(ictx->rdev); 2139 rc_unregister_device(ictx->rdev);
2148rdev_setup_failed: 2140rdev_setup_failed:
2149 input_unregister_device(ictx->idev); 2141 input_unregister_device(ictx->idev);
2150idev_setup_failed: 2142idev_setup_failed:
@@ -2371,7 +2363,7 @@ static void __devexit imon_disconnect(struct usb_interface *interface)
2371 ictx->dev_present_intf0 = false; 2363 ictx->dev_present_intf0 = false;
2372 usb_kill_urb(ictx->rx_urb_intf0); 2364 usb_kill_urb(ictx->rx_urb_intf0);
2373 input_unregister_device(ictx->idev); 2365 input_unregister_device(ictx->idev);
2374 ir_input_unregister(ictx->rdev); 2366 rc_unregister_device(ictx->rdev);
2375 if (ictx->display_supported) { 2367 if (ictx->display_supported) {
2376 if (ictx->display_type == IMON_DISPLAY_TYPE_LCD) 2368 if (ictx->display_type == IMON_DISPLAY_TYPE_LCD)
2377 usb_deregister_dev(interface, &imon_lcd_class); 2369 usb_deregister_dev(interface, &imon_lcd_class);