]> git.hungrycats.org Git - linux/commitdiff
mfd: intel-lpss: Introduce QUIRK_CLOCK_DIVIDER_UNITY for XPS 9530
authorAleksandrs Vinarskis <alex.vinarskis@gmail.com>
Thu, 21 Dec 2023 18:51:42 +0000 (19:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:45 +0000 (15:11 +0200)
commit 1d8c51ed2ddcc4161e6496cf14fcd83921c50ec8 upstream.

Some devices (eg. Dell XPS 9530, 2023) due to a firmware bug have a
misconfigured clock divider, which should've been 1:1. This introduces
quirk which conditionally re-configures the clock divider to 1:1.

Signed-off-by: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231221185142.9224-3-alex.vinarskis@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mfd/intel-lpss-pci.c
drivers/mfd/intel-lpss.c
drivers/mfd/intel-lpss.h

index eb3b0195db2e8a3e87f1603a2234689f77427e85..cab11ed23b4f35a150031aa9dfa712cd7117f2cd 100644 (file)
@@ -29,6 +29,11 @@ static const struct pci_device_id quirk_ids[] = {
                PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
                .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS,
        },
+       {
+               /* Dell XPS 9530 (2023) */
+               PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x51fb, 0x1028, 0x0beb),
+               .driver_data = QUIRK_CLOCK_DIVIDER_UNITY,
+       },
        { }
 };
 
index 7af0a1fab062e31cb43d28e71a829b3ce999eb1e..d422e88ba491bf907a43839640f0e776f7b4615d 100644 (file)
@@ -292,6 +292,7 @@ static int intel_lpss_register_clock_divider(struct intel_lpss *lpss,
 {
        char name[32];
        struct clk *tmp = *clk;
+       int ret;
 
        snprintf(name, sizeof(name), "%s-enable", devname);
        tmp = clk_register_gate(NULL, name, __clk_get_name(tmp), 0,
@@ -308,6 +309,12 @@ static int intel_lpss_register_clock_divider(struct intel_lpss *lpss,
                return PTR_ERR(tmp);
        *clk = tmp;
 
+       if (lpss->info->quirks & QUIRK_CLOCK_DIVIDER_UNITY) {
+               ret = clk_set_rate(tmp, lpss->info->clk_rate);
+               if (ret)
+                       return ret;
+       }
+
        snprintf(name, sizeof(name), "%s-update", devname);
        tmp = clk_register_gate(NULL, name, __clk_get_name(tmp),
                                CLK_SET_RATE_PARENT, lpss->priv, 31, 0, NULL);
index f636059cbc71d4e5095892b4894bccc4225d989b..f50d11d60d94a3a527fd4863a113be38f141ce3c 100644 (file)
  * Set to ignore resource conflicts with ACPI declared SystemMemory regions.
  */
 #define QUIRK_IGNORE_RESOURCE_CONFLICTS BIT(0)
+/*
+ * Some devices have misconfigured clock divider due to a firmware bug.
+ * Set this to force the clock divider to 1:1 ratio.
+ */
+#define QUIRK_CLOCK_DIVIDER_UNITY              BIT(1)
 
 struct device;
 struct resource;