mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
drivers/rpmsg_port_spi: call rpmsg_port_spi_pm_action(false) in inactive path
Only call rpmsg_port_spi_pm_action(false) when no more data to transfer to avoid unnecessary pm unlock/lock operations. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -461,7 +461,6 @@ static void rpmsg_port_spi_complete_handler(FAR void *arg)
|
|||||||
unlock:
|
unlock:
|
||||||
spin_unlock_irqrestore(&rpspi->lock, flags);
|
spin_unlock_irqrestore(&rpspi->lock, flags);
|
||||||
out:
|
out:
|
||||||
rpmsg_port_spi_pm_action(rpspi, false);
|
|
||||||
if (atomic_xchg(&rpspi->transferring, 0) > 1)
|
if (atomic_xchg(&rpspi->transferring, 0) > 1)
|
||||||
{
|
{
|
||||||
rpmsg_port_spi_exchange(rpspi);
|
rpmsg_port_spi_exchange(rpspi);
|
||||||
@@ -471,6 +470,10 @@ out:
|
|||||||
{
|
{
|
||||||
IOEXP_WRITEPIN(rpspi->ioe, rpspi->mreq, 1);
|
IOEXP_WRITEPIN(rpspi->ioe, rpspi->mreq, 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rpmsg_port_spi_pm_action(rpspi, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -522,12 +522,15 @@ static void rpmsg_port_spi_slave_notify(FAR struct spi_slave_dev_s *dev,
|
|||||||
unlock:
|
unlock:
|
||||||
spin_unlock_irqrestore(&rpspi->lock, flags);
|
spin_unlock_irqrestore(&rpspi->lock, flags);
|
||||||
out:
|
out:
|
||||||
rpmsg_port_spi_pm_action(rpspi, false);
|
|
||||||
if (atomic_xchg(&rpspi->transferring, 0) > 1 ||
|
if (atomic_xchg(&rpspi->transferring, 0) > 1 ||
|
||||||
(rpspi->txavail > 0 && rpmsg_port_queue_nused(&rpspi->port.txq) > 0))
|
(rpspi->txavail > 0 && rpmsg_port_queue_nused(&rpspi->port.txq) > 0))
|
||||||
{
|
{
|
||||||
rpmsg_port_spi_exchange(rpspi);
|
rpmsg_port_spi_exchange(rpspi);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rpmsg_port_spi_pm_action(rpspi, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user