Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2637890pxb; Tue, 13 Apr 2021 06:47:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykVp4CDa/JWc4D5yhjWWz2kqU6oNdL8OdR5v8W26vHlYaz3ZAR+KS+j2RPOiGoESNE8Pg5 X-Received: by 2002:a17:90a:5418:: with SMTP id z24mr85071pjh.189.1618321662137; Tue, 13 Apr 2021 06:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618321662; cv=none; d=google.com; s=arc-20160816; b=LBSL1+Cjd+Of2YvrLOcHqsQZaOEw77t/KdJ8zbC9YaG28OiINCFT2ATFt7mvQbmKmP 79xwyhMZAV5se/hImLqkv4fvlztwPtuaMcomgNZymuPVXs0QhM46XdKEZNan7NQ0Bm+l /aMcY87IVAHYmQ+Y/lJ+6kdpgLnSJipcEJ4UF7jVvFHlOftFQKqfUwyzJ7g9l9dDk/Eq Is9170nw7BI4kXMs9MN2aEUoRxHPlnsRizdtn7DZG6I0Io2344IleBocHtBPwFEG5o9f G9oEbNy0qwO5+aGb2fRhcfUC1AHsggAirXBowywQ6omFjxIGLIpo722yVQGuYuwtInOO O6yA== 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=POs+aRXrDv4MrI9+TGllrh1vAK4omkFwEUV2CYJolXM=; b=GwbYTA/8qW9YmArbWvpXG7WPQaMHoMYn6cqvW8XP8J2bkVAh89JcBes1B2TzLt6xQ4 7M6R2jzQp9V1J7jjqjkphU2vOBy87r2ZGGZx7hkpQxMHxa1jdWQ8xWIwVLHXFoTN/w4o riLgMvwrz4veRmi3gPibFhpHPvPX1fQfAFsbkcLUgBpdS13VMguHF71Kry5dUDz/BI7g bC6lDb4WBc5jPNXOeOTc6EiCsgVyp1rhFnav7NLDQkBEE26gp+WQh5Gntu3CtePSA76t Ijbt+HoqCILFd1v8S29t/l/kSbX0/6dMQz4/NtXYJ0h1k5xHVZMgYhbworZJFfwpLqR5 NDKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=NGQXHvEF; 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 r4si17334856pgg.126.2021.04.13.06.47.29; Tue, 13 Apr 2021 06:47:42 -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=NGQXHvEF; 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 S240409AbhDMHgq (ORCPT + 99 others); Tue, 13 Apr 2021 03:36:46 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:60516 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240362AbhDMHgp (ORCPT ); Tue, 13 Apr 2021 03:36:45 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (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 365BFC00BB; Tue, 13 Apr 2021 07:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618299386; bh=nj1BeKTbsJpmOWsKzyw4Q4Ak3JprmbRdIDgrwfON3Og=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=NGQXHvEFKJbMpDLaohQbK1OTrPRDGwOQLbjy7v6KYSZ0yRW3zovrwakuF9wlFCp5g gd9l6ynZmWMxCRIa5MYJORVw3Z1GG04ixg0mVjDPQXdPi/c270vrW9E6G9dOtVsjyJ +fMxGzHnlgQCdt1E/4S8OAkI4anrppldRV/BQ+6TBBqx686qGuslPIQnvfci6eXmej TFnF0FC/aPhKOad3k8Gzn+VwxoI2G5KbvwuG+VrdHujhJvUaIvTZnn9DBf9k1zj8w8 njJBqfUrXNjrJaf+Q6A8EdTjADIYZoUG1kBcSYcgXsE9Tfpx3acoRW1JY8XnPuJWFs YRY5j5CEUfGRA== 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 65355A022E; Tue, 13 Apr 2021 07:36:23 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Tue, 13 Apr 2021 11:36:22 +0400 Date: Tue, 13 Apr 2021 11:36:22 +0400 In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH v2 03/12] usb: dwc2: Allow entering clock gating from USB_SUSPEND interrupt 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: <20210413073623.65355A022E@mailhost.synopsys.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If core doesn't support hibernation or partial power down power saving options, power can still be saved using clock gating on all the clocks. - Added entering clock gating state from USB_SUSPEND interrupt. Signed-off-by: Artur Petrosyan Acked-by: Minas Harutyunyan --- drivers/usb/dwc2/core_intr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 8c0152b514be..ab7fe303c0f9 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -529,14 +529,18 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) /* Ask phy to be suspended */ if (!IS_ERR_OR_NULL(hsotg->uphy)) usb_phy_set_suspend(hsotg->uphy, true); - } - - if (hsotg->hw_params.hibernation) { + } else if (hsotg->hw_params.hibernation) { ret = dwc2_enter_hibernation(hsotg, 0); if (ret && ret != -ENOTSUPP) dev_err(hsotg->dev, "%s: enter hibernation failed\n", __func__); + } else { + /* + * If not hibernation nor partial power down are supported, + * clock gating is used to save power. + */ + dwc2_gadget_enter_clock_gating(hsotg); } skip_power_saving: /* -- 2.25.1