summaryrefslogtreecommitdiff
path: root/driver/als_tcs3400.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-07-15 14:10:11 -0600
committerCommit Bot <commit-bot@chromium.org>2019-09-03 20:36:04 +0000
commitdfbc632cd5b5a856086249253a98bc83d8942a29 (patch)
tree9f0359115a96ca0efe66905b5f6b1be644367430 /driver/als_tcs3400.c
parent083788ac19505f07bfe57a4d8b54a3b11b7554b3 (diff)
downloadchrome-ec-dfbc632cd5b5a856086249253a98bc83d8942a29.tar.gz
config: Refactor CONFIG_ACCEL_FIFO to enable use of IS_ENABLED
This change allows us to use the IS_ENABLED condition to replace the various ifdef guards around the CONFIG_ACCEL_FIFO BUG=b:137758297,chromium:981990 BRANCH=None TEST=buildall and CTS tests on Arcada Change-Id: I65d36bac19855e51c830a33e6f3812575e8d15d9 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704164 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'driver/als_tcs3400.c')
-rw-r--r--driver/als_tcs3400.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c
index 774efd863c..7e867a606d 100644
--- a/driver/als_tcs3400.c
+++ b/driver/als_tcs3400.c
@@ -18,9 +18,7 @@
#define CPRINTS(fmt, args...) cprints(CC_ACCEL, "%s "fmt, __func__, ## args)
-#ifdef CONFIG_ACCEL_FIFO
-static volatile uint32_t last_interrupt_timestamp;
-#endif
+STATIC_IF(CONFIG_ACCEL_FIFO) volatile uint32_t last_interrupt_timestamp;
#ifdef CONFIG_TCS_USE_LUX_TABLE
/*
@@ -423,10 +421,10 @@ static int tcs3400_post_events(struct motion_sensor_t *s, uint32_t last_ts)
}
#endif /* CONFIG_ACCEL_SPOOF_MODE */
-#ifdef CONFIG_ACCEL_FIFO
- vector.sensor_num = s - motion_sensors;
- motion_sense_fifo_stage_data(&vector, s, 3, last_ts);
-#endif
+ if (IS_ENABLED(CONFIG_ACCEL_FIFO)) {
+ vector.sensor_num = s - motion_sensors;
+ motion_sense_fifo_stage_data(&vector, s, 3, last_ts);
+ }
}
/*
@@ -476,9 +474,9 @@ static int tcs3400_post_events(struct motion_sensor_t *s, uint32_t last_ts)
void tcs3400_interrupt(enum gpio_signal signal)
{
-#ifdef CONFIG_ACCEL_FIFO
- last_interrupt_timestamp = __hw_clock_source_read();
-#endif
+ if (IS_ENABLED(CONFIG_ACCEL_FIFO))
+ last_interrupt_timestamp = __hw_clock_source_read();
+
task_set_event(TASK_ID_MOTIONSENSE,
CONFIG_ALS_TCS3400_INT_EVENT, 0);
}