From patchwork Thu Nov 21 05:17:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11255307 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C4246C1 for ; Thu, 21 Nov 2019 05:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7153208A1 for ; Thu, 21 Nov 2019 05:17:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FcyT/9IS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbfKUFRd (ORCPT ); Thu, 21 Nov 2019 00:17:33 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41890 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725842AbfKUFRa (ORCPT ); Thu, 21 Nov 2019 00:17:30 -0500 Received: by mail-pl1-f195.google.com with SMTP id t8so932319plr.8 for ; Wed, 20 Nov 2019 21:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qt9koM1LHBmgQkeJkd8cthdiqJNvUQyFhHQ//lqCfgM=; b=FcyT/9IS6MHjiwahzYdVH3N1GQ+MK4ukLef367ioMGyT/L0WQwOVxnWOPm1Ail6UDh px6AugZ3oUk6fyzZ0pvnQz1CgIZ2kEZH7Kz7rA1VGPeiF7gGXOnCV0dKvi/Ozrnxryxy L16oVlJOG8SLqM80q61Ls2ehFebbAgyGuEVMU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qt9koM1LHBmgQkeJkd8cthdiqJNvUQyFhHQ//lqCfgM=; b=cl8qcT5HpwY5txE6xk2YRUTBx7X2BQqCz/i2vf159Z8Eoz6cXUphGoOr301ATqBLXs +MvpPAJHaYnvtPMqgwhOZdZCXtO4CKUVOjA2u/iIBNAc0ELPNb9sP3d2LYY9mQZoe3H3 pnBfNasNqw1qs8keam5qoUyS4vuqsHr1XApONC3fFSxWLXFdtSexgIK+RBST6kfdbNcS ovPePEB3kIk030StnKcPiztykXB5SmsIxc0JuUMQFrgu9T4THER611VltSSCuUGDzDQC u4y8wqKQxqv7Z9bQmdjR10QRjsT+67PeBB2U6rq9JoVPTO+QmeZZgRq+uJrnudfkK9w7 U42A== X-Gm-Message-State: APjAAAWRZ+tUNAldoqAAVFRvirXk12KpEq77nY4ogqCoUzKR8rPL7qEg 8rfnQnuNyjf4LDfJfjKC4zm5WQ== X-Google-Smtp-Source: APXvYqxBWKwQVCFM/1gTdB6N93iKAMbhnEC3bfcQuaQYIbCr0a6dqG6+2QNRVxc1UuMuydZ7odftNQ== X-Received: by 2002:a17:902:9889:: with SMTP id s9mr6956371plp.18.1574313449223; Wed, 20 Nov 2019 21:17:29 -0800 (PST) Received: from ikjn-p920.tpe.corp.google.com ([2401:fa00:1:10:254e:2b40:ef8:ee17]) by smtp.gmail.com with ESMTPSA id d11sm1367463pfq.72.2019.11.20.21.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 21:17:28 -0800 (PST) From: Ikjoon Jang To: devicetree@vger.kernel.org Cc: GregKroah-Hartman , RobHerring , MarkRutland , AlanStern , SuwanKim , "GustavoA . R . Silva" , IkjoonJang , JohanHovold , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, drinkcat@chromium.org Subject: [PATCH v2 1/2] dt-bindings: usb: add "hub,interval" property Date: Thu, 21 Nov 2019 13:17:24 +0800 Message-Id: <20191121051724.110576-1-ikjn@chromium.org> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add "hub,interval" property to usb-device, so a hard wired hub device can have different bInterval from its endpoint. When we know reducing autosuspend delay for built-in HIDs is better for power saving, we can reduce it to the optimal value. But if a parent hub has a long bInterval, mouse lags a lot from more frequent autosuspend. So this enables overriding bInterval for a hard wired hub device only when we know that reduces the power consumption. Signed-off-by: Ikjoon Jang --- Documentation/devicetree/bindings/usb/usb-device.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/usb-device.txt b/Documentation/devicetree/bindings/usb/usb-device.txt index 036be172b1ae..44bef2ff2704 100644 --- a/Documentation/devicetree/bindings/usb/usb-device.txt +++ b/Documentation/devicetree/bindings/usb/usb-device.txt @@ -66,6 +66,9 @@ Required properties for host-controller nodes with device nodes: - #size-cells: shall be 0 +Optional properties for hub nodes +- hub,interval: bInterval of status change endpoint. The range is 1-255. + Example: &usb1 { /* host controller */ @@ -75,6 +78,7 @@ Example: hub@1 { /* hub connected to port 1 */ compatible = "usb5e3,608"; reg = <1>; + hub,interval = <8>; }; device@2 { /* device connected to port 2 */ From patchwork Thu Nov 21 05:18:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11255309 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E5FF930 for ; Thu, 21 Nov 2019 05:18:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E5BA2089F for ; Thu, 21 Nov 2019 05:18:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="M0RlwCSI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726346AbfKUFSZ (ORCPT ); Thu, 21 Nov 2019 00:18:25 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38804 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbfKUFSZ (ORCPT ); Thu, 21 Nov 2019 00:18:25 -0500 Received: by mail-pg1-f196.google.com with SMTP id t3so537108pgl.5 for ; Wed, 20 Nov 2019 21:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4VuwOGBrzR2whkS1/3LbZzPNcBDZzFvmrpSRRU9WHj0=; b=M0RlwCSItamoH3wOg/4t5jejha00zSNwwzReV5FFUUBTq2l8OMa29KV9iiGZtrEgG1 MmD42y2WBJdJzSBtw+T26rqAMdE0txaL7fs71Z8ysgyHKugmMl9roW/qJkPVthrnMk1T OAHVSxlOA2IXXrMKBcvq0FAv5jxOLt1dPCtnQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4VuwOGBrzR2whkS1/3LbZzPNcBDZzFvmrpSRRU9WHj0=; b=rVqcBgiJvlees0OaAIz6HxSmZJNQ1eSmwB4kF+zmhkNExnT90SkQfEZGdmjF01RGVb ESbx1Sn05Kgoqcn64zEqQNxaBuUrDsqC+b4eOSrbgldOuAI1zbnFCdeD7EJ36xX2+Kkp tPoGewkHspoG0ootzf3Sz3i1/xVByL47h4+iD/sLz6jUFYkYLTo6LIvloRRL8jLTyF65 0s0Km6aJC3rGwBDHO1Zu517tHZ8jZ4M4a8YSsF8lqaUwSTpb8jeTbSm2nqc6/TaZS+4O qTAEwKivMy3VJGRSJEXXOKWfBMaAiN7075XYRmaGF0g2mtwkVHDVIeDAoMBv6jD+5Sy0 aWyw== X-Gm-Message-State: APjAAAUcandF2Zacffv6mAkRCGuTfKxnJrMuAebiGLMrvILWNItgECDi Ijkc74S+XGA6PwsFaVgawJ/XyRaKJ5HwRA== X-Google-Smtp-Source: APXvYqxJQZ03rhIDy/VBUuNNbTWdjVsS64jTA43uDHNNX74A//zsxJMX41Gb8Yr5a1P/nZfU4Xm+xw== X-Received: by 2002:aa7:9abb:: with SMTP id x27mr8216447pfi.150.1574313504163; Wed, 20 Nov 2019 21:18:24 -0800 (PST) Received: from ikjn-p920.tpe.corp.google.com ([2401:fa00:1:10:254e:2b40:ef8:ee17]) by smtp.gmail.com with ESMTPSA id g30sm1017347pgm.23.2019.11.20.21.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 21:18:23 -0800 (PST) From: Ikjoon Jang To: linux-usb@vger.kernel.org Cc: GregKroah-Hartman , RobHerring , MarkRutland , AlanStern , SuwanKim , "GustavoA . R . Silva" , IkjoonJang , JohanHovold , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, drinkcat@chromium.org Subject: [PATCH v2 2/2] usb: overridable hub bInterval by device node Date: Thu, 21 Nov 2019 13:18:19 +0800 Message-Id: <20191121051819.111593-1-ikjn@chromium.org> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch enables hub device to override its own endpoint descriptor's bInterval when the hub has a device node with "hub,interval" property. When we know reducing autosuspend delay for built-in HIDs is better for power saving, we can reduce it to the optimal value. But if a parent hub has a long bInterval, mouse lags a lot from more frequent autosuspend. So this enables overriding bInterval for a hard wired hub device only when we know that reduces the power consumption. Signed-off-by: Ikjoon Jang Acked-by: Alan Stern --- drivers/usb/core/config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 5f40117e68e7..d2d9c6d6e00a 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -257,6 +258,11 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, memcpy(&endpoint->desc, d, n); INIT_LIST_HEAD(&endpoint->urb_list); + /* device node property overrides bInterval */ + if (usb_of_has_combined_node(to_usb_device(ddev))) + of_property_read_u8(ddev->of_node, "hub, interval", + &d->bInterval); + /* * Fix up bInterval values outside the legal range. * Use 10 or 8 ms if no proper value can be guessed.