Commit 92fd91d
serial: stm32: do not call pm_runtime before startup and after shutdown
The driver failed to call pm_runtime_resume before the shutdown
routine because tty_port is uninitialized when shutdown is called.
For example the bit USART_CR1_RXNEIE is correctly set during the
runtime_suspend routine but if we close the port while the device is
suspended: the runtime_resume returns immediately due to the
!tty_port_initialized condition and the bit USART_CR1_RXNEIE is never
cleared. That will cause issues at the next startup.
To solve this, the !tty_port_initialized condition is removed and replaced
by a boolean "started", which is active when the runtime routines can be
done after port startup is complete.
- After a probe the device is considered suspended
- The startup calls a pm_get but the runtime_resume routine returns
immediately.
- The startup calls a pm_put and the runtime_suspend routine is executed
normally as the driver has completed its startup function.
- The shutdown calls a pm_get and the runtime_resume routine is executed
normally.
- The shutdown calls a pm_put but the runtime_suspend routine returns
immediately.
- The remove forces the device to suspended state.
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Change-Id: Ibf8210021aebc3a7bd144c06c080d378b8928b66
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/563753
ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
Domain-Review: Amelie DELAUNAY <amelie.delaunay@foss.st.com>
ACI: CIBUILD <MDG-smet-aci-builds@list.st.com>1 parent e31e8b8 commit 92fd91d
2 files changed
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | | - | |
| 1372 | + | |
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
| |||
1398 | 1398 | | |
1399 | 1399 | | |
1400 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
1401 | 1403 | | |
1402 | 1404 | | |
1403 | | - | |
| 1405 | + | |
1404 | 1406 | | |
1405 | 1407 | | |
1406 | 1408 | | |
| |||
1413 | 1415 | | |
1414 | 1416 | | |
1415 | 1417 | | |
1416 | | - | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1417 | 1421 | | |
1418 | 1422 | | |
1419 | 1423 | | |
| |||
1453 | 1457 | | |
1454 | 1458 | | |
1455 | 1459 | | |
1456 | | - | |
1457 | | - | |
| 1460 | + | |
1458 | 1461 | | |
1459 | 1462 | | |
1460 | 1463 | | |
| |||
2198 | 2201 | | |
2199 | 2202 | | |
2200 | 2203 | | |
2201 | | - | |
2202 | 2204 | | |
2203 | 2205 | | |
2204 | 2206 | | |
| |||
2246 | 2248 | | |
2247 | 2249 | | |
2248 | 2250 | | |
2249 | | - | |
2250 | 2251 | | |
2251 | 2252 | | |
2252 | 2253 | | |
| |||
2440 | 2441 | | |
2441 | 2442 | | |
2442 | 2443 | | |
2443 | | - | |
| 2444 | + | |
2444 | 2445 | | |
2445 | 2446 | | |
2446 | 2447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
0 commit comments