Commit 4045daf
ASoC: rt5682: Fix deadlock on resume
On resume from suspend the following chain of events can happen:
A rt5682_resume() -> mod_delayed_work() for jack_detect_work
B DAPM sequence starts ( DAPM is locked now)
A1. rt5682_jack_detect_handler() scheduled
- Takes both jdet_mutex and calibrate_mutex
- Calls in to rt5682_headset_detect() which tries to take DAPM lock, it
starts to wait for it as B path took it already.
B1. DAPM sequence reaches the "HP Amp", rt5682_hp_event() tries to take
the jdet_mutex, but it is locked in A1, so it waits.
Deadlock.
To solve the deadlock, drop the jdet_mutex, use the jack_detect_work to do
the jack removal handling, move the dapm lock up one level to protect the
most of the rt5682_jack_detect_handler(), but not the jack reporting as it
might trigger a DAPM sequence.
The rt5682_headset_detect() can be changed to static as well.
Fixes: 8deb34a ("ASoC: rt5682: fix the wrong jack type detected")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220126100325.16513-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent 06feec6 commit 4045daf
3 files changed
Lines changed: 12 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
64 | 63 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
72 | 67 | | |
73 | | - | |
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
| |||
198 | 192 | | |
199 | 193 | | |
200 | 194 | | |
201 | | - | |
202 | 195 | | |
203 | 196 | | |
204 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
922 | 922 | | |
923 | 923 | | |
924 | 924 | | |
925 | | - | |
| 925 | + | |
926 | 926 | | |
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
932 | | - | |
933 | | - | |
934 | 932 | | |
935 | 933 | | |
936 | 934 | | |
| |||
981 | 979 | | |
982 | 980 | | |
983 | 981 | | |
984 | | - | |
985 | | - | |
986 | 982 | | |
987 | 983 | | |
988 | 984 | | |
| |||
1011 | 1007 | | |
1012 | 1008 | | |
1013 | 1009 | | |
1014 | | - | |
1015 | 1010 | | |
1016 | 1011 | | |
1017 | 1012 | | |
| |||
1094 | 1089 | | |
1095 | 1090 | | |
1096 | 1091 | | |
| 1092 | + | |
1097 | 1093 | | |
1098 | 1094 | | |
1099 | 1095 | | |
| |||
1102 | 1098 | | |
1103 | 1099 | | |
1104 | 1100 | | |
1105 | | - | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1106 | 1104 | | |
1107 | 1105 | | |
1108 | 1106 | | |
| |||
1162 | 1160 | | |
1163 | 1161 | | |
1164 | 1162 | | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1165 | 1166 | | |
1166 | 1167 | | |
1167 | 1168 | | |
| |||
1174 | 1175 | | |
1175 | 1176 | | |
1176 | 1177 | | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | 1178 | | |
1181 | 1179 | | |
1182 | 1180 | | |
| |||
1526 | 1524 | | |
1527 | 1525 | | |
1528 | 1526 | | |
1529 | | - | |
1530 | 1527 | | |
1531 | 1528 | | |
1532 | 1529 | | |
| |||
1538 | 1535 | | |
1539 | 1536 | | |
1540 | 1537 | | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
1544 | 1538 | | |
1545 | 1539 | | |
1546 | 1540 | | |
1547 | 1541 | | |
1548 | 1542 | | |
1549 | 1543 | | |
1550 | | - | |
1551 | | - | |
1552 | 1544 | | |
1553 | 1545 | | |
1554 | 1546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | | - | |
1467 | 1466 | | |
1468 | 1467 | | |
1469 | 1468 | | |
| |||
1473 | 1472 | | |
1474 | 1473 | | |
1475 | 1474 | | |
1476 | | - | |
1477 | 1475 | | |
1478 | 1476 | | |
1479 | 1477 | | |
| |||
0 commit comments