From patchwork Thu May 5 08:56:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Kurapati X-Patchwork-Id: 12839246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10860C433FE for ; Thu, 5 May 2022 08:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351047AbiEEJAQ (ORCPT ); Thu, 5 May 2022 05:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350883AbiEEJAP (ORCPT ); Thu, 5 May 2022 05:00:15 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5999B17AA8; Thu, 5 May 2022 01:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1651740996; x=1683276996; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=wkAVYkgF4bDYF4OuAjZsIIusmVqbbAje0ltlN8IZxnY=; b=k8r4x+ImkshkZu3zl/PZR78nMz8JWYdBk9qyN6YoH3S9sDm8AClhf10Z zKEXrWRPaEMER3zwAXYAro8EyfCmTopiE23EMoYqZhMpKzL427ZX524BT B6fEs/w6EvYEmkJa0qZyrduXvHGvB9G0WPZb+LucFpjp+zDRiMUdufzcs U=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 05 May 2022 01:56:36 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 01:56:35 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 5 May 2022 01:56:35 -0700 Received: from hu-kriskura-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 5 May 2022 01:56:29 -0700 From: Krishna Kurapati To: Krzysztof Kozlowski , Rob Herring , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman CC: , , , , , , , , Krishna Kurapati Subject: [v15 2/6] usb: host: xhci-plat: Enable wakeup based on children wakeup status Date: Thu, 5 May 2022 14:26:09 +0530 Message-ID: <1651740973-7944-3-git-send-email-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1651740973-7944-1-git-send-email-quic_kriskura@quicinc.com> References: <1651740973-7944-1-git-send-email-quic_kriskura@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org device_wakeup_path() tells if any of the children devices needs wakeup. Use this hint to enable/disable wakeup of our device. This helps the parent device of xhci-plat (like sysdev) to retrieve the wakeup setting via device_wakeup_path(). Signed-off-by: Krishna Kurapati --- drivers/usb/host/xhci-plat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 649ffd8..ad585fa 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -415,6 +415,14 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) if (pm_runtime_suspended(dev)) pm_runtime_resume(dev); + if (device_wakeup_path(dev)) { + if (!device_may_wakeup(dev)) + device_wakeup_enable(dev); + } else { + if (device_may_wakeup(dev)) + device_wakeup_disable(dev); + } + ret = xhci_priv_suspend_quirk(hcd); if (ret) return ret;