mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 00:21:46 +00:00
motion: Disable tablet mode if one accel is broken
We need 2 accelerometer for tablet mode. If one of them is not working, disable tablet mode. We will stay in clamshell mode, lid angle will be always unreliable. BUG=chrome-os-partner:61141 TEST=On kevin with a single sensor. Check we are in clamshell mode when rebooting the EC. BRANCH=kevin Change-Id: I7bf6cdc9d85370fce20e5183622b4bc18f4f5f99 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424184 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
4234992812
commit
1523e8b3ef
@@ -253,7 +253,6 @@ static int calculate_lid_angle(const vector_3_t base, const vector_3_t lid,
|
||||
tablet_mode_debounce_cnt =
|
||||
TABLET_MODE_DEBOUNCE_COUNT;
|
||||
tablet_set_mode(new_tablet_mode);
|
||||
hook_notify(HOOK_TABLET_MODE_CHANGE);
|
||||
return reliable;
|
||||
}
|
||||
tablet_mode_debounce_cnt--;
|
||||
|
||||
@@ -436,6 +436,16 @@ static void motion_sense_switch_sensor_rate(void)
|
||||
if (ret != EC_SUCCESS) {
|
||||
CPRINTS("%s: %d: init failed: %d",
|
||||
sensor->name, i, ret);
|
||||
#ifdef CONFIG_LID_ANGLE_TABLET_MODE
|
||||
/*
|
||||
* No tablet mode allowed if an accel
|
||||
* is not working.
|
||||
*/
|
||||
if (i == CONFIG_LID_ANGLE_SENSOR_BASE ||
|
||||
i == CONFIG_LID_ANGLE_SENSOR_LID) {
|
||||
tablet_set_mode(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "hooks.h"
|
||||
|
||||
/* Return 1 if in tablet mode, 0 otherwise */
|
||||
static int tablet_mode = 1;
|
||||
|
||||
@@ -13,6 +15,9 @@ int tablet_get_mode(void)
|
||||
|
||||
void tablet_set_mode(int mode)
|
||||
{
|
||||
tablet_mode = mode;
|
||||
if (tablet_mode != mode) {
|
||||
tablet_mode = mode;
|
||||
hook_notify(HOOK_TABLET_MODE_CHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user