From 33d4fba9daf641d8f52171bc1a1de823a1afb650 Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Tue, 6 Apr 2021 15:02:55 -0600 Subject: ec: Filter non-FIXED PDOs in servo_v4{p1} Add a new config CONFIG_USB_PD_ONLY_FIXED_PDOS. If that config is enabled, ignore non-FIXED PDOs in both the console command `ada_srccaps` and also when selecting the preferred PDO for a voltage. Enable CONFIG_USB_PD_ONLY_FIXED_PDOS for servo_v4 and servo_v4p1, since they don't expose non-fixed PDO in their srccaps. Without this change, there is a risk that the "best" PDO for a given voltage will be non-FIXED and then that voltage just won't be supported at all. BRANCH=none BUG=b:178484932 TEST=added Change-Id: I0d1187ca372120c7fe21d627e1b82b59f6334add Signed-off-by: Jeremy Bettis Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809353 Tested-by: Jeremy Bettis Commit-Queue: Keith Short Reviewed-by: Keith Short --- common/usb_pd_dual_role.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common') diff --git a/common/usb_pd_dual_role.c b/common/usb_pd_dual_role.c index 2ad0b99125..3c6aff6adf 100644 --- a/common/usb_pd_dual_role.c +++ b/common/usb_pd_dual_role.c @@ -61,6 +61,9 @@ int pd_find_pdo_index(uint32_t src_cap_cnt, const uint32_t * const src_caps, /* Get max power that is under our max voltage input */ for (i = 0; i < src_cap_cnt; i++) { + if (IS_ENABLED(CONFIG_USB_PD_ONLY_FIXED_PDOS) && + (src_caps[i] & PDO_TYPE_MASK) != PDO_TYPE_FIXED) + continue; /* its an unsupported Augmented PDO (PD3.0) */ if ((src_caps[i] & PDO_TYPE_MASK) == PDO_TYPE_AUGMENTED) continue; -- cgit v1.2.1