mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
asoc: codecs: Avoid spi data transfer during suspend
SPI data transfer can happen during suspend due to race conditions leading to NOC issues. Synchronize data transfer and suspend to fix this issue. Change-Id: Ia5b4d0d16d9bf4fa4a4b73e3509a7d04b45d843f Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
parent
1543085859
commit
d7ee50cc8e
1 changed files with 11 additions and 1 deletions
|
|
@ -815,6 +815,15 @@ static int __wcd_spi_data_xfer(struct spi_device *spi,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
WCD_SPI_MUTEX_LOCK(spi, wcd_spi->clk_mutex);
|
||||
if (wcd_spi_is_suspended(wcd_spi)) {
|
||||
dev_dbg(&spi->dev,
|
||||
"%s: SPI suspended, cannot perform transfer\n",
|
||||
__func__);
|
||||
ret = -EIO;
|
||||
goto done;
|
||||
}
|
||||
|
||||
WCD_SPI_MUTEX_LOCK(spi, wcd_spi->xfer_mutex);
|
||||
if (msg->len == WCD_SPI_WORD_BYTE_CNT) {
|
||||
if (xfer_req == WCD_SPI_XFER_WRITE)
|
||||
|
|
@ -827,7 +836,8 @@ static int __wcd_spi_data_xfer(struct spi_device *spi,
|
|||
ret = wcd_spi_transfer_split(spi, msg, xfer_req);
|
||||
}
|
||||
WCD_SPI_MUTEX_UNLOCK(spi, wcd_spi->xfer_mutex);
|
||||
|
||||
done:
|
||||
WCD_SPI_MUTEX_UNLOCK(spi, wcd_spi->clk_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue