From patchwork Tue Apr 13 07:17:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 12199509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A82DC433ED for ; Tue, 13 Apr 2021 07:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DE6A613B7 for ; Tue, 13 Apr 2021 07:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238711AbhDMHRw (ORCPT ); Tue, 13 Apr 2021 03:17:52 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:35748 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237947AbhDMHRr (ORCPT ); Tue, 13 Apr 2021 03:17:47 -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 79E8A4023B; Tue, 13 Apr 2021 07:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1618298248; bh=BG5GUDIVsA46ColugDQj9igzqclrdp639hYIXtnRcYc=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=TaYFRSk3LjW/r8iv8qzjLtB/wEt1a1K/78mScHkt9GzR2dry7fpmiJrlGYo/P2ZuL 4DUYO75RYOuaqhwFd1Y1TuWLhazU2Qeija4Z8P5tsmKfdflJiZJrw2J7sttbAIDUOl L0hIy7Yh0fVTmpWBjCqYzEOTcyoaB8vODJjCTMxuXBWw9LOCJnt3hLrKDKPEtc6i2A FQtERUWaVTLgL933Jqa9GW3cVICVEpAbbDqBPKhgL6CDKYQ4m15BN5W0MpGvp/ou6m g/f1UB6Lm4DKUilLHkfh5oqCP8GsAR17u+zksNWG7IjJGgzXR3HdX7k1/fzz9GpKG5 DzdnJT/GWqUBA== 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 C4AC8A0094; Tue, 13 Apr 2021 07:17:25 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Tue, 13 Apr 2021 11:17:24 +0400 Date: Tue, 13 Apr 2021 11:17:24 +0400 Message-Id: <98bafb89c2693eb83a17a16cfa31380223c59b06.1618297800.git.Arthur.Petrosyan@synopsys.com> In-Reply-To: References: X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH 10/12] usb: dwc2: Add clock gating entering flow by system suspend To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Youn , Artur Petrosyan Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If not hibernation nor partial power down are supported, clock gating is used to save power. Adds a new flow of entering clock gating when PC is suspended. Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 31d6a1b87228..09dcd37b9ef8 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4372,6 +4372,15 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) break; case DWC2_POWER_DOWN_PARAM_HIBERNATION: case DWC2_POWER_DOWN_PARAM_NONE: + /* + * If not hibernation nor partial power down are supported, + * clock gating is used to save power. + */ + dwc2_host_enter_clock_gating(hsotg); + + /* After entering suspend, hardware is not accessible */ + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + break; default: goto skip_power_saving; }