Add calls to the PPC API that enables and disables the sink and source
paths in the appropriate USB-C stack states.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commit adds checks for results and in case of error, handles it.
The failed initialization of the TCPC can postpone initialization in
case the TCPC needs more time after powering up. Otherwise if other
error happened, the Type-C Layer will be disabled.
Errors in other places of the USB-C stack, like communication errors,
moves the state machine to the error recovery, restarting the
communication with parner.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
This commit adds check in cc_open entry state and logs if setting
either of the values were unsuccessful.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
When the get_cc function returns error, the CC lines should be
considered as open. It may happen either due to some chip malfunction
or chip going into sleep mode and needing time to reinitialize.
TCPC should only go to sleep if there is no partner attaches, so
in case of this error, the lines should be considered as disconnected.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
The TCPC driver initialization can be unsuccessful and it should be
checked and logged if that's the case.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
The asserts in the USB-C stack functions were causing compilation
errors when asserts were enabled in Kconfig.
This was caused because the asserts checked if the functions
parameters were within limits specified by the state machine arrays.
At the position of these asserts, these arrays were only declared
without specifying the size of them, what prohibited the asserts from
knowing the size of arrays and checking if specified value is within
limit of it.
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Build time check that the number of states initialized
in the state machine array matches the number of enums
used to index said array.
Signed-off-by: Sam Hurst <sbh1187@gmail.com>