From 60a9f33f37ae4c5517d084045589543aad63e38c Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 16 Nov 2023 17:13:23 +1000 Subject: [PATCH] drivers: flash: spi_nor: boot into DPD Boot into the deep power down state when `SPI_NOR_IDLE_IN_DPD` is not enabled. DPD is the correct hardware state for the `SUSPENDED` software state. Without this change, it takes a cycle of `SUSPENDED->ACTIVE->SUSPENDED` to get to the low power state. Signed-off-by: Jordan Yates --- drivers/flash/spi_nor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index ea23d11eb959..1658fce10398 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1359,6 +1359,16 @@ static int spi_nor_pm_control(const struct device *dev, enum pm_device_action ac case PM_DEVICE_ACTION_TURN_ON: /* Coming out of power off */ rc = spi_nor_configure(dev); +#ifndef CONFIG_SPI_NOR_IDLE_IN_DPD + if (rc == 0) { + /* Move to DPD, the correct device state + * for PM_DEVICE_STATE_SUSPENDED + */ + acquire_device(dev); + rc = enter_dpd(dev); + release_device(dev); + } +#endif /* CONFIG_SPI_NOR_IDLE_IN_DPD */ break; case PM_DEVICE_ACTION_TURN_OFF: break;