Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8617310ybc; Fri, 29 Nov 2019 13:42:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxw5uEyQuk35saXN5KNpmxldhEGOi0vv5OyNxubc4cGXIEYxoFepIzaFN6sdHiIT+y2hRs+ X-Received: by 2002:a17:906:4ec9:: with SMTP id i9mr11111361ejv.159.1575063766995; Fri, 29 Nov 2019 13:42:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575063766; cv=none; d=google.com; s=arc-20160816; b=b6TZLlju5DHRioYBY9YPuGkLZNd6gzwTCpEP+e+HOvUM3J03P0JdHBi8zrV38Ul8sx 0NjkvcrB/OkEr7UDk1GMUwdvDfQvyfJiTK4luJLOXJJOzycPQEhu+nEIWeCAxhxmUNfV Eh3sQFKCsdAMcYUMf3/t8IKht7b5JAdH9bZclRZiXb4AC66NttlaNJ4TG8xCvY5qTCb3 tH0MwJkZb6E1Wi6b0YqRcpb2h7YDHi9ON5RjL9NKFmdyJz6smgoQ0QwqCIpd58lXRXj/ CduAHPZf6zA3fecZqqO6liEffbqW/h+P4XiJpp031Ty65y/NMOMLv/Ng89sQfggQV/Fw T9jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=HoCIkfIpHUEqxrpa5VNin8a9xzNcml7RJzBZOqUbMCI=; b=oQTDvPId+GpyH+JSW9hed4EOkidD3smQcpEj4dn8NNFqKoyFRjrjOf7p4NjlwRlrb0 ZSK/RtDv7PYOAc0p6xNw/rvIbLy98+yYFoSWsprYRRGhtWBQa5RqtvYlxm6rAq2apHh4 TEBL/knDtB+G7YLajyJdT7C6zsGJApnKXfTzIdGH9l4DQ1WHyDc8UwZN9LX8aH9aRk7u yE1b+ahM3djgm7WWfbk7CIdH48+Qqm46U2OmFPiioxeBrcjp/ojKyc+5BwslKMBi0BNg jEanMrRyEvuf9dFGLiu3FdkMGtw7c2aL35K1nZGgKnvDmYNYHLhqWl4twJkKQ5pTh8Wc XJnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XhymOJiD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 w19si17771287edd.51.2019.11.29.13.42.23; Fri, 29 Nov 2019 13:42:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=XhymOJiD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727219AbfK2VjW (ORCPT + 99 others); Fri, 29 Nov 2019 16:39:22 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36718 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727171AbfK2VjW (ORCPT ); Fri, 29 Nov 2019 16:39:22 -0500 Received: by mail-lj1-f196.google.com with SMTP id k15so33350604lja.3 for ; Fri, 29 Nov 2019 13:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HoCIkfIpHUEqxrpa5VNin8a9xzNcml7RJzBZOqUbMCI=; b=XhymOJiD3Z2aYsBi1GtNTmqv4cD8lZuV3n18svaQOYIQckWoHxOiES3GCLPpqqi9xF ElUzyTYZ/VPe8tY/gh9Fc7J0JDEg7fGZDsQji6Gy+g9cPS7yVWGpavdASwkXBmAJDo9M 6DcZDgXVWSJDqEztf2bZcl8ELnuyOlYW7n1Jk8FnLYoK03OBlPNvo6Ycbn3HBeGzBtHm 7r5nNgT4uFYwy6SdusagmXvIC8XfXg2xFDBtKfsLYtVnFoSblrT1l8DZD9NgPZNUGTpB 7XNcVK1xyUEjbSFuaQUFZ2T/bWzgDCdIlWlzBqhDIOGiS/yhprw/RB1CRSLOHSV9KDgP Y6Bg== 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:mime-version :content-transfer-encoding; bh=HoCIkfIpHUEqxrpa5VNin8a9xzNcml7RJzBZOqUbMCI=; b=NfQOQPWaww2x9OaJhkgNSxNmKldGFgBcXCdVpvclkvEWF/13lkXY7AgTyX+jE06AKP 8Sk7G+OQm7nQzfy6se1pAXsLwsS7lkSl0sL43V9IhUinm4mRozZzUwst9XN/coxakVXK R+ccPisDmh7G7dpU+QOR+m6/VLYsaooDi995wzMmU+TAKRzfP7L4xu9pzYdW7AmQyfkb IHIA7K7ZPzaz23rhkUAdQJfwa+XG2veHvUAbeOUfUXcQ/OYmbB2dA/5CF96kklswn1Bh ILzpSC3YqtJpipWXC6VwgwjRRl/Yh9Ii+sxspkXcRofn+Ks++Mcky14R/N4qOYtzajhF MHKw== X-Gm-Message-State: APjAAAUvUWiYuq2SkDzjc9cMeGLorl2d776boGVYUPFbHK2dzBhYjpMJ wZJIZnQo7olyMl7rcP4VcXX7bQ== X-Received: by 2002:a2e:9549:: with SMTP id t9mr2600851ljh.148.1575063560250; Fri, 29 Nov 2019 13:39:20 -0800 (PST) Received: from centauri.lan (ua-84-217-220-205.bbcust.telenor.se. [84.217.220.205]) by smtp.gmail.com with ESMTPSA id b190sm10742234lfd.39.2019.11.29.13.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2019 13:39:19 -0800 (PST) From: Niklas Cassel To: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: amit.kucheria@linaro.org, sboyd@kernel.org, vireshk@kernel.org, bjorn.andersson@linaro.org, ulf.hansson@linaro.org, Niklas Cassel , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 0/5] Add support for QCOM Core Power Reduction Date: Fri, 29 Nov 2019 22:39:10 +0100 Message-Id: <20191129213917.1301110-1-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds support for Core Power Reduction (CPR), a form of Adaptive Voltage Scaling (AVS), found on certain Qualcomm SoCs. This series is based on top of the qcs404 cpufreq patch series that hasn't landed yet: https://patchwork.kernel.org/project/linux-arm-msm/list/?series=207821 as well as that series' matching device tree changes: https://patchwork.kernel.org/project/linux-arm-msm/list/?series=207831 For testing purposes, this patch series, including the dependencies listed above, is available on the following git tag: https://git.linaro.org/people/niklas.cassel/kernel.git/log/?h=cpr-v7 CPR is a technology that reduces core power on a CPU or on other device. It reads voltage settings from efuses (that have been written in production), it uses these voltage settings as initial values, for each OPP. After moving to a certain OPP, CPR monitors dynamic factors such as temperature, etc. and adjusts the voltage for that frequency accordingly to save power and meet silicon characteristic requirements. This driver has been developed together with Jorge Ramirez-Ortiz, and is based on an RFC by Stephen Boyd[1], which in turn is based on work by others on codeaurora.org[2]. [1] https://lkml.org/lkml/2015/9/18/833 [2] https://source.codeaurora.org/quic/la/kernel/msm-4.14/tree/drivers/regulator/cpr-regulator.c?h=msm-4.14 Changes since v6: (Addressed comments from Ulf Hansson) -Initialize mutex later. -Take the mutex in cpr_pd_attach_dev(), in case we ever implement async attach in the future. -Add comment regarding why we get the cpu clock rate. -Add comment how we handle unlisted frequencies. -Clarify comment regarding why things related to virtual corners are performed in cpr_pd_attach_dev(). -Removed the internal performance_state variable, the performance state is instead calculated using the current corner pointer. -Save a pointer to the first genpd dev that gets attached, and use that rather than get_cpu_device(0), when getting the CPU OPP table. Niklas Cassel (5): dt-bindings: power: avs: Add support for CPR (Core Power Reduction) power: avs: Add support for CPR (Core Power Reduction) arm64: dts: qcom: qcs404: Add CPR and populate OPP table arm64: defconfig: enable CONFIG_QCOM_CPR arm64: defconfig: enable CONFIG_ARM_QCOM_CPUFREQ_NVMEM .../bindings/power/avs/qcom,cpr.txt | 130 ++ MAINTAINERS | 8 + arch/arm64/boot/dts/qcom/qcs404.dtsi | 132 +- arch/arm64/configs/defconfig | 2 + drivers/power/avs/Kconfig | 15 + drivers/power/avs/Makefile | 1 + drivers/power/avs/qcom-cpr.c | 1792 +++++++++++++++++ 7 files changed, 2072 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/avs/qcom,cpr.txt create mode 100644 drivers/power/avs/qcom-cpr.c -- 2.23.0