PM / AVS: SVS: Introduce SVS engine
Subsystems (3)
v7 cover PM / AVS: SVS: Introduce SVS engine
1. SVS driver use OPP adjust event in [1] to update OPP table voltage part.
2. SVS dts node refers to CPU opp table [2] and GPU opp table [3].
3. SVS and thermal dts use the same thermal efuse [4].
4. SVS dts needs PMIC regulator [5].
[1] https://patchwork.kernel.org/patch/11193513/
[2] https://patchwork.kernel.org/patch/11304935/
[3] https://patchwork.kernel.org/patch/11423009/
[4] https://patchwork.kernel.org/patch/11316495/
[5] https://patchwork.kernel.org/patch/11284617/
pending discussion on v7:
- SVS sub-node architecture pending discussion in below patch.
https://lore.kernel.org/patchwork/patch/1175994/
changes since v6:
- svs_isr_handler() function is merged into svs_isr().
- In svs_isr(), we find which bank fires interrupt first and check this bank is suspended or not secondly.
- Use memdup_user_nul() instead of copy_from_user().
- Use U32_MAX instead of "(u32)-1.
- SVS needs to do resume after thermal resume in system suspend flow. Therefore, change SVS pm_ops to prepare/complete.
- Add high temperature voltages compensation codes.
- Add irqflags in "struct svs_platform" for supporting different SVS HW setting.
- Set signed-off voltages to system when system suspend.
- Add SVS HW reset flag for future SVS HW support.
- Coding style refinement.
Roger Lu (3):
dt-bindings: soc: add mtk svs dt-bindings
arm64: dts: mt8183: add svs device information
PM / AVS: SVS: Introduce SVS engine
.../devicetree/bindings/power/mtk-svs.txt | 76 + arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 16 + arch/arm64/boot/dts/mediatek/mt8183.dtsi | 41 + drivers/power/avs/Kconfig | 10 + drivers/power/avs/Makefile | 1 + drivers/power/avs/mtk_svs.c | 2074 +++++++++++++++++ include/linux/power/mtk_svs.h | 23 + 7 files changed, 2241 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/mtk-svs.txt create mode 100644 drivers/power/avs/mtk_svs.c create mode 100644 include/linux/power/mtk_svs.h
PATCH v7 1/3 dt-bindings: soc: add mtk svs dt-bindings
Document the binding for enabling mtk svs on MediaTek SoC.
--- .../devicetree/bindings/power/mtk-svs.txt | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/mtk-svs.txt
Documentation/devicetree/bindings/power/mtk-svs.txt new file +76 -0
@@ -0,0 +1,76 @@ +* Mediatek Smart Voltage Scaling (MTK SVS) + +This describes the device tree binding for the MTK SVS controller (bank) +which helps provide the optimized CPU/GPU/CCI voltages. This device also +needs thermal data to calculate thermal slope for accurately compensate +the voltages when temperature change. + +Required properties: +- compatible: + - "mediatek,mt8183-svs" : For MT8183 family of SoCs +- reg: Address range of the MTK SVS controller. +- interrupts: IRQ for the MTK SVS controller. +- clocks, clock-names: Clocks needed for the svs hardware. required + clocks are: + "main": Main clock for svs controller to work. +- nvmem-cells: Phandle to the calibration data provided by a nvmem device. +- nvmem-cell-names: Should be "svs-calibration-data" and "calibration-data" + +Subnodes: +- svs-cpu-little: SVS bank device node of little CPU + compatible: "mediatek,mt8183-svs-cpu-little" + operating-points-v2: OPP table hooked by SVS little CPU bank. + SVS will optimze this OPP table voltage part. + vcpu-little-supply: PMIC buck of little CPU +- svs-cpu-big: SVS bank device node of big CPU + compatible: "mediatek,mt8183-svs-cpu-big" + operating-points-v2: OPP table hooked by SVS big CPU bank. + SVS will optimze this OPP table voltage part. + vcpu-big-supply: PMIC buck of big CPU +- svs-cci: SVS bank device node of CCI + compatible: "mediatek,mt8183-svs-cci" + operating-points-v2: OPP table hooked by SVS CCI bank. + SVS will optimze this OPP table voltage part. + vcci-supply: PMIC buck of CCI +- svs-gpu: SVS bank device node of GPU + compatible: "mediatek,mt8183-svs-gpu" + operating-points-v2: OPP table hooked by SVS GPU bank. + SVS will optimze this OPP table voltage part. + vgpu-supply: PMIC buck of GPU + +Example: + + svs: svs@1100b000 { + compatible = "mediatek,mt8183-svs"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_LOW>; + clocks = <&infracfg CLK_INFRA_THERM>; + clock-names = "main_clk"; + nvmem-cells = <&svs_calibration>, <&thermal_calibration>; + nvmem-cell-names = "svs-calibration-data", "calibration-data"; + + svs_cpu_little: svs-cpu-little { + compatible = "mediatek,mt8183-svs-cpu-little"; + operating-points-v2 = <&cluster0_opp>; + vcpu-little-supply = <&mt6358_vproc12_reg>; + }; + + svs_cpu_big: svs-cpu-big { + compatible = "mediatek,mt8183-svs-cpu-big"; + operating-points-v2 = <&cluster1_opp>; + vcpu-big-supply = <&mt6358_vproc11_reg>; + }; + + svs_cci: svs-cci { + compatible = "mediatek,mt8183-svs-cci"; + operating-points-v2 = <&cci_opp>; + vcci-supply = <&mt6358_vproc12_reg>; + }; + + svs_gpu: svs-gpu { + compatible = "mediatek,mt8183-svs-gpu"; + power-domains = <&scpsys MT8183_POWER_DOMAIN_MFG_2D>; + operating-points-v2 = <&gpu_opp_table>; + vgpu-spply = <&mt6358_vgpu_reg>; + }; + };
Signature · 1 line
2.18.0
PATCH v7 2/3 arm64: dts: mt8183: add svs device information
In reply to Roger Luadd pmic/clock/irq/efuse setting in svs node
--- arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 16 ++++++++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 41 +++++++++++++++++++++ 2 files changed, 57 insertions(+)
arch/arm64/boot/dts/mediatek/mt8183-evb.dts +16 -0
@@ -231,6 +231,22 @@ }; +&svs_cpu_little { + vcpu-little-supply = <&mt6358_vproc12_reg>; +}; + +&svs_cpu_big { + vcpu-big-supply = <&mt6358_vproc11_reg>; +}; + +&svs_cci { + vcci-supply = <&mt6358_vproc12_reg>; +}; + +&svs_gpu { + vgpu-spply = <&mt6358_vgpu_reg>; +}; + &uart0 { status = "okay"; };
arch/arm64/boot/dts/mediatek/mt8183.dtsi +41 -0
53 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v7 3/3 PM / AVS: SVS: Introduce SVS engine
In reply to Roger LuThe SVS (Smart Voltage Scaling) engine is a piece of hardware which is used to calculate optimized voltage values of several power domains, e.g. CPU/GPU/CCI, according to chip process corner, temperatures, and other factors. Then DVFS driver could apply those optimized voltage values to reduce power consumption.
--- drivers/power/avs/Kconfig | 10 + drivers/power/avs/Makefile | 1 + drivers/power/avs/mtk_svs.c | 2074 +++++++++++++++++++++++++++++++++ include/linux/power/mtk_svs.h | 23 + 4 files changed, 2108 insertions(+) create mode 100644 drivers/power/avs/mtk_svs.c create mode 100644 include/linux/power/mtk_svs.h
drivers/power/avs/Kconfig +10 -0
@@ -35,3 +35,13 @@ config ROCKCHIP_IODOMAIN Say y here to enable support io domains on Rockchip SoCs. It is necessary for the io domain setting of the SoC to match the voltage supplied by the regulators. + +config MTK_SVS + bool "MediaTek Smart Voltage Scaling(SVS)" + depends on POWER_AVS && MTK_EFUSE && NVMEM + help + The SVS engine is a piece of hardware which is used to calculate + optimized voltage values of several power domains, e.g. + CPU clusters/GPU/CCI, according to chip process corner, temperatures, + and other factors. Then DVFS driver could apply those optimized voltage + values to reduce power consumption.
drivers/power/avs/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_POWER_AVS_OMAP) += smartreflex.o obj-$(CONFIG_QCOM_CPR) += qcom-cpr.o obj-$(CONFIG_ROCKCHIP_IODOMAIN) += rockchip-io-domain.o +obj-$(CONFIG_MTK_SVS) += mtk_svs.o
drivers/power/avs/mtk_svs.c new file +2074 -0
2,074 lines not on this page · raw message
include/linux/power/mtk_svs.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2020 MediaTek Inc. +*/ + +#ifndef __MTK_SVS_H__ +#define __MTK_SVS_H__ + +#if IS_ENABLED (CONFIG_MTK_SVS ) +unsigned long claim_mtk_svs_lock (void ); +void release_mtk_svs_lock (unsigned long flags); +#else +static inline unsigned long claim_mtk_svs_lock (void ) +{ +return 0 ; +} + +static inline void release_mtk_svs_lock (unsigned long flags) +{ +} +#endif /* CONFIG_MTK_SVS */ + +#endif /* __MTK_SVS_H__ */
Signature · 1 line
2.18.0