Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp543135yba; Wed, 3 Apr 2019 14:02:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD7yHtr094DdfLvG/TroDTbJ+wK43YMn8c0GpCNz2drwIxsiiUsqkpSonlp8we2EsNtTfa X-Received: by 2002:a63:4b14:: with SMTP id y20mr1772078pga.306.1554325377612; Wed, 03 Apr 2019 14:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554325377; cv=none; d=google.com; s=arc-20160816; b=FF4ibMgyPWlKhDZ6zwcOnjxMW83F+R6gUjJnx0luYEaXi/M1Zv/wqZXdF0gJO7ueiE Jd5qfM+we+yUu2VLqbbukIBl65jrDA4edxTbIrLN9mZxCyFnfwbt4oDvzb8HD40QbfdD 6u6gec/p9WahNuUxmKoCFaGhxTPVt0y/ba3GKS93FjSkdZHf2jiWUogZXjsjikybeewL aUlXNSc6GCER3w1ejgSyLWBHDcQIQfXuwCLM4TBxzkvWDQZY8jtIEyS0erSh5ygfhWY/ Bd7JDLszSGDObe3/0+oCIQqN+qFm6934nKDRts4U8qnpkhJXGJnW1Af65tUcXP7Z/Ncj Nvww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mm+wqxtkVVK0HjGNZVBNwFuILHRwZwys8pnK+jn9FAI=; b=esOyb+oV+RDwmB2Ixgm+lYpcMkOUijScm+icqbsrLZjQBrXY+G8rPc5r3YVBH+JXks J3uYYJk80BgZT54B2o2m2STCaMYtyUokLWY2O4RST/0MWPdN3CvTvxhzoRGYBxqnWJUg wGvYmQuoZpAHvA4Cw7SdO+mGHJnXMZ/Q1BqtB9SH+cagHg9+PzN86RqEvWSVhJ8gDdLI XAO/9pEqx5yH2B1cIh8Wa8G8tY51fB59GnYaHnknOtQE+DYFm77YBTEBdyXqnp3OnbNQ ZUHoyPj4T50EpVohbkdhgC5ZpejrFSb65sj19ZqwL7rEG6TLhLxaDoFuMTGeiNd/PRvU uV3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j1j9Li0P; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i195si14851988pgd.521.2019.04.03.14.02.42; Wed, 03 Apr 2019 14:02:57 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b=j1j9Li0P; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfDCVB7 (ORCPT + 99 others); Wed, 3 Apr 2019 17:01:59 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38857 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbfDCVB7 (ORCPT ); Wed, 3 Apr 2019 17:01:59 -0400 Received: by mail-pf1-f193.google.com with SMTP id 10so191008pfo.5 for ; Wed, 03 Apr 2019 14:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mm+wqxtkVVK0HjGNZVBNwFuILHRwZwys8pnK+jn9FAI=; b=j1j9Li0PuhiF4PRq2w78+oBOrsY0h4CAzlvyR0nIjJRmiRw4uWU/EBwXv/m34Il0HG Tvtgq3KwohaNHpHd1zoYJMBOtFsC4CJ6PfLJp0Faj7h4ous0UUg1Rxd7cXLqiwFFAsGW d9gvjb7j/E+9UP8+dLKZNRgLqboUXDHdP6m3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mm+wqxtkVVK0HjGNZVBNwFuILHRwZwys8pnK+jn9FAI=; b=L4hWRbbr1fg7s8z4lfKx49y1fIry8eY0F58QIlhM0Rt1AAvkDX+q2Rmx89FAY8c3Wc 7fcDIjWe/Rgg+EsitnA7McueLhxApIYClW3eBxTBvnMdByCQySKZdblYcx6KnlTeQTji GoyBouj0DcwEJsAdG2K39YLJCHsseR/P5T4VmkhesBg9HL8eoajyoP6wOqwuCPQs2Hcm iI1N7o3yYaIUWhUj4Y+0HBFFGRDlRQUfWi5Hwi24aC4NMcnXIrAX8eNRZN0Ks+tm2jB4 HErHVn1iGtQK9aev597t6jAECzqyi5H3aoplArso1BpB3uZ9/LlU3dmnTxuG4JXUtf9D jkFg== X-Gm-Message-State: APjAAAVHUXhHg2OPVTSGi8SomgvHVZtRH6f4Lm4fqw/AdHgyHE6K593b F9v3Rx1X6Ygpw/FAfntLaH+fvQ== X-Received: by 2002:a63:e556:: with SMTP id z22mr1803195pgj.290.1554325318326; Wed, 03 Apr 2019 14:01:58 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:ffda:7716:9afc:1301]) by smtp.gmail.com with ESMTPSA id v7sm22361531pgh.53.2019.04.03.14.01.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Apr 2019 14:01:57 -0700 (PDT) From: Evan Green To: Benson Leung , Enric Balletbo i Serra Cc: Furquan Shaikh , Rajat Jain , Evan Green , linux-kernel@vger.kernel.org, Guenter Roeck , Lee Jones Subject: [PATCH v2 1/2] mfd: cros_ec: Add host_sleep_event_v1 command Date: Wed, 3 Apr 2019 14:01:47 -0700 Message-Id: <20190403210148.77908-2-evgreen@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190403210148.77908-1-evgreen@chromium.org> References: <20190403210148.77908-1-evgreen@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the command and response structures for the second revision of the host sleep event. These structures are part of a new EC change that enables detection of failure to enter S0ix. The EC waits a kernel-specified timeout (or a default amount of time) for the S0_SLP pin to change, and wakes the system if that change does not occur in time. Signed-off-by: Evan Green --- Changes in v2: - Made unions anonymous - Replaced reserved union members with a comment include/linux/mfd/cros_ec_commands.h | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index fc91082d4c35..1cdb07c0ece1 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -2729,6 +2729,63 @@ struct ec_params_host_sleep_event { uint8_t sleep_event; } __packed; +/* + * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep + * transition failures + */ +#define EC_HOST_SLEEP_TIMEOUT_DEFAULT 0 + +/* Disable timeout detection for this sleep transition */ +#define EC_HOST_SLEEP_TIMEOUT_INFINITE 0xFFFF + +struct ec_params_host_sleep_event_v1 { + /* The type of sleep being entered or exited. */ + uint8_t sleep_event; + + /* Padding */ + uint8_t reserved; + union { + /* Parameters that apply for suspend messages. */ + struct { + /* + * The timeout in milliseconds between when this message + * is received and when the EC will declare sleep + * transition failure if the sleep signal is not + * asserted. + */ + uint16_t sleep_timeout_ms; + } suspend_params; + + /* No parameters for non-suspend messages. */ + }; +} __packed; + +/* A timeout occurred when this bit is set */ +#define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 + +/* + * The mask defining which bits correspond to the number of sleep transitions, + * as well as the maximum number of suspend line transitions that will be + * reported back to the host. + */ +#define EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK 0x7FFFFFFF + +struct ec_response_host_sleep_event_v1 { + union { + /* Response fields that apply for resume messages. */ + struct { + /* + * The number of sleep power signal transitions that + * occurred since the suspend message. The high bit + * indicates a timeout occurred. + */ + uint32_t sleep_transitions; + } resume_response; + + /* No response fields for non-resume messages. */ + }; +} __packed; + /*****************************************************************************/ /* Smart battery pass-through */ -- 2.20.1