Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp543016yba; Wed, 3 Apr 2019 14:02:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqpzlP7pg0EsuCsuSZRgTE1UfKKhO7ZQESlVmOFl33wTH59Lz7aTHizvdRGB36V96vyta5 X-Received: by 2002:a62:8381:: with SMTP id h123mr1688729pfe.226.1554325369682; Wed, 03 Apr 2019 14:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554325369; cv=none; d=google.com; s=arc-20160816; b=TeA2JkZs2ax2NyVWk/VYKrGaduSRq3wC1tThol1bBZbpyF/QZ1d83tUyhKBl03Ty9c nH6WLtrwWLYsWYNVMcMOWGcsY9Rz+EY1n99eo1IgACs86H9NkLcAKoRqH/zj2vAck1TS AF3dW/rvr/ztyT91zkPnl2X7B2wmda7oxVkY8y+2y8KsLmKLIJm2Ny0fXDDJ3J5+B8AZ 3D6+L/hes2esQhq/ML7D+AH6McZ5UqNe87EJ3ok3FW0/G4ixGPCMSy2ILm5qTvb2aFim pF3O0FXfJH7la2J4AQASxUGyVxafhR8DfwX1DdMRBqaTg4znQZ24iWvqeZpB8KUMqCdY HP0Q== 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=t8NoxwMq+0fVtTTSLZ+e1apynKOICX4I+P5PGvvZeuY=; b=gGPTtZ225ZKdch84xWesuhvjTg6SDy6Uy1a40xREFkHMvytxxUOEo4BCwcYzMnumOH gij12RgjGNNsIsBcdMoA1YS6VWottaZ1JA7TcwSfaMfiXjxjLnIqYZxvMhoTyCFbX2ye UVokRzkI9mq1Ogk+ro5tFy3yG4nr8ah0ahtVwJrRwuLq3JRtTfReYh3/5SX7dTdXYwKn RjD+Aq/Oh+4jIwyigNeiubp0wjOBbVc67COurAZLuz27cbke/qNjmB2Xw1Nl+8hOnPGv +JqkjBoHUK+etWOG4dmBz1Bu8+oeQxCnR9bxjH7IJeFLtZ7jF6h/ndVILpEyYkCYscDp PVQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ctbo8Si5; 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 d10si14598508pla.42.2019.04.03.14.02.33; Wed, 03 Apr 2019 14:02:49 -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=Ctbo8Si5; 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 S1726444AbfDCVBx (ORCPT + 99 others); Wed, 3 Apr 2019 17:01:53 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38851 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbfDCVBx (ORCPT ); Wed, 3 Apr 2019 17:01:53 -0400 Received: by mail-pf1-f193.google.com with SMTP id 10so190897pfo.5 for ; Wed, 03 Apr 2019 14:01:53 -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=t8NoxwMq+0fVtTTSLZ+e1apynKOICX4I+P5PGvvZeuY=; b=Ctbo8Si5k0uXaWfi12WWs9w+hQIYze+ejELetVMiVG9SxQxd/aMISbyd+faBt83NzZ kbuzxgbFhJ7XUjFyZyzVO6LoUXfYraa09mCl+WCfK0ob0RjIi/1ozVa5YkiLGGfalJmT YYCmrR1BAzGryFw6UsXWJ/SMlLdMVJbvxL0cU= 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=t8NoxwMq+0fVtTTSLZ+e1apynKOICX4I+P5PGvvZeuY=; b=uA4zQsgKHNTUqs6cNvCWuG1v2bvrjzpGL1aJgZG22mNF8qqRib1TK5phrxMFKf1R06 fYZZTm++oixAQbYj0Uv6A9ngEAnEIEWUXGD954/G9pQ9QHN9ZC54/qBN3o9wrUIzq5Zl xcMhkdtxhhSYVW8LR5K19hPSfLIPLAPwuHzXhUyyeAHcnWDb3a5eyD4MaBIFuYVSkLbE teRExijI/LCNa3BK0cAw4yVIFPg85aUUQZ72yunSUc+ZlT9AEAFsV8+kiB1LB7DhBGZO 8Op5+eZ+5YB5vJ36wUCkBylGl5i4ArJJfaXI0PI4cDUw6Zs5WXGVM+nEYnpy8+wDFHLT 2Jxg== X-Gm-Message-State: APjAAAUJ7CUV3mF0gNwnWoflOf+8rW6R8nKOB+ooz/4XlBMaWaGZxoO9 NKmKAEXd+0K+dR4QFNtEDHhDfw== X-Received: by 2002:a62:2587:: with SMTP id l129mr1633920pfl.151.1554325312876; Wed, 03 Apr 2019 14:01:52 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Apr 2019 14:01:52 -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 0/2] platform/chrome: Add support for host sleep event command v1 Date: Wed, 3 Apr 2019 14:01:46 -0700 Message-Id: <20190403210148.77908-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 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 | 9 ++++ include/linux/mfd/cros_ec.h | 2 + include/linux/mfd/cros_ec_commands.h | 57 +++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 5 deletions(-) -- 2.20.1