* [PATCH v1 1/1] mfd: intel-lpss: Switch to generalized quirk table
@ 2023-12-21 17:11 Aleksandrs Vinarskis
2023-12-21 17:44 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Aleksandrs Vinarskis @ 2023-12-21 17:11 UTC (permalink / raw)
To: Lee Jones, Andy Shevchenko, Aleksandrs Vinarskis, linux-kernel
Introduce generic quirk table, and port existing walkaround for select
Microsoft devices to it. This is a preparation for
QUIRK_CLOCK_DIVIDER_UNITY.
---
drivers/mfd/intel-lpss-pci.c | 15 +++++++++------
drivers/mfd/intel-lpss.c | 2 +-
drivers/mfd/intel-lpss.h | 9 ++++++++-
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index 4621d3950b8f..433f9380a465 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -23,12 +23,13 @@
#include "intel-lpss.h"
-/* Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resources */
-static const struct pci_device_id ignore_resource_conflicts_ids[] = {
+static const struct pci_device_id quirk_ids[] = {
/* Microsoft Surface Go (version 1) I2C4 */
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182), },
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182),
+ .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
/* Microsoft Surface Go 2 I2C4 */
- { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), },
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
+ .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
{ }
};
@@ -36,6 +37,7 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
const struct intel_lpss_platform_info *data = (void *)id->driver_data;
+ const struct pci_device_id *quirk_pci_info;
struct intel_lpss_platform_info *info;
int ret;
@@ -55,8 +57,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
info->mem = pci_resource_n(pdev, 0);
info->irq = pci_irq_vector(pdev, 0);
- if (pci_match_id(ignore_resource_conflicts_ids, pdev))
- info->ignore_resource_conflicts = true;
+ quirk_pci_info = pci_match_id(quirk_ids, pdev);
+ if (quirk_pci_info)
+ info->quirks = quirk_pci_info->driver_data;
pdev->d3cold_delay = 0;
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index eff423f7dd28..aafa0da5f8db 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -412,7 +412,7 @@ int intel_lpss_probe(struct device *dev,
return ret;
lpss->cell->swnode = info->swnode;
- lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;
+ lpss->cell->ignore_resource_conflicts = info->quirks & QUIRK_IGNORE_RESOURCE_CONFLICTS;
intel_lpss_init_dev(lpss);
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index c1d72b117ed5..2fa9ef916258 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -11,16 +11,23 @@
#ifndef __MFD_INTEL_LPSS_H
#define __MFD_INTEL_LPSS_H
+#include <linux/bits.h>
#include <linux/pm.h>
+/*
+ * Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resources.
+ * Set to ignore resource conflicts with ACPI declared SystemMemory regions.
+ */
+#define QUIRK_IGNORE_RESOURCE_CONFLICTS BIT(0)
+
struct device;
struct resource;
struct software_node;
struct intel_lpss_platform_info {
struct resource *mem;
- bool ignore_resource_conflicts;
int irq;
+ unsigned int quirks;
unsigned long clk_rate;
const char *clk_con_id;
const struct software_node *swnode;
--
2.40.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1 1/1] mfd: intel-lpss: Switch to generalized quirk table
2023-12-21 17:11 [PATCH v1 1/1] mfd: intel-lpss: Switch to generalized quirk table Aleksandrs Vinarskis
@ 2023-12-21 17:44 ` Andy Shevchenko
2023-12-21 17:45 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-12-21 17:44 UTC (permalink / raw)
To: Aleksandrs Vinarskis; +Cc: Lee Jones, linux-kernel
On Thu, Dec 21, 2023 at 06:11:13PM +0100, Aleksandrs Vinarskis wrote:
> Introduce generic quirk table, and port existing walkaround for select
> Microsoft devices to it. This is a preparation for
> QUIRK_CLOCK_DIVIDER_UNITY.
Check your repository, seems you forgot to add -s to git commit --amend or so.
...
> +static const struct pci_device_id quirk_ids[] = {
> /* Microsoft Surface Go (version 1) I2C4 */
> - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182), },
> + { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182),
> + .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
> /* Microsoft Surface Go 2 I2C4 */
> - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), },
> + { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
> + .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
> { }
> };
I would suggest to look at the existing style, as I also in doubts on the
above. Perhaps the following is more common in MFD subsystem?
{
PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
.driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS
},
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1 1/1] mfd: intel-lpss: Switch to generalized quirk table
2023-12-21 17:44 ` Andy Shevchenko
@ 2023-12-21 17:45 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-12-21 17:45 UTC (permalink / raw)
To: Aleksandrs Vinarskis; +Cc: Lee Jones, linux-kernel
On Thu, Dec 21, 2023 at 07:44:14PM +0200, Andy Shevchenko wrote:
> On Thu, Dec 21, 2023 at 06:11:13PM +0100, Aleksandrs Vinarskis wrote:
...
> > +static const struct pci_device_id quirk_ids[] = {
> > /* Microsoft Surface Go (version 1) I2C4 */
> > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182), },
> > + { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1182),
> > + .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
> > /* Microsoft Surface Go 2 I2C4 */
> > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237), },
> > + { PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
> > + .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS },
> > { }
> > };
>
> I would suggest to look at the existing style, as I also in doubts on the
> above. Perhaps the following is more common in MFD subsystem?
>
> {
> PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, 0x9d64, 0x152d, 0x1237),
> .driver_data = QUIRK_IGNORE_RESOURCE_CONFLICTS
Ah, and in this form we usually leave trailing comma as we don't know
the future (possible, but quite unlikely, new fields in the structure).
> },
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-21 17:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 17:11 [PATCH v1 1/1] mfd: intel-lpss: Switch to generalized quirk table Aleksandrs Vinarskis
2023-12-21 17:44 ` Andy Shevchenko
2023-12-21 17:45 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®