From a3474a731e0123037abbff227e5cbfde6e0ec0ee Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Wed, 25 Jan 2017 23:24:28 -0200 Subject: [PATCH] Bluetooth: SPI: Disable IRQ pin callback to avoid spurious IRQs Avoid spurious IRQ when already handling the SPI Slave IRQ. Change-Id: If8452a668bc9768d462a5fa56b851e99a076e67c Signed-off-by: Ricardo Salveti --- drivers/bluetooth/hci/spi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index 08e9778182f..4015b916b71 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -142,6 +142,8 @@ static void bt_spi_rx_thread(void) while (true) { k_sem_take(&sem_request, K_FOREVER); + /* Disable IRQ pin callback to avoid spurious IRQs */ + gpio_pin_disable_callback(irq_dev, GPIO_IRQ_PIN); k_sem_take(&sem_busy, K_FOREVER); do { @@ -159,6 +161,7 @@ static void bt_spi_rx_thread(void) spi_transceive(spi_dev, &txmsg, size, &rxmsg, size); } while (rxmsg[0] == 0); + gpio_pin_enable_callback(irq_dev, GPIO_IRQ_PIN); #if defined(CONFIG_BLUETOOTH_SPI_BLUENRG) gpio_pin_write(cs_dev, GPIO_CS_PIN, 1); #endif /* CONFIG_BLUETOOTH_SPI_BLUENRG */