summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-12-16 23:29:04 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-24 01:11:02 +0000
commitfca75f573ff913a5be050c7a13e7dcda6be68da2 (patch)
treedc192d0343545550a4f88df2d91f813d58d27d1a
parentc9cc5600573a6a28bd0a66d43916e969bd403bbd (diff)
downloadchrome-ec-fca75f573ff913a5be050c7a13e7dcda6be68da2.tar.gz
TCPMv2: Update source-out configs
Now that the DPM will be handling source-out decisions for TCPMv2, remove references to its old configuration options from TCPMv2 boards in order to avoid any confusion as to what code is running now. Also remove the charge manager notifications of sink attach/detach since the policy is being centralized into the DPM. Note that the previous configuration options only ever allocated one 3.0 A port, and so the default number of 3.0 A ports has been set to 1. BRANCH=None BUG=b:168862110,b:141690755 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie452e3da32b04226503539daa67b6b9f4a58aa58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597431 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--baseboard/dedede/baseboard.h1
-rw-r--r--baseboard/intelrvp/baseboard.h2
-rw-r--r--baseboard/intelrvp/chg_usb_pd_mecc_0_9.c2
-rw-r--r--baseboard/intelrvp/usb_pd_policy_mecc_0_9.c4
-rw-r--r--baseboard/intelrvp/usb_pd_policy_mecc_1_0.c10
-rw-r--r--baseboard/octopus/baseboard.h1
-rw-r--r--baseboard/octopus/usb_pd_policy.c10
-rw-r--r--baseboard/trogdor/baseboard.h1
-rw-r--r--baseboard/trogdor/usb_pd_policy.c8
-rw-r--r--baseboard/volteer/baseboard.h1
-rw-r--r--baseboard/volteer/usb_pd_policy.c10
-rw-r--r--baseboard/zork/baseboard.h1
-rw-r--r--baseboard/zork/usb_pd_policy.c10
-rw-r--r--board/adlrvpp_ite/board.h6
-rw-r--r--board/ambassador/board.h1
-rw-r--r--board/ambassador/usb_pd_policy.c10
-rw-r--r--board/asurada/board.h1
-rw-r--r--board/asurada/usb_pd_policy.c14
-rw-r--r--board/boldar/board.h6
-rw-r--r--board/boten/usb_pd_policy.c10
-rw-r--r--board/copano/board.h6
-rw-r--r--board/dooly/board.h1
-rw-r--r--board/dooly/usb_pd_policy.c10
-rw-r--r--board/drawcia/usb_pd_policy.c10
-rw-r--r--board/drobit/board.h6
-rw-r--r--board/eve/board.h1
-rw-r--r--board/eve/usb_pd_policy.c6
-rw-r--r--board/galtic/usb_pd_policy.c10
-rw-r--r--board/genesis/board.h1
-rw-r--r--board/genesis/usb_pd_policy.c10
-rw-r--r--board/halvor/board.h6
-rw-r--r--board/it8xxx2_pdevb/board.h1
-rw-r--r--board/lantis/usb_pd_policy.c10
-rw-r--r--board/madoo/usb_pd_policy.c10
-rw-r--r--board/magolor/usb_pd_policy.c10
-rw-r--r--board/metaknight/usb_pd_policy.c10
-rw-r--r--board/mushu/board.h1
-rw-r--r--board/nocturne/board.h1
-rw-r--r--board/puff/board.h1
-rw-r--r--board/puff/usb_pd_policy.c10
-rw-r--r--board/reef_it8320/board.h1
-rw-r--r--board/reef_it8320/usb_pd_policy.c6
-rw-r--r--board/sasuke/usb_pd_policy.c10
-rw-r--r--board/storo/usb_pd_policy.c10
-rw-r--r--board/terrador/board.h6
-rw-r--r--board/tglrvpu_ite/board.h6
-rw-r--r--board/todor/board.h6
-rw-r--r--board/trondo/board.h6
-rw-r--r--board/voema/board.h7
-rw-r--r--board/volteer/board.h6
-rw-r--r--board/voxel/board.h6
-rw-r--r--board/waddledee/usb_pd_policy.c10
-rw-r--r--board/waddledoo/usb_pd_policy.c10
-rw-r--r--board/wheelie/usb_pd_policy.c10
-rw-r--r--common/mock/usb_pd_dpm_mock.c6
-rw-r--r--common/usb_common.c6
-rw-r--r--common/usbc/usb_pd_dpm.c27
-rw-r--r--common/usbc/usb_pe_drp_sm.c8
-rw-r--r--fuzz/fuzz_config.h2
-rw-r--r--include/config.h21
-rw-r--r--include/usb_pd_dpm.h9
-rw-r--r--test/fake_usbc.c6
-rw-r--r--test/test_config.h1
63 files changed, 76 insertions, 340 deletions
diff --git a/baseboard/dedede/baseboard.h b/baseboard/dedede/baseboard.h
index adedd00a42..691456e6ee 100644
--- a/baseboard/dedede/baseboard.h
+++ b/baseboard/dedede/baseboard.h
@@ -170,7 +170,6 @@
#define CONFIG_USB_PD_DP_HPD_GPIO
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_REV30
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_TCPCI
diff --git a/baseboard/intelrvp/baseboard.h b/baseboard/intelrvp/baseboard.h
index 2db5e43fb8..ba32522bb4 100644
--- a/baseboard/intelrvp/baseboard.h
+++ b/baseboard/intelrvp/baseboard.h
@@ -84,6 +84,7 @@
/* USB PD config */
#if defined(BOARD_TGLRVPU_ITE_TCPMV1) || defined(BOARD_TGLRVPY_ITE_TCPMV1)
#define CONFIG_USB_PD_TCPMV1
+ #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#else
#define CONFIG_USB_DRP_ACC_TRYSRC
#define CONFIG_USB_PD_DECODE_SOP
@@ -93,7 +94,6 @@
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT
diff --git a/baseboard/intelrvp/chg_usb_pd_mecc_0_9.c b/baseboard/intelrvp/chg_usb_pd_mecc_0_9.c
index 650fabfedc..455b384295 100644
--- a/baseboard/intelrvp/chg_usb_pd_mecc_0_9.c
+++ b/baseboard/intelrvp/chg_usb_pd_mecc_0_9.c
@@ -34,7 +34,7 @@ void board_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp)
/* Only Type-C ports can source VBUS */
if (is_typec_port(port)) {
/* Enable SRC ILIM if rp is MAX single source current */
- ilim_en = (rp == CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT &&
+ ilim_en = (rp == TYPEC_RP_3A0 &&
board_vbus_source_enabled(port));
gpio_set_level(tcpc_gpios[port].src_ilim.pin,
diff --git a/baseboard/intelrvp/usb_pd_policy_mecc_0_9.c b/baseboard/intelrvp/usb_pd_policy_mecc_0_9.c
index d0ca3d6025..6d173fd032 100644
--- a/baseboard/intelrvp/usb_pd_policy_mecc_0_9.c
+++ b/baseboard/intelrvp/usb_pd_policy_mecc_0_9.c
@@ -20,8 +20,10 @@ int pd_set_power_supply_ready(int port)
/* Provide VBUS */
board_vbus_enable(port, 1);
+#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
+#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -34,8 +36,10 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
board_vbus_enable(port, 0);
+#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
/* Give back the current quota we are no longer using */
charge_manager_source_port(port, 0);
+#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/baseboard/intelrvp/usb_pd_policy_mecc_1_0.c b/baseboard/intelrvp/usb_pd_policy_mecc_1_0.c
index 7df0d56a3e..29a538231f 100644
--- a/baseboard/intelrvp/usb_pd_policy_mecc_1_0.c
+++ b/baseboard/intelrvp/usb_pd_policy_mecc_1_0.c
@@ -30,11 +30,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -54,11 +49,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h
index a20b7bc8de..1f64338e25 100644
--- a/baseboard/octopus/baseboard.h
+++ b/baseboard/octopus/baseboard.h
@@ -200,6 +200,7 @@
#define CONFIG_USB_PD_DECODE_SOP
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_TCPMV2
+#define CONFIG_USB_PD_3A_PORTS 0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
diff --git a/baseboard/octopus/usb_pd_policy.c b/baseboard/octopus/usb_pd_policy.c
index dcd7b41ee1..3dd6ad29f5 100644
--- a/baseboard/octopus/usb_pd_policy.c
+++ b/baseboard/octopus/usb_pd_policy.c
@@ -39,11 +39,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -64,11 +59,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/baseboard/trogdor/baseboard.h b/baseboard/trogdor/baseboard.h
index ff7bb66453..185d84f281 100644
--- a/baseboard/trogdor/baseboard.h
+++ b/baseboard/trogdor/baseboard.h
@@ -114,7 +114,6 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_CMD_TCPC_DUMP
diff --git a/baseboard/trogdor/usb_pd_policy.c b/baseboard/trogdor/usb_pd_policy.c
index ef5c470611..fa11b88a38 100644
--- a/baseboard/trogdor/usb_pd_policy.c
+++ b/baseboard/trogdor/usb_pd_policy.c
@@ -50,11 +50,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -70,9 +65,6 @@ int pd_set_power_supply_ready(int port)
vbus_en[port] = 1;
board_vbus_update_source_current(port);
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index 8dc48f4c8c..772b34e694 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -160,7 +160,6 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DISCHARGE_PPC
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
diff --git a/baseboard/volteer/usb_pd_policy.c b/baseboard/volteer/usb_pd_policy.c
index a18e8c7149..2b4cd162aa 100644
--- a/baseboard/volteer/usb_pd_policy.c
+++ b/baseboard/volteer/usb_pd_policy.c
@@ -36,11 +36,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -61,11 +56,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
index a827a44474..e31a0574ff 100644
--- a/baseboard/zork/baseboard.h
+++ b/baseboard/zork/baseboard.h
@@ -171,7 +171,6 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_NCT38XX
diff --git a/baseboard/zork/usb_pd_policy.c b/baseboard/zork/usb_pd_policy.c
index f988fd18d0..99282d36d4 100644
--- a/baseboard/zork/usb_pd_policy.c
+++ b/baseboard/zork/usb_pd_policy.c
@@ -39,11 +39,6 @@ void pd_power_supply_reset(int port)
pd_set_vbus_discharge(port, 1);
}
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -65,11 +60,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/adlrvpp_ite/board.h b/board/adlrvpp_ite/board.h
index 4c8a1d2ecc..bdfd36e774 100644
--- a/board/adlrvpp_ite/board.h
+++ b/board/adlrvpp_ite/board.h
@@ -129,12 +129,6 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-/*
- * For USB4, set the total budget for source current to 7.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 7500
/* Config Fan */
#define CONFIG_FANS 1
diff --git a/board/ambassador/board.h b/board/ambassador/board.h
index ebaf8201ce..fdc4ff3405 100644
--- a/board/ambassador/board.h
+++ b/board/ambassador/board.h
@@ -144,7 +144,6 @@
#define CONFIG_USB_PD_DISCHARGE_PPC
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_VBUS_DETECT_PPC
#define CONFIG_USBC_PPC_SN5S330
diff --git a/board/ambassador/usb_pd_policy.c b/board/ambassador/usb_pd_policy.c
index a218d66603..a9122e507a 100644
--- a/board/ambassador/usb_pd_policy.c
+++ b/board/ambassador/usb_pd_policy.c
@@ -42,11 +42,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -67,11 +62,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/asurada/board.h b/board/asurada/board.h
index 4c8ece2544..116cfc710e 100644
--- a/board/asurada/board.h
+++ b/board/asurada/board.h
@@ -125,7 +125,6 @@
#define CONFIG_USB_PD_FRS_TCPC
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_LOW_POWER
#define CONFIG_USB_PD_TCPMV2
diff --git a/board/asurada/usb_pd_policy.c b/board/asurada/usb_pd_policy.c
index 7039f4e5f9..9e90eb95a3 100644
--- a/board/asurada/usb_pd_policy.c
+++ b/board/asurada/usb_pd_policy.c
@@ -10,8 +10,8 @@
#include "usb_pd.h"
#include "usbc_ppc.h"
-#ifndef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
-#error Asurada reference must define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
+#if CONFIG_USB_PD_3A_PORTS != 1
+#error Asurada reference must have at least one 3.0 A port
#endif
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
@@ -182,11 +182,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -213,11 +208,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/boldar/board.h b/board/boldar/board.h
index 3e659d991c..d686e432f9 100644
--- a/board/boldar/board.h
+++ b/board/boldar/board.h
@@ -94,12 +94,6 @@
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x37
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
#define USB_PORT_COUNT 1
diff --git a/board/boten/usb_pd_policy.c b/board/boten/usb_pd_policy.c
index 5a7b7f1f91..a3d0c502ff 100644
--- a/board/boten/usb_pd_policy.c
+++ b/board/boten/usb_pd_policy.c
@@ -30,11 +30,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -60,11 +55,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/copano/board.h b/board/copano/board.h
index e19a7314fb..cd97d9a22a 100644
--- a/board/copano/board.h
+++ b/board/copano/board.h
@@ -74,12 +74,6 @@
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
diff --git a/board/dooly/board.h b/board/dooly/board.h
index 25ca27f211..140013b6cd 100644
--- a/board/dooly/board.h
+++ b/board/dooly/board.h
@@ -168,7 +168,6 @@
#define CONFIG_USB_PD_DISCHARGE_PPC
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_PPC
#define CONFIG_USBC_PPC_SN5S330
diff --git a/board/dooly/usb_pd_policy.c b/board/dooly/usb_pd_policy.c
index 3197a4235e..fb42e30ea2 100644
--- a/board/dooly/usb_pd_policy.c
+++ b/board/dooly/usb_pd_policy.c
@@ -42,11 +42,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -67,11 +62,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/drawcia/usb_pd_policy.c b/board/drawcia/usb_pd_policy.c
index 9d53f20047..7046e25d6c 100644
--- a/board/drawcia/usb_pd_policy.c
+++ b/board/drawcia/usb_pd_policy.c
@@ -38,11 +38,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
sm5803_set_vbus_disch(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -62,11 +57,6 @@ int pd_set_power_supply_ready(int port)
/* Provide Vbus */
charger_enable_otg_power(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/drobit/board.h b/board/drobit/board.h
index d30c42ee02..8e4b005ddc 100644
--- a/board/drobit/board.h
+++ b/board/drobit/board.h
@@ -67,12 +67,6 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
diff --git a/board/eve/board.h b/board/eve/board.h
index ea09b9c8e3..d83fa3135a 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -180,7 +180,6 @@
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_BD9995X_DELAY_INPUT_PORT_SELECT
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_BOARD_INIT
diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c
index 4d10047d85..d6dd5ad1be 100644
--- a/board/eve/usb_pd_policy.c
+++ b/board/eve/usb_pd_policy.c
@@ -85,9 +85,6 @@ int pd_set_power_supply_ready(int port)
/* Ensure we're not charging from this port */
bd9995x_select_input_port(port, 0);
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-
pd_set_vbus_discharge(port, 0);
/* Provide VBUS */
vbus_en[port] = 1;
@@ -113,9 +110,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
diff --git a/board/galtic/usb_pd_policy.c b/board/galtic/usb_pd_policy.c
index 4c5558d87b..678e9055d7 100644
--- a/board/galtic/usb_pd_policy.c
+++ b/board/galtic/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/genesis/board.h b/board/genesis/board.h
index ebaf8201ce..fdc4ff3405 100644
--- a/board/genesis/board.h
+++ b/board/genesis/board.h
@@ -144,7 +144,6 @@
#define CONFIG_USB_PD_DISCHARGE_PPC
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_VBUS_DETECT_PPC
#define CONFIG_USBC_PPC_SN5S330
diff --git a/board/genesis/usb_pd_policy.c b/board/genesis/usb_pd_policy.c
index a218d66603..a9122e507a 100644
--- a/board/genesis/usb_pd_policy.c
+++ b/board/genesis/usb_pd_policy.c
@@ -42,11 +42,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -67,11 +62,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/halvor/board.h b/board/halvor/board.h
index 09ae5baee5..850ffd7f43 100644
--- a/board/halvor/board.h
+++ b/board/halvor/board.h
@@ -65,12 +65,6 @@
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x42
-/*
- * For USB4, set the total budget for source current to 6A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 6000
/* USB Type A Features */
diff --git a/board/it8xxx2_pdevb/board.h b/board/it8xxx2_pdevb/board.h
index 7c40a1ffc7..c598b79e15 100644
--- a/board/it8xxx2_pdevb/board.h
+++ b/board/it8xxx2_pdevb/board.h
@@ -41,6 +41,7 @@
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_CHECK_MAX_REQUEST_ALLOWED
#define CONFIG_USB_PD_CUSTOM_PDO
+#define CONFIG_USB_PD_3A_PORTS 0
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
diff --git a/board/lantis/usb_pd_policy.c b/board/lantis/usb_pd_policy.c
index 9d53f20047..7046e25d6c 100644
--- a/board/lantis/usb_pd_policy.c
+++ b/board/lantis/usb_pd_policy.c
@@ -38,11 +38,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
sm5803_set_vbus_disch(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -62,11 +57,6 @@ int pd_set_power_supply_ready(int port)
/* Provide Vbus */
charger_enable_otg_power(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/madoo/usb_pd_policy.c b/board/madoo/usb_pd_policy.c
index bcdf8300c5..2f226803e3 100644
--- a/board/madoo/usb_pd_policy.c
+++ b/board/madoo/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/magolor/usb_pd_policy.c b/board/magolor/usb_pd_policy.c
index bcdf8300c5..2f226803e3 100644
--- a/board/magolor/usb_pd_policy.c
+++ b/board/magolor/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/metaknight/usb_pd_policy.c b/board/metaknight/usb_pd_policy.c
index 905e049937..3ad79b9f1f 100644
--- a/board/metaknight/usb_pd_policy.c
+++ b/board/metaknight/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/mushu/board.h b/board/mushu/board.h
index 40c4046350..7534190178 100644
--- a/board/mushu/board.h
+++ b/board/mushu/board.h
@@ -65,6 +65,7 @@
* parade PS8751 TCPC
*/
#define CONFIG_USB_PD_TCPMV2
+#undef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
#define CONFIG_USB_PID 0x5047
#define CONFIG_USB_PD_DECODE_SOP
#define CONFIG_USB_PD_TRY_SRC
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index 5f481167dc..84b91af516 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -131,6 +131,7 @@
/* USB PD */
#define CONFIG_USB_DRP_ACC_TRYSRC
+#define CONFIG_USB_PD_3A_PORTS 0
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_COMM_LOCKED
diff --git a/board/puff/board.h b/board/puff/board.h
index 078769622f..bcb7bb64ed 100644
--- a/board/puff/board.h
+++ b/board/puff/board.h
@@ -144,7 +144,6 @@
#define CONFIG_USB_PD_DISCHARGE_PPC
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_VBUS_DETECT_PPC
#define CONFIG_USBC_PPC_SN5S330
diff --git a/board/puff/usb_pd_policy.c b/board/puff/usb_pd_policy.c
index eeba1eee80..623f4ba502 100644
--- a/board/puff/usb_pd_policy.c
+++ b/board/puff/usb_pd_policy.c
@@ -42,11 +42,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -67,11 +62,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h
index 52ade2bbf7..487592b7e8 100644
--- a/board/reef_it8320/board.h
+++ b/board/reef_it8320/board.h
@@ -78,7 +78,6 @@
#define CONFIG_USB_PD_DUAL_ROLE
#define CONFIG_USB_PD_DISCHARGE_GPIO
#define CONFIG_USB_PD_LOGGING
-#define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
diff --git a/board/reef_it8320/usb_pd_policy.c b/board/reef_it8320/usb_pd_policy.c
index 87b9c8d42e..7fec6bc975 100644
--- a/board/reef_it8320/usb_pd_policy.c
+++ b/board/reef_it8320/usb_pd_policy.c
@@ -58,9 +58,6 @@ int pd_set_power_supply_ready(int port)
/* Ensure we're not charging from this port */
bd9995x_select_input_port(port, 0);
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-
pd_set_vbus_discharge(port, 0);
/* Provide VBUS */
vbus_en[port] = 1;
@@ -86,9 +83,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
pd_set_vbus_discharge(port, 1);
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
diff --git a/board/sasuke/usb_pd_policy.c b/board/sasuke/usb_pd_policy.c
index 905e049937..3ad79b9f1f 100644
--- a/board/sasuke/usb_pd_policy.c
+++ b/board/sasuke/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/storo/usb_pd_policy.c b/board/storo/usb_pd_policy.c
index 9d53f20047..7046e25d6c 100644
--- a/board/storo/usb_pd_policy.c
+++ b/board/storo/usb_pd_policy.c
@@ -38,11 +38,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
sm5803_set_vbus_disch(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -62,11 +57,6 @@ int pd_set_power_supply_ready(int port)
/* Provide Vbus */
charger_enable_otg_power(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/terrador/board.h b/board/terrador/board.h
index ed1b059137..16b1af04b7 100644
--- a/board/terrador/board.h
+++ b/board/terrador/board.h
@@ -76,12 +76,6 @@
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
diff --git a/board/tglrvpu_ite/board.h b/board/tglrvpu_ite/board.h
index b653502a3d..9351fe5982 100644
--- a/board/tglrvpu_ite/board.h
+++ b/board/tglrvpu_ite/board.h
@@ -90,12 +90,6 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
#ifndef __ASSEMBLER__
diff --git a/board/todor/board.h b/board/todor/board.h
index 2dd671fc6e..d73130cd07 100644
--- a/board/todor/board.h
+++ b/board/todor/board.h
@@ -76,12 +76,6 @@
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
diff --git a/board/trondo/board.h b/board/trondo/board.h
index 9fbeb2e329..5808e07016 100644
--- a/board/trondo/board.h
+++ b/board/trondo/board.h
@@ -68,12 +68,6 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
diff --git a/board/voema/board.h b/board/voema/board.h
index fe8276c3ce..34e4c7fe1d 100644
--- a/board/voema/board.h
+++ b/board/voema/board.h
@@ -74,13 +74,6 @@
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
-
/* USB Type A Features */
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
diff --git a/board/volteer/board.h b/board/volteer/board.h
index 11cca25d4d..2033884215 100644
--- a/board/volteer/board.h
+++ b/board/volteer/board.h
@@ -82,12 +82,6 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
#define USB_PORT_COUNT 1
diff --git a/board/voxel/board.h b/board/voxel/board.h
index 88b03a3ee6..c868938778 100644
--- a/board/voxel/board.h
+++ b/board/voxel/board.h
@@ -82,12 +82,6 @@
#define CONFIG_USB_PD_USB4
#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
-/*
- * For USB4, set the total budget for source current to 4.5A so that the first
- * connected port is allowed to source 3A while sourcing 1.5A on other type-C
- * ports.
- */
-#define CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT 4500
/* USB Type A Features */
#define USB_PORT_COUNT 1
diff --git a/board/waddledee/usb_pd_policy.c b/board/waddledee/usb_pd_policy.c
index 9d53f20047..7046e25d6c 100644
--- a/board/waddledee/usb_pd_policy.c
+++ b/board/waddledee/usb_pd_policy.c
@@ -38,11 +38,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
sm5803_set_vbus_disch(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -62,11 +57,6 @@ int pd_set_power_supply_ready(int port)
/* Provide Vbus */
charger_enable_otg_power(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/waddledoo/usb_pd_policy.c b/board/waddledoo/usb_pd_policy.c
index 905e049937..3ad79b9f1f 100644
--- a/board/waddledoo/usb_pd_policy.c
+++ b/board/waddledoo/usb_pd_policy.c
@@ -24,11 +24,6 @@ void pd_power_supply_reset(int port)
/* Disable VBUS */
tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -54,11 +49,6 @@ int pd_set_power_supply_ready(int port)
if (rv)
return rv;
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/wheelie/usb_pd_policy.c b/board/wheelie/usb_pd_policy.c
index 1611af23e0..02ae21a420 100644
--- a/board/wheelie/usb_pd_policy.c
+++ b/board/wheelie/usb_pd_policy.c
@@ -39,11 +39,6 @@ void pd_power_supply_reset(int port)
if (prev_en)
sm5803_set_vbus_disch(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Give back the current quota we are no longer using */
- charge_manager_source_port(port, 0);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -63,11 +58,6 @@ int pd_set_power_supply_ready(int port)
/* Provide Vbus */
chg_chips[port].drv->enable_otg_power(port, 1);
-#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
- /* Ensure we advertise the proper available current quota */
- charge_manager_source_port(port, 1);
-#endif /* defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT) */
-
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/common/mock/usb_pd_dpm_mock.c b/common/mock/usb_pd_dpm_mock.c
index a68f56ae3b..8edae9ee0b 100644
--- a/common/mock/usb_pd_dpm_mock.c
+++ b/common/mock/usb_pd_dpm_mock.c
@@ -55,3 +55,9 @@ void dpm_evaluate_sink_fixed_pdo(int port, uint32_t vsafe5v_pdo)
void dpm_remove_sink(int port)
{
}
+
+int dpm_get_source_pdo(const uint32_t **src_pdo, const int port)
+{
+ *src_pdo = pd_src_pdo;
+ return pd_src_pdo_cnt;
+}
diff --git a/common/usb_common.c b/common/usb_common.c
index 36e94dd540..05f464cc00 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -24,6 +24,7 @@
#include "usb_common.h"
#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_pd_dpm.h"
#include "usb_pd_tcpm.h"
#include "usbc_ocp.h"
#include "usbc_ppc.h"
@@ -263,7 +264,10 @@ int pd_check_requested_voltage(uint32_t rdo, const int port)
int idx = RDO_POS(rdo);
uint32_t pdo;
uint32_t pdo_ma;
-#if defined(CONFIG_USB_PD_DYNAMIC_SRC_CAP) || \
+#if defined(CONFIG_USB_PD_TCPMV2) && defined(CONFIG_USB_PE_SM)
+ const uint32_t *src_pdo;
+ const int pdo_cnt = dpm_get_source_pdo(&src_pdo, port);
+#elif defined(CONFIG_USB_PD_DYNAMIC_SRC_CAP) || \
defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT)
const uint32_t *src_pdo;
const int pdo_cnt = charge_manager_get_source_pdo(&src_pdo, port);
diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c
index d607485ae4..6643fed42c 100644
--- a/common/usbc/usb_pd_dpm.c
+++ b/common/usbc/usb_pd_dpm.c
@@ -376,9 +376,6 @@ static int count_port_bits(uint32_t bitmask)
return total;
}
-/* TODO(b/141690755): Move to config.h */
-#define CONFIG_USB_PD_3A_PORTS 1
-
/*
* Centralized, mutex-controlled updates to the claimed 3.0 A ports
*/
@@ -416,6 +413,9 @@ unlock:
/* Process sink's first Sink_Capabilities PDO for port current consideration */
void dpm_evaluate_sink_fixed_pdo(int port, uint32_t vsafe5v_pdo)
{
+ if (CONFIG_USB_PD_3A_PORTS == 0)
+ return;
+
/* Verify partner supplied valid vSafe5V fixed object first */
if ((vsafe5v_pdo & PDO_TYPE_MASK) != PDO_TYPE_FIXED)
return;
@@ -434,6 +434,9 @@ void dpm_evaluate_sink_fixed_pdo(int port, uint32_t vsafe5v_pdo)
void dpm_remove_sink(int port)
{
+ if (CONFIG_USB_PD_3A_PORTS == 0)
+ return;
+
if (!(BIT(port) & sink_max_pdo_requested))
return;
@@ -442,25 +445,21 @@ void dpm_remove_sink(int port)
balance_source_ports();
}
-#if defined(CONFIG_USB_PD_DYNAMIC_SRC_CAP) || \
- defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT)
/*
- * Charge manager APIs
- * TODO(b/141690755): Remove and replace with DPM calls
+ * Note: all ports receive the 1.5 A source offering until they are found to
+ * match a criteria on the 3.0 A priority list (ex. though sink capability
+ * probing), at which point they will be offered a new 3.0 A source capability.
*/
-void charge_manager_source_port(int port, int enable)
-{
- /* No-op present for linking */
-}
-
-int charge_manager_get_source_pdo(const uint32_t **src_pdo, const int port)
+int dpm_get_source_pdo(const uint32_t **src_pdo, const int port)
{
+ /* Max PDO may not exist on boards which don't offer 3 A */
+#if CONFIG_USB_PD_3A_PORTS > 0
if (max_current_claimed & BIT(port)) {
*src_pdo = pd_src_pdo_max;
return pd_src_pdo_max_cnt;
}
+#endif
*src_pdo = pd_src_pdo;
return pd_src_pdo_cnt;
}
-#endif
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 2a116f0cf4..8e2ff806e6 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -1549,14 +1549,8 @@ static void print_current_state(const int port)
static void send_source_cap(int port)
{
-#if defined(CONFIG_USB_PD_DYNAMIC_SRC_CAP) || \
- defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT)
const uint32_t *src_pdo;
- const int src_pdo_cnt = charge_manager_get_source_pdo(&src_pdo, port);
-#else
- const uint32_t *src_pdo = pd_src_pdo;
- const int src_pdo_cnt = pd_src_pdo_cnt;
-#endif
+ const int src_pdo_cnt = dpm_get_source_pdo(&src_pdo, port);
if (src_pdo_cnt == 0) {
/* No source capabilities defined, sink only */
diff --git a/fuzz/fuzz_config.h b/fuzz/fuzz_config.h
index 88664c8fb6..ae0534d8ba 100644
--- a/fuzz/fuzz_config.h
+++ b/fuzz/fuzz_config.h
@@ -60,6 +60,7 @@
#define PD_VCONN_SWAP_DELAY 5000
#define CONFIG_SHA256
#define CONFIG_SW_CRC
+#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */
#endif /* TEST_USB_TCPM_V2_REV30_FUZZ */
#ifdef TEST_USB_TCPM_V2_REV20_FUZZ
@@ -80,6 +81,7 @@
#define PD_VCONN_SWAP_DELAY 5000
#define CONFIG_SHA256
#define CONFIG_SW_CRC
+#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */
#endif /* TEST_USB_TCPM_V2_REV20_FUZZ */
#endif /* TEST_FUZZ */
diff --git a/include/config.h b/include/config.h
index c3872b5fb7..40e64b05df 100644
--- a/include/config.h
+++ b/include/config.h
@@ -5069,6 +5069,27 @@
/******************************************************************************/
/*
+ * Ensure that CONFIG_USB_PD_TCPMV2 is not being used with charge_manager source
+ * defines, and define a default number of 3.0 A ports if not selected. Note
+ * that the functionality of this default of 1 is equivalent to both previous
+ * defines, which only ever allocated one 3.0 A port.
+ */
+#ifdef CONFIG_USB_PD_TCPMV2
+#if defined(CONFIG_USB_PD_MAX_TOTAL_SOURCE_CURRENT) || \
+ defined(CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT)
+#error Define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT is limited to TCPMv1
+#endif
+#ifndef CONFIG_USB_PD_3A_PORTS
+#define CONFIG_USB_PD_3A_PORTS 1
+#endif
+/* USB4 support requires at least one port providing 3.0 A */
+#if defined(CONFIG_USB_PD_USB4) && CONFIG_USB_PD_3A_PORTS == 0
+#error USB4 support requires at least one 3.0 A port
+#endif
+#endif
+
+/******************************************************************************/
+/*
* Automatically define CONFIG_HOSTCMD_X86 if either child option is defined.
* Ensure LPC and eSPI are mutually exclusive
*/
diff --git a/include/usb_pd_dpm.h b/include/usb_pd_dpm.h
index 29253f4031..d897c8ce84 100644
--- a/include/usb_pd_dpm.h
+++ b/include/usb_pd_dpm.h
@@ -75,4 +75,13 @@ void dpm_evaluate_sink_fixed_pdo(int port, uint32_t vsafe5v_pdo);
*/
void dpm_remove_sink(int port);
+/*
+ * Return the appropriate Source Capability PDO to offer this port
+ *
+ * @param src_pdo Will point to appropriate PDO to offer
+ * @param port USB-C port number
+ * @return Number of PDOs
+ */
+int dpm_get_source_pdo(const uint32_t **src_pdo, const int port);
+
#endif /* __CROS_EC_USB_DPM_H */
diff --git a/test/fake_usbc.c b/test/fake_usbc.c
index 8343b9a944..cdbd41d03d 100644
--- a/test/fake_usbc.c
+++ b/test/fake_usbc.c
@@ -283,6 +283,12 @@ void dpm_remove_sink(int port)
{
}
+int dpm_get_source_pdo(const uint32_t **src_pdo, const int port)
+{
+ *src_pdo = pd_src_pdo;
+ return pd_src_pdo_cnt;
+}
+
static enum tcpc_rp_value lcl_rp;
__overridable void typec_select_src_current_limit_rp(int port,
enum tcpc_rp_value rp)
diff --git a/test/test_config.h b/test/test_config.h
index eb3f428a09..712ad61a14 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -497,6 +497,7 @@ int ncp15wb_calculate_temp(uint16_t adc);
#define CONFIG_USB_PD_DEBUG_LEVEL 3
#define CONFIG_USB_PD_EXTENDED_MESSAGES
#define CONFIG_USB_PD_DECODE_SOP
+#define CONFIG_USB_PD_3A_PORTS 0 /* Host does not define a 3.0 A PDO */
#endif
#ifdef TEST_USB_PD_INT