serial: uart_nrfx_uarte: update state when enabled
Update the drivers power state knowledge immediately after calling `nrf_uarte_enable`. This ensures that the state is correct regardless of which path the function exits by. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
302a36a115
commit
5979b0085f
1 changed files with 3 additions and 2 deletions
|
@ -1538,6 +1538,9 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
|
|||
if (new_state == DEVICE_PM_ACTIVE_STATE) {
|
||||
uarte_nrfx_pins_enable(dev, true);
|
||||
nrf_uarte_enable(uarte);
|
||||
|
||||
data->pm_state = new_state;
|
||||
|
||||
#ifdef CONFIG_UART_ASYNC_API
|
||||
if (hw_rx_counting_enabled(get_dev_data(dev))) {
|
||||
nrfx_timer_enable(&get_dev_config(dev)->timer);
|
||||
|
@ -1559,8 +1562,6 @@ static void uarte_nrfx_set_power_state(const struct device *dev,
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
data->pm_state = new_state;
|
||||
} else {
|
||||
__ASSERT_NO_MSG(new_state == DEVICE_PM_LOW_POWER_STATE ||
|
||||
new_state == DEVICE_PM_SUSPEND_STATE ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue