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-19 22:24:28 +0000
commit6eae30ed20ed766b43ac7f7d2bc6aa40f7cbe64d (patch)
treec60367ba6b2e1f91df65e887a26268cad39e9a9a
parent826ec33aeffb3437a8b206e552a47e5f237e87d4 (diff)
downloadchrome-ec-6eae30ed20ed766b43ac7f7d2bc6aa40f7cbe64d.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> (cherry picked from commit 2b702d8cc86ac5763a5181854caf2139b61b4e7c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229796 Reviewed-by: Andrey Pronin <apronin@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 b07f13f419..fb9878d3ee 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;
}
}