Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp334445pxb; Fri, 16 Apr 2021 06:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn3oUS0H5bqloIFJYRZnj0Q2ptRnfr/RqBjgHl2JW7BGhoLZGWxa7lrAjLtAi0Px3oX4LK X-Received: by 2002:a17:906:48c4:: with SMTP id d4mr8671361ejt.548.1618581374710; Fri, 16 Apr 2021 06:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618581374; cv=none; d=google.com; s=arc-20160816; b=xk7Oa0JGc5NVWuqK7GUpjkwiDt9wslHCI+qaZ1EEf/wFz1vpWlSiUze4QRa2hJd9sa jfouFl924nlLrkn2z5psfeynFqz4WkZWUmXCPbvvN5q1tZJ6J4TdNOcrcu8lZIiPlMYa uijI0Dg/kA2f/f5OcYQSyLP+fRFx8f0rE97pxaLaEStqeP53ZSN+WROuZAUVgWswW4/Y nZgEJqCBrhGcyMMq1XCTzAvqdIR+XkgDtuqHnBgpNfd13d6mDyHljNQ4yQwNXY2Lxhu6 UjR2wRT5rJ6jwyXOicYMYkaA22NxS5PsCd2MnowX3KnTCl+ANBMyOwtXx+++0JJaKuVr ESMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:cc:to:subject:from:references :in-reply-to:date:dkim-signature; bh=1XH9sKsgr1wpbl/9rNNUGAqlFCm7LjW30rUvnmW/DH4=; b=ZGq0+ySR2rZ1bp1s6c0i9iKEBvxNrM2ao05WCSENrxmX9A0hVu6CvZ09Ld9iyn3fRf jW68iOchtKzbUU8IdoXSH46u7Tw40TC0t4Lo8OcZsNvGyVHQmJ0QmC3+grh5D9xYNKR2 vRMbYRQZVBdmESKgL+4kNcQVCHd37oGSU+nt0arjUMUQ4UNk+0znKdrABYcPbWsa1a34 5k3WwEZALNxjreaC3C4dHN1rARNqDCiqWbxVXSbiXGsAYJyIVvsfhw7/E7uUOf3I8l/w YJsNf/gbzuAEfBPay0sAVoyOCLnLD+zHChvqv06vHWbcnx/B1q3st9rohMHZorxDD52H jycg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Xla2bExm; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si4839974edr.542.2021.04.16.06.55.45; Fri, 16 Apr 2021 06:56:14 -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=@synopsys.com header.s=mail header.b=Xla2bExm; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243744AbhDPMtH (ORCPT + 99 others); Fri, 16 Apr 2021 08:49:07 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:42316 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243768AbhDPMtD (ORCPT ); Fri, 16 Apr 2021 08:49:03 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 8D8F6C06B9; Fri, 16 Apr 2021 12:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618577318; bh=FHLZ7VgZo7/0nBxiPZCw24PQ1RTUO894+7mdEeSmKgk=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=Xla2bExm/RSaibhRhlTFL20/xePG4iGFQNcCMqeSVaXKkAYOczSRriWbWZQJhmyKQ Fq+gltURsbkWI4XB5YUcALruE4v01hCko55wB7Xyf0U0c9zf48pgOc78F0WJugdGXb YWvmAVgASyHmHtK4ZENSqwb5sKy+ep6cuYNdaEq5spUGkGVEmU7wDdjnNBO+gFJUp4 7L5Grb/KC0tHpo1QMcWApc4G8EexGAr0Vp3Wn/sD+7NkkXGe8lZkBJoiIwsxF/zuTN UPnOnrOpLJRT1ccTbwSIAcSpW2en7MK1/JPf0OvuGyScClfXg6xAL8CM7IEHgFqDiE YYdX1c5JNYZZg== Received: from razpc-HP (razpc-hp.internal.synopsys.com [10.116.126.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPSA id 9F257A005D; Fri, 16 Apr 2021 12:48:35 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Fri, 16 Apr 2021 16:48:34 +0400 Date: Fri, 16 Apr 2021 16:48:34 +0400 In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH v2 14/15] usb: dwc2: Update dwc2_handle_usb_suspend_intr function. To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Youn , Artur Petrosyan , Minas Harutyunyan Message-Id: <20210416124835.9F257A005D@mailhost.synopsys.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid working in two modes (partial power down and hibernation) changed conditions for entering partial power down or hibernation. Instead of checking hw_params.power_optimized and hw_params.hibernation now checking power_down param which already set to one of the options (Hibernation or Partial Power Down) based on OTG_EN_PWROPT. Signed-off-by: Artur Petrosyan Signed-off-by: Minas Harutyunyan Acked-by: Minas Harutyunyan --- drivers/usb/dwc2/core_intr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index f8963c0cf6af..470458ac664b 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -532,7 +532,8 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) return; } if (dsts & DSTS_SUSPSTS) { - if (hsotg->hw_params.power_optimized) { + switch (hsotg->params.power_down) { + case DWC2_POWER_DOWN_PARAM_PARTIAL: ret = dwc2_enter_partial_power_down(hsotg); if (ret) { if (ret != -ENOTSUPP) @@ -541,21 +542,22 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) __func__); goto skip_power_saving; } - udelay(100); /* Ask phy to be suspended */ if (!IS_ERR_OR_NULL(hsotg->uphy)) usb_phy_set_suspend(hsotg->uphy, true); - } else if (hsotg->hw_params.hibernation) { + break; + case DWC2_POWER_DOWN_PARAM_HIBERNATION: ret = dwc2_enter_hibernation(hsotg, 0); if (ret && ret != -ENOTSUPP) dev_err(hsotg->dev, "%s: enter hibernation failed\n", __func__); - } else { + break; + case DWC2_POWER_DOWN_PARAM_NONE: /* - * If not hibernation nor partial power down are supported, + * If neither hibernation nor partial power down are supported, * clock gating is used to save power. */ dwc2_gadget_enter_clock_gating(hsotg); -- 2.25.1