From patchwork Wed Oct 10 21:20:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju P L S S S N X-Patchwork-Id: 148584 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1352748lji; Wed, 10 Oct 2018 14:21:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV63NMUUrG1Nfr4/RzDcy7LxA8o9e9sCV8K7KfNbwhxNVjOL8a43BDb71BmdzXjUPwy5dcP34 X-Received: by 2002:a17:902:103:: with SMTP id 3-v6mr34480937plb.58.1539206496448; Wed, 10 Oct 2018 14:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539206496; cv=none; d=google.com; s=arc-20160816; b=amjvoNuHwd/z93/e4xtdTNE3GqjslHF1ruJ09XyzUpSWkTNxKUEPiD5dlmnOvt2pg0 eGFBQN8LoPSWCMdZKGlP+I11e1asJIVgDjfkesQjfyjfuQfk77MH8BWQ4AGigg4HLsSl rNM5CphwVGpTyaKjub37JuBUKRghCyxl1Q7HeWdCHxtERkdRHMURQrXB+L+OavkcjTyu is3k1fCYNc/UxfshPQ9PvNXgbpsdF9+lz2FWEhRDrFyNQxa+GcdWYmaagnN8gVQolshV hXdMsDCJiC8cH0rtPq/nDLfE+oFALuiL4k9GD2KKrH7xuGxFNMwsXyn4z9fk/oK7Qu7c CK8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=n8pj1hQfz8Ebcphf72EYBeoiqVlaDy3yQqqlBZzex7M=; b=RK3/qoWfkVIqMj4zfED0vgCektG7nF8Jokv4ZeLc2O65EaTGq+k5ut5flnQYoERIIG ant76hUsCJijINQ0G78UCFy9PQHlomG0dkqSFeiP1OCmppsvYC2nlrJcrv0pf/4zUhXv X861pgdPgrAlTG3pJj9lb92P7Wst/bu5LywDFoXEe+K5zAxGyTqMuMNPwMpJqGHad7Uw gv2C6J8FbHryzvsGdYUXsRJsP44IkiLcbvCM0Nzjq+wHg0H/0umB8PMsc1Rwu5po4Dxm Z4cUfo8vVX9LfxbVdPszjD2wkRCOR75siUmjm6XGHNK+VOttKjCnkSkNqDG33oWUGC1l vNbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hNMwJtCm; dkim=pass header.i=@codeaurora.org header.s=default header.b=PXSjiaZn; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si17417674pfi.184.2018.10.10.14.21.36; Wed, 10 Oct 2018 14:21:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hNMwJtCm; dkim=pass header.i=@codeaurora.org header.s=default header.b=PXSjiaZn; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726126AbeJKEpe (ORCPT + 13 others); Thu, 11 Oct 2018 00:45:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37964 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbeJKEpe (ORCPT ); Thu, 11 Oct 2018 00:45:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B0AC760C7D; Wed, 10 Oct 2018 21:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206494; bh=0lhzS25MklLZZhZMk9kpgz6k/DU9SoDNv2mDTJSstZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNMwJtCmEJcUNt3bqiAWxA1FBr/TRO+oQBi+e1EnrEYgTGIGagurwBPiKVI8Lmtgc fs7sI68S37HamyjZ/Vr+cPNNiFkQoc7DdZrgwuhIg36lTBpemvQhBsIzJCJ4W9Vtyx 5Wl0RwEaqkMQ9c7Y3DPAJoxXII6NdWVnejBT8WSs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID, DKIM_SIGNED, FROM_LOCAL_NOVOWEL autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6FFD2601A8; Wed, 10 Oct 2018 21:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539206492; bh=0lhzS25MklLZZhZMk9kpgz6k/DU9SoDNv2mDTJSstZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXSjiaZn50nT3CCY3AVL28DHlfMzKeiAmk1xrc2iwXEVlYGJjDT2JR3jd+vCLm5bb oejVBq5y4+0GlcWVRKgJDBEFSlush87+TdD2+o++QppzAMixL4sfnfqzxKw76TXKZy ap2AoqPr/ny6qcs8HR9TLse1z5HCxwTR3mFsb5H0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6FFD2601A8 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rplsssn@codeaurora.org From: "Raju P.L.S.S.S.N" To: andy.gross@linaro.org, david.brown@linaro.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH RFC v1 2/8] kernel/cpu_pm: Manage runtime PM in the idle path for CPUs Date: Thu, 11 Oct 2018 02:50:49 +0530 Message-Id: <1539206455-29342-3-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> References: <1539206455-29342-1-git-send-email-rplsssn@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Ulf Hansson To allow CPUs being power managed by PM domains, let's deploy support for runtime PM for the CPU's corresponding struct device. More precisely, at the point when the CPU is about to enter an idle state, decrease the runtime PM usage count for its corresponding struct device, via calling pm_runtime_put_sync_suspend(). Then, at the point when the CPU resumes from idle, let's increase the runtime PM usage count, via calling pm_runtime_get_sync(). Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Signed-off-by: Raju P.L.S.S.S.N (am from https://patchwork.kernel.org/patch/10478153/) --- kernel/cpu_pm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation. diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c index 67b02e1..492d4a8 100644 --- a/kernel/cpu_pm.c +++ b/kernel/cpu_pm.c @@ -16,9 +16,11 @@ */ #include +#include #include #include #include +#include #include #include @@ -91,6 +93,7 @@ int cpu_pm_enter(void) { int nr_calls; int ret = 0; + struct device *dev = get_cpu_device(smp_processor_id()); ret = cpu_pm_notify(CPU_PM_ENTER, -1, &nr_calls); if (ret) @@ -100,6 +103,9 @@ int cpu_pm_enter(void) */ cpu_pm_notify(CPU_PM_ENTER_FAILED, nr_calls - 1, NULL); + if (!ret && dev && dev->pm_domain) + pm_runtime_put_sync_suspend(dev); + return ret; } EXPORT_SYMBOL_GPL(cpu_pm_enter); @@ -118,6 +124,11 @@ int cpu_pm_enter(void) */ int cpu_pm_exit(void) { + struct device *dev = get_cpu_device(smp_processor_id()); + + if (dev && dev->pm_domain) + pm_runtime_get_sync(dev); + return cpu_pm_notify(CPU_PM_EXIT, -1, NULL); } EXPORT_SYMBOL_GPL(cpu_pm_exit);