aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2018-11-07 21:49:39 -0500
committerBenson Leung <bleung@chromium.org>2018-11-14 00:25:28 -0500
commit6ad16b78a039b45294b1ad5d69c14ac57b2fe706 (patch)
treec2b3e3f960c321cc03ccb066c960d555c0322ace
parent475b08734edb3695b9396950c87e75d7c72278a8 (diff)
platform/chrome: don't report EC_MKBP_EVENT_SENSOR_FIFO as wakeup
EC_MKBP_EVENT_SENSOR_FIFO events can be triggered for a variety of reasons, and there are very few cases in which they should be treated as wakeup interrupts (particularly, when a certain MOTIONSENSE_MODULE_FLAG_* is set, but this is not even supported in the mainline cros_ec_sensor driver yet). Most of the time, they are benign sensor readings. In any case, the top-level cros_ec device doesn't know enough to determine that they should wake the system, and so it should not report the event. This would be the job of the cros_ec_sensors driver to parse. This patch adds checks to cros_ec_get_next_event() such that it doesn't signal 'wakeup' for events of type EC_MKBP_EVENT_SENSOR_FIFO. This patch is particularly relevant on devices like Scarlet (Rockchip RK3399 tablet, known as Acer Chromebook Tab 10), where the EC firmware reports sensor events much more frequently. This was causing /sys/power/wakeup_count to increase very frequently, often needlessly interrupting our ability to suspend the system. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index fff67b389c87..cc7baf0ecb3c 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -575,6 +575,7 @@ static int get_keyboard_state_event(struct cros_ec_device *ec_dev)
575 575
576int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event) 576int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
577{ 577{
578 u8 event_type;
578 u32 host_event; 579 u32 host_event;
579 int ret; 580 int ret;
580 581
@@ -594,11 +595,22 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev, bool *wake_event)
594 return ret; 595 return ret;
595 596
596 if (wake_event) { 597 if (wake_event) {
598 event_type = ec_dev->event_data.event_type;
597 host_event = cros_ec_get_host_event(ec_dev); 599 host_event = cros_ec_get_host_event(ec_dev);
598 600
599 /* Consider non-host_event as wake event */ 601 /*
600 *wake_event = !host_event || 602 * Sensor events need to be parsed by the sensor sub-device.
601 !!(host_event & ec_dev->host_event_wake_mask); 603 * Defer them, and don't report the wakeup here.
604 */
605 if (event_type == EC_MKBP_EVENT_SENSOR_FIFO)
606 *wake_event = false;
607 /* Masked host-events should not count as wake events. */
608 else if (host_event &&
609 !(host_event & ec_dev->host_event_wake_mask))
610 *wake_event = false;
611 /* Consider all other events as wake events. */
612 else
613 *wake_event = true;
602 } 614 }
603 615
604 return ret; 616 return ret;