driver: soc: power: npcx: Add power managerment support.

This CL introduces power management driver that improves the efficiency
of ec operation by adjusting the chip’s power consumption to the level
of activity required by the application in npcx series.

The following list summarizes the main properties of the various chip
power states. Please refer the power.c file for more detail.

Main power states in npcx series include:
- Active: Core, RAM and modules operate at the clocks generated by PLL.
- Idle: Enter this state when the Core executes WFI or WFE instruction.
- Sleep: clock is stopped for most of modules but PLL is enabled.
- Deep Sleep: As Sleep mode but PLL is disabled.
- Standby: All power rails are turned off besides standby and battery
  power rails.

And this CL implements one power state, PM_STATE_SUSPEND_TO_IDLE, with
two sub-states for Zephyr power management system.
Sub-state 0 - "Deep Sleep" mode with “Instant” wake-up if residency
              time is greater or equal to 1 ms
Sub-state 1 - "Deep Sleep" mode with "Standard" wake-up if residency
              time is greater or equal to 201 ms

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
Mulin Chao 2021-01-03 19:52:56 -08:00 committed by Anas Nashif
commit 1f731c6c02
12 changed files with 375 additions and 3 deletions

View file

@ -1054,5 +1054,17 @@ int npcx_host_init_subs_core_domain(const struct device *host_bus_dev,
irq_enable(DT_INST_IRQ_BY_NAME(0, p80_fifo, irq));
#endif
if (IS_ENABLED(CONFIG_PM)) {
/*
* Configure the host access wake-up event triggered from a host
* transaction on eSPI/LPC bus. No need for callback function.
*/
npcx_miwu_interrupt_configure(&host_sub_cfg.host_acc_wui,
NPCX_MIWU_MODE_EDGE, NPCX_MIWU_TRIG_HIGH);
/* Enable irq of interrupt-input module */
npcx_miwu_irq_enable(&host_sub_cfg.host_acc_wui);
}
return 0;
}