mfd: intel-lpss: Fix I2C4 not being available on the Microsoft Surface Go & Go 2
PATCH 1/1 mfd: intel-lpss: Fix I2C4 not being available on the Microsoft Surface Go & Go 2
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a _SB.PCI0.GEXP ACPI Device node describing an I2C attached GPIO expander.
This seems to be something which is copy and pasted from the DSDT from some reference design since this ACPI Device is present even on models where no such GPIO expander is used at all, such as on the Microsoft Surface Go & Go 2.
This ACPI Device is a problem because it contains a SystemMemory OperationRegion which covers the MMIO for the I2C4 I2C controller this causes the MFD cell for the I2C4 controller to not be instantiated due to a resource conflict, requiring the use of acpi_enforce_resources=lax to work around this.
I have done an extensive analysis of all the ACPI tables on the Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are not used by any code in the ACPI tables, neither are any of them directly called by any Linux kernel code. This is unsurprising since running i2cdetect on the I2C4 bus shows that there is no GPIO expander chip present on these devices at all.
This commit adds a PCI subsystem vendor:device table listing PCI devices where it is known to be safe to ignore a resource-conflicts with ACPI declared SystemMemory regions.
This makes the I2C4 bus work out of the box on the Microsoft Surface Go & Go 2, which is necessary for the cameras on these devices to work.
--- drivers/mfd/intel-lpss-pci.c | 12 ++++++++++++ drivers/mfd/intel-lpss.c | 1 + drivers/mfd/intel-lpss.h | 1 + 3 files changed, 14 insertions(+)
drivers/mfd/intel-lpss-pci.c +12 -0
@@ -17,6 +17,15 @@#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[] = { +/* Microsoft Surface Go (version 1) I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1182 ), }, +/* Microsoft Surface Go 2 I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1237 ), }, + { } +}; +static int intel_lpss_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {
@@ -35,6 +44,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem = &pdev->resource[0 ]; info->irq = pdev->irq; +if (pci_match_id (ignore_resource_conflicts_ids, pdev)) + info->ignore_resource_conflicts = true; + pdev->d3cold_delay =0 ;/* Probably it is enough to set this for iDMA capable devices only */
drivers/mfd/intel-lpss.c +1 -0
@@ -401,6 +401,7 @@ int intel_lpss_probe(struct device *dev,return ret; lpss->cell->swnode = info->swnode; + lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;intel_lpss_init_dev (lpss);
drivers/mfd/intel-lpss.h +1 -0
@@ -19,6 +19,7 @@ struct software_node;struct intel_lpss_platform_info {struct resource *mem; +bool ignore_resource_conflicts;int irq;unsigned long clk_rate;const char *clk_con_id;
Signature · 1 line
2.33.1
Hi Hans,
Thank you for the patch.
Quoted 10 lines · Hans de Goede
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a _SB.PCI0.GEXP ACPI Device node describing an I2C attached GPIO expander.
This seems to be something which is copy and pasted from the DSDT from some reference design since this ACPI Device is present even on models where no such GPIO expander is used at all, such as on the Microsoft Surface Go & Go 2.
This ACPI Device is a problem because it contains a SystemMemory OperationRegion which covers the MMIO for the I2C4 I2C controller this
s/this/that/ (or ". This" ?)
Quoted 11 lines
causes the MFD cell for the I2C4 controller to not be instantiated due to a resource conflict, requiring the use of acpi_enforce_resources=lax to work around this.
I have done an extensive analysis of all the ACPI tables on the Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are not used by any code in the ACPI tables, neither are any of them directly called by any Linux kernel code. This is unsurprising since running i2cdetect on the I2C4 bus shows that there is no GPIO expander chip present on these devices at all.
Quoted 6 lines
This commit adds a PCI subsystem vendor:device table listing PCI devices where it is known to be safe to ignore a resource-conflicts with ACPI declared SystemMemory regions.
This makes the I2C4 bus work out of the box on the Microsoft Surface Go & Go 2, which is necessary for the cameras on these devices to work.
This will make the life of the Go and Go2 users *much* easier.
Quoted 16 lines
Cc Laurent Pinchart <[email protected]>Cc Dan Scally <[email protected]>Cc Kate Hsuan <[email protected]>Cc Maximilian Luz <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/mfd/intel-lpss-pci.c | 12 ++++++++++++ drivers/mfd/intel-lpss.c | 1 + drivers/mfd/intel-lpss.h | 1 + 3 files changed, 14 insertions(+)drivers/mfd/intel-lpss-pci.c +0
-0
drivers/mfd/intel-lpss-pci.c line 26
Quoted 10 lines
drivers/mfd/intel-lpss-pci.c +7
-0@@ -17,6 +17,15 @@#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[] = { +/* Microsoft Surface Go (version 1) I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1182 ), }, +/* Microsoft Surface Go 2 I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1237 ), }, + { }
Reading the commit message, I was going to mention that the match should probably be machine-dependent, but that seems to be covered by the PCI subsystem ID.
Quoted 39 lines
drivers/mfd/intel-lpss-pci.c +5
-0+}; +static int intel_lpss_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {@@ -35,6 +44,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem = &pdev->resource[0 ]; info->irq = pdev->irq; +if (pci_match_id (ignore_resource_conflicts_ids, pdev)) + info->ignore_resource_conflicts = true; + pdev->d3cold_delay =0 ;/* Probably it is enough to set this for iDMA capable devices only */ drivers/mfd/intel-lpss.c +1
-0@@ -401,6 +401,7 @@ int intel_lpss_probe(struct device *dev,return ret; lpss->cell->swnode = info->swnode; + lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;intel_lpss_init_dev (lpss);drivers/mfd/intel-lpss.h +1
-0@@ -19,6 +19,7 @@ struct software_node;struct intel_lpss_platform_info {struct resource *mem; +bool ignore_resource_conflicts;int irq;unsigned long clk_rate;const char *clk_con_id;
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent,
Quoted 13 lines · Laurent Pinchart
Hi Hans,
Thank you for the patch.
Quoted 8 lines · Hans de Goede
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a _SB.PCI0.GEXP ACPI Device node describing an I2C attached GPIO expander.
This seems to be something which is copy and pasted from the DSDT from some reference design since this ACPI Device is present even on models where no such GPIO expander is used at all, such as on the Microsoft Surface Go & Go 2.
Quoted 4 lines
Quoted 2 lines
This ACPI Device is a problem because it contains a SystemMemory OperationRegion which covers the MMIO for the I2C4 I2C controller this
s/this/that/ (or ". This" ?)
I've gone with ". This" for v2.
Quoted 52 lines
Quoted 12 lines
causes the MFD cell for the I2C4 controller to not be instantiated due to a resource conflict, requiring the use of acpi_enforce_resources=lax to work around this.
I have done an extensive analysis of all the ACPI tables on the Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are not used by any code in the ACPI tables, neither are any of them directly called by any Linux kernel code. This is unsurprising since running i2cdetect on the I2C4 bus shows that there is no GPIO expander chip present on these devices at all.
Quoted 6 lines
This commit adds a PCI subsystem vendor:device table listing PCI devices where it is known to be safe to ignore a resource-conflicts with ACPI declared SystemMemory regions.
This makes the I2C4 bus work out of the box on the Microsoft Surface Go & Go 2, which is necessary for the cameras on these devices to work.
This will make the life of the Go and Go2 users *much* easier.
Quoted 16 lines
Cc Laurent Pinchart <[email protected]>Cc Dan Scally <[email protected]>Cc Kate Hsuan <[email protected]>Cc Maximilian Luz <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/mfd/intel-lpss-pci.c | 12 ++++++++++++ drivers/mfd/intel-lpss.c | 1 + drivers/mfd/intel-lpss.h | 1 + 3 files changed, 14 insertions(+)drivers/mfd/intel-lpss-pci.c +0
-0drivers/mfd/intel-lpss-pci.c line 26
Quoted 10 lines
drivers/mfd/intel-lpss-pci.c +7
-0@@ -17,6 +17,15 @@#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[] = { +/* Microsoft Surface Go (version 1) I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1182 ), }, +/* Microsoft Surface Go 2 I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1237 ), }, + { }Reading the commit message, I was going to mention that the match should probably be machine-dependent, but that seems to be covered by the PCI subsystem ID.
Quoted 1 line
Reviewed-by Laurent Pinchart <[email protected]>
Thanks you.
Regards,
Hans
Quoted 41 lines
Quoted 40 lines
drivers/mfd/intel-lpss-pci.c +5
-0+}; +static int intel_lpss_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {@@ -35,6 +44,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem = &pdev->resource[0 ]; info->irq = pdev->irq; +if (pci_match_id (ignore_resource_conflicts_ids, pdev)) + info->ignore_resource_conflicts = true; + pdev->d3cold_delay =0 ;/* Probably it is enough to set this for iDMA capable devices only */ drivers/mfd/intel-lpss.c +1
-0@@ -401,6 +401,7 @@ int intel_lpss_probe(struct device *dev,return ret; lpss->cell->swnode = info->swnode; + lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;intel_lpss_init_dev (lpss);drivers/mfd/intel-lpss.h +1
-0@@ -19,6 +19,7 @@ struct software_node;struct intel_lpss_platform_info {struct resource *mem; +bool ignore_resource_conflicts;int irq;unsigned long clk_rate;const char *clk_con_id;
Quoted 3 lines · Hans de Goede
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a _SB.PCI0.GEXP ACPI Device node describing an I2C attached GPIO expander.
For the record (and probably good to mention it's here) it's a PCA953x compatible one.
Quoted 4 lines
This seems to be something which is copy and pasted from the DSDT from some reference design since this ACPI Device is present even on models where no such GPIO expander is used at all, such as on the Microsoft Surface Go & Go 2.
Does this come from schematics? Or..? Ah, I see below.
Quoted 5 lines
This ACPI Device is a problem because it contains a SystemMemory OperationRegion which covers the MMIO for the I2C4 I2C controller this causes the MFD cell for the I2C4 controller to not be instantiated due to a resource conflict, requiring the use of acpi_enforce_resources=lax to work around this.
Right.
Quoted 6 lines
I have done an extensive analysis of all the ACPI tables on the Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are not used by any code in the ACPI tables, neither are any of them directly called by any Linux kernel code. This is unsurprising since running i2cdetect on the I2C4 bus shows that there is no GPIO expander chip present on these devices at all.
I believe it's an optional component on our reference designs (I saw a lot of those expanders on our development boards).
Quoted 2 lines
This commit adds a PCI subsystem vendor:device table listing PCI devices where it is known to be safe to ignore a resource-conflicts with ACPI
ignore resource conflicts
(no article, no dash) ?
Quoted 4 lines
declared SystemMemory regions.
This makes the I2C4 bus work out of the box on the Microsoft Surface Go & Go 2, which is necessary for the cameras on these devices to work.
After addressing comments
Thanks for the patch!
Quoted 16 lines
Cc Laurent Pinchart <[email protected]>Cc Dan Scally <[email protected]>Cc Kate Hsuan <[email protected]>Cc Maximilian Luz <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/mfd/intel-lpss-pci.c | 12 ++++++++++++ drivers/mfd/intel-lpss.c | 1 + drivers/mfd/intel-lpss.h | 1 + 3 files changed, 14 insertions(+)drivers/mfd/intel-lpss-pci.c +0
-0
drivers/mfd/intel-lpss-pci.c line 25
Quoted 9 lines
drivers/mfd/intel-lpss-pci.c +6
-0@@ -17,6 +17,15 @@#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[] = { +/* Microsoft Surface Go (version 1) I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1182 ), }, +/* Microsoft Surface Go 2 I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1237 ), },
Can we use PCI_VENDOR_ID_INTEL?
Quoted 43 lines
drivers/mfd/intel-lpss-pci.c +6
-0+ { } +}; +static int intel_lpss_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {@@ -35,6 +44,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem = &pdev->resource[0 ]; info->irq = pdev->irq; +if (pci_match_id (ignore_resource_conflicts_ids, pdev)) + info->ignore_resource_conflicts = true; + pdev->d3cold_delay =0 ;/* Probably it is enough to set this for iDMA capable devices only */ drivers/mfd/intel-lpss.c +1
-0@@ -401,6 +401,7 @@ int intel_lpss_probe(struct device *dev,return ret; lpss->cell->swnode = info->swnode; + lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;intel_lpss_init_dev (lpss);drivers/mfd/intel-lpss.h +1
-1@@ -19,6 +19,7 @@ struct software_node;struct intel_lpss_platform_info {struct resource *mem; +bool ignore_resource_conflicts;int irq;unsigned long clk_rate;const char *clk_con_id; --2.33.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines · Hans de Goede
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a _SB.PCI0.GEXP ACPI Device node describing an I2C attached GPIO expander.
For the record (and probably good to mention it's here) it's a PCA953x compatible one.
Ack, added to the commit msg for v2.
Quoted 22 lines
Quoted 4 lines
This seems to be something which is copy and pasted from the DSDT from some reference design since this ACPI Device is present even on models where no such GPIO expander is used at all, such as on the Microsoft Surface Go & Go 2.
Does this come from schematics? Or..? Ah, I see below.
Quoted 5 lines
This ACPI Device is a problem because it contains a SystemMemory OperationRegion which covers the MMIO for the I2C4 I2C controller this causes the MFD cell for the I2C4 controller to not be instantiated due to a resource conflict, requiring the use of acpi_enforce_resources=lax to work around this.
Right.
Quoted 6 lines
I have done an extensive analysis of all the ACPI tables on the Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are not used by any code in the ACPI tables, neither are any of them directly called by any Linux kernel code. This is unsurprising since running i2cdetect on the I2C4 bus shows that there is no GPIO expander chip present on these devices at all.
Quoted 7 lines
I believe it's an optional component on our reference designs (I saw a lot of those expanders on our development boards).
Quoted 2 lines
This commit adds a PCI subsystem vendor:device table listing PCI devices where it is known to be safe to ignore a resource-conflicts with ACPI
ignore resource conflicts
Ack, fixed for v2.
Quoted 30 lines
(no article, no dash) ?
Quoted 4 lines
declared SystemMemory regions.
This makes the I2C4 bus work out of the box on the Microsoft Surface Go & Go 2, which is necessary for the cameras on these devices to work.
After addressing comments
Reviewed-by Andy Shevchenko <[email protected]>Thanks for the patch!
Quoted 19 lines
Cc Laurent Pinchart <[email protected]>Cc Dan Scally <[email protected]>Cc Kate Hsuan <[email protected]>Cc Maximilian Luz <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/mfd/intel-lpss-pci.c | 12 ++++++++++++ drivers/mfd/intel-lpss.c | 1 + drivers/mfd/intel-lpss.h | 1 + 3 files changed, 14 insertions(+)drivers/mfd/intel-lpss-pci.c +0
-0@@ -17,6 +17,15 @@#include "intel-lpss.h"
Quoted 8 lines
drivers/mfd/intel-lpss-pci.c line 25
Quoted 6 lines
drivers/mfd/intel-lpss-pci.c +6
-0+/* Some DSDTs have an unused GEXP ACPI device conflicting with I2C4 resources */ +static const struct pci_device_id ignore_resource_conflicts_ids[] = { +/* Microsoft Surface Go (version 1) I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1182 ), }, +/* Microsoft Surface Go 2 I2C4 */ + {PCI_DEVICE_SUB (0x8086 ,0x9d64 ,0x152d ,0x1237 ), },Can we use
PCI_VENDOR_ID_INTEL?
Done for v2.
Thank you for the review.
Regards,
Hans
Quoted 46 lines
Quoted 44 lines
drivers/mfd/intel-lpss-pci.c +6
-0+ { } +}; +static int intel_lpss_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {@@ -35,6 +44,9 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev, info->mem = &pdev->resource[0 ]; info->irq = pdev->irq; +if (pci_match_id (ignore_resource_conflicts_ids, pdev)) + info->ignore_resource_conflicts = true; + pdev->d3cold_delay =0 ;/* Probably it is enough to set this for iDMA capable devices only */ drivers/mfd/intel-lpss.c +1
-0@@ -401,6 +401,7 @@ int intel_lpss_probe(struct device *dev,return ret; lpss->cell->swnode = info->swnode; + lpss->cell->ignore_resource_conflicts = info->ignore_resource_conflicts;intel_lpss_init_dev (lpss);drivers/mfd/intel-lpss.h +1
-1@@ -19,6 +19,7 @@ struct software_node;struct intel_lpss_platform_info {struct resource *mem; +bool ignore_resource_conflicts;int irq;unsigned long clk_rate;const char *clk_con_id; --2.33.1