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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull more input subsystem updates from Dmitry Torokhov:
"Just a few more driver fixes; new drivers will be coming in the next
merge window"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: pwm-beeper - fix - scheduling while atomic
Input: xpad - xbox one elite controller support
Input: xpad - add more third-party controllers
Input: xpad - prevent spurious input from wired Xbox 360 controllers
Input: xpad - move pending clear to the correct location
Input: uinput - handle compat ioctl for UI_SET_PHYS

+70 -23
+16 -2
drivers/input/joystick/xpad.c
··· 87 87 #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" 88 88 #define DRIVER_DESC "X-Box pad driver" 89 89 90 - #define XPAD_PKT_LEN 32 90 + #define XPAD_PKT_LEN 64 91 91 92 92 /* xbox d-pads should map to buttons, as is required for DDR pads 93 93 but we map them to axes when possible to simplify things */ ··· 129 129 { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, 130 130 { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, 131 131 { 0x045e, 0x02dd, "Microsoft X-Box One pad (Firmware 2015)", 0, XTYPE_XBOXONE }, 132 + { 0x045e, 0x02e3, "Microsoft X-Box One Elite pad", 0, XTYPE_XBOXONE }, 132 133 { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, 133 134 { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, 134 135 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, ··· 174 173 { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, 175 174 { 0x0e6f, 0x0105, "HSM3 Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, 176 175 { 0x0e6f, 0x0113, "Afterglow AX.1 Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 176 + { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, 177 177 { 0x0e6f, 0x0201, "Pelican PL-3601 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, 178 178 { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 179 179 { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, 180 + { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, 180 181 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, 181 182 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, 182 183 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, ··· 186 183 { 0x0f0d, 0x000a, "Hori Co. DOA4 FightStick", 0, XTYPE_XBOX360 }, 187 184 { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 188 185 { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 186 + { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, 189 187 { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, 190 188 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, 191 189 { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, ··· 203 199 { 0x162e, 0xbeef, "Joytech Neo-Se Take2", 0, XTYPE_XBOX360 }, 204 200 { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, 205 201 { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, 202 + { 0x24c6, 0x542a, "Xbox ONE spectra", 0, XTYPE_XBOXONE }, 206 203 { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, 207 204 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, 208 205 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, ··· 217 212 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, 218 213 { 0x24c6, 0x5300, "PowerA MINI PROEX Controller", 0, XTYPE_XBOX360 }, 219 214 { 0x24c6, 0x5303, "Xbox Airflo wired controller", 0, XTYPE_XBOX360 }, 215 + { 0x24c6, 0x541a, "PowerA Xbox One Mini Wired Controller", 0, XTYPE_XBOXONE }, 216 + { 0x24c6, 0x543a, "PowerA Xbox One wired controller", 0, XTYPE_XBOXONE }, 220 217 { 0x24c6, 0x5500, "Hori XBOX 360 EX 2 with Turbo", 0, XTYPE_XBOX360 }, 221 218 { 0x24c6, 0x5501, "Hori Real Arcade Pro VX-SA", 0, XTYPE_XBOX360 }, 222 219 { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, ··· 314 307 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ 315 308 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ 316 309 XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ 310 + XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ 317 311 XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ 318 312 XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ 319 313 XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ 320 314 XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ 321 315 XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ 316 + XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ 322 317 XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ 323 318 XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ 319 + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ 324 320 XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */ 325 321 XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */ 326 322 XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */ ··· 467 457 static void xpad360_process_packet(struct usb_xpad *xpad, struct input_dev *dev, 468 458 u16 cmd, unsigned char *data) 469 459 { 460 + /* valid pad data */ 461 + if (data[0] != 0x00) 462 + return; 463 + 470 464 /* digital pad */ 471 465 if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { 472 466 /* dpad as buttons (left, right, up, down) */ ··· 770 756 if (packet) { 771 757 memcpy(xpad->odata, packet->data, packet->len); 772 758 xpad->irq_out->transfer_buffer_length = packet->len; 759 + packet->pending = false; 773 760 return true; 774 761 } 775 762 ··· 812 797 switch (status) { 813 798 case 0: 814 799 /* success */ 815 - xpad->out_packets[xpad->last_out_packet].pending = false; 816 800 xpad->irq_out_active = xpad_prepare_next_out_packet(xpad); 817 801 break; 818 802
+48 -21
drivers/input/misc/pwm-beeper.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/pwm.h> 22 22 #include <linux/slab.h> 23 + #include <linux/workqueue.h> 23 24 24 25 struct pwm_beeper { 25 26 struct input_dev *input; 26 27 struct pwm_device *pwm; 28 + struct work_struct work; 27 29 unsigned long period; 28 30 }; 29 31 30 32 #define HZ_TO_NANOSECONDS(x) (1000000000UL/(x)) 31 33 34 + static void __pwm_beeper_set(struct pwm_beeper *beeper) 35 + { 36 + unsigned long period = beeper->period; 37 + 38 + if (period) { 39 + pwm_config(beeper->pwm, period / 2, period); 40 + pwm_enable(beeper->pwm); 41 + } else 42 + pwm_disable(beeper->pwm); 43 + } 44 + 45 + static void pwm_beeper_work(struct work_struct *work) 46 + { 47 + struct pwm_beeper *beeper = 48 + container_of(work, struct pwm_beeper, work); 49 + 50 + __pwm_beeper_set(beeper); 51 + } 52 + 32 53 static int pwm_beeper_event(struct input_dev *input, 33 54 unsigned int type, unsigned int code, int value) 34 55 { 35 - int ret = 0; 36 56 struct pwm_beeper *beeper = input_get_drvdata(input); 37 - unsigned long period; 38 57 39 58 if (type != EV_SND || value < 0) 40 59 return -EINVAL; ··· 68 49 return -EINVAL; 69 50 } 70 51 71 - if (value == 0) { 72 - pwm_disable(beeper->pwm); 73 - } else { 74 - period = HZ_TO_NANOSECONDS(value); 75 - ret = pwm_config(beeper->pwm, period / 2, period); 76 - if (ret) 77 - return ret; 78 - ret = pwm_enable(beeper->pwm); 79 - if (ret) 80 - return ret; 81 - beeper->period = period; 82 - } 52 + if (value == 0) 53 + beeper->period = 0; 54 + else 55 + beeper->period = HZ_TO_NANOSECONDS(value); 56 + 57 + schedule_work(&beeper->work); 83 58 84 59 return 0; 60 + } 61 + 62 + static void pwm_beeper_stop(struct pwm_beeper *beeper) 63 + { 64 + cancel_work_sync(&beeper->work); 65 + 66 + if (beeper->period) 67 + pwm_disable(beeper->pwm); 68 + } 69 + 70 + static void pwm_beeper_close(struct input_dev *input) 71 + { 72 + struct pwm_beeper *beeper = input_get_drvdata(input); 73 + 74 + pwm_beeper_stop(beeper); 85 75 } 86 76 87 77 static int pwm_beeper_probe(struct platform_device *pdev) ··· 121 93 */ 122 94 pwm_apply_args(beeper->pwm); 123 95 96 + INIT_WORK(&beeper->work, pwm_beeper_work); 97 + 124 98 beeper->input = input_allocate_device(); 125 99 if (!beeper->input) { 126 100 dev_err(&pdev->dev, "Failed to allocate input device\n"); ··· 142 112 beeper->input->sndbit[0] = BIT(SND_TONE) | BIT(SND_BELL); 143 113 144 114 beeper->input->event = pwm_beeper_event; 115 + beeper->input->close = pwm_beeper_close; 145 116 146 117 input_set_drvdata(beeper->input, beeper); 147 118 ··· 172 141 173 142 input_unregister_device(beeper->input); 174 143 175 - pwm_disable(beeper->pwm); 176 144 pwm_free(beeper->pwm); 177 145 178 146 kfree(beeper); ··· 183 153 { 184 154 struct pwm_beeper *beeper = dev_get_drvdata(dev); 185 155 186 - if (beeper->period) 187 - pwm_disable(beeper->pwm); 156 + pwm_beeper_stop(beeper); 188 157 189 158 return 0; 190 159 } ··· 192 163 { 193 164 struct pwm_beeper *beeper = dev_get_drvdata(dev); 194 165 195 - if (beeper->period) { 196 - pwm_config(beeper->pwm, beeper->period / 2, beeper->period); 197 - pwm_enable(beeper->pwm); 198 - } 166 + if (beeper->period) 167 + __pwm_beeper_set(beeper); 199 168 200 169 return 0; 201 170 }
+6
drivers/input/misc/uinput.c
··· 981 981 } 982 982 983 983 #ifdef CONFIG_COMPAT 984 + 985 + #define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t) 986 + 984 987 static long uinput_compat_ioctl(struct file *file, 985 988 unsigned int cmd, unsigned long arg) 986 989 { 990 + if (cmd == UI_SET_PHYS_COMPAT) 991 + cmd = UI_SET_PHYS; 992 + 987 993 return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); 988 994 } 989 995 #endif