From patchwork Fri Nov 22 04:24:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11257165 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 6A9496C1 for ; Fri, 22 Nov 2019 04:25:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A9492070A for ; Fri, 22 Nov 2019 04:25:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KWkzto2Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfKVEYz (ORCPT ); Thu, 21 Nov 2019 23:24:55 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:39585 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfKVEYz (ORCPT ); Thu, 21 Nov 2019 23:24:55 -0500 Received: by mail-pl1-f194.google.com with SMTP id o9so2563663plk.6 for ; Thu, 21 Nov 2019 20:24:54 -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=Vl/L3GceOHYxcg4cTV/C8OsBfxoa2/C+RjQ/F5C0XIo=; b=KWkzto2YidBehY5hy6CnYbfskxUqhiKN52tLynPMla94UhTtKFFQ67SOJ2g+PKqbjY HF6tZ8W2aqp+g6NR4dPAwwwB298tgN7Sr32qMNr/vNkHGYXuEMhm61vAHMvIJJk4en6a LOBdOYGyxlbDz0KvKvVIYxsiuJfH7LFYUu5aM= 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=Vl/L3GceOHYxcg4cTV/C8OsBfxoa2/C+RjQ/F5C0XIo=; b=bpKx91IZIGYq0FcXF3xecXtOlwEmQqSkh+OpATOBjIxKF2lq9b2eVEMjmDgL+EKkQ7 MkT0Rk+kug/+pl3nhWYUJDwPOpLteAXgEuoh3TQkB0pgvLMrOxnk5uWVun0PBv4ROQ7Q 26079fsc4vGy5qgSYqypCGZyPtKtJ6HpeNQaRbwMmB59asfAy/gyi7NeL0ZuPPeMr7e8 qcVAEcWa72CbMZ8g5a2NqyxYA+HPYBXQW/3HI6NbM65hYbtnqJ5hJ/hvC1RPay7NV6Ox OgUgdAIHEAQT+FoVpn/aJcI1lkxtAZEbULshawdrY4f2vz8cRiq0JnAOPIsEFfgdy9dY /jeQ== X-Gm-Message-State: APjAAAUNckq8qXC7TDm5HyDL8TqNG17SZICVZYw6VPdRy6De4WRNszNw eY4gPcgIqIfIG99rIx99jm9AiA== X-Google-Smtp-Source: APXvYqzR7Pewj2r6dUUfOv/6ROcwoWzNzrYgFMIJzyy+mJ8KW5vjsie2VAtXyT5q+9mmayBamWqEKw== X-Received: by 2002:a17:90a:86c3:: with SMTP id y3mr16294373pjv.102.1574396694254; Thu, 21 Nov 2019 20:24:54 -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 x203sm4812869pgx.61.2019.11.21.20.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 20:24:53 -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 v3 1/2] dt-bindings: usb: add "hub,interval" property Date: Fri, 22 Nov 2019 12:24:49 +0800 Message-Id: <20191122042449.205621-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 hub device can override endpoint descriptor's bInterval. 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 Fri Nov 22 04:25:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ikjoon Jang X-Patchwork-Id: 11257167 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 3C7B214DB for ; Fri, 22 Nov 2019 04:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C59220704 for ; Fri, 22 Nov 2019 04:25:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="aD1jwx6z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbfKVEZN (ORCPT ); Thu, 21 Nov 2019 23:25:13 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:40979 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfKVEZM (ORCPT ); Thu, 21 Nov 2019 23:25:12 -0500 Received: by mail-pj1-f65.google.com with SMTP id gc1so2480484pjb.8 for ; Thu, 21 Nov 2019 20:25:11 -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=8TaUjGR1ZK3h0U41Xrlyjvus/YvOSCFkyRPWGIeHKfc=; b=aD1jwx6z+f92KHKX9yFRTVyInNQGgPastRMpBKSMyxmF2ijG8yfcbYaFjNY/T0Od60 PjZVloFTMviB3NolgoCvOibRwFT2q48VSBw4RoS5Y3uv4HEPgAoa19m6hUClXA/2AXIP oN/mzFwnwtEV57HtZ4f66U+f4j9e/ng+/5fC4= 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=8TaUjGR1ZK3h0U41Xrlyjvus/YvOSCFkyRPWGIeHKfc=; b=s0pi8Uy3nMhsh/f5l4Ct4mEs2EqDjwcTXTK/HNhaCjZgQoUoYIRvOJqfaJfDemLE6m YmdkGvujA4nLAUcniOMRxvoPaFlkIqQxGYaSvZjo5i845ZIbZHXc+EwYApSjUWH46dyy iSiVqnTI/Ch6/PgtuugFj3SlgmQgZXoNGTizKVkO44hy263uedm+sgflm7UOzv6uJ2v3 dLHG0lDmsQjF98dtYalrJPLq3Aah8nzUj0ts20lhIzOSC9Xd9zKlYKUyCG/Mpo1cHH2+ 1AZbhOdr6XhtZp2drKc9x/3Q6LwmzydyqUc6gPAAW14uKKw4wh+MX7bbZ6ZWL12LFJq6 VIrw== X-Gm-Message-State: APjAAAXg7VZ3BOPsYAwbJ4RHEawCNyjJog2vS6tpE5PNmye3QO3Ldrw5 55N37yUGYyG7Bw/VK5tWdkZty3/u0EgXLA== X-Google-Smtp-Source: APXvYqw0xEIHeWcFvt2KpNgve53FlnVWf404GB3ugZXsdS5M/ZbW3Sav8UMHXT9d/R+RDe02HDJFzg== X-Received: by 2002:a17:902:7287:: with SMTP id d7mr12522360pll.333.1574396710980; Thu, 21 Nov 2019 20:25:10 -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 d11sm5680854pfq.72.2019.11.21.20.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 20:25:10 -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 v3 2/2] usb: overridable hub bInterval by device node Date: Fri, 22 Nov 2019 12:25:07 +0800 Message-Id: <20191122042507.205716-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..1939f2ff87ef 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.