From patchwork Wed Oct 11 07:24:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 115512 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp437755qgn; Wed, 11 Oct 2017 00:24:50 -0700 (PDT) X-Received: by 10.84.229.143 with SMTP id c15mr7580017plk.389.1507706690414; Wed, 11 Oct 2017 00:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507706690; cv=none; d=google.com; s=arc-20160816; b=YpPm0ZoA7QY4Ns1DGXJlSE3gC0NW6LKnkwWLXpcLXh1RPdW1ZXel+dXsR7S99gXS68 K1OrixwcsMb5DS6KL8pU+dr9cXAxt0CCBT31aIaoeR5a6vBdHPYSZVw7XPN9ybP60wH2 pD2q7NzPT4/5UEU5bhZPJbVO8ppdGhHmLU/SifD6smm0msiZtEVNed3fShotB7+Mv6Hp Z6riHAg54dTdEcQ2ZOZwK2H8OD10m0AbpTP6hHsK2VUOHk4aWOfP8KON05l59lmdLquR npjxvVl6m2u2jTtlSwQvh8j11bfV5A6OtQHinKw73allmF3XJ91oSYLKxEGhomz32Gjt GEhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=BJdq1uaehAOr4NGD8vdiwJEZTC56U0YZ4SLjahCqkHY=; b=Y9us+hcPtjUuL9oEQT+crM8ZMJkpr1dYy3RhYbN4rCMy+6bIeocdzA7H/wA0jE9F5w utLVrLpEbP4GM1DJHLWwEDWMQkAkIOmkkJuRIqTLM3/kLuudxLh5vUfgTYLHRGPF2YCa HPpWgQrv1o//0BhgUdchyXEoiP7XYyHDb4kpq8pjC9MXfxX7K5vlrt1l94D3/ymZ/zEX dRmU8eYQdLq1ZL2Pd+ZVvmakQdfxc2GsjiO2siFE1tl1J0VniAvCC9PSN18pJqyI9hSV b4EVTTo1DFs9Z55kt0U78tZqoj6YvogTpfQfRCgoyCUCpRdg9TNfFLj2Dap/817WY+G8 1lUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OrrgcEnx; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si10530674plb.17.2017.10.11.00.24.50; Wed, 11 Oct 2017 00:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=@linaro.org header.s=google header.b=OrrgcEnx; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753822AbdJKHYt (ORCPT + 12 others); Wed, 11 Oct 2017 03:24:49 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:54521 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdJKHYr (ORCPT ); Wed, 11 Oct 2017 03:24:47 -0400 Received: by mail-pf0-f179.google.com with SMTP id m28so677790pfi.11 for ; Wed, 11 Oct 2017 00:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=BJdq1uaehAOr4NGD8vdiwJEZTC56U0YZ4SLjahCqkHY=; b=OrrgcEnxubX0sAw/ZYEBr91BoEICB6nMQS2z1v+hNyHCKetpKyyvg18vtiSCYM+H7H 0X3BFJ/JSI20mMACwAAhdHR4h0DRJLD7YQmKKzwW0mv92Bz3DgZRfOfiIu2seULHNGCT K1CdqbSEdP6+CX5e3ZE1IBnnw1bCjiTw2fKrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BJdq1uaehAOr4NGD8vdiwJEZTC56U0YZ4SLjahCqkHY=; b=tEaLtb+rkpDYpZ00rQIxYCpHT/Yu3KIRNhGgjBEDdWVCeFYkoOfmFZjoK/ZO4RRpVD 562Gi25ddnR8lFeK8fbqE20xVWNPhWY1oXnWLBwVY0Z25M5JFLcShjwa4Rslv06jME6Q epDl8b0tGXyXFXjgjKxWmJ8TniThpAFh7jkG9HQ+ln0px1csWYmT1r9ulfd6ahCQjtQ7 xWacXUrxxqypJyXoAotJCT5pa0fifpMN3CxOWHAMlta3rig+2OcebfyrAK5KNq3KG4oB Lq14X8si5xk8YnFPmCG3y1i6jF0eiUvjf2TLiWh5viJX3WxYlyPS2/5TsbUsMLSb8Js3 dPTg== X-Gm-Message-State: AMCzsaU7HTV1FkpP05CLbM5ujyc1qY0Gqko9Q65nyfj9d0vH+tVqqQfv aXfxNnOqkJnyPknGRSMM9jPSZQ== X-Google-Smtp-Source: AOwi7QDeueZTUTrUgbMVly5DNOlIXYzMMmf2QRfeUuW93aUUDa40LgLsFy9F3q4eaYB7jv5YPgHA3w== X-Received: by 10.84.214.151 with SMTP id j23mr14729227pli.21.1507706687132; Wed, 11 Oct 2017 00:24:47 -0700 (PDT) Received: from localhost ([122.172.169.205]) by smtp.gmail.com with ESMTPSA id g11sm1513711pfe.41.2017.10.11.00.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2017 00:24:45 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Kevin Hilman , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Nishanth Menon , robh+dt@kernel.org, lina.iyer@linaro.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, Len Brown , Pavel Machek , Andy Gross , David Brown Subject: [PATCH V11 0/7] PM / Domains: Performance state support Date: Wed, 11 Oct 2017 12:54:12 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.rc1.236.g92ea95045093 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi, This version contains the changes we discussed during Linaro Connect. Some platforms have the capability to configure the performance state of their power domains. The process of configuring the performance state is pretty much platform dependent and we may need to work with a wide range of configurables. For some platforms, like Qcom, it can be a positive integer value alone, while in other cases it can be voltage levels, etc. The power-domain framework until now was only designed for the idle state management of the device and this needs to change in order to reuse the power-domain framework for active state management of the devices. The first patch updates the genpd framework to supply new APIs to support active state management and the second patch uses them from the OPP core. The third patch adds a new API to the OPP core to get performance state corresponding to OPPs (This should rather come via DT and would be removed once we have fixed bindings for performance states). Rest of the patches [4-7/7] are included to show how user drivers would end up using the new APIs and these patches aren't ready to get merged yet and are marked clearly like that. Moreover some of them may go via SoC specific trees instead of the PM tree. This is currently tested by: - /me by hacking the kernel a bit with virtual power-domains for the ARM 64 hikey platform. - Rajendra Nayak, on msm8996 platform (Qcom) with MMC controller. Thanks Rajendra for helping me testing this out. I also had a chat with Rajendra and we should be able to get a Qualcomm specific power domain driver (which uses these changes) in coming weeks. I am targeting the first 3 patches for 4.15-rc1, if possible. Pushed here as well: https://git.linaro.org/people/viresh.kumar/linux.git/log/?h=opp/genpd-performance-state Rebased over: pm/linux-next V10->V11: - Dropped propagation to master domains of a subdomain, as we don't have such requirements yet and we may not have 1 to 1 relation between the states of subdomains and masters. - Updated genpd API to get performance state directly instead of frequency. The conversion of frequency to performance state is now done by OPP core instead, which is more logical. - Only the mmc patch is kept and other user patches are dropped, anyway none of those is getting merged right now. - Updates to the rpm power domain driver and a new OPP driver is added as well. V9->V10: - Performance state of masters is updated before the state of the genpd (Ulf). - 2/7 and 3/7 are swapped. V8->V9: - Renamed genpd callbacks and internal routines. - dev_pm_genpd_has_performance_state() simplified a lot and doesn't check master hierarchy now. Rather a new patch (2/7) is added to take care of that and WARN if no master has set genpd_set_performance_state() callback. - Update is propagated to the masters even if the genpd's callback is already called. - Exit _genpd_reeval_performance_state() early if no state change is required and it gets an additional argument (new state of the device/subdomain). - Taken care of genpd on/off cases. - s/parent/master everywhere in comments and logs. - Better explanations in logs, comments etc. - All the other patches (3-7/7) are same as V8. (Just minor update in 5/7 to use the updated callback names). V7->V8: - Ulf helped a lot in reviewing V7 and pointed out couple of issues, specially in locking while dealing with a hierarchy of power domains. - All those locking issues are sorted out now, even for the complex cases. - genpd_lookup_dev() is used in pm_genpd_has_performance_state() to make sure we have a valid genpd available for the device. - Validation of performance state callbacks isn't done anymore in pm_genpd_init() as it gets called very early and the binding of subdomains to their parent domains happens later. This is handled in pm_genpd_has_performance_state() now, which is called from user drivers. - User driver changes (not to be merged) are included for the first time here, to demonstrate how changes would look finally. V6->V7: - Almost a rewrite, only two patches against 9 in earlier version. - No bindings updated now and domain's performance state aren't passed via DT for now (until we know how users are going to use it). - We also skipped the QoS framework completely and new APIs are provided directly by genpd. V5->V6: - Use freq/voltage in OPP table as it is for power domain and don't create "domain-performance-level" property - Create new "power-domain-opp" property for the devices. - Take care of domain providers that provide multiple domains and extend "operating-points-v2" property to contain a list of phandles - Update code according to those bindings. V4->V5: - Only 3 patches were resent and 2 of them are Acked from Ulf. V3->V4: - Use OPP table for genpd devices as well. - Add struct device to genpd, in order to reuse OPP infrastructure. - Based over: https://marc.info/?l=linux-kernel&m=148972988002317&w=2 - Fixed examples in DT document to have voltage in target,min,max order. V2->V3: - Based over latest pm/linux-next - Bindings and code are merged together - Lots of updates in bindings - the performance-states node is present within the power-domain now, instead of its phandle. - performance-level property is replaced by "reg". - domain-performance-state property of the consumers contain an integer value now instead of phandle. - Lots of updates to the code as well - Patch "PM / QOS: Add default case to the switch" is merged with other patches and the code is changed a bit as well. - Don't pass 'type' to dev_pm_qos_add_notifier(), rather handle all notifiers with a single list. A new patch is added for that. - The OPP framework patch can be applied now and has proper SoB from me. - Dropped "PM / domain: Save/restore performance state at runtime suspend/resume". - Drop all WARN(). - Tested-by Rajendra nayak. V1->V2: - Based over latest pm/linux-next - It is mostly a resend of what is sent earlier as this series hasn't got any reviews so far and Rafael suggested that its better I resend it. - Only the 4/6 patch got an update, which was shared earlier as reply to V1 as well. It has got several fixes for taking care of power domain hierarchy, etc. -- viresh Rajendra Nayak (3): soc: qcom: rpmpd: Add driver to model cx/mx power domains soc: qcom: rpmpd: Add support for set performance state mmc: sdhci-msm: Adapt the driver to use OPPs to set clocks/performance state Viresh Kumar (4): PM / Domains: Add support to select performance-state of domains OPP: Support updating performance state of device's power domain OPP: Add dev_pm_opp_{un}register_get_pstate_helper() OPP: qcom: Add support to get performance states corresponding to OPPs .../devicetree/bindings/power/qcom,rpmpd.txt | 9 + arch/arm64/boot/dts/qcom/msm8996.dtsi | 39 +++ drivers/base/power/domain.c | 179 ++++++++++- drivers/clk/qcom/gcc-msm8996.c | 8 +- drivers/mmc/host/sdhci-msm.c | 39 ++- drivers/opp/Makefile | 2 + drivers/opp/core.c | 135 ++++++++- drivers/opp/debugfs.c | 3 + drivers/opp/opp.h | 6 + drivers/opp/qcom-rpmpd.c | 107 +++++++ drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpmpd.c | 330 +++++++++++++++++++++ include/linux/pm_domain.h | 13 + include/linux/pm_opp.h | 10 + 15 files changed, 873 insertions(+), 17 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/qcom,rpmpd.txt create mode 100644 drivers/opp/qcom-rpmpd.c create mode 100644 drivers/soc/qcom/rpmpd.c -- 2.7.4