From 55475e86d9d2c070412615dd8e0f7fa0c234299a Mon Sep 17 00:00:00 2001 From: Eric Yilun Lin Date: Fri, 10 Mar 2023 14:07:47 +0800 Subject: tcpci: fix get_vbus_voltage macro The scale mask is at b10 and b11. So the shift should be 10 instead. BUG=b:272664811 TEST=with the next CL, ./twister -c -i -T zephyr/test/drivers BRANCH=none Change-Id: I53aa0557a184eec5d49dcfb7ba33869eba764470 Signed-off-by: Eric Yilun Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4328913 Reviewed-by: Ting Shen Commit-Queue: Ting Shen Auto-Submit: Eric Yilun Lin Tested-by: Eric Yilun Lin --- include/driver/tcpm/tcpci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/driver/tcpm/tcpci.h b/include/driver/tcpm/tcpci.h index eb2b4e7f9f..4ded8c23e7 100644 --- a/include/driver/tcpm/tcpci.h +++ b/include/driver/tcpm/tcpci.h @@ -279,7 +279,7 @@ * 11: reserved */ #define TCPC_REG_VBUS_VOLTAGE_SCALE(x) \ - (1 << (((x)&TCPC_REG_VBUS_VOLTAGE_SCALE_FACTOR) >> 9)) + (1 << (((x)&TCPC_REG_VBUS_VOLTAGE_SCALE_FACTOR) >> 10)) #define TCPC_REG_VBUS_VOLTAGE_MEASURE(x) ((x)&TCPC_REG_VBUS_VOLTAGE_MEASUREMENT) #define TCPC_REG_VBUS_VOLTAGE_VBUS(x) \ (TCPC_REG_VBUS_VOLTAGE_SCALE(x) * TCPC_REG_VBUS_VOLTAGE_MEASURE(x) * \ -- cgit v1.2.1