diff options
-rw-r--r-- | common/ec_features.c | 8 | ||||
-rw-r--r-- | common/motion_sense.c | 10 | ||||
-rw-r--r-- | include/motion_sense.h | 6 |
3 files changed, 21 insertions, 3 deletions
diff --git a/common/ec_features.c b/common/ec_features.c index 6778a3b36a..7a69575500 100644 --- a/common/ec_features.c +++ b/common/ec_features.c @@ -5,11 +5,12 @@ /* Present Chrome EC device features to the outside world */ +#include "board_config.h" #include "common.h" #include "config.h" #include "console.h" #include "ec_commands.h" -#include "board_config.h" +#include "motion_sense.h" uint32_t get_feature_flags0(void) { @@ -128,7 +129,10 @@ uint32_t get_feature_flags1(void) | EC_FEATURE_MASK_1(EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS) #endif #if defined(CONFIG_LID_ANGLE) && defined(CONFIG_TABLET_MODE) - | EC_FEATURE_MASK_1(EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS) + | (sensor_board_is_lid_angle_available() ? + EC_FEATURE_MASK_1( + EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS) : + 0) #endif #ifdef CONFIG_VBOOT_EFS2 | EC_FEATURE_MASK_1(EC_FEATURE_EFS2) diff --git a/common/motion_sense.c b/common/motion_sense.c index c08909d24e..f6011ae6d5 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -81,6 +81,13 @@ static int init_sensor_mutex(const struct device *dev) SYS_INIT(init_sensor_mutex, POST_KERNEL, 50); #endif /* CONFIG_ZEPHYR */ +#ifdef CONFIG_LID_ANGLE +__attribute__((weak)) int sensor_board_is_lid_angle_available(void) +{ + return 1; +} +#endif + static inline int motion_sensor_in_forced_mode(const struct motion_sensor_t *sensor) { @@ -1422,7 +1429,8 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args) default: /* Call other users of the motion task */ if (IS_ENABLED(CONFIG_LID_ANGLE) && - (ret == EC_RES_INVALID_PARAM)) + (ret == EC_RES_INVALID_PARAM) && + sensor_board_is_lid_angle_available()) ret = host_cmd_motion_lid(args); return ret; } diff --git a/include/motion_sense.h b/include/motion_sense.h index 6033d52ff9..750208d5cf 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -283,6 +283,12 @@ int sensor_init_done(struct motion_sensor_t *sensor); void sensor_board_proc_double_tap(void); /** + * Board specific function to double check lid angle calculation is possible. + * + */ +int sensor_board_is_lid_angle_available(void); + +/** * Commit the data in a sensor's raw_xyz vector. This operation might have * different meanings depending on the CONFIG_ACCEL_FIFO flag. * |