spi_qmsi_ss: add device_busy_set() to avoid re-enter deep sleep
When CONFIG_SYS_POWER_DEEP_SLEEP is enabled, spi_qmsi_ss will keep entering deep sleep because it needs to wait until the current transfer completes, which blocks the current thread. The system keeps entering deep sleep again and again and the transfer will never complete. Add device_busy_set() to spi_qmsi_ss driver to indicate that the device is busy and block the system from entering deep sleep during transaction. Jira: ZEP-1488 Change-Id: I5a4456933249def93eaa529b30b99d730af74482 Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
This commit is contained in:
parent
e4ad31a231
commit
b549e0fbca
1 changed files with 5 additions and 0 deletions
|
@ -169,6 +169,8 @@ static int ss_spi_qmsi_transceive(struct device *dev,
|
|||
pending_transfers[spi_id].dev = dev;
|
||||
k_sem_give(&context->sem);
|
||||
|
||||
device_busy_set(dev);
|
||||
|
||||
xfer = &pending_transfers[spi_id].xfer;
|
||||
|
||||
xfer->rx = rx_buf;
|
||||
|
@ -206,6 +208,7 @@ static int ss_spi_qmsi_transceive(struct device *dev,
|
|||
|
||||
rc = qm_ss_spi_set_config(spi_id, cfg);
|
||||
if (rc != 0) {
|
||||
device_busy_clear(dev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -218,11 +221,13 @@ static int ss_spi_qmsi_transceive(struct device *dev,
|
|||
#ifdef CONFIG_SPI_SS_CS_GPIO
|
||||
spi_control_cs(dev, false);
|
||||
#endif
|
||||
device_busy_clear(dev);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
k_sem_take(&context->device_sync_sem, K_FOREVER);
|
||||
|
||||
device_busy_clear(dev);
|
||||
return context->rc ? -EIO : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue