Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32353 )
Change subject: board/kukui: Support ADC value for NC ......................................................................
board/kukui: Support ADC value for NC
When the components like LCM ID are not installed (i.e., NC), ADC will return some value with much larger variation from standard value (out of the tolerance we set). To support that, we should check tolerance only on non-NC voltages.
Also improve the error messages so we can see the ADC raw values instead of simple assertion error (which makes debugging more difficult since we have to build another firmware image just to print the values).
BUG=None TEST=Booted on Kukui and got correct SKU ID for NC LCMID. BRANCH=None
Change-Id: I8d00956e0e3b48ddbcaa505dd3ade24720c3b4ad Signed-off-by: Hung-Te Lin hungte@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/32353 Reviewed-by: Julius Werner jwerner@chromium.org Reviewed-by: You-Cheng Syu youcheng@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/google/kukui/boardid.c 1 file changed, 7 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved You-Cheng Syu: Looks good to me, but someone else must approve
diff --git a/src/mainboard/google/kukui/boardid.c b/src/mainboard/google/kukui/boardid.c index b9f1ba2..71f051f 100644 --- a/src/mainboard/google/kukui/boardid.c +++ b/src/mainboard/google/kukui/boardid.c @@ -15,6 +15,7 @@
#include <assert.h> #include <boardid.h> +#include <console/console.h> #include <soc/auxadc.h> #include <ec/google/chromeec/ec.h> #include <stddef.h> @@ -82,8 +83,13 @@ if (value < (voltages[id] + voltages[id + 1]) / 2) break;
+ /* The last level is NC and may be larger than standard tolerance. */ const int tolerance = 10000; /* 10,000 uV */ - assert(ABS(value - voltages[id]) < tolerance); + if (id < ADC_LEVELS - 1 && ABS(value - voltages[id]) > tolerance) { + printk(BIOS_ERR, "ADC channel %u value out of range: %d\n", + channel, value); + assert(0); + }
return id; }