Skip to content

Commit eb81bfb

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Dmitry writes: "Input updates for v4.19-rc7 - we added a few scheduling points into various input interfaces to ensure that large writes will not cause RCU stalls - fixed configuring PS/2 keyboards as wakeup devices on newer platforms - added a new Xbox gamepad ID." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: uinput - add a schedule point in uinput_inject_events() Input: evdev - add a schedule point in evdev_write() Input: mousedev - add a schedule point in mousedev_write() Input: i8042 - enable keyboard wakeups by default when s2idle is used Input: xpad - add support for Xbox1 PDP Camo series gamepad
2 parents 0c53b6a + cecf107 commit eb81bfb

7 files changed

Lines changed: 34 additions & 9 deletions

File tree

‎drivers/input/evdev.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer,
564564

565565
input_inject_event(&evdev->handle,
566566
event.type, event.code, event.value);
567+
cond_resched();
567568
}
568569

569570
out:

‎drivers/input/joystick/xpad.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static const struct xpad_device {
231231
{ 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE },
232232
{ 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE },
233233
{ 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE },
234+
{ 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE },
234235
{ 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
235236
{ 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE },
236237
{ 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
@@ -530,6 +531,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
530531
XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),
531532
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),
532533
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),
534+
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),
535+
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),
533536
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
534537
XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
535538
XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),

‎drivers/input/misc/uinput.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ static ssize_t uinput_inject_events(struct uinput_device *udev,
598598

599599
input_event(udev->dev, ev.type, ev.code, ev.value);
600600
bytes += input_event_size();
601+
cond_resched();
601602
}
602603

603604
return bytes;

‎drivers/input/mousedev.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ static ssize_t mousedev_write(struct file *file, const char __user *buffer,
707707
mousedev_generate_response(client, c);
708708

709709
spin_unlock_irq(&client->packet_lock);
710+
cond_resched();
710711
}
711712

712713
kill_fasync(&client->fasync, SIGIO, POLL_IN);

‎drivers/input/serio/i8042.c‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,15 +1395,26 @@ static void __init i8042_register_ports(void)
13951395
for (i = 0; i < I8042_NUM_PORTS; i++) {
13961396
struct serio *serio = i8042_ports[i].serio;
13971397

1398-
if (serio) {
1399-
printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n",
1400-
serio->name,
1401-
(unsigned long) I8042_DATA_REG,
1402-
(unsigned long) I8042_COMMAND_REG,
1403-
i8042_ports[i].irq);
1404-
serio_register_port(serio);
1405-
device_set_wakeup_capable(&serio->dev, true);
1406-
}
1398+
if (!serio)
1399+
continue;
1400+
1401+
printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n",
1402+
serio->name,
1403+
(unsigned long) I8042_DATA_REG,
1404+
(unsigned long) I8042_COMMAND_REG,
1405+
i8042_ports[i].irq);
1406+
serio_register_port(serio);
1407+
device_set_wakeup_capable(&serio->dev, true);
1408+
1409+
/*
1410+
* On platforms using suspend-to-idle, allow the keyboard to
1411+
* wake up the system from sleep by enabling keyboard wakeups
1412+
* by default. This is consistent with keyboard wakeup
1413+
* behavior on many platforms using suspend-to-RAM (ACPI S3)
1414+
* by default.
1415+
*/
1416+
if (pm_suspend_via_s2idle() && i == I8042_KBD_PORT_NO)
1417+
device_set_wakeup_enable(&serio->dev, true);
14071418
}
14081419
}
14091420

‎include/linux/suspend.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ static inline bool idle_should_enter_s2idle(void)
251251
return unlikely(s2idle_state == S2IDLE_STATE_ENTER);
252252
}
253253

254+
extern bool pm_suspend_via_s2idle(void);
254255
extern void __init pm_states_init(void);
255256
extern void s2idle_set_ops(const struct platform_s2idle_ops *ops);
256257
extern void s2idle_wake(void);
@@ -282,6 +283,7 @@ static inline void pm_set_suspend_via_firmware(void) {}
282283
static inline void pm_set_resume_via_firmware(void) {}
283284
static inline bool pm_suspend_via_firmware(void) { return false; }
284285
static inline bool pm_resume_via_firmware(void) { return false; }
286+
static inline bool pm_suspend_via_s2idle(void) { return false; }
285287

286288
static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
287289
static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }

‎kernel/power/suspend.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ static DECLARE_SWAIT_QUEUE_HEAD(s2idle_wait_head);
6363
enum s2idle_states __read_mostly s2idle_state;
6464
static DEFINE_RAW_SPINLOCK(s2idle_lock);
6565

66+
bool pm_suspend_via_s2idle(void)
67+
{
68+
return mem_sleep_current == PM_SUSPEND_TO_IDLE;
69+
}
70+
EXPORT_SYMBOL_GPL(pm_suspend_via_s2idle);
71+
6672
void s2idle_set_ops(const struct platform_s2idle_ops *ops)
6773
{
6874
lock_system_sleep();

0 commit comments

Comments
 (0)