summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-03-12 09:54:28 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-12 19:36:48 +0000
commita1258ba9944c16dd60080fa69a94bf1b28f8db61 (patch)
tree210d5b9117187238361d8b39f2e38795c0b04164
parentd3494eb152ae9992de6067e8b00a3f2595302b68 (diff)
downloadchrome-ec-a1258ba9944c16dd60080fa69a94bf1b28f8db61.tar.gz
zephyr: add DPTF support
Add a Kconfig option to enable DPTF support. Adds support for the following ACPI entries: EC_ACPI_MEM_FAN_DUTY (0x04) EC_ACPI_MEM_TEMP_ID (0x05) EC_ACPI_MEM_TEMP_THRESHOLD (0x06) EC_ACPI_MEM_TEMP_COMMIT (0x07) BUG=b:179886912 BRANCH=none TEST=zmake testall TEST=Boot zephyr-ec on Volteer, observe that ACPI warnings for ignored read/writes for DPTF commands are fixed. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I40cbe79e57c3d4687d828ec46fe0d51034e96bfc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757028 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
-rw-r--r--common/acpi.c1
-rw-r--r--common/dptf.c4
-rw-r--r--zephyr/CMakeLists.txt1
-rw-r--r--zephyr/Kconfig.temperature14
-rw-r--r--zephyr/shim/include/config_chip.h5
-rw-r--r--zephyr/shim/src/util.c8
6 files changed, 33 insertions, 0 deletions
diff --git a/common/acpi.c b/common/acpi.c
index 4f2b7bda6d..941a8b2e56 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -9,6 +9,7 @@
#include "console.h"
#include "dptf.h"
#include "ec_commands.h"
+#include "fan.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
diff --git a/common/dptf.c b/common/dptf.c
index 2a2cef0c17..33a42ba5af 100644
--- a/common/dptf.c
+++ b/common/dptf.c
@@ -13,6 +13,10 @@
#include "temp_sensor.h"
#include "util.h"
+#ifdef CONFIG_ZEPHYR
+#include "temp_sensor/temp_sensor.h"
+#endif
+
/* Console output macros */
#define CPUTS(outstr) cputs(CC_DPTF, outstr)
#define CPRINTS(format, args...) cprints(CC_DPTF, format, ## args)
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 214c2ccf7e..2bb9e731de 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -194,6 +194,7 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CHARGE_RAMP_SW
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CBI "${PLATFORM_EC}/common/cbi.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CONSOLE_CMD_MEM
"${PLATFORM_EC}/common/memory_commands.c")
+zephyr_sources_ifdef(CONFIG_PLATFORM_EC_DPTF "${PLATFORM_EC}/common/dptf.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ
"${PLATFORM_EC}/common/chipset.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_ESPI "${PLATFORM_EC}/common/espi.c")
diff --git a/zephyr/Kconfig.temperature b/zephyr/Kconfig.temperature
index 3aa6e17509..19ce5e3146 100644
--- a/zephyr/Kconfig.temperature
+++ b/zephyr/Kconfig.temperature
@@ -10,6 +10,20 @@ menuconfig PLATFORM_EC_TEMP_SENSOR
if PLATFORM_EC_TEMP_SENSOR
+config PLATFORM_EC_DPTF
+ bool "Dynamic Platform and Thermal Framework"
+ default y if PLATFORM_EC_ACPI
+ help
+ Enables the Dynamic Platform and Thermal Framework (DPTF). DPTF
+ exposes the temperature sensors and the fan controls to the
+ Applicaiton Processor (AP) using Advanced Configuration and Power
+ Interface (ACPI). This permits the AP to control thermal management
+ independent of the EC.
+
+ Even when DPTF is enabled, the EC still monitors temperature sensors
+ and will take corrective actions for high temperatures such as turning
+ on the fans or powering down the AP.
+
config PLATFORM_EC_THERMISTOR
bool "Thermistor support"
depends on PLATFORM_EC_ADC
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index f5b5645b13..0e33f124ea 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1236,4 +1236,9 @@ enum battery_type {
#define CONFIG_USB_PD_TCPC_VCONN
#endif
+#undef CONFIG_DPTF
+#ifdef CONFIG_PLATFORM_EC_DPTF
+#define CONFIG_DPTF
+#endif
+
#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/zephyr/shim/src/util.c b/zephyr/shim/src/util.c
index 38a254bf47..ca45025cd7 100644
--- a/zephyr/shim/src/util.c
+++ b/zephyr/shim/src/util.c
@@ -234,6 +234,14 @@ enum cond_internal_bits {
COND_FALL_MASK = BIT(2), /* set if 1->0 */
};
+void cond_init(cond_t *c, int val)
+{
+ if (val)
+ *c = COND_CURR_MASK;
+ else
+ *c = 0;
+}
+
void cond_set(cond_t *c, int val)
{
if (val && cond_is(c, 0))