summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-10-14 18:19:47 +0000
committerCommit Bot <commit-bot@chromium.org>2021-10-15 18:39:17 +0000
commit2b702d8cc86ac5763a5181854caf2139b61b4e7c (patch)
tree909f133d49ee113f2973937c38b76b0f891e8fbb
parent484f31b694f04a3b027e3129f5153044a296ee5c (diff)
downloadchrome-ec-2b702d8cc86ac5763a5181854caf2139b61b4e7c.tar.gz
i2cp: reduce the number of i2c flog errors
Cap the number of I2C flog errors at 2 per boot. The timestamps of the two events can indicate if the unwedge issues happen successively or if there is a large gap between events. Many events with a short gap are likely benign and due to i2c not being terminated correctly. Inidividual I2C errors are likely caused by some other issue. BUG=b:146067724 TEST=check the number of i2c log messages on coral in s0ix Change-Id: I3f04c85e6233bf0c790db0d40a85aab3c927b9b8 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3225996 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--chip/g/i2cp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/g/i2cp.c b/chip/g/i2cp.c
index d6b99c79a0..6f016e87c9 100644
--- a/chip/g/i2cp.c
+++ b/chip/g/i2cp.c
@@ -104,6 +104,9 @@ static uint16_t last_read_pointer;
static uint16_t i2cp_read_recovery_count;
static uint16_t i2cp_sda_low_count;
+/* Maximum number of times to log i2c errors each boot. */
+#define FLOG_I2C_MAX_ERRORS 2
+
static void check_i2cp_state(void)
{
if (gpio_get_level(GPIO_MONITOR_I2CP_SDA))
@@ -255,6 +258,11 @@ static void poll_read_state(void)
*/
i2cp_register_write_complete_handler(
write_complete_handler_);
+
+#ifdef CONFIG_FLASH_LOG
+ if (i2cp_read_recovery_count <= FLOG_I2C_MAX_ERRORS)
+ flash_log_add_event(FE_TPM_I2C_ERROR, 0, NULL);
+#endif
return;
}
}