diff mbox

[v7,3/3] ACPI / spi: attach gpio irq from acpi description to spi device

Message ID 1450163493-4938-4-git-send-email-christophe-h.ricard@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christophe Ricard Dec. 15, 2015, 7:11 a.m. UTC
spi->irq was ignoring GpioInt property setting it to -1.
acpi_dev_gpio_irq_get returns and configure the slave irq according to
the acpi slave node description.
It is now inline with devicetree behavior.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
---
 drivers/spi/spi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Brown Dec. 18, 2015, 8:01 a.m. UTC | #1
On Tue, Dec 15, 2015 at 08:11:33AM +0100, Christophe Ricard wrote:
> spi->irq was ignoring GpioInt property setting it to -1.
> acpi_dev_gpio_irq_get returns and configure the slave irq according to
> the acpi slave node description.
> It is now inline with devicetree behavior.

Acked-by: Mark Brown <broonie@kernel.org>

though it seems like we might want to have a common "get the interrupt
for this ACPI device" function here.  OTOH there's only a few users.
Mika Westerberg Dec. 18, 2015, 9:17 a.m. UTC | #2
On Tue, Dec 15, 2015 at 08:11:33AM +0100, Christophe Ricard wrote:
> spi->irq was ignoring GpioInt property setting it to -1.
> acpi_dev_gpio_irq_get returns and configure the slave irq according to
> the acpi slave node description.
> It is now inline with devicetree behavior.
> 
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> ---
>  drivers/spi/spi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 2b0a8ec..6e5d1f7 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1583,6 +1583,8 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
>  
>  		if (acpi_dev_resource_interrupt(ares, 0, &r))
>  			spi->irq = r.start;
> +		else
> +			spi->irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(&spi->dev), 0);

This still does not work as expected if the device has other resources
in _CRS.

Instead of this, you should do something like below which only uses GPIO
when we are sure no Interrupt() resource was found.

acpi_spi_add_device()
{
	...
	acpi_dev_get_resources()
	...

	if (spi->irq < 0)
		spi->irq = acpi_dev_gpio_irq_get(adev, 0);
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2b0a8ec..6e5d1f7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1583,6 +1583,8 @@  static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
 
 		if (acpi_dev_resource_interrupt(ares, 0, &r))
 			spi->irq = r.start;
+		else
+			spi->irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(&spi->dev), 0);
 	}
 
 	/* Always tell the ACPI core to skip this resource */