Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2737417pxb; Mon, 1 Nov 2021 00:18:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywJUDzeEoYAzD0CEBUvZLjLWwD6RQA44UKhv2kmIa2/FyMf7VzR/KXZyuJiiHPRnIXnNut X-Received: by 2002:a05:6e02:665:: with SMTP id l5mr19472890ilt.211.1635751108681; Mon, 01 Nov 2021 00:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635751108; cv=none; d=google.com; s=arc-20160816; b=Pz/L0yR0e+eWr+AgVrOeBmCLWTsUeLU9Cq7LfCuaj+sLxQhl3B3abNufNfGTPaAekO wjjpcGBSqlE+TqPIBLnO7kavqV15r7wZSZTJpj/taKKR808bMKdWZp87v3sACLYejGQc xsUErvrSIBAHMZehO0O+e7oqDN5mnW1q5Mx6XzehFHR9VXhW13ToTp21qUeXgkCk69Cj c3/dQpmF031VOBp+fvgirpQMfPqxPkt9Yak+ZqRIBQvhaMJMoxEGVn44U2sHGE1X81sR 0URMGofJAimRE5B8HPR8EdTyqCRBYm3NhBIULjaXNIVoQQ1AhzVIC/2pZ83DKJB8jF+k 16vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=mwoQQAnQIoPaSQhCBrG4l2HGA1dJ5qeCSkL39cd8k8k=; b=pYCSW6fRtmfS9f58NXoMO++PCt7/5nU4Nem5W8a1SJFcUdbmTjKDqRol68rAVB/cwm GCl45DGafkEzoqKCdtyk7TDoQ1wScP/+CB7oeoioltpONdorSWQKMewM0hrOdhgngqD9 rQFgxp8gm5l4QpAFeFMbydE/8ei60L5oY8d71mTkHQXvqOqxZdgx7FnY+mNUWx0Y8Myx lV9+5v+MHZNIDtjIzuG4BxmyMqvuDFLWk0l7QMAn8rRiXvvtbOE3Kol0L6vruPC3TjY+ avusr76ya2ZvmXOx4HYlCqwd0unUM1hqxkQI2q5OkuvRY40/g3GOGntD3lCqVZl/qDis K9zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si15192965ilg.110.2021.11.01.00.18.17; Mon, 01 Nov 2021 00:18:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbhKAHT5 (ORCPT + 99 others); Mon, 1 Nov 2021 03:19:57 -0400 Received: from mail.loongson.cn ([114.242.206.163]:57112 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229622AbhKAHT5 (ORCPT ); Mon, 1 Nov 2021 03:19:57 -0400 Received: from localhost.localdomain.localdomain (unknown [10.2.5.46]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxX2pzlH9hp4QjAA--.39563S2; Mon, 01 Nov 2021 15:17:12 +0800 (CST) From: Yinbo Zhu To: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zhuyinbo@loongson.cn Subject: [PATCH v1] usb: xhci: add LPM quirk for ensuring uPD720201 into D3 state after S5 Date: Mon, 1 Nov 2021 15:17:05 +0800 Message-Id: <1635751025-25906-1-git-send-email-zhuyinbo@loongson.cn> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: AQAAf9DxX2pzlH9hp4QjAA--.39563S2 X-Coremail-Antispam: 1UD129KBjvJXoW7AF1fuF15Cw4UtFyUGF17ZFb_yoW8Zr15pF 4rWayUurs5Kr4IqryDAF1v9as5G3ZFkFyUKry7C3yqgrZ8trZ5GFyUGFW3GrZ3W395Jw1a qF1kW3y5WFW7GaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkS14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26r xl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVCm-wCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUozVbDUUUU X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After S5, any pci device should into D3 state that if supported, but the uPD720201 was not and it may be the cause of xhci firmware and cause OSPM power consumption is more higher that S5 than S4. I think xhci HCD can add a quirk ensure it into D3 state after S5 that is appropriate and this patch was to add LPM quirk and set PCI_D3hot to uPD720201 pmsc register in xhci_pci_shutdown to fix xhci power consumption issue. Signed-off-by: Yinbo Zhu --- drivers/usb/host/xhci-pci.c | 4 +++- drivers/usb/host/xhci.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 2c9f25c..f97bb64 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -265,6 +265,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device == 0x0014) { xhci->quirks |= XHCI_TRUST_TX_LENGTH; xhci->quirks |= XHCI_ZERO_64B_REGS; + xhci->quirks |= XHCI_LPM_QUIRK; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS && pdev->device == 0x0015) { @@ -608,7 +609,8 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd) xhci_shutdown(hcd); /* Yet another workaround for spurious wakeups at shutdown with HSW */ - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) + if (xhci->quirks & XHCI_SPURIOUS_WAKEUP || + xhci->quirks & XHCI_LPM_QUIRK) pci_set_power_state(pdev, PCI_D3hot); } #endif /* CONFIG_PM */ diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index dca6181..5f790202 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1899,6 +1899,7 @@ struct xhci_hcd { #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) #define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_BROKEN_D3COLD BIT_ULL(41) +#define XHCI_LPM_QUIRK BIT_ULL(42) unsigned int num_active_eps; unsigned int limit_active_eps; -- 1.8.3.1