From patchwork Mon Aug 20 15:34:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravi Chandra Sadineni X-Patchwork-Id: 10570509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1774813B4 for ; Mon, 20 Aug 2018 15:34:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0817C28FF9 for ; Mon, 20 Aug 2018 15:34:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0075293D3; Mon, 20 Aug 2018 15:34:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABA5E2937D for ; Mon, 20 Aug 2018 15:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbeHTSua (ORCPT ); Mon, 20 Aug 2018 14:50:30 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37805 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbeHTSua (ORCPT ); Mon, 20 Aug 2018 14:50:30 -0400 Received: by mail-pg1-f193.google.com with SMTP id h8-v6so510832pgs.4 for ; Mon, 20 Aug 2018 08:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:subject:date:message-id; bh=qMyHORIoNYPSIueH4e/M3+17FAqMwSDrQJGLfkY3URU=; b=ZVNY3sJIwO3XuHiz0cI87HyVdC1EOsAOSydFf/Kto9JVWuN4kHWFhbaNJ6z2hxpwlr KcFyX/SlYZyNIdGWfJc29JiN9rmFxgNoz1FHBQ8aPdwg6EY9Fa962uHPbA2I7Ur9xJS8 TX1nXFv5Ia7aUirXv3/V2S4QfRuG2ncIx5fgU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=qMyHORIoNYPSIueH4e/M3+17FAqMwSDrQJGLfkY3URU=; b=JKiCrrr5FtPYSwVdwy1Vrc2sy11Hky37AwUyjBkQTQFIOOwvyRjsvb/HuRx5G5ox4D uv7Fm8ljmRjR35jnPMeiCAPUe0fqMVl5TnzVyUwYcGgVbnJzdEooSSjp1n5+YRgDAF1g 8/HpvBTINfDufav+pHlMErRgJgw6QIETRyQfuTX+q04uUFj5L/mgdAQ6BH/A/PImrybp K9Rl8MZzcyllxWT6mCDq9eXVxW1CUStYgRhRTdF7P4G8bMhTnaO05DGiwlY+hFUlNoJS hXrkcDmenwW3V4/mbpmS2glhFiK6EOj4KcVSWG3T0DGu3AxsP/Cw2CTKrDO8Mx4E4hir 38fg== X-Gm-Message-State: AOUpUlHNGpcY4ai9sRsqAfQe+itrFBenMTz2iUQ2vFVf6wkdfyZ2bTVg ijvhdnzv+oN0o6JCihH3M5IXQw== X-Google-Smtp-Source: AA+uWPxh6IslMtWTJi5mLBELLcLbp13F/tZiX3PzQugsOiVGo78IspHA3KmmLT/mXvViEwyrW4S02Q== X-Received: by 2002:a62:bd4:: with SMTP id 81-v6mr49007352pfl.67.1534779264272; Mon, 20 Aug 2018 08:34:24 -0700 (PDT) Received: from ravisadineni0.mtv.corp.google.com ([2620:15c:202:1:9f2c:2145:3c42:4e88]) by smtp.gmail.com with ESMTPSA id k64-v6sm17064728pfg.141.2018.08.20.08.34.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Aug 2018 08:34:23 -0700 (PDT) From: RaviChandra Sadineni X-Google-Original-From: RaviChandra Sadineni To: lee.jones@linaro.org, dmitry.torokhov@gmail.com, ravisadineni@chromium.org, ravisadineni@google.com, dtor@google.com, linux-samsung-soc@vger.kernel.org, tbroch@google.com, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com Subject: mfd: cros_ec: Check for mkbp events on resume only if supported. Date: Mon, 20 Aug 2018 08:34:19 -0700 Message-Id: <20180820153419.32098-1-ravisadineni@google.com> X-Mailer: git-send-email 2.16.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently on every resume we check for mkbp events and notify the clients. This helps in identifying the wakeup sources. But on devices that do not support mkbp protocol, we might end up querying key state of the keyboard in a loop which blocks the resume. Instead check for events only if mkbp is supported. Signed-off-by: RaviChandra Sadineni Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski --- Note: This patch fixes the suspend/resume issue on Snow and Peach-Pit Chromebooks, both on vanilla v4.18 as well as linux-next from 20 August 2018. Further info at: https://lkml.org/lkml/2018/6/5/1076 drivers/mfd/cros_ec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 65a9757a6d21..fe6f83766144 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -218,7 +218,8 @@ EXPORT_SYMBOL(cros_ec_suspend); static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { - while (cros_ec_get_next_event(ec_dev, NULL) > 0) + while (ec_dev->mkbp_event_supported && + cros_ec_get_next_event(ec_dev, NULL) > 0) blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); }