From patchwork Thu Oct 19 10:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 736164 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1DA71EB27 for ; Thu, 19 Oct 2023 10:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KjRy/9hp" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC0A3119 for ; Thu, 19 Oct 2023 03:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697711308; x=1729247308; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U9tJYrLMXGaiXw6LWcSyDKynz+MAXoAdhoATj+8laec=; b=KjRy/9hp0DpRdMFYMkJC/GnR+ulIbFiKOmFi+X/6/5jqYqMOrH58o+sk vU/LIqF5OTQ6fv1uKxXd2J+WwLIHkcY8NUY0BF8/QlMui0kstVXNlHhvC iOV0q61Kcg/OUjjY7Eg/dMdy/u1YRqc4GtSD53nigzIYy5VOyU4GXeR4d u0i/+QGPCBavoK9EtREMZdLhewkxPKWEryr4mqNVTttSaoLm6ZI1XzDF8 iUyqH8gUOFpHT+ApahQU56htFALjgcjlMgfOfycUknKrjT9mEfDdKhp1g DgEvjApChKF3hTGJM3MBxoLchx/C/JRG4kVIXQh7jQnr/nkGEV/xymIL5 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="389075940" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="389075940" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 03:28:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="930557845" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="930557845" Received: from mattu-haswell.fi.intel.com ([10.237.72.199]) by orsmga005.jf.intel.com with ESMTP; 19 Oct 2023 03:28:26 -0700 From: Mathias Nyman To: Cc: , Basavaraj Natikar , Mario Limonciello , Mathias Nyman Subject: [PATCH 15/19] xhci: Enable RPM on controllers that support low-power states Date: Thu, 19 Oct 2023 13:29:20 +0300 Message-Id: <20231019102924.2797346-16-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231019102924.2797346-1-mathias.nyman@linux.intel.com> References: <20231019102924.2797346-1-mathias.nyman@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Basavaraj Natikar Use the low-power states of the underlying platform to enable runtime PM. If the platform doesn't support runtime D3, then enabling default RPM will result in the controller malfunctioning, as in the case of hotplug devices not being detected because of a failed interrupt generation. Cc: Mario Limonciello Signed-off-by: Basavaraj Natikar Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index bde43cef8846..95ed9404f6f8 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -695,7 +695,9 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ pm_runtime_put_noidle(&dev->dev); - if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) + if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) + pm_runtime_forbid(&dev->dev); + else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) pm_runtime_allow(&dev->dev); dma_set_max_seg_size(&dev->dev, UINT_MAX);