Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp567090yba; Wed, 3 Apr 2019 14:36:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMhtagR6+avzzyfADqaQHW7H9FHP80i4ehcr/8jJmlzjy5QzjBZJpaPa1EZWw1xwNzjXjz X-Received: by 2002:aa7:92c4:: with SMTP id k4mr1786606pfa.183.1554327373671; Wed, 03 Apr 2019 14:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554327373; cv=none; d=google.com; s=arc-20160816; b=gBUDD0vKYUbyl7rmm1xsSz/yHKC5ou0F+Q2h9xAHo+vrTbU3NBO6UtCKjpXVrGZc4m ldamhkCtOkCfwdOGorB7TVFnWx1YN4+JKjr/CmSz1igvjrXOqDONtj6o/Dncwuh44q9v w+6P0xShp6v/xaVBDqEPxU34JJwmX9TQDv7fODlWMEqXiRDjpYPOL6xhYqnRRe2gHecD RMJ6mpYbW6goHL9QgsNI0RS7W17XBO8TRQlXUYu02dQyWs9RZ75/71fU/XTVAj5ArAq2 sd3dsBj+/bWIP/fOnCBShSN1tG7nU32NWprVlHa/7hwW9FvgSh1rZQaczfZQvshnMkXZ KIMg== 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=OV11Yd+JyO8D2jFDZUkBxNwVTwEby0NJc8k+iAM1aeg=; b=XmSDyo8NM01G9eKXjqg7kisKJ5YVHPtyMpC7iOiNcsWRM2q4DRi/bjYQ7ung1SrpWV BVAGGJDS5r0SP32cMQdR21NmrkYVPftPVV03lKXsUQDxcHxiveYCgWVkkDEIZakxtmao rEA/ni5cTGC/GtRuTlu2I8e4fEuadUbF+eKjBA85eUBsT8SKd4UTg+TB1DhuIiZNxkPE xuX2KQHVmfJHPpBS9X0Gp9tE1U+6ph74fKas69b6Qre9UeCqELA16/wKYfyzwPy0O2E7 Gm4nCPoLvM0pjMJQ4gcSdcp8ltFyBnLLyLDjlABnQhSz1W+BGi61411puHGZBqOVBnQu dztA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f+5kF9AR; 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 a22si14493420plm.263.2019.04.03.14.35.58; Wed, 03 Apr 2019 14:36:13 -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=f+5kF9AR; 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 S1726534AbfDCVek (ORCPT + 99 others); Wed, 3 Apr 2019 17:34:40 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34800 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfDCVei (ORCPT ); Wed, 3 Apr 2019 17:34:38 -0400 Received: by mail-pg1-f196.google.com with SMTP id v12so129033pgq.1 for ; Wed, 03 Apr 2019 14:34:38 -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=OV11Yd+JyO8D2jFDZUkBxNwVTwEby0NJc8k+iAM1aeg=; b=f+5kF9ARFtRfY2Fy28XRkDvW1GkdbCg/sdLT2/6IhdEpPlh1sY7Sok1UGkjHgmAfvy 02UqvoRTCn83JP2xVKbOZII4ohaj2YzoZaI+EMO8puwrC+a/LP5+TobAujXYYvAits3u yCK8inxjoXMR98XL5323p9tiaPG6xm5emuOgo= 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=OV11Yd+JyO8D2jFDZUkBxNwVTwEby0NJc8k+iAM1aeg=; b=ocsPQL5bFsR7Rua+w1E2ghLmYTWA1QPKg3DvQzR4vyvEgFnV1KOYtpNczpcq/RUSvg hiUnc6Qy5776Tru6tiobB6hbXdWNE1EKT9+kfFdXCkGHPuqFgZtNGrNhbCLtWBKFgW1l mpV87RJRkGipH4VoHQZookrziA+gL7t0TcRj857W1o6myD5RNjx1ltMdhvbH+1UCmCKE 961bTSasjoSQdz47DjHL4grIq6PTISV5XkQTwNpdsT41h6vD+jyLrA57AckV3Bu6ExXJ WsQ3EhNObC98UOjaPCZ5yUtk3aML2CVgrBose0lo71s8HVd3InB/ZS1ittzM6g1N5ySt RyDg== X-Gm-Message-State: APjAAAWqS0M4jjmAUkhV921hJGkZ5EPDAZeN++tsIcE0xIT4Zs5fyE4l NsheOy1yAX6DcySGWtUz9qPIIA== X-Received: by 2002:a63:6142:: with SMTP id v63mr2053252pgb.342.1554327278000; Wed, 03 Apr 2019 14:34:38 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:ffda:7716:9afc:1301]) by smtp.gmail.com with ESMTPSA id k124sm21796741pgc.65.2019.04.03.14.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Apr 2019 14:34:37 -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 v3 1/2] mfd: cros_ec: Add host_sleep_event_v1 command Date: Wed, 3 Apr 2019 14:34:27 -0700 Message-Id: <20190403213428.89920-2-evgreen@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190403213428.89920-1-evgreen@chromium.org> References: <20190403213428.89920-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 v3: None 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