Skip to contentSkip to conversation

platform:x86: Add PMC Driver for Intel Core SOC

PATCH Superseded Rajneesh Bhardwaj 1 participant 1 message May 10, 2016

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 platform:x86: Add PMC Driver for Intel Core SOC

This patch adds the Power Management Controller driver as a pci driver for Intel Core SOC architecture.

This driver can utilize debugging capabilities and supported features as exposed by the Power Management Controller.

Please refer to the below specification for more details on PMC features.
http://www.intel.in/content/www/in/en/chipsets/100-series-chipset-datasheet-vol-2.html

The current version of this driver exposes slp_s0_residency counter. This counter can be used for detecting fragile SLP_S0 signal related failures and take corrective actions when PCH SLP_S0 signal is not asserted after kernel freeze as part of suspend to idle flow (echo freeze > /sys/power/state).

Intel Platform Controller Hub (PCH) asserts SLP_S0 signal when it detects favorable conditions to enter its low power mode. As a pre-requisite the SOC should be in deepest possible Package C-State and devices should be in low power mode. For example, on Skylake SOC the deepest Package C-State is Package C10 or PC10. Suspend to idle flow generally leads to PC10 state but PC10 state may not be sufficient for realizing the platform wide power potential which SLP_S0 signal assertion can provide.

SLP_S0 signal is often connected to the Embedded Controller (EC) and the Power Management IC (PMIC) for other platform power management related optimizations.

In general, SLP_S0 assertion == PC10 + PCH low power mode + ModPhy Lanes power gated + PLL Idle.

As part of this driver, a mechanism to read the slp_s0 residency is exposed as an api and also debugfs features are added to indicate slp_s0 signal assertion residency in microseconds.

echo freeze > /sys/power/state
wake the system
cat /sys/kernel/debug/pmc_core/slp_s0_residency_usec

---
Changes in v3:
* Updated the commit message, added reference to the chipset datasheet.
* Renamed the header file to intel_pmc_core.h for consistency.
* Added All rights reserved notification after the Copyright message.
* Improved variable names in the header file. Added SPT prefix.
* Fixed kernel-doc related whitespace and comma issues for struct pmc_dev.
* Changed feature_available to bool has_slp_s0_res.
* Enhanced the Kconfig description as per the review suggestions.
* Added error propagating logic to pmc_core_dev_state_show.
* Streamlined intel_pmc_slp_s0_counter_read as per the review comments.
* Streamlined the use of #if IS_ENABLED(CONFIG_DEBUG_FS) while registering debugfs in the probe call.
* Removed the *duplicate definition* of pmc_core_debugfs_register.
* Added MAINTAINERS related changes.
* Checkpatch warning due to long URL name in the commit message.

Changes in v2:
* Fixed inconsistent spaces in the header file.
* Updated commit message.
* Enhanced acronym SKL CPU to Skylake CPUID Signature.
* Put error check on pci_read_config_dword in probe function.
* Changed goto label (disable) to disable_pci.
* Changed x86_match_cpu error handling for consistency.

 MAINTAINERS                           |   8 ++
 arch/x86/include/asm/intel_pmc_core.h |  54 ++++++++++
 drivers/platform/x86/Kconfig          |  13 +++
 drivers/platform/x86/Makefile         |   1 +
 drivers/platform/x86/intel_pmc_core.c | 194 ++++++++++++++++++++++++++++++++++
 5 files changed, 270 insertions(+)
 create mode 100644 arch/x86/include/asm/intel_pmc_core.h
 create mode 100644 drivers/platform/x86/intel_pmc_core.c
MAINTAINERS +8 -0
index 1d5b4be..a526a61 100644
@@ -5879,6 +5879,14 @@ S:	Maintained
 F:	arch/x86/include/asm/intel_telemetry.h
 F:	drivers/platform/x86/intel_telemetry*
 
+INTEL PMC CORE DRIVER
+M:      Rajneesh Bhardwaj <[email protected]>
+M:      Vishwanath Somayaji <[email protected]>
+L:      [email protected]
+S:      Maintained
+F:      arch/x86/include/asm/intel_pmc_core.h
+F:      drivers/platform/x86/intel_pmc_core.c
+
 IOC3 ETHERNET DRIVER
 M:	Ralf Baechle <[email protected]>
 L:	[email protected]
arch/x86/include/asm/intel_pmc_core.h new file +54 -0

54 lines not on this page · raw message

drivers/platform/x86/Kconfig +13 -0
index ed2004b..d4d3512 100644
@@ -821,6 +821,19 @@ config INTEL_IPS
 	  functionality.  If in doubt, say Y here; it will only load on
 	  supported platforms.
 
+config INTEL_PMC_CORE
+	bool "Intel PMC Core driver"
+	depends on X86 && PCI
+	default y
+	---help---
+	  The Intel Platform Controller Hub for Intel Core SoCs provides access
+	  to Power Management Controller registers via a pci interface. This
+	  driver can utilize debugging capabilities and supported features as
+	  exposed by the Power Management Controller.
+
+	  Supported features:
+		- slp_s0_residency counter.
+
 config INTEL_IMR
 	bool "Intel Isolated Memory Region support"
 	default n
drivers/platform/x86/Makefile +1 -0
index 448443c..9b11b40 100644
@@ -69,3 +69,4 @@ obj-$(CONFIG_INTEL_PUNIT_IPC)  += intel_punit_ipc.o
 obj-$(CONFIG_INTEL_TELEMETRY)	+= intel_telemetry_core.o \
 				   intel_telemetry_pltdrv.o \
 				   intel_telemetry_debugfs.o
+obj-$(CONFIG_INTEL_PMC_CORE)    += intel_pmc_core.o
drivers/platform/x86/intel_pmc_core.c new file +194 -0

194 lines not on this page · raw message

Signature · 1 line
1.9.1