platform/x86/amd/pmc: Only run IRQ1 firmware version check on Cezanne
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 12 Dec 2023 04:50:04 +0000 (22:50 -0600)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 18 Dec 2023 13:08:16 +0000 (15:08 +0200)
amd_pmc_wa_czn_irq1() only runs on Cezanne platforms currently but
may be extended to other platforms in the future.  Rename the function
and only check platform firmware version when it's called for a Cezanne
based platform.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20231212045006.97581-3-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.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/pmc/pmc.c

index 666cc6e98267b1496cd65f4a81db2e38ae77c8d8..824673a8673e586b559ce09ddedc64cca4401b72 100644 (file)
@@ -756,19 +756,22 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)
        return -EINVAL;
 }
 
-static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev)
+static int amd_pmc_wa_irq1(struct amd_pmc_dev *pdev)
 {
        struct device *d;
        int rc;
 
-       if (!pdev->major) {
-               rc = amd_pmc_get_smu_version(pdev);
-               if (rc)
-                       return rc;
-       }
+       /* cezanne platform firmware has a fix in 64.66.0 */
+       if (pdev->cpu_id == AMD_CPU_ID_CZN) {
+               if (!pdev->major) {
+                       rc = amd_pmc_get_smu_version(pdev);
+                       if (rc)
+                               return rc;
+               }
 
-       if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65))
-               return 0;
+               if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65))
+                       return 0;
+       }
 
        d = bus_find_device_by_name(&serio_bus, NULL, "serio0");
        if (!d)
@@ -928,7 +931,7 @@ static int amd_pmc_suspend_handler(struct device *dev)
        struct amd_pmc_dev *pdev = dev_get_drvdata(dev);
 
        if (pdev->cpu_id == AMD_CPU_ID_CZN && !disable_workarounds) {
-               int rc = amd_pmc_czn_wa_irq1(pdev);
+               int rc = amd_pmc_wa_irq1(pdev);
 
                if (rc) {
                        dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc);