mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 09:01:35 +00:00
Fix potential bug in pd_soft_reset() function. That function is part of a global API and as such can be called by other tasks. For example, a sysjump which takes place as part of host command task. So, this function should not directly initiate PD communication because if it is interrupted by the PD task, then there will be unpredictable behavior since the send_validate_message() is not designed to be re-entrant for a given port. This changes pd_soft_reset() to simply change the PD state to SOFT_RESET and then wake up the task to actually send the command. BUG=none BRANCH=none TEST=you can test this with a type-C to A receptacle dongle. The dongle has a pulldown on the CC line, but no device to respond to PD comms. When you plug in C to A cable, samus should send source cap repeatedly for 5 seconds. During that time, if you do a sysjump from RO to RW, it will call pd_soft_reset(), which will send the soft reset command. But, since there is no device it will timeout and retry 3 times. During that period, the PD task will wake up and try to do it's own thing, causing craziness and eventually a hang and watchdog reset. With this fix, I can plug in a C to A adapter, and sysjump to RW cleanly. Change-Id: Icab936ab8ab930e8e37b5a23825f7f054a50c177 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219893 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
26 KiB
26 KiB