aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVarshit B Pandya <varshit.b.pandya@intel.com>2022-04-02 15:11:36 +0530
committerFelix Held <felix-coreboot@felixheld.de>2022-04-05 14:48:47 +0000
commit170a76caa7d9080612f6cf9b1374aca295627efb (patch)
treed4d2d2428c86d43eb88783e3b2c9c7c6878c8030 /src
parent1e124b94fc43df00abe60b067a316460384a6df1 (diff)
drivers/intel/dptf: Add support for Battery participant
As per Intel Dynamic Tuning revision 1.3.13 (Doc no: 541817) add support for TBAT device under \_SB.DPTF BUG=b:205928013 TEST=Build, boot brya0 and dump SSDT to check TBAT device Device (TBAT) { Name (_HID, "INTC1061") // _HID: Hardware ID Name (_UID, "TBAT") // _UID: Unique ID Name (_STR, "Battery Participant") // _STR: Description String Name (PTYP, 0xC) Method (_STA, 0, NotSerialized) // _STA: Status { Return (0x0F) } } Signed-off-by: Varshit B Pandya <varshit.b.pandya@intel.com> Change-Id: I9104318fd838f30253ab1eeac4e212b3b917f516 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63315 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/acpi/acpigen_dptf.c2
-rw-r--r--src/drivers/intel/dptf/Kconfig7
-rw-r--r--src/drivers/intel/dptf/dptf.c25
-rw-r--r--src/drivers/intel/dptf/dptf.h1
-rw-r--r--src/include/acpi/acpigen_dptf.h1
5 files changed, 36 insertions, 0 deletions
diff --git a/src/acpi/acpigen_dptf.c b/src/acpi/acpigen_dptf.c
index 4a5bd09800..a4b3b09ba1 100644
--- a/src/acpi/acpigen_dptf.c
+++ b/src/acpi/acpigen_dptf.c
@@ -76,6 +76,8 @@ static const char *namestring_of(enum dptf_participant participant)
return "TPCH";
case DPTF_POWER:
return "TPWR";
+ case DPTF_BATTERY:
+ return "TBAT";
default:
return "";
}
diff --git a/src/drivers/intel/dptf/Kconfig b/src/drivers/intel/dptf/Kconfig
index a7a5760e0d..c0e62b7175 100644
--- a/src/drivers/intel/dptf/Kconfig
+++ b/src/drivers/intel/dptf/Kconfig
@@ -19,3 +19,10 @@ config DRIVERS_INTEL_DPTF_SUPPORTS_TPWR
help
When enabled, chip driver/intel/dptf will publish information to the
SSDT for TPWR device.
+
+config DRIVERS_INTEL_DPTF_SUPPORTS_TBAT
+ def_bool n
+ depends on DRIVERS_INTEL_DPTF
+ help
+ When enabled, chip driver/intel/dptf will publish information to the
+ SSDT for TBAT device.
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c
index ecb338bf88..27c713313b 100644
--- a/src/drivers/intel/dptf/dptf.c
+++ b/src/drivers/intel/dptf/dptf.c
@@ -14,12 +14,14 @@ enum dptf_generic_participant_type {
DPTF_GENERIC_PARTICIPANT_TYPE_TSR = 0x3,
DPTF_GENERIC_PARTICIPANT_TYPE_TPCH = 0x5,
DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER = 0xB,
+ DPTF_GENERIC_PARTICIPANT_TYPE_BATTERY = 0xC,
DPTF_GENERIC_PARTICIPANT_TYPE_POWER = 0x11,
};
#define DEFAULT_CHARGER_STR "Battery Charger"
#define DEFAULT_TPCH_STR "Intel PCH FIVR Participant"
#define DEFAULT_POWER_STR "Power Participant"
+#define DEFAULT_BATTERY_STR "Battery Participant"
#define PMC_IPC_COMMAND_FIVR_SIZE 0x8
@@ -388,6 +390,26 @@ static void write_tpwr_methods(const struct dptf_platform_info *platform_info)
write_create_tpwr(platform_info);
}
+static void write_create_tbat(const struct dptf_platform_info *platform_info)
+{
+ acpigen_write_device("TBAT");
+ acpigen_write_name("_HID");
+ if (platform_info->tbat_device_hid != NULL)
+ dptf_write_hid(platform_info->use_eisa_hids, platform_info->tbat_device_hid);
+ acpigen_write_name_string("_UID", "TBAT");
+ acpigen_write_name_string("_STR", DEFAULT_BATTERY_STR);
+ acpigen_write_name_integer("PTYP", DPTF_GENERIC_PARTICIPANT_TYPE_BATTERY);
+ acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
+ acpigen_write_device_end(); /* TBAT Battery Participant Device */
+}
+
+
+static void write_tbat_methods(const struct dptf_platform_info *platform_info)
+{
+ write_create_tbat(platform_info);
+}
+
+
/* \_SB.DPTF - note: leaves the Scope open for child devices */
static void write_open_dptf_device(const struct device *dev,
const struct dptf_platform_info *platform_info)
@@ -429,6 +451,9 @@ static void write_device_definitions(const struct device *dev)
if (CONFIG(DRIVERS_INTEL_DPTF_SUPPORTS_TPWR))
write_tpwr_methods(platform_info);
+ if (CONFIG(DRIVERS_INTEL_DPTF_SUPPORTS_TBAT))
+ write_tbat_methods(platform_info);
+
acpigen_pop_len(); /* DPTF Device (write_open_dptf_device) */
acpigen_pop_len(); /* Scope */
}
diff --git a/src/drivers/intel/dptf/dptf.h b/src/drivers/intel/dptf/dptf.h
index c80e64a9ac..ed258802be 100644
--- a/src/drivers/intel/dptf/dptf.h
+++ b/src/drivers/intel/dptf/dptf.h
@@ -16,6 +16,7 @@ struct dptf_platform_info {
const char *fan_hid;
const char *tpch_device_hid;
const char *tpwr_device_hid;
+ const char *tbat_device_hid;
struct {
const char *set_fivr_low_clock_method;
const char *set_fivr_high_clock_method;
diff --git a/src/include/acpi/acpigen_dptf.h b/src/include/acpi/acpigen_dptf.h
index 0d4945203e..893256e6af 100644
--- a/src/include/acpi/acpigen_dptf.h
+++ b/src/include/acpi/acpigen_dptf.h
@@ -27,6 +27,7 @@ enum dptf_participant {
DPTF_TEMP_SENSOR_4,
DPTF_TPCH,
DPTF_POWER,
+ DPTF_BATTERY,
DPTF_PARTICIPANT_COUNT,
};