From patchwork Sun Nov 1 15:31:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Rojtberg X-Patchwork-Id: 7532401 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DC91BEEA4 for ; Sun, 1 Nov 2015 15:32:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74AB4206B6 for ; Sun, 1 Nov 2015 15:31:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87F0B20680 for ; Sun, 1 Nov 2015 15:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbbKAPb6 (ORCPT ); Sun, 1 Nov 2015 10:31:58 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:33894 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751123AbbKAPb5 (ORCPT ); Sun, 1 Nov 2015 10:31:57 -0500 Received: by wmff134 with SMTP id f134so41619700wmf.1 for ; Sun, 01 Nov 2015 07:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=12gWl+Yb6EpuYg+ZnKcnTOEPTbAGFWr81O8GNuvTKOg=; b=FepDa3Q6MdJY6Zate4tLkIN6QYkP3IRfc4GGY1JVUWeuUx7K51HE5hWYL4f33S0op+ 28f3LrQHA2HaOipg8anotKobSg5KT1YrSP/jElLNZYKda2uj2b1kHwI7gjYBe6MeHXlO iM934jg4Kiqwogv/BUa69O5ecC8fEBxC4T/WUh8c8MQULsHXLeT8iCAfULDLs+JQxD7x +hzkD1kYUkH5JMmzrVeGhFn8/kF8U38S7cEiguyUCtbWoHp7+0WcTSY53IbVlh7MsCaC PRXRLklWL2EyjNKEp5DlGbBES2KvZrJi+XCcSGaRHSkpv2YotLc3/OaWWoXfmPbOZSOx Nqtw== X-Received: by 10.28.140.211 with SMTP id o202mr9043824wmd.73.1446391916551; Sun, 01 Nov 2015 07:31:56 -0800 (PST) Received: from deepwhite.fritz.box (p5DDCEA2E.dip0.t-ipconnect.de. [93.220.234.46]) by smtp.gmail.com with ESMTPSA id iw8sm17505161wjb.5.2015.11.01.07.31.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Nov 2015 07:31:56 -0800 (PST) From: Pavel Rojtberg X-Google-Original-From: Pavel Rojtberg < rojtberg@gmail.com > To: linux-input@vger.kernel.org, pgriffais@valvesoftware.com, dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org Cc: Pavel Rojtberg Subject: [PATCH 4/5] Input: xpad: workaround dead irq_out after suspend/ resume Date: Sun, 1 Nov 2015 16:31:38 +0100 Message-Id: <1446391899-24250-5-git-send-email-rojtberg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446391899-24250-1-git-send-email-rojtberg@gmail.com> References: <1446391899-24250-1-git-send-email-rojtberg@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pavel Rojtberg the irq_out urb is dead after suspend/ resume on my x360 wr pad. (also reproduced by Zachary Lund [0]) Work around this by resetting the usb device on resume. Added suspend/ resume callbacks to do so. [0]: https://github.com/paroj/xpad/issues/6 Signed-off-by: Pavel Rojtberg --- drivers/input/joystick/xpad.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index f3754c7..e8dcc80 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1423,17 +1423,23 @@ err_free_mem: } -static void xpad_disconnect(struct usb_interface *intf) +static void xpad_stop_communication(struct usb_xpad *xpad) { - struct usb_xpad *xpad = usb_get_intfdata (intf); - - xpad_deinit_output(xpad); + xpad_stop_output(xpad); if (xpad->xtype == XTYPE_XBOX360W) { usb_kill_urb(xpad->irq_in); } cancel_work_sync(&xpad->work); +} + +static void xpad_disconnect(struct usb_interface *intf) +{ + struct usb_xpad *xpad = usb_get_intfdata(intf); + + xpad_stop_communication(xpad); + xpad_deinit_output(xpad); if (xpad->pad_present) xpad_deinit_input(xpad); @@ -1447,10 +1453,26 @@ static void xpad_disconnect(struct usb_interface *intf) usb_set_intfdata(intf, NULL); } +static int xpad_suspend(struct usb_interface *intf, pm_message_t message) +{ + struct usb_xpad *xpad = usb_get_intfdata(intf); + + xpad_stop_communication(xpad); + return 0; +} + +static int xpad_resume(struct usb_interface *intf) +{ + usb_queue_reset_device(intf); + return 0; +} + static struct usb_driver xpad_driver = { .name = "xpad", .probe = xpad_probe, .disconnect = xpad_disconnect, + .suspend = xpad_suspend, + .resume = xpad_resume, .id_table = xpad_table, };