From b3120ec649e50d65120cc766882e245629088035 Mon Sep 17 00:00:00 2001 From: Txanton Bejos Date: Fri, 27 Mar 2026 11:55:03 -0700 Subject: [PATCH 1/2] fwk: fix PD charge ceiling ignoring controller when not source This fixes an issue where it would set the ceiling value on just the port value, meaning it would always go to the same controller even when it should be applying to a different controller. --- zephyr/program/framework/src/cypress_pd_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zephyr/program/framework/src/cypress_pd_common.c b/zephyr/program/framework/src/cypress_pd_common.c index ef17edc257..8eb0bb902e 100644 --- a/zephyr/program/framework/src/cypress_pd_common.c +++ b/zephyr/program/framework/src/cypress_pd_common.c @@ -1268,7 +1268,7 @@ static void cypd_update_port_state(int controller, int port) /* * The port can have several states active: - * 1. Type C active (with no PD contract) CC resistor negociation only + * 1. Type C active (with no PD contract) CC resistor negotiation only * 2. Type C active with PD contract * 3. Not active * Each of 1 and 2 can be either source or sink @@ -1280,7 +1280,7 @@ static void cypd_update_port_state(int controller, int port) type_c_current); } else { typec_set_input_current_limit(port_idx, 0, 0); - charge_manager_set_ceil(port, + charge_manager_set_ceil(port_idx, CEIL_REQUESTOR_PD, CHARGE_CEIL_NONE); } From 60d89410ebf19518081e8d51798865a2367d5b7a Mon Sep 17 00:00:00 2001 From: Txanton Bejos Date: Fri, 27 Mar 2026 12:16:19 -0700 Subject: [PATCH 2/2] fwk: Fix cypress error recovery never sent to port 1+ There was a bug where when looping through the ports for a given controller, it would try to get the controller from the port value. This would always be zero as it is just looping. --- zephyr/program/framework/src/cypress_pd_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zephyr/program/framework/src/cypress_pd_common.c b/zephyr/program/framework/src/cypress_pd_common.c index 8eb0bb902e..f2c1aad60f 100644 --- a/zephyr/program/framework/src/cypress_pd_common.c +++ b/zephyr/program/framework/src/cypress_pd_common.c @@ -1440,7 +1440,7 @@ static void perform_error_recovery(int controller) battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)) { data[0] = PORT_TO_CONTROLLER_PORT(i); - cypd_write_reg_block(PORT_TO_CONTROLLER(i), + cypd_write_reg_block(controller, CCG_DPM_CMD_REG, data, 2); }