From patchwork Thu Sep 20 13:49:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10607805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0ED89157B for ; Thu, 20 Sep 2018 13:49:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F33CD2D78F for ; Thu, 20 Sep 2018 13:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E65A72D7C3; Thu, 20 Sep 2018 13:49:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8227B2D78F for ; Thu, 20 Sep 2018 13:49:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732302AbeITTdU (ORCPT ); Thu, 20 Sep 2018 15:33:20 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:40914 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbeITTdU (ORCPT ); Thu, 20 Sep 2018 15:33:20 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 6E22124E13D6; Thu, 20 Sep 2018 06:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1537451385; bh=PASe7hdOv0atv5RQchPDqhe6Fz0As4b+XMUhDOz2w2A=; h=Date:In-Reply-To:References:From:Subject:To:CC:From; b=Mne8Gngiusns+txpenfnJD55mpDEOeYDJRwINMI5ragUIHArhsthTORRHOGdITsl5 G8k3x+vE2Z+8tk2OR07rgS0W6zN0ELFPX0fYb7iSamQ5ifWX6QWwOoMg3YMsJDTenT aihR6l+ZIbW24eBA4LynEUr6W1v/7WsHnojtOtqbv5azDHZSP83XjQecsBDcN+TWkm HXxGyg/ElrW9nPmknwK6gmWv2jZmH8LpFB5IVdu2g46QSf6+ODSSvzcwQVrgkyy4ZM amad9DIPmXRbdMOcI0+fughnGNyufybkZTdFry/OXiTVwiUKHG/UipNty+13j4RXwv DQ3XsfoLpGeBg== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 5821057B9; Thu, 20 Sep 2018 06:49:45 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (10.15.84.232) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 20 Sep 2018 06:49:44 -0700 Received: from arturp-ubuntu (10.13.184.20) by US01WEHTC3.internal.synopsys.com (10.15.84.231) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 20 Sep 2018 06:49:43 -0700 Received: by arturp-ubuntu (sSMTP sendmail emulation); Thu, 20 Sep 2018 09:49:39 -0400 Date: Thu, 20 Sep 2018 09:49:39 -0400 Message-ID: <6016d1185adc9c939cabafbc8e6922063e0552c8.1537451080.git.arturp@synopsys.com> In-Reply-To: References: From: Artur Petrosyan Subject: [PATCH 2/3] usb: dwc2: Update dwc2_handle_usb_suspend_intr function. To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , CC: John Youn , Artur Petrosyan MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/usb/dwc2/core_intr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 19ae2595f1c3..3602aca3316b 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -498,14 +498,15 @@ 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) dev_err(hsotg->dev, "%s: enter partial_power_down failed\n", __func__); - goto skip_power_saving; + break; } udelay(100); @@ -513,16 +514,16 @@ 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) { + 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__); + break; } -skip_power_saving: + /* * Change to L2 (suspend) state before releasing * spinlock