summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-07-12 18:56:14 +0800
committerCommit Bot <commit-bot@chromium.org>2019-07-18 07:03:56 +0000
commit75b9e4032d757d1429d43b611b8c72353cc15551 (patch)
tree9ff14eef33fd756daee234f802707cbd974ef315
parentbb5f16bd8b4b20182b2b426f0c0fd2f7953fe004 (diff)
downloadchrome-ec-75b9e4032d757d1429d43b611b8c72353cc15551.tar.gz
driver/tcs3400: make error message in sensor read less spammy.
In EMULATED_IRQ_EVENT mode, we try to estimate the time between a read request and data ready. If the estimated time is shorter, an error message is printed to the console on every retry. On Kukui, this caused ec console spamming one line per second. Change the behavior to print only when returning error. No need to adjust the estimate time because one retry per read is still good enough. BUG=b:137345336 TEST=manually, verify that error message disappeared. BRANCH=None Change-Id: Ie85e8f1a80ea36ca5c50f57a19eba35f3f79f86d Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697889 Tested-by: Fei Shao <fshao@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--driver/als_tcs3400.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c
index 5e9c53e784..61b16bb355 100644
--- a/driver/als_tcs3400.c
+++ b/driver/als_tcs3400.c
@@ -104,9 +104,10 @@ static int tcs3400_post_events(struct motion_sensor_t *s, uint32_t last_ts)
return ret;
if (!(data & TCS_I2C_STATUS_RGBC_VALID)) {
retries--;
- if (retries == 0)
+ if (retries == 0) {
+ CPRINTS("RGBC not valid (0x%x)", data);
return EC_ERROR_UNCHANGED;
- CPRINTS("RGBC not valid (0x%x)", data);
+ }
msleep(20);
}
} while (!(data & TCS_I2C_STATUS_RGBC_VALID));