Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3952034pxv; Mon, 28 Jun 2021 17:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGU7CuZwuUCkekj46h4e0cJ7fjj0oqvaptHp6d5YTnZVuR20UkiYraQZLlilnyvtqBHL35 X-Received: by 2002:a05:6638:1349:: with SMTP id u9mr1878461jad.43.1624926859322; Mon, 28 Jun 2021 17:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624926859; cv=none; d=google.com; s=arc-20160816; b=eTQQN9gD2jrAilMP591qY01UhgULtpVh2CuUCSHxnzGSkdY03XTEeZX0k2XUSvziVK c+LkhzNTUsQruJlMeoifBMK3uxqEy5ROQu3pctxylmSgY7Ozgc2lQ+Pu3/6/Uz+Nf6yY K5GAYv2/DcgxmAzEPhrbZEniT2Wus+KewvpVu9ceqezZEwhC/gK4dfY/zBxixDrUXFTs pNIu9m3LDRBP4maN7XJJuS4mEM1Crk09lcds8fnsZw6GeKTAGMONTyYgWiEK95O1nXMK b/K/cJqACCQwaj/+aMhy3i4wi3g5QChEFccrED+VsPiJLbEFCiYrkxPsm8Yqifimb7o8 w4Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=beDcbwnP5As/mpTZp4157m7lhvaIkwus448ktxDYZvw=; b=TMH9BcK36kwHc+P5iL7gb6zEkuk9b0fMXl+XzhiAO+iFDim9rlFmmc/sgLmVmecRym 4v6mTKG2PxMixRVQynbcZ1v9kvHQMmyAN+BnHZRiHdWEwaEU/1tXfrMMAo/i4rp7gYJe wK7QI5RNbHIykWgFNrzADROsdo+ide7uttMNq/aKoidYQSOGi+C0MxBQGenjHuyKlBCd 5JTYm18vH9er1BaO166nn8tEEw7yEQOQWkrvdD2ErB7CpkYlrvPAblxGyBxHltkHLg8g ZMbGbOL/fx99k4nU3icCLOgrWAAaBAy+gim2EzL/ccku3zIdjzy4P36dNUGoeQacpEVh dhAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hWBO2BGh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si6841079ilm.39.2021.06.28.17.34.07; Mon, 28 Jun 2021 17:34:19 -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; dkim=pass header.i=@chromium.org header.s=google header.b=hWBO2BGh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238212AbhF1V36 (ORCPT + 99 others); Mon, 28 Jun 2021 17:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238373AbhF1V03 (ORCPT ); Mon, 28 Jun 2021 17:26:29 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8638C061766 for ; Mon, 28 Jun 2021 14:23:58 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id v13so9686396ple.9 for ; Mon, 28 Jun 2021 14:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=beDcbwnP5As/mpTZp4157m7lhvaIkwus448ktxDYZvw=; b=hWBO2BGhHo4wGkJVLXWZrYlXf4KDPCrSBwu9CLS9i1uqZziusrG8bjJ9mhC2Gvqo5U /9D563iCVi95+zuDP6wh8g98G0A1nr54k9YZIqal45xzZx/Sfu6Cq+WGvFHtcpRh9CmK p1i4f38U+srKWyf3c+pGv9BuT7Vfe4zLq5qtU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=beDcbwnP5As/mpTZp4157m7lhvaIkwus448ktxDYZvw=; b=Ks6THP9PtJehBazRHJZ+IK9VIyarflhR2khHhzaI+9x9/iVd64e3dGaRZziHbI+bkD RwqC1w/eJ/8162Ghz/jyW08+AVTFZJbYx9Ifv4Fa294zJCUHZhrc5HTIo7ctENVyJlH1 hdOsxUMl3S/nQwMn9JBZXECgLizHfMcsACVuUOGNH7eQO4W3ybkdvke3kaGFA1r3S3my xJUCiK69GXWZ4bAs9iHDOErx1Dm3vZimTEKAon1j4d8/Dpgw5u/6nM9qx4iyDco7gcYG doXZXA/Amel3gzeYNPWUoLsuRaxPFwxq0mVnCH61FcaFQB4CKzRxcJdVgK9i4Xn/MfRc fmVg== X-Gm-Message-State: AOAM530035CSNTbJ8weMN5EHL1PixV2g7+BE4y0Rd/MBEcBtF+9wyV5K OaXSTT6D7P+bvxPosnN4PIKeAg== X-Received: by 2002:a17:90a:390d:: with SMTP id y13mr39170373pjb.133.1624915438390; Mon, 28 Jun 2021 14:23:58 -0700 (PDT) Received: from localhost ([2620:15c:202:201:df70:d2d8:b384:35cf]) by smtp.gmail.com with UTF8SMTPSA id j2sm15093743pfi.111.2021.06.28.14.23.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Jun 2021 14:23:57 -0700 (PDT) Date: Mon, 28 Jun 2021 14:23:56 -0700 From: Matthias Kaehlcke To: Sandeep Maheswaram Cc: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Mathias Nyman , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Pratham Pratap Subject: Re: [PATCH v8 6/6] usb: dwc3: qcom: Keep power domain on to support wakeup Message-ID: References: <1624882097-23265-1-git-send-email-sanm@codeaurora.org> <1624882097-23265-7-git-send-email-sanm@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1624882097-23265-7-git-send-email-sanm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 28, 2021 at 05:38:17PM +0530, Sandeep Maheswaram wrote: > If wakeup capable devices are connected to the controller (directly > or through hubs) at suspend time keep the power domain on in order > to support wakeup from these devices. > > Signed-off-by: Sandeep Maheswaram > --- > Checking phy_power_off flag instead of usb_wakeup_enabled_descendants > to keep gdsc active. > > drivers/usb/dwc3/dwc3-qcom.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 82125bc..ba31aa3 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -355,9 +356,15 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) > u32 val; > int i, ret; > > + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); > + struct generic_pm_domain *genpd = pd_to_genpd(qcom->dev->pm_domain); > + > if (qcom->is_suspended) > return 0; > > + if (!dwc->phy_power_off && dwc->xhci) > + genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP; > + > val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG); > if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) > dev_err(qcom->dev, "HS-PHY not in L2\n"); > @@ -382,9 +389,15 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) > int ret; > int i; > > + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); > + struct generic_pm_domain *genpd = pd_to_genpd(qcom->dev->pm_domain); > + > if (!qcom->is_suspended) > return 0; > > + if (dwc->xhci) > + genpd->flags &= ~GENPD_FLAG_ACTIVE_WAKEUP; > + > if (device_may_wakeup(qcom->dev)) > dwc3_qcom_disable_interrupts(qcom); > This is essentially the same as v7, which Felipe NAKed (https://patchwork.kernel.org/project/linux-arm-msm/patch/1619586716-8687-6-git-send-email-sanm@codeaurora.org/) I think Felipe wants to see the handling of the power domain in the xhci-plat driver. One problem here is that the power domain is owned by the glue driver. For dwc3 the glue device is the parent of the xHCI device, this is also the case for some other drivers like histb or cdns3, but I'm not sure if it is universally true. If it isn't xhci-plat could only make use of dev->parent->pm_domain for certain compatible strings. One could argue that it isn't very clean either if xhci-plat manipulates a resource of it's parent. At the same time the glue driver isn't supposed to check for the wakeup capable devices, so I guess some kind of trade-off needs to be made.