diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c index 806f5fd4dc..9282ef4d71 100644 --- a/core/embed/projects/prodtest/main.c +++ b/core/embed/projects/prodtest/main.c @@ -79,6 +79,7 @@ #ifdef USE_POWERCTL #include "../../sys/powerctl/npm1300/npm1300.h" +#include "../../sys/powerctl/stwlc38/stwlc38.h" #endif #ifdef USE_STORAGE_HWKEY @@ -939,6 +940,52 @@ void test_pmic(const char *args) { } } +void test_wpc(const char *args) { + stwlc38_init(); + + stwlc38_status_t status; + + if (strcmp(args, "EN") == 0) { + if (!stwlc38_enable(true)) { + vcp_println("ERROR # STWLC38 not initialized"); + return; + } + vcp_println("OK"); + } else if (strcmp(args, "DIS") == 0) { + if (!stwlc38_enable(false)) { + vcp_println("ERROR # STWLC38 not initialized"); + return; + } + vcp_println("OK"); + } else if (strcmp(args, "VEN") == 0) { + if (!stwlc38_enable_vout(true)) { + vcp_println("ERROR # STWLC38 not initialized"); + return; + } + vcp_println("OK"); + } else if (strcmp(args, "VDIS") == 0) { + if (!stwlc38_enable_vout(false)) { + vcp_println("ERROR # STWLC38 not initialized"); + return; + } + vcp_println("OK"); + } else { + if (!stwlc38_get_status(&status)) { + vcp_println("ERROR # STWLC38 not initialized"); + return; + } else { + vcp_println("# ready = %d", status.ready); + vcp_println("# vout_ready = %d", status.vout_ready); + vcp_println("# vrect = %d", status.vrect); + vcp_println("# vout = %d", status.vout); + vcp_println("# icur = %d", status.icur); + vcp_println("# tmeas = %d", status.tmeas); + vcp_println("# opfreq = %d", status.opfreq); + vcp_println("# ntc = %d", status.ntc); + } + } +} + #define BACKLIGHT_NORMAL 150 int main(void) { @@ -1106,6 +1153,10 @@ int main(void) { test_pmic(line + 5); } else if (startswith(line, "PMIC")) { test_pmic(line + 4); + } else if (startswith(line, "WPC ")) { + test_wpc(line + 4); + } else if (startswith(line, "WPC")) { + test_wpc(line + 3); } else { vcp_println("UNKNOWN"); }