summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2017-09-21 14:48:39 -0700
committerRobb Glasser <rglasser@google.com>2017-09-25 14:25:53 -0700
commitdbf989c00cdf95a8520f1ac2bb22f6bfbfbcb33c (patch)
tree16094f7ebc44add2a208c6bff1950b276a82f8a9
parentb4c787de72ca64e7710c8fb75ecb7b3ff42e559d (diff)
downloadtegra-dbf989c00cdf95a8520f1ac2bb22f6bfbfbcb33c.tar.gz
CHROMIUM: cros_ec: Don't call pm_wake for sensor events
When interrupted by EC, we normally wake up and interrupt suspend. However, when suspending, we should not abort suspend because of sensor events: EC sensor stack does not know yet we are suspending, and interrupts are send very often. We are losing significant motion interrupt, but suspending is a short window. BUG=b:25425420 TEST=Check we are entering suspend. Change-Id: I60fc031a70535ababe28d62e5dffd548752078a0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
-rw-r--r--drivers/mfd/cros_ec.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
index c982b81af926..d770843714ec 100644
--- a/drivers/mfd/cros_ec.c
+++ b/drivers/mfd/cros_ec.c
@@ -406,15 +406,25 @@ u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev)
static irqreturn_t ec_irq_thread(int irq, void *data)
{
struct cros_ec_device *ec_dev = data;
- int ret;
-
- if (device_may_wakeup(ec_dev->dev))
- pm_wakeup_event(ec_dev->dev, 0);
+ int ret, wake_event = 1;
- if (ec_dev->mkbp_event_supported)
+ if (ec_dev->mkbp_event_supported) {
ret = cros_ec_get_next_event(ec_dev);
- else
+ if (ec_dev->event_data.event_type == EC_MKBP_EVENT_SENSOR_FIFO) {
+ /*
+ * While we are suspending, we may still receive
+ * sensor information on the wake up interrupt line.
+ * Ignore wake up event (significant motion) until we
+ * are fully suspended.
+ */
+ wake_event = 0;
+ }
+ } else {
ret = cros_ec_get_keyboard_state_event(ec_dev);
+ }
+
+ if (device_may_wakeup(ec_dev->dev) && wake_event)
+ pm_wakeup_event(ec_dev->dev, 0);
if (ret > 0)
blocking_notifier_call_chain(&ec_dev->event_notifier,