From patchwork Wed Mar 6 13:35:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10841131 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 377AC1669 for ; Wed, 6 Mar 2019 13:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 236F72D95F for ; Wed, 6 Mar 2019 13:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1787F2D9DD; Wed, 6 Mar 2019 13:35:25 +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 9311A2D95F for ; Wed, 6 Mar 2019 13:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbfCFNfY (ORCPT ); Wed, 6 Mar 2019 08:35:24 -0500 Received: from mail-eopbgr40070.outbound.protection.outlook.com ([40.107.4.70]:40514 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726962AbfCFNfX (ORCPT ); Wed, 6 Mar 2019 08:35:23 -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=pLe3trH4VW4zsYoRI2e0cOJ3j63s8S7vS3olX/RwCLI=; b=MKQHRGgFwRsZwH6pN+hHj41jMYoSeJ6Wj+FhDa2zdA06jPgJ1RRYBhbwBqTVIUJGVik7EjF1qZqX2jrNkB4qXGdRaexWXvf42ItCh9haG1l6UaxlPFahdPzMTLwgpNYDJeiWF41VTX4D+6qOBkQZsewinGvxKkyFMWS+uyjAQ4M= 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:20 +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:20 +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 1/2] PM / Domains: Support enter deepest state for multiple states domains Thread-Topic: [PATCH 1/2] PM / Domains: Support enter deepest state for multiple states domains Thread-Index: AQHU1CFx3mZA+LLWq0ehzswGR+73hA== Date: Wed, 6 Mar 2019 13:35:20 +0000 Message-ID: <1551878926-8455-2-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: b568d619-ab6b-44b0-0b21-08d6a238939e 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=3Ax/?= =?iso-8859-1?q?0AgGK4Qwjyv88PTfG5epG3hukiuYDmXSuZyV40q0Dfu44u+moQkjq5aXrmqm?= =?iso-8859-1?q?6oHxCOS4jKriDlEiAyOmZFZLHq9Aar3Ig2DJyim/4C761VLmUOv/QnjOD0GJ?= =?iso-8859-1?q?KqeYxrtZ4jfx3iOMK/tTnUxKqqOd/3vzL3mK6H6yuGrw0nRhgA/R3dIsTFw7?= =?iso-8859-1?q?vDpLLmb0voD8dvAI++va+/kWKoow6WwG3CkLWcWFIo6vZficgMUEwEandrp7?= =?iso-8859-1?q?tcCHfR6SoCOX6Ku7rtsvn/JYh9f8nt17NatWZT9SB7ni2rklT69IiATFPKTP?= =?iso-8859-1?q?DwXCbZk4zIf0GwieUuncU54ynKujA5p+aA2Dt7SXJBVyLL4kvNPmLB3KMrUV?= =?iso-8859-1?q?MYpa/XRuHuIgLug/CyVdjVJHDtT1RPu4yAczghQambpSqvml+TPNTdokau/1?= =?iso-8859-1?q?mIx1cULT7MjRv/Vf6sqZXla9D2Yb1R8dQ07qGcVJYSAqdOExqzWX37ANlqI7?= =?iso-8859-1?q?UXe3xbAedv6dYnqkG4/5nwLwzU33SED3/pU1EXTbpBM/05agiVclQl5bX73l?= =?iso-8859-1?q?AzSF9JO+9YuehxcQXegFMeD32ymHd/Bc8KNTWHRx0Vslme0ZwYMCUeMtHREJ?= =?iso-8859-1?q?b/D2M3z5tg5UZ1smnAQLCwLS1l1beN8uQgFh3NPICqzmp6UeNC5Rv+eCE0ur?= =?iso-8859-1?q?dmIgWELpjrXw2CdQ74thM4BTjntfr5L0DFENVecTMrPcIDbKdOfaxYhkzQFO?= =?iso-8859-1?q?9JsLbL0dAdg97un8O/YEEUas2pdLQLHeY2X3R5uxCzBePz4Euws+SXz/vPqR?= =?iso-8859-1?q?OM89jm4yyjup8lvKyyE42ikGJu7Je8GRk1RMl7dvpufmNC/tJSaRQ8Xj+rJb?= =?iso-8859-1?q?sk/4Wv9ND30tkPaRk3btWu35IxT9K09tB/69RiDsLmRzVBxhkLFoly/mbBz8?= =?iso-8859-1?q?Sb0a041kQ0OqIToT/uA7HGJbMi5kf2zudKjERDHAliyn+qs8/ibt4DoM/rWp?= =?iso-8859-1?q?3/cXAmKSahmvg4kgYyYw+EvRsjlyhr3OgfIwRifhP8/q98nMK5DNYASfDv/C?= =?iso-8859-1?q?PMagrwBQbuEF20MarwWwIYPUX1ipHU5SkdOPVW936H13Ssem7l2yQNG1//2c?= =?iso-8859-1?q?w7iIyGuEZNaLhJHkGBSgTrLTZi8otQmqQuI0tXbn/QtV01yoYVmyADGDggfq?= =?iso-8859-1?q?sZkK4ajo/gq+9zTVdNOKbOmj6nQVDJ9cHaDl+QsfXn4fSg8SPBFuEksDZ8BI?= =?iso-8859-1?q?u9yvBfg8iIZgUafEfXOvkt9beoq2qcoSIxDECdTJS3l1b4aFpPVAHGrWpWi+?= =?iso-8859-1?q?hzfc/2Zd/4MMTkXK7fUJ0pjbVKJMnMYsN96/F4JQ=3D=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)(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: Rh93CNApztYrMJ/hhqEmD2GRU2NVollDoczjmdKxUaPnVDmYE1uKYkypY/Z2LbFJUJsn+DLZKy8pjVfRfyBBxhZP2079LK4gLkNPGUzXXP6qAjAiehAVP0e4g3ddR5NKV17PKeCJiYWj/aB9sx97R4vrmu8LDesI6re6MfmUHZANCX7vtFFcO+YTDoX7p+mtwTAdcGtS/Ocy8OIWgE95CaxgnkrpuiF9Tqb6l7KhiPm/wVo6AFaBjUnWj8VWgtsycvNjaUy/UozzG9Mv/SMn1X8Ke+Plm023VJOkAi5cqDHpEch3IUY093lTZslGmKXCDfcDHdTuiMeJ+EFaSmJayGpXKyIaPOcq542+vYwmYloa81crgXOFIhAp0M0UtjJbDcBQOKoBCi4DrXtcAaRknuhlywK0AZBB3Mw0MtOY9Vk= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b568d619-ab6b-44b0-0b21-08d6a238939e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 13:35:20.0171 (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 Currently the generic power domain will power off the domain if all devices in it have been stopped during system suspend. It is done by checking if the domain is active in genpd_sync_power_off, then disable it. However, for power domains supporting multiple low power states, it may have already entered an intermediate low power state by runtime PM before system suspend and the status is already GPD_STATE_POWER_OFF which results in then the power domain stay at an intermediate low power state during system suspend. Then genpd_sync_power_off will keep it at the low power state instead of completely gate off it. Let's give the power domain a chance to switch to the deepest state in case it's already off but in an intermediate low power state. Signed-off-by: Dong Aisheng --- drivers/base/power/domain.c | 18 +++++++++++++++++- include/linux/pm_domain.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 61cd500..847a69e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -959,7 +959,17 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, { struct gpd_link *link; - if (!genpd_status_on(genpd) || genpd_is_always_on(genpd)) + /* + * Give the power domain a chance to switch to the deepest state in + * case it's already off but in an intermediate low power state. + */ + genpd->state_idx_saved = genpd->state_idx; + + if (genpd_is_always_on(genpd)) + return; + + if (!genpd_status_on(genpd) && + genpd->state_idx == (genpd->state_count - 1)) return; if (genpd->suspended_count != genpd->device_count) @@ -970,6 +980,9 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, if (_genpd_power_off(genpd, false)) return; + if (genpd->status == GPD_STATE_POWER_OFF) + return; + genpd->status = GPD_STATE_POWER_OFF; list_for_each_entry(link, &genpd->slave_links, slave_node) { @@ -1017,6 +1030,9 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock, _genpd_power_on(genpd, false); + /* restore save power domain state after resume */ + genpd->state_idx = genpd->state_idx_saved; + genpd->status = GPD_STATE_ACTIVE; } diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 1ed5874..95db21f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -124,6 +124,7 @@ struct generic_pm_domain { }; }; + unsigned int state_idx_saved; /* saved power state for recovery after system suspend/resume */ }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 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