Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: move zeroplus FF processing

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Jiri Slaby and committed by
Jiri Kosina
987fbc1f 10e41a71

+76 -21
+8
drivers/hid/Kconfig
··· 252 252 Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or 253 253 a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel. 254 254 255 + config ZEROPLUS_FF 256 + tristate "Zeroplus based game controller support" 257 + default m 258 + depends on USB_HID 259 + select INPUT_FF_MEMLESS 260 + help 261 + Say Y here if you have a Zeroplus based game controller. 262 + 255 263 endmenu 256 264 257 265 endif # HID_SUPPORT
+1
drivers/hid/Makefile
··· 38 38 obj-$(CONFIG_HID_SONY) += hid-sony.o 39 39 obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o 40 40 obj-$(CONFIG_THRUSTMASTER_FF) += hid-tmff.o 41 + obj-$(CONFIG_ZEROPLUS_FF) += hid-zpff.o 41 42 42 43 obj-$(CONFIG_USB_HID) += usbhid/ 43 44 obj-$(CONFIG_USB_MOUSE) += usbhid/
+2
drivers/hid/hid-core.c
··· 1530 1530 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, 1531 1531 { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, 1532 1532 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, 1533 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 1534 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 1533 1535 { } 1534 1536 }; 1535 1537
+3
drivers/hid/hid-dummy.c
··· 58 58 #ifdef CONFIG_THRUSTMASTER_FF_MODULE 59 59 HID_COMPAT_CALL_DRIVER(thrustmaster); 60 60 #endif 61 + #ifdef CONFIG_ZEROPLUS_FF_MODULE 62 + HID_COMPAT_CALL_DRIVER(zeroplus); 63 + #endif 61 64 62 65 return -EIO; 63 66 }
+2
drivers/hid/hid-ids.h
··· 388 388 #define USB_VENDOR_ID_YEALINK 0x6993 389 389 #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001 390 390 391 + #define USB_VENDOR_ID_ZEROPLUS 0x0c12 392 + 391 393 #define USB_VENDOR_ID_KYE 0x0458 392 394 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 393 395
-8
drivers/hid/usbhid/Kconfig
··· 44 44 feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such 45 45 devices. 46 46 47 - config ZEROPLUS_FF 48 - bool "Zeroplus based game controller support" 49 - depends on HID_FF 50 - select INPUT_FF_MEMLESS if USB_HID 51 - help 52 - Say Y here if you have a Zeroplus based game controller and want to 53 - enable force feedback for it. 54 - 55 47 config USB_HIDDEV 56 48 bool "/dev/hiddev raw HID device support" 57 49 depends on USB_HID
-3
drivers/hid/usbhid/Makefile
··· 13 13 ifeq ($(CONFIG_HID_PID),y) 14 14 usbhid-objs += hid-pidff.o 15 15 endif 16 - ifeq ($(CONFIG_ZEROPLUS_FF),y) 17 - usbhid-objs += hid-zpff.o 18 - endif 19 16 ifeq ($(CONFIG_HID_FF),y) 20 17 usbhid-objs += hid-ff.o 21 18 endif
-4
drivers/hid/usbhid/hid-ff.c
··· 50 50 * be a PID device 51 51 */ 52 52 static struct hid_ff_initializer inits[] = { 53 - #ifdef CONFIG_ZEROPLUS_FF 54 - { 0xc12, 0x0005, hid_zpff_init }, 55 - { 0xc12, 0x0030, hid_zpff_init }, 56 - #endif 57 53 { 0, 0, hid_pidff_init} /* Matches anything */ 58 54 }; 59 55
+60 -5
drivers/hid/usbhid/hid-zpff.c drivers/hid/hid-zpff.c
··· 21 21 */ 22 22 23 23 24 + #include <linux/hid.h> 24 25 #include <linux/input.h> 25 26 #include <linux/usb.h> 26 - #include <linux/hid.h> 27 - #include "usbhid.h" 27 + 28 + #include "hid-ids.h" 29 + 30 + #include "usbhid/usbhid.h" 28 31 29 32 struct zpff_device { 30 33 struct hid_report *report; 31 34 }; 32 35 33 - static int hid_zpff_play(struct input_dev *dev, void *data, 36 + static int zpff_play(struct input_dev *dev, void *data, 34 37 struct ff_effect *effect) 35 38 { 36 39 struct hid_device *hid = input_get_drvdata(dev); ··· 61 58 return 0; 62 59 } 63 60 64 - int hid_zpff_init(struct hid_device *hid) 61 + static int zpff_init(struct hid_device *hid) 65 62 { 66 63 struct zpff_device *zpff; 67 64 struct hid_report *report; ··· 90 87 91 88 set_bit(FF_RUMBLE, dev->ffbit); 92 89 93 - error = input_ff_create_memless(dev, zpff, hid_zpff_play); 90 + error = input_ff_create_memless(dev, zpff, zpff_play); 94 91 if (error) { 95 92 kfree(zpff); 96 93 return error; ··· 108 105 109 106 return 0; 110 107 } 108 + 109 + static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id) 110 + { 111 + int ret; 112 + 113 + ret = hid_parse(hdev); 114 + if (ret) { 115 + dev_err(&hdev->dev, "parse failed\n"); 116 + goto err; 117 + } 118 + 119 + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 120 + if (ret) { 121 + dev_err(&hdev->dev, "hw start failed\n"); 122 + goto err; 123 + } 124 + 125 + zpff_init(hdev); 126 + 127 + return 0; 128 + err: 129 + return ret; 130 + } 131 + 132 + static const struct hid_device_id zp_devices[] = { 133 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, 134 + { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, 135 + { } 136 + }; 137 + MODULE_DEVICE_TABLE(hid, zp_devices); 138 + 139 + static struct hid_driver zp_driver = { 140 + .name = "zeroplus", 141 + .id_table = zp_devices, 142 + .probe = zp_probe, 143 + }; 144 + 145 + static int zp_init(void) 146 + { 147 + return hid_register_driver(&zp_driver); 148 + } 149 + 150 + static void zp_exit(void) 151 + { 152 + hid_unregister_driver(&zp_driver); 153 + } 154 + 155 + module_init(zp_init); 156 + module_exit(zp_exit); 157 + MODULE_LICENSE("GPL"); 158 + 159 + HID_COMPAT_LOAD_DRIVER(zeroplus);
-1
include/linux/hid.h
··· 760 760 #ifdef CONFIG_HID_FF 761 761 int hid_ff_init(struct hid_device *hid); 762 762 763 - int hid_zpff_init(struct hid_device *hid); 764 763 #ifdef CONFIG_HID_PID 765 764 int hid_pidff_init(struct hid_device *hid); 766 765 #else