drivers: serial: stm32: Don't block PM if pinctrl sleep state is absent
When dealing with pm action 'suspend', driver applies device pinctrl sleep state. Using PM_DEVICE modes should allow to save more current consumption, and applying pinctrl sleep state is one of the gains, but sleep state not being available on a device is not a sufficient reason to block PM transition to lower power mode. If this pin state is not provided for the device, warn but don't block pm transition. This will save some time to users setting up this feature for the first time. Warning will give the opportunity to users to fine tune their setup in a later step. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
a439c04eb4
commit
e89e4b529e
1 changed files with 5 additions and 2 deletions
|
@ -1740,7 +1740,7 @@ static int uart_stm32_pm_action(const struct device *dev,
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_ACTION_SUSPEND:
|
case PM_DEVICE_ACTION_SUSPEND:
|
||||||
uart_stm32_suspend_setup(dev);
|
uart_stm32_suspend_setup(dev);
|
||||||
/* Stop device clock */
|
/* Stop device clock. Note: fixed clocks are not handled yet. */
|
||||||
err = clock_control_off(data->clock, (clock_control_subsys_t)&config->pclken[0]);
|
err = clock_control_off(data->clock, (clock_control_subsys_t)&config->pclken[0]);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
LOG_ERR("Could not enable (LP)UART clock");
|
LOG_ERR("Could not enable (LP)UART clock");
|
||||||
|
@ -1749,7 +1749,10 @@ static int uart_stm32_pm_action(const struct device *dev,
|
||||||
|
|
||||||
/* Move pins to sleep state */
|
/* Move pins to sleep state */
|
||||||
err = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
|
err = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
|
||||||
if (err < 0) {
|
if (err == -ENOENT) {
|
||||||
|
/* Warn but don't block PM suspend */
|
||||||
|
LOG_WRN("(LP)UART pinctrl sleep state not available ");
|
||||||
|
} else if (err < 0) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue