Skip to content

Commit 187f87a

Browse files
the-sneaky-foxChromeos LUCI
authored andcommitted
ktu1125: fix polarity and vconn sourcing
Set polarity to be used when enabling vconn BUG=b:207178886 BRANCH=none TEST=manual test on rex sku2 Change-Id: I82efeeb7d01f7b8baa6493753c0a96471116b1a9 Signed-off-by: Boris Mittelberg <[email protected]> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4409006 Reviewed-by: Diana Z <[email protected]>
1 parent 020eba3 commit 187f87a

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

driver/ppc/ktu1125.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ static int ktu1125_dump(int port)
9696
/* helper */
9797
static int ktu1125_power_path_control(int port, int enable)
9898
{
99-
int status = enable ? set_flags(port, KTU1125_CTRL_SW_CFG,
100-
KTU1125_SW_AB_EN) :
101-
clr_flags(port, KTU1125_CTRL_SW_CFG,
102-
KTU1125_SW_AB_EN | KTU1125_CC1S_VCONN |
103-
KTU1125_CC2S_VCONN);
99+
int status =
100+
enable ?
101+
set_flags(port, KTU1125_CTRL_SW_CFG, KTU1125_SW_AB_EN) :
102+
clr_flags(port, KTU1125_CTRL_SW_CFG, KTU1125_SW_AB_EN);
104103

105104
if (status) {
106105
CPRINTS("ppc p%d: Failed to %s power path", port,
@@ -345,11 +344,19 @@ static int ktu1125_discharge_vbus(int port, int enable)
345344
#ifdef CONFIG_USBC_PPC_VCONN
346345
static int ktu1125_set_vconn(int port, int enable)
347346
{
348-
int status = enable ? set_flags(port, KTU1125_CTRL_SW_CFG,
349-
KTU1125_VCONN_EN) :
350-
clr_flags(port, KTU1125_CTRL_SW_CFG,
351-
KTU1125_VCONN_EN | KTU1125_CC1S_VCONN |
352-
KTU1125_CC2S_VCONN);
347+
int polarity;
348+
int status;
349+
int flags = KTU1125_VCONN_EN;
350+
351+
polarity = polarity_rm_dts(pd_get_polarity(port));
352+
353+
if (enable) {
354+
flags |= polarity ? KTU1125_CC2S_VCONN : KTU1125_CC1S_VCONN;
355+
status = set_flags(port, KTU1125_SET_SW_CFG, flags);
356+
} else {
357+
flags |= KTU1125_CC1S_VCONN | KTU1125_CC2S_VCONN;
358+
status = clr_flags(port, KTU1125_SET_SW_CFG, flags);
359+
}
353360

354361
return status;
355362
}

zephyr/Kconfig.ppc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ config PLATFORM_EC_USBC_PPC_RT1718S
8080

8181
config PLATFORM_EC_USBC_PPC_KTU1125
8282
bool "Kinetic KTU1125 Power Path Controller"
83+
default y
84+
depends on DT_HAS_KINETIC_KTU1125_ENABLED
8385
select PLATFORM_EC_USBC_OCP
86+
select PLATFORM_EC_USBC_PPC_POLARITY
87+
select PLATFORM_EC_USBC_PPC_SBU
88+
select PLATFORM_EC_USBC_PPC_VCONN if PLATFORM_EC_USBC_VCONN
8489
help
8590
KTU1125 integrates power switches to provide a compact protection
8691
solution to USB Type-C applications by eliminating the dependence

0 commit comments

Comments
 (0)