pmdomain: airoha: Add Airoha CPU PM Domain support
Subsystems (3)
PATCH v10 1/2 pmdomain: airoha: Add Airoha CPU PM Domain support
Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC.
Frequency and power can be controlled with the use of the SMC command by passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command.
---
Changes v10:
- Depends on HAVE_ARM_SMCCC
Changes v9:
- Fix compile error targetting wrong branch (remove_new change) Changes v8:
- Add this patch
- Use SMC invoke instead of 1.2
drivers/pmdomain/mediatek/Kconfig | 12 ++ drivers/pmdomain/mediatek/Makefile | 1 + .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c
drivers/pmdomain/mediatek/Kconfig +12 -0
@@ -26,4 +26,16 @@ config MTK_SCPSYS_PM_DOMAINS Control Processor System (SCPSYS) has several power management related tasks in the system. +config AIROHA_CPU_PM_DOMAIN + tristate "Airoha CPU power domain" + default ARCH_AIROHA + depends on HAVE_ARM_SMCCC + depends on PM + select PM_GENERIC_DOMAINS + help + Say y here to enable CPU power domain support for Airoha SoC. + + CPU frequency and power is controlled by ATF with SMC command to + set performance states. + endmenu
drivers/pmdomain/mediatek/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS) += mtk-pm-domains.o +obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o
drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH v10 2/2 cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver
Add simple CPU Freq driver for Airoha EN7581 SoC that control CPU frequency scaling with SMC APIs and register a generic "cpufreq-dt" device.
All CPU share the same frequency and can't be controlled independently. CPU frequency is controlled by the attached PM domain.
Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq driver is needed with OPP v2 nodes declared in DTS.
---
Changes v9:
- Fix compile error targetting wrong branch (remove_new change and new PM OPs) Changes v8:
- Split in dedicated PM domain driver
Changes v7:
- No changes
Changes v6:
- Improve Kconfig depends logic
- Select PM (PM_GENERIC_DOMAINS depends on it)
- Drop (int) cast for
Changes v5:
- Rename cpu_pd to perf for power domain name
- Use remove instead of remove_new
Changes v4:
- Rework to clk-only + PM set_performance_state implementation Changes v3:
- Adapt to new cpufreq-dt APIs
- Register cpufreq-dt instead of custom freq driver
Changes v2:
- Fix kernel bot error with missing slab.h and bitfield.h header
- Limit COMPILE_TEST to ARM64 due to smcc 1.2
drivers/cpufreq/Kconfig.arm | 8 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/airoha-cpufreq.c | 152 +++++++++++++++++++++++++++ drivers/cpufreq/cpufreq-dt-platdev.c | 2 + 4 files changed, 163 insertions(+) create mode 100644 drivers/cpufreq/airoha-cpufreq.c
drivers/cpufreq/Kconfig.arm +8 -0
@@ -15,6 +15,14 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM To compile this driver as a module, choose M here: the module will be called sun50i-cpufreq-nvmem. +config ARM_AIROHA_SOC_CPUFREQ + tristate "Airoha EN7581 SoC CPUFreq support" + depends on ARCH_AIROHA || COMPILE_TEST + select PM_OPP + default ARCH_AIROHA + help + This adds the CPUFreq driver for Airoha EN7581 SoCs. + config ARM_APPLE_SOC_CPUFREQ tristate "Apple Silicon SoC CPUFreq support" depends on ARCH_APPLE || (COMPILE_TEST && 64BIT)
drivers/cpufreq/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) += amd_freq_sensitivity.o ################################################################################## # ARM SoC drivers +obj-$(CONFIG_ARM_AIROHA_SOC_CPUFREQ) += airoha-cpufreq.o obj-$(CONFIG_ARM_APPLE_SOC_CPUFREQ) += apple-soc-cpufreq.o obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o obj-$(CONFIG_ARM_ARMADA_8K_CPUFREQ) += armada-8k-cpufreq.o
drivers/cpufreq/airoha-cpufreq.c new file +152 -0
152 lines not on this page · raw message
drivers/cpufreq/cpufreq-dt-platdev.c +2 -0
@@ -103,6 +103,8 @@ static const struct of_device_id allowlist[] __initconst = {* platforms using "operating-points-v2" property. */ static const struct of_device_id blocklist[]__initconst = { + { .compatible ="airoha,en7581" , }, + { .compatible ="allwinner,sun50i-a100" }, { .compatible ="allwinner,sun50i-h6" , }, { .compatible ="allwinner,sun50i-h616" , },
Signature · 1 line
2.45.2
Viresh Kumar
maintainerUlf,
Quoted 8 lines · Christian Marangi
Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC.
Frequency and power can be controlled with the use of the SMC command by passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command.
Signed-off-by Christian Marangi <[email protected]>
Quoted 8 lines
---
Changes v10:
- Depends onHAVE_ARM_SMCCC
Changes v9:
- Fix compile error targetting wrong branch (remove_newchange) Changes v8:
- Add this patch
- Use SMC invoke instead of 1.2
Any inputs on this ?
Signature · 1 line
viresh
Quoted 21 lines · Viresh Kumar
Ulf,
Quoted 8 lines · Christian Marangi
Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC.
Frequency and power can be controlled with the use of the SMC command by passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command.
Signed-off-by Christian Marangi <[email protected]>Quoted 8 lines
---
Changes v10:
- Depends onHAVE_ARM_SMCCC
Changes v9:
- Fix compile error targetting wrong branch (remove_newchange) Changes v8:
- Add this patch
- Use SMC invoke instead of 1.2
Quoted 1 line
Any inputs on this ?
Apologize for the delay! This looks good to me! So, applied for next to my pmdomain tree, thanks!
I assume Viresh will take the cpufreq patch via his tree? Please let me know if you prefer another route.
Kind regards
Uffe
Viresh Kumar
maintainerQuoted 22 lines · Ulf Hansson
Quoted 21 lines · Viresh Kumar
Ulf,
Quoted 16 lines · Christian Marangi
Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC.
Frequency and power can be controlled with the use of the SMC command by passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command.
Signed-off-by Christian Marangi <[email protected]>---
Changes v10:
- Depends onHAVE_ARM_SMCCC
Changes v9:
- Fix compile error targetting wrong branch (remove_newchange) Changes v8:
- Add this patch
- Use SMC invoke instead of 1.2
Quoted 7 lines
Quoted 1 line
Any inputs on this ?
Apologize for the delay! This looks good to me! So, applied for next to my pmdomain tree, thanks!
I assume Viresh will take the cpufreq patch via his tree? Please let me know if you prefer another route.
Applied 2/2. Thanks.
Signature · 1 line
viresh