Skip to content

Commit

Permalink
drivers: flash: spi_nor: boot into DPD
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jordan Yates authored and carlescufi committed Dec 19, 2023
1 parent f82c2f9 commit 60a9f33
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/flash/spi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 60a9f33

Please sign in to comment.