Skip to content

Commit

Permalink
spi: Fix acpi deferred irq probe
Browse files Browse the repository at this point in the history
When probing spi device take care of deferred probe of ACPI irq gpio
similar like for OF/DT case.

>From practical standpoint this fixes issue with vsc-tp driver on
Dell XP 9340 laptop, which try to request interrupt with spi->irq
equal to -EPROBE_DEFER and fail to probe with the following error:

vsc-tp spi-INTC10D0:00: probe with driver vsc-tp failed with error -22

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Fixes: 33ada67 ("ACPI / spi: attach GPIO IRQ from ACPI description to SPI device")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Alexis Lothoré <alexis.lothore@bootlin.com> # Dell XPS9320, ov01a10
Link: https://patch.msgid.link/20241122094224.226773-1-stanislaw.gruszka@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Stanislaw Gruszka authored and Mark Brown committed Nov 26, 2024
1 parent 2ac40e6 commit d24cfee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,16 @@ static int spi_probe(struct device *dev)
spi->irq = 0;
}

if (has_acpi_companion(dev) && spi->irq < 0) {
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);

spi->irq = acpi_dev_gpio_irq_get(adev, 0);
if (spi->irq == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (spi->irq < 0)
spi->irq = 0;
}

ret = dev_pm_domain_attach(dev, true);
if (ret)
return ret;
Expand Down Expand Up @@ -2866,9 +2876,6 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
sizeof(spi->modalias));

if (spi->irq < 0)
spi->irq = acpi_dev_gpio_irq_get(adev, 0);

acpi_device_set_enumerated(adev);

adev->power.flags.ignore_parent = true;
Expand Down

0 comments on commit d24cfee

Please sign in to comment.