diff options
author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2022-08-02 20:41:48 +0530 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-08-15 13:23:38 +0200 |
commit | 9448ec9b0f90ce0479264d37106b9f5df232ea41 (patch) | |
tree | 88dc14c2bd4f5b7fe51b401feea72631007a0ee9 /drivers/platform/x86/amd/pmf | |
parent | 7d77dcc83adaffacbb9000924a212566170c1257 (diff) |
platform/x86/amd/pmf: Force load driver on older supported platforms
Some of the older platforms with _HID "AMDI0100" PMF driver can be force
loaded by interested users but only for experimental purposes.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20220802151149.2123699-11-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/amd/pmf')
-rw-r--r-- | drivers/platform/x86/amd/pmf/core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index 228fe243a13c..e46d63aa51b8 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -39,6 +39,7 @@ #define AMD_PMF_RESULT_FAILED 0xFF /* List of supported CPU ids */ +#define AMD_CPU_ID_RMB 0x14b5 #define AMD_CPU_ID_PS 0x14e8 #define PMF_MSG_DELAY_MIN_US 50 @@ -52,6 +53,11 @@ static int metrics_table_loop_ms = 1000; module_param(metrics_table_loop_ms, int, 0644); MODULE_PARM_DESC(metrics_table_loop_ms, "Metrics Table sample size time (default = 1000ms)"); +/* Force load on supported older platforms */ +static bool force_load; +module_param(force_load, bool, 0444); +MODULE_PARM_DESC(force_load, "Force load this driver on supported older platforms (experimental)"); + static int current_power_limits_show(struct seq_file *seq, void *unused) { struct amd_pmf_dev *dev = seq->private; @@ -208,6 +214,7 @@ out_unlock: } static const struct pci_device_id pmf_pci_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_RMB) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PS) }, { } }; @@ -265,6 +272,7 @@ static void amd_pmf_deinit_features(struct amd_pmf_dev *dev) } static const struct acpi_device_id amd_pmf_acpi_ids[] = { + {"AMDI0100", 0x100}, {"AMDI0102", 0}, { } }; @@ -272,6 +280,7 @@ MODULE_DEVICE_TABLE(acpi, amd_pmf_acpi_ids); static int amd_pmf_probe(struct platform_device *pdev) { + const struct acpi_device_id *id; struct amd_pmf_dev *dev; struct pci_dev *rdev; u32 base_addr_lo; @@ -280,6 +289,13 @@ static int amd_pmf_probe(struct platform_device *pdev) u32 val; int err; + id = acpi_match_device(amd_pmf_acpi_ids, &pdev->dev); + if (!id) + return -ENODEV; + + if (id->driver_data == 0x100 && !force_load) + return -ENODEV; + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; |