]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/amd/pmf: Add helper to verify BIOS input notifications are enable/disable
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Mon, 1 Sep 2025 11:01:36 +0000 (16:31 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 11 Sep 2025 08:03:41 +0000 (11:03 +0300)
Implement a helper function to check if BIOS input notifications are
enabled or disabled.

Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Tested-by: Yijun Shen <Yijun.Shen@Dell.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://patch.msgid.link/20250901110140.2519072-6-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/acpi.c
drivers/platform/x86/amd/pmf/pmf.h

index f75f7ecd8cd91c9d55abc38ce6e46eed7fe69fc0..4982311ac0455ad7e92e80719818136066e909f3 100644 (file)
@@ -161,6 +161,11 @@ int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index)
        return !!(pdev->supported_func & BIT(index - 1));
 }
 
+int is_apmf_bios_input_notifications_supported(struct amd_pmf_dev *pdev)
+{
+       return !!(pdev->notifications & CUSTOM_BIOS_INPUT_BITS);
+}
+
 int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev,
                                       struct amd_pmf_apts_granular_output *data, u32 apts_idx)
 {
@@ -385,6 +390,7 @@ static int apmf_if_verify_interface(struct amd_pmf_dev *pdev)
 
        pdev->pmf_if_version = output.version;
 
+       pdev->notifications =  output.notification_mask;
        return 0;
 }
 
index f5e874b10f0fdda75f108f1d0437dfe87684e4f2..6ddd1a6e9115c1678729152be6269d36f9f4db0c 100644 (file)
@@ -118,6 +118,7 @@ struct cookie_header {
 #define PMF_IF_V2              2
 
 #define APTS_MAX_STATES                16
+#define CUSTOM_BIOS_INPUT_BITS GENMASK(16, 7)
 
 /* APTS PMF BIOS Interface */
 struct amd_pmf_apts_output {
@@ -377,6 +378,7 @@ struct amd_pmf_dev {
        struct resource *res;
        struct apmf_sbios_req_v2 req; /* To get custom bios pending request */
        struct mutex cb_mutex;
+       u32 notifications;
 };
 
 struct apmf_sps_prop_granular_v2 {
@@ -641,6 +643,19 @@ static const struct amd_pmf_pb_bitmap custom_bios_inputs[] __used = {
        {"NOTIFY_CUSTOM_BIOS_INPUT10",    BIT(14)},
 };
 
+static const struct amd_pmf_pb_bitmap custom_bios_inputs_v1[] __used = {
+       {"NOTIFY_CUSTOM_BIOS_INPUT1",     BIT(7)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT2",     BIT(8)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT3",     BIT(9)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT4",     BIT(10)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT5",     BIT(11)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT6",     BIT(12)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT7",     BIT(13)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT8",     BIT(14)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT9",     BIT(15)},
+       {"NOTIFY_CUSTOM_BIOS_INPUT10",    BIT(16)},
+};
+
 enum platform_type {
        PTYPE_UNKNOWN = 0,
        LID_CLOSE,
@@ -792,6 +807,7 @@ int apmf_os_power_slider_update(struct amd_pmf_dev *dev, u8 flag);
 int amd_pmf_set_dram_addr(struct amd_pmf_dev *dev, bool alloc_buffer);
 int amd_pmf_notify_sbios_heartbeat_event_v2(struct amd_pmf_dev *dev, u8 flag);
 u32 fixp_q88_fromint(u32 val);
+int is_apmf_bios_input_notifications_supported(struct amd_pmf_dev *pdev);
 
 /* SPS Layer */
 int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf);