From patchwork Fri Apr 19 11:24:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 10909535 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 A09FA1515 for ; Fri, 19 Apr 2019 18:53:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 960B828DFC for ; Fri, 19 Apr 2019 18:53:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89E6328DFB; Fri, 19 Apr 2019 18:53:17 +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 0F03C28DF9 for ; Fri, 19 Apr 2019 18:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728522AbfDSSxO (ORCPT ); Fri, 19 Apr 2019 14:53:14 -0400 Received: from dc2-smtprelay2.synopsys.com ([198.182.61.142]:37874 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727526AbfDSSxN (ORCPT ); Fri, 19 Apr 2019 14:53:13 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.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 8E368C0BBB; Fri, 19 Apr 2019 11:24:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1555673090; bh=CZz1oOjo2ubLfuhbH7HzE1RDYKomNQTzI3bDoDGt+nw=; h=From:To:CC:Subject:Date:References:In-Reply-To:From; b=gAoDBdxBkX9AF78ZTzBLF8fgyATSItqT3drSVxrfuetjZIcsmWqC7rJJiRp8tXsDL kV5QHgl8n2+4+XFlzEmGNBmplvel6kKjg6uRY02kJdOJW0+kiFxHct4MuR1JUDIX5x Wvg/nWsVmW3y2pdA/klWe7eyuUfE+0z4XNY2f6lmS2FFQuxIkoNtxVq5TBF4b65Yuu wSSIrVsmBtfNmhHujP2aVp1UvDhpGK/cKIegOu7zphFYCOhnSNmJCHRnfxtY62fNUa O50I0m9n3LtIH1DXOWRUEPxNWz8cYqqpVczObX8RZT6iNdcXqvC85L4W9hGhCbI0Xc 1AzQxeQ7MQWJw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 9A74AA005D; Fri, 19 Apr 2019 11:24:51 +0000 (UTC) Received: from US01HYBRID2.internal.synopsys.com (10.15.246.24) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 19 Apr 2019 04:24:51 -0700 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (10.13.134.195) by mrs.synopsys.com (10.15.246.24) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 19 Apr 2019 04:24:51 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.onmicrosoft.com; s=selector1-synopsys-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CZz1oOjo2ubLfuhbH7HzE1RDYKomNQTzI3bDoDGt+nw=; b=rYCwGxf/jtFWRmgwoBHPRAxx+bmIL+2GMNmlsOS6ucq/+KxZ3DYTy/c+8GcpkZFvvlrUlitX+DIAUrRy8UBl0f6mBReSTWBwA6jaEivmNJct063Kh//gC0vIn0WvHLq60irs80cSTeDA8+h5B9vahW8dyJsRLzJtviPcxRsOaUk= Received: from SN1PR12MB2431.namprd12.prod.outlook.com (52.132.195.146) by SN1PR12MB2383.namprd12.prod.outlook.com (52.132.194.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.14; Fri, 19 Apr 2019 11:24:49 +0000 Received: from SN1PR12MB2431.namprd12.prod.outlook.com ([fe80::5ca6:ee5f:1147:df5a]) by SN1PR12MB2431.namprd12.prod.outlook.com ([fe80::5ca6:ee5f:1147:df5a%4]) with mapi id 15.20.1813.013; Fri, 19 Apr 2019 11:24:49 +0000 From: Artur Petrosyan To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , "linux-usb@vger.kernel.org" CC: John Youn , Artur Petrosyan Subject: [PATCH v1 08/14] usb: dwc2: Add default param to control power optimization. Thread-Topic: [PATCH v1 08/14] usb: dwc2: Add default param to control power optimization. Thread-Index: AQHU9qJ/tHbivSmPyUKJBC/Mf5HbVQ== Date: Fri, 19 Apr 2019 11:24:48 +0000 Message-ID: <15bba89b920e29e27de4cfaac546834fba5d1a76.1555672441.git.arturp@synopsys.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR10CA0107.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::36) To SN1PR12MB2431.namprd12.prod.outlook.com (2603:10b6:802:27::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=arturp@synopsys.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [84.53.141.189] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1481e60a-d3b2-4233-2d9b-08d6c4b9a140 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:SN1PR12MB2383; x-ms-traffictypediagnostic: SN1PR12MB2383: x-microsoft-antispam-prvs: x-forefront-prvs: 0012E6D357 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(39850400004)(346002)(136003)(366004)(199004)(189003)(110136005)(316002)(2616005)(54906003)(68736007)(99286004)(478600001)(8936002)(2501003)(64756008)(52116002)(73956011)(66946007)(118296001)(66446008)(3846002)(6116002)(66066001)(8676002)(36756003)(14454004)(386003)(186003)(305945005)(2906002)(4326008)(102836004)(6436002)(26005)(486006)(256004)(25786009)(53936002)(14444005)(476003)(71200400001)(71190400001)(6512007)(86362001)(107886003)(5660300002)(97736004)(81156014)(446003)(76176011)(6506007)(7736002)(6486002)(11346002)(66476007)(66556008)(81166006);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR12MB2383;H:SN1PR12MB2431.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: synopsys.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: zMOjqsEI1JxzOahOJk9PUTn3/YsmcelWoBjjDmYedWGheGx5BHQzSp5UDi3iJ4BVjEC+e1vZI02Z4c+6NAPd0FwPCD2a4O3uK2IgOGJINpf8+9YM1t/Z198hrMpXkPkFQi+sfNTSnXqJgcw3G9mE/iBLFLfX5cer4U4RHXU2Q6cnWVe7z1NQ3mLSdprBo5HYTd9C53gzru6WQh1SCj+u6leGJcfXncKbJA6CG8ypiY8uqTbQwK+JWoTEFE75cyQ1ENE+AYlb8xDzAUDtq8FVeeTMGvq31Sd6OGIbiLUlGexB+leWeck6eg9/lw9A5kEt5Bj6CD7VgKhvFvWjkBzdASnvJJZBas9DDL9OLwCAiIZCPAVLsyHOQXvsV2OB6hLuPnJpbayemUX9FgWZA1NDLcfhcFkdcC79TE0CRhO2frE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1481e60a-d3b2-4233-2d9b-08d6c4b9a140 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2019 11:24:48.8467 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 X-OriginatorOrg: synopsys.com 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 - Added a default param "power_saving" to enable or disable hibernation or partial power down features. - Printed hibernation param in hw_params_show and power_saving param in params_show. Signed-off-by: Artur Petrosyan Signed-off-by: Minas Harutyunyan --- drivers/usb/dwc2/core.h | 3 +++ drivers/usb/dwc2/debugfs.c | 2 ++ drivers/usb/dwc2/params.c | 19 +++++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 30bab8463c96..9221933ab64e 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -373,6 +373,8 @@ enum dwc2_ep0_state { * case. * 0 - No (default) * 1 - Yes + * @power_saving: Specifies if power saving is enabled or not. If it is + * enabled power_down functionality will be enabled. * @power_down: Specifies whether the controller support power_down. * If power_down is enabled, the controller will enter * power_down in both peripheral and host mode when @@ -469,6 +471,7 @@ struct dwc2_core_params { bool uframe_sched; bool external_id_pin_ctl; + unsigned int power_saving:1; int power_down; #define DWC2_POWER_DOWN_PARAM_NONE 0 #define DWC2_POWER_DOWN_PARAM_PARTIAL 1 diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index 7f62f4cdc265..8b27cf0b682b 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -695,6 +695,7 @@ static int params_show(struct seq_file *seq, void *v) print_param_hex(seq, p, ahbcfg); print_param(seq, p, uframe_sched); print_param(seq, p, external_id_pin_ctl); + print_param(seq, p, power_saving); print_param(seq, p, power_down); print_param(seq, p, lpm); print_param(seq, p, lpm_clock_gating); @@ -746,6 +747,7 @@ static int hw_params_show(struct seq_file *seq, void *v) print_param(seq, hw, num_dev_perio_in_ep); print_param(seq, hw, total_fifo_size); print_param(seq, hw, power_optimized); + print_param(seq, hw, hibernation); print_param(seq, hw, utmi_phy_data_width); print_param_hex(seq, hw, snpsid); print_param_hex(seq, hw, dev_ep_dirs); diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 24ff5f21cb25..d7cc336aa1b7 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -263,12 +263,18 @@ static void dwc2_set_param_power_down(struct dwc2_hsotg *hsotg) { int val; - if (hsotg->hw_params.hibernation) - val = 2; - else if (hsotg->hw_params.power_optimized) - val = 1; - else - val = 0; + if (!hsotg->params.power_saving) { + val = DWC2_POWER_DOWN_PARAM_NONE; + dev_dbg(hsotg->dev, "%s: Power saving is disabled.\n", + __func__); + } else { + if (hsotg->hw_params.hibernation) + val = DWC2_POWER_DOWN_PARAM_HIBERNATION; + else if (hsotg->hw_params.power_optimized) + val = DWC2_POWER_DOWN_PARAM_PARTIAL; + else + val = DWC2_POWER_DOWN_PARAM_NONE; + } hsotg->params.power_down = val; } @@ -290,6 +296,7 @@ static void dwc2_set_default_params(struct dwc2_hsotg *hsotg) dwc2_set_param_phy_type(hsotg); dwc2_set_param_speed(hsotg); dwc2_set_param_phy_utmi_width(hsotg); + p->power_saving = true; dwc2_set_param_power_down(hsotg); p->phy_ulpi_ddr = false; p->phy_ulpi_ext_vbus = false;