Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp72140img; Wed, 20 Mar 2019 14:22:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxinsk3Ege7w2KHsmWim48qTuOVEFmdsSwsltP5sipNUWZ5SRc/2gLof8QzKVRO5l7q1QS4 X-Received: by 2002:a62:4649:: with SMTP id t70mr10133134pfa.100.1553116951041; Wed, 20 Mar 2019 14:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553116951; cv=none; d=google.com; s=arc-20160816; b=KBt9lf00/1ywrPdvAk2GFtbmLHHF4reKhif38SOzOZ976ugRrCzl5B1lcs8d480ZMv j7i0uNLqtvpijTaIDRkqKrc3Byz124zziPiwV8OBoN2+NkIQ0+3ezXGp1nGKWGB4nutr +hNGtancJjECS9swVxOn9W+T3V7eX7JYdgn9Qcvp7GtWTD3gaUPLT4pAu7nKBv68OTMZ u01UmMQml8LKk2E4imiGqvOitrnZCiq1myx0iie7+RZkO0rsluMDbmF3HDEjlRnsIGNL yFkh2N7NSlQXLCY6cAotyQcp2OwwKCRGgZNaHKPiu02eMO8Efu7G+D4m9P8FF4WGau+e SPhQ== 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=VwzRKcrTw0645WVKxPkV1qbI608tr9KQ/mty/gY/Qrg=; b=Z5mZaMgNLhbm9WVEmTtIzFK8138yuuo9+Xgbf5tmzbzWODcO8w++7auAGnyzApcSTW omgBEWwzcxxt4uqqNs57eA0MlBAloQrsa+jw1whdWLfdmfXbJhUd++0tvk00f0MbPbGV uDisBJLNP53969bSkdL79Oh0Zg12hoZMT5jo8BNTq8oIPiLR+lnHCwvZxasRXeaqYzPj RfHWo9IR5+g3HVnsM0zs49SC+H6NvNL+X3V3lmBxOfMUmKs70oWH2JTIXrR7hw+TXX8a PiW350OAJTgYEDuLDTmz4zRBa7OnBfBME/TgAQ9KM5/5opN4Cit/GihwA7WoW+oa2R8u z1Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dUk0AOQ2; 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 u73si2750412pfj.30.2019.03.20.14.22.13; Wed, 20 Mar 2019 14:22:31 -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=dUk0AOQ2; 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 S1727651AbfCTVU5 (ORCPT + 99 others); Wed, 20 Mar 2019 17:20:57 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43763 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbfCTVU5 (ORCPT ); Wed, 20 Mar 2019 17:20:57 -0400 Received: by mail-pf1-f196.google.com with SMTP id c8so2811264pfd.10 for ; Wed, 20 Mar 2019 14:20:57 -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=VwzRKcrTw0645WVKxPkV1qbI608tr9KQ/mty/gY/Qrg=; b=dUk0AOQ2OTecYaLCcQHtM0RZdWcu0Z31bN4OkfuviPj7REaz6eemdRsstMxXklWrRn TddlnAoJ0y55p/bDsD7/P76jr5KldOHl+6guouK4l/Z4AXpgxb2SCQWAAbkORxJiKLc5 0xyPB++OAKk1nrezgGXZDNpl2QBciqGee5D6Y= 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=VwzRKcrTw0645WVKxPkV1qbI608tr9KQ/mty/gY/Qrg=; b=MmL5CuHCGo+9dBzK/L48XHo/MvOlXCQ4GpoI45/oHHU9Dsaemv1PByhELAKPz0n+wb luEJNJU5xFaom05t2WsZvPFey5wLZ9CW40P79UCldFBPYcH2KvZ0GhZ7ArbKqRstPAxy svhxj9HOpWk7bj6N/ui7AqhUKNHwGBMLtaZxlc35FmGpT38AYkhcAIHM86HECkOas3yc vGvuaPuPjNLbH8XemQbBqjN4htycCKlm2ZeBeifYqadtTxdSLsQDhxawhcf3j6M+MNo3 RmYyuSmKAc1bGnPIqKfu1RENCDqSIKvgs2KzacYJCzWV+x6odgjn5JIRq9wBWYhvBZEQ z4og== X-Gm-Message-State: APjAAAUxXhTWLVj5yzc2EOIrVqPtFI1990SCEir3jTECudNJZs1yr5W2 oJpzWlAFqFqHHDPKqinhB5Sl0A== X-Received: by 2002:a17:902:7590:: with SMTP id j16mr10188437pll.304.1553116856805; Wed, 20 Mar 2019 14:20:56 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:ffda:7716:9afc:1301]) by smtp.gmail.com with ESMTPSA id u13sm5288609pfa.169.2019.03.20.14.20.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Mar 2019 14:20:56 -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 1/2] mfd: cros_ec: Add host_sleep_event_v1 command Date: Wed, 20 Mar 2019 14:20:29 -0700 Message-Id: <20190320212030.43682-2-evgreen@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190320212030.43682-1-evgreen@chromium.org> References: <20190320212030.43682-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 --- include/linux/mfd/cros_ec_commands.h | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index fc91082d4c35..4db1240c28a8 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -2729,6 +2729,65 @@ 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; + + /* Reserved space for non-suspend commands. */ + uint16_t reserved; + } u; +} __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; + + /* Padding for non-resume responses. */ + uint32_t reserved; + } u; +} __packed; + /*****************************************************************************/ /* Smart battery pass-through */ -- 2.20.1