Skip to contentSkip to conversation

cpuidle: Convert Qualcomm SPM driver to a generic CPUidle driver

PATCH Superseded Stephan Gerhold 1 participant 1 message Apr 5, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: Convert Qualcomm SPM driver to a generic CPUidle driver

The Qualcomm SPM cpuidle driver seems to be the last driver still using the generic ARM CPUidle infrastructure.

Converting it actually allows us to simplify the driver, and we end up being able to remove more lines than adding new ones:

- We can parse the CPUidle states in the device tree directly with dt_idle_states (and don't need to duplicate that functionality into the spm driver).

- Each "saw" device managed by the SPM driver now directly registers its own cpuidle driver, removing the need for any global (per cpu) state.

The device tree binding is the same, so the driver stays compatible with all old device trees.

---
Related change for the PSCI cpuidle driver:
https://lore.kernel.org/linux-pm/[email protected]/
(converting the QCOM SPM driver was mentioned there)

---
 MAINTAINERS                                   |   1 +
 drivers/cpuidle/Kconfig.arm                   |  13 ++
 drivers/cpuidle/Makefile                      |   1 +
 .../qcom/spm.c => cpuidle/cpuidle-qcom-spm.c} | 138 +++++++-----------
 drivers/soc/qcom/Kconfig                      |  10 --
 drivers/soc/qcom/Makefile                     |   1 -
 6 files changed, 67 insertions(+), 97 deletions(-)
 rename drivers/{soc/qcom/spm.c => cpuidle/cpuidle-qcom-spm.c} (75%)
MAINTAINERS +1 -0
index 88bf75088b5a..fb4a347f874d 100644
@@ -2208,6 +2208,7 @@ F:	drivers/*/*/qcom*
 F:	drivers/*/pm8???-*
 F:	drivers/bluetooth/btqcomsmd.c
 F:	drivers/clocksource/timer-qcom.c
+F:	drivers/cpuidle/cpuidle-qcom-spm.c
 F:	drivers/extcon/extcon-qcom*
 F:	drivers/iommu/msm*
 F:	drivers/i2c/busses/i2c-qup.c
drivers/cpuidle/Kconfig.arm +13 -0
index 62272ecfa771..51cf487d54d4 100644
@@ -86,3 +86,16 @@ config ARM_MVEBU_V7_CPUIDLE
 	depends on (ARCH_MVEBU || COMPILE_TEST) && !ARM64
 	help
 	  Select this to enable cpuidle on Armada 370, 38x and XP processors.
+
+config ARM_QCOM_SPM_CPUIDLE
+	bool "CPU Idle Driver for Qualcomm Subsystem Power Manager (SPM)"
+	depends on (ARCH_QCOM || COMPILE_TEST) && !ARM64
+	select ARM_CPU_SUSPEND
+	select CPU_IDLE_MULTIPLE_DRIVERS
+	select DT_IDLE_STATES
+	select QCOM_SCM
+	help
+	  Select this to enable cpuidle for Qualcomm processors.
+	  The Subsystem Power Manager (SPM) controls low power modes for the
+	  CPU and L2 cores. It interface with various system drivers to put
+	  the cores in low power modes.
drivers/cpuidle/Makefile +1 -0
index cc8c769d7fa9..1a7dc93671b4 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_ARM_CPUIDLE)		+= cpuidle-arm.o
 obj-$(CONFIG_ARM_PSCI_CPUIDLE)		+= cpuidle_psci.o
 cpuidle_psci-y				:= cpuidle-psci.o
 cpuidle_psci-$(CONFIG_PM_GENERIC_DOMAINS_OF) += cpuidle-psci-domain.o
+obj-$(CONFIG_ARM_QCOM_SPM_CPUIDLE)	+= cpuidle-qcom-spm.o
 
 ###############################################################################
 # MIPS drivers
drivers/cpuidle/cpuidle-qcom-spm.c renamed from drivers/soc/qcom/spm.c +52 -86

213 lines not on this page · raw message

drivers/soc/qcom/Kconfig +0 -10
index d0a73e76d563..3efccf9e09f5 100644
@@ -76,16 +76,6 @@ config QCOM_OCMEM
 	  requirements. This is typically used by the GPU, camera/video, and
 	  audio components on some Snapdragon SoCs.
 
-config QCOM_PM
-	bool "Qualcomm Power Management"
-	depends on ARCH_QCOM && !ARM64
-	select ARM_CPU_SUSPEND
-	select QCOM_SCM
-	help
-	  QCOM Platform specific power driver to manage cores and L2 low power
-	  modes. It interface with various system drivers to put the cores in
-	  low power modes.
-
 config QCOM_QMI_HELPERS
 	tristate
 	depends on ARCH_QCOM || COMPILE_TEST
drivers/soc/qcom/Makefile +0 -1
index 9fb35c8a495e..2366424a061f 100644
@@ -7,7 +7,6 @@ obj-$(CONFIG_QCOM_GLINK_SSR) +=	glink_ssr.o
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
 obj-$(CONFIG_QCOM_MDT_LOADER)	+= mdt_loader.o
 obj-$(CONFIG_QCOM_OCMEM)	+= ocmem.o
-obj-$(CONFIG_QCOM_PM)	+=	spm.o
 obj-$(CONFIG_QCOM_QMI_HELPERS)	+= qmi_helpers.o
 qmi_helpers-y	+= qmi_encdec.o qmi_interface.o
 obj-$(CONFIG_QCOM_RMTFS_MEM)	+= rmtfs_mem.o
Signature · 1 line
2.26.0