summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/acpi/dptc.asl25
-rw-r--r--src/soc/amd/common/block/acpi/alib.c64
-rw-r--r--src/soc/amd/common/block/include/amdblocks/alib.h4
3 files changed, 75 insertions, 18 deletions
diff --git a/src/soc/amd/common/acpi/dptc.asl b/src/soc/amd/common/acpi/dptc.asl
new file mode 100644
index 0000000000..611024cb02
--- /dev/null
+++ b/src/soc/amd/common/acpi/dptc.asl
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+External(\_SB.DDEF, MethodObj)
+External(\_SB.DTAB, MethodObj)
+
+Scope (\_SB)
+{
+ Method (DPTC, 0, Serialized)
+ {
+ /* If _SB.DDEF is not present, DPTC is not enabled so return early. */
+ If (!CondRefOf (\_SB.DDEF))
+ {
+ Return (Zero)
+ }
+
+ If (CondRefOf (\_SB.DTAB) && (\_SB.PCI0.LPCB.EC0.TBMD == One))
+ {
+ \_SB.DTAB()
+ Return (Zero)
+ }
+
+ \_SB.DDEF()
+ Return (Zero)
+ }
+}
diff --git a/src/soc/amd/common/block/acpi/alib.c b/src/soc/amd/common/block/acpi/alib.c
index 7dbb9b8407..4f6eafb320 100644
--- a/src/soc/amd/common/block/acpi/alib.c
+++ b/src/soc/amd/common/block/acpi/alib.c
@@ -16,28 +16,60 @@ static void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t
acpigen_emit_namestring(buf_name);
}
-void acpigen_write_alib_dptc(uint8_t *default_param, size_t default_param_len,
- uint8_t *tablet_param, size_t tablet_param_len)
+void acpigen_write_alib_dptc_default(uint8_t *default_param, size_t default_param_len)
{
/* Scope (\_SB) */
acpigen_write_scope("\\_SB");
- /* Method(DPTC, 0, Serialized) */
- acpigen_write_method_serialized("DPTC", 0);
-
- /* TODO: The code assumes that if DPTC gets called the following object exists */
- /* If (LEqual ("\_SB.PCI0.LPCB.EC0.TBMD", 1)) */
- acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.LPCB.EC0.TBMD", 1);
-
- acpigen_dptc_call_alib("TABB", tablet_param, tablet_param_len);
+ /* Default (Unthrottled) Mode */
+ /* Scope (\_SB)
+ * {
+ * Method (DDEF, 0, Serialized)
+ * {
+ * Debug = "DPTC: Using normal SOC DPTC Settings."
+ * Name (DEFB, Buffer (0x25)
+ * {
+ * ...
+ * })
+ * \_SB.ALIB
+ * 0x0C
+ * DEFB
+ * }
+ * }
+ */
+ acpigen_write_method_serialized("DDEF", 0);
+ acpigen_write_debug_string("DPTC: Using normal SOC DPTC Settings.");
+ acpigen_dptc_call_alib("DEFB", default_param, default_param_len);
+ acpigen_write_method_end();
- /* Else */
- acpigen_write_else();
+ acpigen_write_scope_end();
+}
- acpigen_dptc_call_alib("DEFB", default_param, default_param_len);
+void acpigen_write_alib_dptc_tablet(uint8_t *tablet_param, size_t tablet_param_len)
+{
+ /* Scope (\_SB) */
+ acpigen_write_scope("\\_SB");
- acpigen_pop_len(); /* Else */
+ /* Tablet Mode */
+ /* Scope (\_SB)
+ * {
+ * Method (DTAB, 0, Serialized)
+ * {
+ * Debug = "DPTC: Using tablet mode SOC DPTC Settings."
+ * Name (TABB, Buffer (0x25)
+ * {
+ * ...
+ * })
+ * \_SB.ALIB
+ * 0x0C
+ * TABB
+ * }
+ * }
+ */
+ acpigen_write_method_serialized("DTAB", 0);
+ acpigen_write_debug_string("DPTC: Using tablet mode SOC DPTC Settings.");
+ acpigen_dptc_call_alib("TABB", tablet_param, tablet_param_len);
+ acpigen_write_method_end();
- acpigen_pop_len(); /* Method DPTC */
- acpigen_pop_len(); /* Scope \_SB */
+ acpigen_write_scope_end();
}
diff --git a/src/soc/amd/common/block/include/amdblocks/alib.h b/src/soc/amd/common/block/include/amdblocks/alib.h
index 8899c78eaa..6e193661bd 100644
--- a/src/soc/amd/common/block/include/amdblocks/alib.h
+++ b/src/soc/amd/common/block/include/amdblocks/alib.h
@@ -27,8 +27,8 @@ struct alib_dptc_param {
uint32_t value;
} __packed;
-void acpigen_write_alib_dptc(uint8_t *default_param, size_t default_param_len,
- uint8_t *tablet_param, size_t tablet_param_len);
+void acpigen_write_alib_dptc_default(uint8_t *default_param, size_t default_param_len);
+void acpigen_write_alib_dptc_tablet(uint8_t *tablet_param, size_t tablet_param_len);
#endif /* !__ACPI__ */