Received: by 10.223.185.116 with SMTP id b49csp3553375wrg; Tue, 6 Mar 2018 00:40:14 -0800 (PST) X-Google-Smtp-Source: AG47ELuKNVfrs7LIV8KKFkeFjzwuOFCPMnDnslOEgDmFjibiqiz9j1ee97zq8URj8U6ri4CT+b2I X-Received: by 10.98.204.132 with SMTP id j4mr18393235pfk.35.1520325614439; Tue, 06 Mar 2018 00:40:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520325614; cv=none; d=google.com; s=arc-20160816; b=b1LGLJcY9n5k11V7CBIn+N8NkWBPgm69HX3/attuBgE54X81pmg3WIGaCtIQjFcnVv swzptSMEMCJ+EIZCQycBO/2cXTITwMKxswuIiSqApFXQHwbVorixslPf/of0h2hO2NO+ H7Y+MWd79xJM3aqNXFlC9v9ntOGhA/jkUrCOgocfABX3C7eLEGX4fR4CuzmALDI6a1R3 EGu9d2wNiYJY0HpbE9I7g+UMozucDeyZT7ohAAj6Pu6D946SjNjBdsP0fOMkAiXRJzfb NZuBkb6sdX6lI67Cfurd8MH0yP1Oxhev2Rs+3PcIX5flcmce+V5ntgVdNwry7jayWCP+ Sn3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ho6WOPuJJhjb/U53w7ngwgtiCEgex5e2IXXcytVkp8M=; b=nkzSdh+IZwVqs6VeEpTCnxteCSziVXbGufUXBKwSKJVnY/zHTY/zYz0MO4KPkJEE8l SKeT/4QRDeSGJumWj+VhhqK+pLvHQj6zB8UpDArrtObG5kH82uTM50nul95l1hh9wDuQ bHfPZrvtLKtKzF3TvMGMDQQAnCfZ5ZH9qTOJ1xp1L5J7jADCSww/At5v0Zia+wRnmeGr QpZL31jSmYt0YHfShhbz1AssnxYru6H9J4tomzsi5I5SLVbRoGZqTdrVVgnHUz0pOxw6 /XRn5W+vjc7AC7ioOVCu+W6jHWVTalTxElPsbZG8pwjK6R7ZX8ibgRmX4th+QpLtjkxW ZxUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g88si11689288pfk.65.2018.03.06.00.39.59; Tue, 06 Mar 2018 00:40:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753320AbeCFIjI (ORCPT + 99 others); Tue, 6 Mar 2018 03:39:08 -0500 Received: from hs01.dk-develop.de ([213.136.71.231]:58567 "EHLO hs01.dk-develop.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbeCFIjG (ORCPT ); Tue, 6 Mar 2018 03:39:06 -0500 Received: from arch-linux.fritz.box (ipbcc13fda.dynamic.kabel-deutschland.de [188.193.63.218]) by hs01.dk-develop.de (Postfix) with ESMTPSA id 88F301320CAB; Tue, 6 Mar 2018 09:39:11 +0100 (CET) From: Danilo Krummrich To: gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kai.heng.feng@canonical.com, Danilo Krummrich , stable@vger.kernel.org Subject: [PATCH resend] usb: quirks: add control message delay for 1b1c:1b20 Date: Tue, 6 Mar 2018 09:38:49 +0100 Message-Id: <20180306083849.3293-1-danilokrummrich@dk-develop.de> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Corsair Strafe RGB keyboard does not respond to usb control messages sometimes and hence generates timeouts. Commit de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") tried to fix those timeouts by adding USB_QUIRK_DELAY_INIT. Unfortunately, even with this quirk timeouts of usb_control_msg() can still be seen, but with a lower frequency (approx. 1 out of 15): [ 29.103520] usb 1-8: string descriptor 0 read error: -110 [ 34.363097] usb 1-8: can't set config #1, error -110 Adding further delays to different locations where usb control messages are issued just moves the timeouts to other locations, e.g.: [ 35.400533] usbhid 1-8:1.0: can't add hid device: -110 [ 35.401014] usbhid: probe of 1-8:1.0 failed with error -110 The only way to reliably avoid those issues is having a pause after each usb control message. In approx. 200 boot cycles no more timeouts were seen. Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary to have the delay in hub_port_connect() after hub_port_init(). The overall boot time seems not to be influenced by these additional delays, even on fast machines and lightweight distributions. Fixes: de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") Cc: stable@vger.kernel.org Signed-off-by: Danilo Krummrich --- drivers/usb/core/message.c | 4 ++++ drivers/usb/core/quirks.c | 3 ++- include/linux/usb/quirks.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index c64cf6c4a83d..0c11d40a12bc 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -151,6 +151,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout); + /* Linger a bit, prior to the next control message. */ + if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) + msleep(200); + kfree(dr); return ret; diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index f4a548471f0f..54b019e267c5 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -230,7 +230,8 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, /* Corsair Strafe RGB */ - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | + USB_QUIRK_DELAY_CTRL_MSG }, /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index f1fcec2fd5f8..b7a99ce56bc9 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -63,4 +63,7 @@ */ #define USB_QUIRK_DISCONNECT_SUSPEND BIT(12) +/* Device needs a pause after every control message. */ +#define USB_QUIRK_DELAY_CTRL_MSG BIT(13) + #endif /* __LINUX_USB_QUIRKS_H */ -- 2.16.2