From patchwork Wed Mar 6 13:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10841133 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 212AF1803 for ; Wed, 6 Mar 2019 13:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BFA42D95F for ; Wed, 6 Mar 2019 13:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 005062D9DD; Wed, 6 Mar 2019 13:35:28 +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 A59842D95F for ; Wed, 6 Mar 2019 13:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbfCFNf2 (ORCPT ); Wed, 6 Mar 2019 08:35:28 -0500 Received: from mail-eopbgr40087.outbound.protection.outlook.com ([40.107.4.87]:48286 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726729AbfCFNf2 (ORCPT ); Wed, 6 Mar 2019 08:35:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RLl7MNzn+Tu9IEVuf5NuZMhF8/mZU8/fFB7rwF//5H0=; b=SrIi62wiia7Y0YR2b1oJZDYTALP0q8nNp/ck6oI+0VSLyoKBhPTdoDdl3wXEltn6/CaqDbCM4+N6XP7MLsJ7FfyN/LpxPIEp++3YZwNbjrAuVHD8+dYh2PdnFdfZZI61G+hdJSlwu4jGpphquEwf++oJU/ObIuILkjfsUqScTrU= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.92.158) by AM0PR04MB4770.eurprd04.prod.outlook.com (20.177.41.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.17; Wed, 6 Mar 2019 13:35:24 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::50ed:d1b5:c043:3b79]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::50ed:d1b5:c043:3b79%2]) with mapi id 15.20.1686.016; Wed, 6 Mar 2019 13:35:24 +0000 From: Aisheng Dong To: "linux-pm@vger.kernel.org" CC: "linux-arm-kernel@lists.infradead.org" , "dongas86@gmail.com" , dl-linux-imx , "rjw@rjwysocki.net" , "ulf.hansson@linaro.org" , "khilman@kernel.org" , Aisheng Dong Subject: [PATCH 2/2] PM / Domains: Choose the deepest state to enter if no devices using it Thread-Topic: [PATCH 2/2] PM / Domains: Choose the deepest state to enter if no devices using it Thread-Index: AQHU1CFzg5FXML1TukGlKs0Suxgc6Q== Date: Wed, 6 Mar 2019 13:35:23 +0000 Message-ID: <1551878926-8455-3-git-send-email-aisheng.dong@nxp.com> References: <1551878926-8455-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1551878926-8455-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR04CA0052.apcprd04.prod.outlook.com (2603:1096:202:14::20) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:5b::30) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bab064f8-8be9-4fd4-983c-08d6a23895c3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB4770; x-ms-traffictypediagnostic: AM0PR04MB4770: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BAM0PR04MB4770=3B23=3ABg?= =?iso-8859-1?q?ujCGlqYc+Hx7vmfGIMdqc+FRr9wuJSuHDbLAZ7/qFWbYjRBSwbrZah9YcQOC?= =?iso-8859-1?q?LkuvdfEwL/43SXaKx0bNeQPPeaNT3+xHZFojyGBTYbLdf6CCGgN4eqpRo7WD?= =?iso-8859-1?q?16QXI67Ii8cTDkS9oPo9HHmGoQJuTPprtYOM+zJz8VoTd62zECgHVOeZZedy?= =?iso-8859-1?q?K2fWT10uGMjTyCbJGBIvO9RJokmuIrRyjgsZHvtQ1/W8QlA79BzjS1c1HJQy?= =?iso-8859-1?q?k4iXgvmBh9gr8lp0yM6w9+bOzl2TFQpnsTbfKB82HrC5ZIFH8+VaGV0z+XnF?= =?iso-8859-1?q?wf1FxTxal4On84fdvT8uHmjnSkc/NzCULysnhvRRupt9HU9Dz1Nn7e8wFp3K?= =?iso-8859-1?q?WCjTPXssVi+5gDmZSXZ70K7WBZ/jailPvtN4/LXUTE9vFll+KvEKe9T4b8r/?= =?iso-8859-1?q?2atQUiQ9CEBQ4HFBC1a9vSqEyH2vGVLv+Qa9RnXnoQg1vikMJCl7ndGZoQBD?= =?iso-8859-1?q?zHfgWPC2vh9ZeTi6bPOMi8WWaXx9D7rLx6u8hzVmAfdybrrZWxKC66VPxlyy?= =?iso-8859-1?q?ZfdOY2DGXlPPRAY/P2iI0jEU6T974CLqrdBxunDUnGLI8WtB95sQ689jrYhg?= =?iso-8859-1?q?sL9D0rafVxt+qvAV1ZQKotOB2H+LDqshl5ybGIK3gMAU9zpJPQohBTupSmD1?= =?iso-8859-1?q?rE19xbEj1CWpYM/jG5wDpImKIyrBOT4MGACaMWgawVW8f7qcSepu8KSBwmq6?= =?iso-8859-1?q?5R6nE6oGdfO49i8nj6JPJzFEHmrSeR6qnoW65kYtu2A1dgMClwFbDubvtI+b?= =?iso-8859-1?q?VpwFzbH2h6ftYD/cnrMcfBXRbbBap6TObS4x56kyBBraBdPTvjS52JfzdFQm?= =?iso-8859-1?q?wx2TV9UyMOQSr0ILve1bG2qQLrgoBtdEXDkNI7cuOIAo0MGk5bY9Q2W7ocCR?= =?iso-8859-1?q?ydEHps/gJICw9NQL0Nso329VSPJWTCRO4woxph7j/b8UnRrT4e7yN6fB5uRb?= =?iso-8859-1?q?PFC446PVIHkrO4o0MtSov9Vn8AXN9qGzqAo+I2UrFDcC/5RXyrY6z+glGoQE?= =?iso-8859-1?q?bVPhXHbN7pkJFHuYOnKj9NPWGRIi3JA5gZnG58LsH51Cs5r//JoTIwMgSyp0?= =?iso-8859-1?q?1wWn5Y/2qchnxzyWUI2JX0G7TxOekjfqHg/R6p3vEH6bFA+Shv5o7XC4VzJ4?= =?iso-8859-1?q?M35HLYasmQb48x0p+IuiVQNP53Gw/hr5sN7Iba0lMmcom2I5gMCPzYmYv4yI?= =?iso-8859-1?q?fNXbk2XO2yMHD8Gqf5FTY1xGnIuV6YCe8U7xBtkCiolLvA49ZNzIJfE4+mG7?= =?iso-8859-1?q?U4+NrNXB0HN37X1ZaWQ5A4A1BUGA4X3QqPhjH+xh7KdEExxx8otaiQ68HG0p?= =?iso-8859-1?q?8=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(366004)(39860400002)(136003)(346002)(199004)(189003)(68736007)(186003)(102836004)(26005)(11346002)(105586002)(8676002)(486006)(81166006)(81156014)(106356001)(446003)(53936002)(86362001)(36756003)(97736004)(7736002)(2616005)(2351001)(6506007)(386003)(305945005)(476003)(6916009)(316002)(4326008)(6512007)(44832011)(256004)(4744005)(5640700003)(71190400001)(8936002)(71200400001)(25786009)(2906002)(14454004)(52116002)(6436002)(6116002)(5660300002)(50226002)(478600001)(76176011)(99286004)(6486002)(2501003)(54906003)(66066001)(3846002)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4770;H:AM0PR04MB4211.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: fIDujf/C2WJpZ8b3gn74KWyKm8Xw9HCLU95fmOHNLVu+IaeyiBEdX65pwQ6gHjPp3gaUPE8rt30TUYxLSQ/l+PxZgQVwkyPf/K7FRgEX37i1nwvZgk4S7hYCA/CXfEA03DnHE40VbkyH8Inrj9EbvjBD/HKk0bG0O+zq5M4CjOnVT7Aeqz53A7Ad4CcNij5mVP8+RuwIxYYK9vH26nNYX5I0W6uaeM++xfxKhFvGaw5lEVuGc34LTJNvHn+1Kzqc8sy3zYX30Bac5zwJNfBFl0AWrOMMsYztAL7a3kYpuPIG7JoEf2wnC3V+hTJohpBecpKg5OU+NA4WAgHFvRJktFfiPckSPjXca3RMT9wLPQrBElBXlhjX5w6uidr6rKMKqLjwpoZgHQgUT9XN+4aYgj3WD4KZtwOfDrsHaVYGnBU= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bab064f8-8be9-4fd4-983c-08d6a23895c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 13:35:24.0380 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4770 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For a domain has no working devices anymore, let's choose the deepest state to enter to save power. e.g. driver probe failure. Signed-off-by: Dong Aisheng --- drivers/base/power/domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 847a69e..d3f57c2 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -550,6 +550,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, if (!genpd->gov) genpd->state_idx = 0; + /* Choose the deepest state if no devices using this domain */ + if (!genpd->device_count) + genpd->state_idx = genpd->state_count - 1; + /* * If sd_count > 0 at this point, one of the subdomains hasn't * managed to call genpd_power_on() for the master yet after