Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp566527yba; Wed, 3 Apr 2019 14:35:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfZzly4JjB4Uz5hkNxo9BTjaNwl/FjH1DzJ33JIVXtTv8760buM7CmESbF2Hyc2AHHbdw8 X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr2374817plb.155.1554327327551; Wed, 03 Apr 2019 14:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554327327; cv=none; d=google.com; s=arc-20160816; b=tJbHSjZ0UMjXjeUSJRlGplf+0/cwfBKfv8z5yJDKqVHsRpAhL7YgR/baOt86Q4pFsT +G2gpNc2aOU7SJStk9riCkEZvq0fJKzcaCgdPNPyzCUkoNCORm+fDnP1/ADg8bQk1VsK Mu0O0iVAxVsyvUnDQfYZZJwEGDAv0MNeez2EgJ39N7Fymx0Z+juEjuPZG21LcWrCNm3P MdEgJXaOgdlYJQRbvvcs/NtlUo4VJrkUOueAHKziXHsaj/jERa+s1ZkFLULJHCsFQtiq 8RUwQsziYwPCBvVdXsieYOvU+TkB6tadyVXQaAQUFqGlCYIHrkckqa9BBIqpII4EVSx0 ZPcg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ZVabg8vfpQdzoO1GOYLZ6s87p9khPMRcdnFHfdli2BE=; b=x2VJwIFJxMY86DswRjmnTV+TW5+5GYKPr4SO6rAJRyflBq0Hu9D27qqM+Y2tTv4Sz5 FWoJIgAZK0FJ3zjR+NRojtBtLI5DsNa00JkA7Vh5Nf2dvcDhXRwUhwe4SwsW7bY66Roe Xzja+E7xU/INd/PbOPbsMnB6usAhRaufR+GX7oz28oolulUH35qY/EFm0c/Gd6YaNvBm hlaCdBhRZ61S0IFe6g82LqzjP5MEPCARudlW38PVqM5WnEAHTCyYpLa6d2SKEdR2DEMT onBjuN3VvemVz0y2CQJARINW0SPP/3BPDQOT709QeJoNTl9IY38LigYkoXNprQ19QBOB NgGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NpMRAqGn; 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 be7si8203421plb.266.2019.04.03.14.35.12; Wed, 03 Apr 2019 14:35:27 -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=NpMRAqGn; 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 S1726672AbfDCVeg (ORCPT + 99 others); Wed, 3 Apr 2019 17:34:36 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35443 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfDCVeg (ORCPT ); Wed, 3 Apr 2019 17:34:36 -0400 Received: by mail-pg1-f195.google.com with SMTP id g8so126542pgf.2 for ; Wed, 03 Apr 2019 14:34:35 -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:mime-version :content-transfer-encoding; bh=ZVabg8vfpQdzoO1GOYLZ6s87p9khPMRcdnFHfdli2BE=; b=NpMRAqGn2uyOwkptaA9JfxSplN4MuWMrazo/aGDjyDVKYt3rZ7MMmpfVN7TX2PpNdR aSdLg5dXtHIhfYfY7K5hYLaSQEHYkt1ZsS0b2aXKEt0EGL8TY113qfGFs+uL7+JIupvr aP45J8OB1qPM0Lsr9d3oaZtHaXuKazBQqxUUE= 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:mime-version :content-transfer-encoding; bh=ZVabg8vfpQdzoO1GOYLZ6s87p9khPMRcdnFHfdli2BE=; b=Q1eO4ZPO332IBJd8x2fzSeTCjfRsdfaYkCMuFdPxtvu0BSVk3UYQilsSlehPERpfqJ FAZwvLFl8nUBCYIa9z7cB8DTQ2ATk06L13SkGvjkH0akWqbLW8Y6imuc/H2JMmuUyeUz E7I4Tb8Jwjd1edMEouEjYkuMd3+z+EjbBUYt46/0vD5p0rLN6Paf4IvySoEyLufOX7kT 32mLWRSS5W2WdY+aaxuojQDOiwacFtCDP6em+wpIYRzDTsRDYB4Ha8uQPWaZaOX0LNwg vP3xJzr2qPkpxd2blCZpuA1tG8E3vEDjN/oAuL8l+wKc3GdD4bwkeCeh622+9vjoEVkz wMRg== X-Gm-Message-State: APjAAAVrEZD8kE/SGWre2CnT1lUbwlrvF2KvEEeuKAewgTqlkLcpClua 8UZwiDTE3rWTzxBofQABIWON/unDswyCuw== X-Received: by 2002:a63:ed4f:: with SMTP id m15mr1877899pgk.387.1554327275508; Wed, 03 Apr 2019 14:34:35 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Apr 2019 14:34:34 -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 0/2] platform/chrome: Add support for host sleep event command v1 Date: Wed, 3 Apr 2019 14:34:26 -0700 Message-Id: <20190403213428.89920-1-evgreen@chromium.org> X-Mailer: git-send-email 2.20.1 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 The Chrome OS EC has an updated set of parameters for the host sleep event command. With the new parameters, the host can indicate a timeout along with suspend messages. Specifically S0ix suspend messages are supported now, though the host command format isn't specific to S0ix. When the EC sees an S0ix suspend host sleep event, it arms a timer for the specified number of milliseconds (or a sane per-board default baked into the EC). If the EC does not observe the platform's SLP_S0 line assert within the specified timeout, then the EC wakes the system. On resume, the EC reports the number of transitions seen on the SLP_S0 line. The high bit is used to report whether or not a timeout occurred. The number of transitions can then be used to detect cases of excessive housekeeping activities, where the system wakes up out of S0ix temporarily (unbeknownst to Linux), and then (hopefully) goes back to sleep. This mechanism helps in cases where the system attempted to suspend via S0ix, but due to driver bugs ended up suspending to a shallower idle state instead. In concert with additional changes that detect S0ix entry failures, this mechanism allows the system to quickly detect and report on incorrect suspend outcomes. Enric, Gwendal informed me that his patch was rejected, so I'm sending this as a standalone series rather than basing on top of his. The corresponding EC code for this has now landed at: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1501512 Changes in v3: - Consolidated boolean logic for host_sleep_v1 (Guenter) Changes in v2: - Made unions anonymous - Replaced reserved union members with a comment - Removed unnecessary version assignment (Guenter) - Changed WARN to WARN_ONCE (Guenter) - Fixed C code to use anonymous unions - insize is only bigger for resume events. Evan Green (2): mfd: cros_ec: Add host_sleep_event_v1 command platform/chrome: Add support for v1 of host sleep event drivers/mfd/cros_ec.c | 39 ++++++++++++++--- drivers/platform/chrome/cros_ec_proto.c | 6 +++ include/linux/mfd/cros_ec.h | 2 + include/linux/mfd/cros_ec_commands.h | 57 +++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 5 deletions(-) -- 2.20.1