Received: by 10.223.185.116 with SMTP id b49csp807368wrg; Fri, 23 Feb 2018 07:07:47 -0800 (PST) X-Google-Smtp-Source: AH8x225prM7jzRfOwqgNiqwHdCTHq77QynZWTO7cnHoPAHEMf+JBN9glS3S9UX3NGO1gIYg3lGCy X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr2005430plb.250.1519398467010; Fri, 23 Feb 2018 07:07:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519398466; cv=none; d=google.com; s=arc-20160816; b=SD1kEbtOw9pzXA9kt1NPtjsahEvyX/j8loFMvlHBzXn91qqjDW0qLLPfFA1hE8Sna0 V/s+JB7+yDDZkzjysiGkdm8FLOIkqUF3vCnp5dXXOb9hMswrSdUham9OUuvcaTsGBq05 mxdAb2Ag0SbUAFgToRjxC/uQDmkThgpReJmbAJ4IKLW/JlImrDlhPGhANdgW/avdf4lj p8mgY8uxx68YGXImX8cYVnj+tAuHnU1cpJfprSl9cZqDzxqdfHGkO/7UdWHBQlViA1CY j12koEnBhDjDYjD55X1JnxWFTpsugWl35caTlYrde49r6dzJiK69zt0Pl1z29lBZWcsY AUYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=R4cb08+RqimquN5xYPt7neOw0BD0c8mdmvuUGQeb3RM=; b=vgt2ZZ4kkQMM8SiB09r/jwLxGOsHGtah6wSRL/MR8CsbzEarRN1/k5MsLwX2A2qXmY YbS2Me7BrlbjTZoVpDR872/8a3kbijLo0DZMqBjOBl8C9KmTpHqzaYYMY5CWbUqJf/Yf 8S2bv7fd8m+iZOUXk1YQslWbpl4hWfbTuQSyDO3yvuXxMMeCuTw55AhWKD3Vy5FO69DV UGSiJS5mJOM73TROrbVR8FDMIDlbmEk22JgNmuT7FHVx8of1AzfxipXseHb31iKpDMGK I1lmOHkvQTY1jNbCW6xn7UQCjREJ7emtEIOAvLkfIQKzFfQcFs6BAGL9yNAfj1SEmUyc 4+hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y26si1934102pfm.63.2018.02.23.07.07.32; Fri, 23 Feb 2018 07:07:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbeBWPG3 (ORCPT + 99 others); Fri, 23 Feb 2018 10:06:29 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:37278 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbeBWPGS (ORCPT ); Fri, 23 Feb 2018 10:06:18 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id A4D57271C04 From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: groeck@chromium.org, gwendal@chromium.org, kernel@collabora.com, linux-kernel@vger.kernel.org, Douglas Anderson , Benson Leung , Olof Johansson Subject: [PATCH v2 3/8] mfd: cros_ec: Don't try to grab log when suspended Date: Fri, 23 Feb 2018 16:06:00 +0100 Message-Id: <20180223150605.10417-4-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180223150605.10417-1-enric.balletbo@collabora.com> References: <20180223150605.10417-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson We should stop our worker thread while we're suspended. If we don't then we'll get messages like: cros-ec-spi spi5.0: spi transfer failed: -108 cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108 cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed Signed-off-by: Douglas Anderson Signed-off-by: Enric Balletbo i Serra --- Changes in v2: - [3/8] That patch is new in this series. drivers/mfd/cros_ec_dev.c | 4 ++++ drivers/platform/chrome/cros_ec_debugfs.c | 20 ++++++++++++++++++++ include/linux/mfd/cros_ec.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index e4fafdd96e5e..f98e5beffca6 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -471,6 +471,8 @@ static __maybe_unused int ec_device_suspend(struct device *dev) { struct cros_ec_dev *ec = dev_get_drvdata(dev); + cros_ec_debugfs_suspend(ec); + lb_suspend(ec); return 0; @@ -480,6 +482,8 @@ static __maybe_unused int ec_device_resume(struct device *dev) { struct cros_ec_dev *ec = dev_get_drvdata(dev); + cros_ec_debugfs_resume(ec); + lb_resume(ec); return 0; diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 0e88e18362c1..0328856ec3a2 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -398,3 +398,23 @@ void cros_ec_debugfs_remove(struct cros_ec_dev *ec) cros_ec_cleanup_console_log(ec->debug_info); } EXPORT_SYMBOL(cros_ec_debugfs_remove); + +void cros_ec_debugfs_suspend(struct cros_ec_dev *ec) +{ + /* + * cros_ec_debugfs_init() failures are non-fatal; it's also possible + * that we initted things but decided that console log wasn't supported. + * We'll use the same set of checks that cros_ec_debugfs_remove() + + * cros_ec_cleanup_console_log() end up using to handle those cases. + */ + if (ec->debug_info && ec->debug_info->log_buffer.buf) + cancel_delayed_work_sync(&ec->debug_info->log_poll_work); +} +EXPORT_SYMBOL(cros_ec_debugfs_suspend); + +void cros_ec_debugfs_resume(struct cros_ec_dev *ec) +{ + if (ec->debug_info && ec->debug_info->log_buffer.buf) + schedule_delayed_work(&ec->debug_info->log_poll_work, 0); +} +EXPORT_SYMBOL(cros_ec_debugfs_resume); diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index c61535979b8f..804b3ddbf819 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -325,6 +325,8 @@ extern struct attribute_group cros_ec_vbc_attr_group; /* debugfs stuff */ int cros_ec_debugfs_init(struct cros_ec_dev *ec); void cros_ec_debugfs_remove(struct cros_ec_dev *ec); +void cros_ec_debugfs_suspend(struct cros_ec_dev *ec); +void cros_ec_debugfs_resume(struct cros_ec_dev *ec); /* ACPI GPE handler */ #ifdef CONFIG_ACPI -- 2.16.1