Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3024188rwb; Mon, 15 Aug 2022 16:21:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7zbYuYVTHb+t9ehSl7Y/7qd0t4SAtazOLFMMRV71OFNR6tEJwXQni13+M1mL+gMQzBUm8b X-Received: by 2002:a17:903:50e:b0:170:d829:b3bb with SMTP id jn14-20020a170903050e00b00170d829b3bbmr18874688plb.93.1660605608041; Mon, 15 Aug 2022 16:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605608; cv=none; d=google.com; s=arc-20160816; b=UTYeK5BQXqRMU4252nEg7YKjZi+krzieDZNMaVF+a6eYJXezs8+YaIluF+wxsDnuzK Cicvs1RvJKvXAP8j3TynMtpcY8U8sEidtH4hjHdebLGtYlyOptmXyRXCifU1dJ6Ka5kY JNw8sRefODKhkwIzDoJfwxvXazcrak8gbDxni+CSYhGV8PW/PHCNSQR2VtsX6n7Zu0Rg Hn7ZiGzRCLLs6MdiDsCZp8y1qOcHp5txr4Bg6K3e4iR2RPd8jrOIlWCAHNJrmHsO0BKl 2N617g5yZcS3D8hdRvtlt/rHFJ53EuzcVkXBHZykcj56D/uDzYPGRtlsV56jy0ISPK18 f20Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FmHDk/NDvCK3XwuiZTVIpI9RwKVA2XqBTEnW7sqWojM=; b=drEjAcjwesByHNm0kM6uSHJasn8kjJQaYNCLXRZU6kVip2K9dI40oFqTKYWosDisTQ 1FT2hFJYdnYvB8ajIHTjbIYbkidKfCnWdJL0Z28IBNrSDZvuv+Zbf1lDN4FJy41TRiTH I+oIfBY8lwKjdUb3IvTl8m5sz4L0qRSZpoFPrEEpHBeEkWe87lyUAvH9DZCUbHCHmF3u Zg0XZA5imNmcZ5aYszjzfLdy5MG/8sHavfPlJTa1l8KnGncjlEuyieh6Oc6t3Wahfx3+ eO0AefG7C/sAnSFLe4AsfKExQiWzRgETeZg/Lr4L3FJajsv8lO3SUHM0u5xrlfdY/1l6 ECNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VpGxYeSq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 190-20020a6301c7000000b004224a9f5db0si10323270pgb.49.2022.08.15.16.19.56; Mon, 15 Aug 2022 16:20:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VpGxYeSq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348970AbiHOVj1 (ORCPT + 99 others); Mon, 15 Aug 2022 17:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349046AbiHOVgc (ORCPT ); Mon, 15 Aug 2022 17:36:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B58F66DAE9; Mon, 15 Aug 2022 12:26:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 345B2610A1; Mon, 15 Aug 2022 19:26:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 396C1C433C1; Mon, 15 Aug 2022 19:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591566; bh=QR1XBvrH8wI3gk0GPZBv4A5itdT7WIsgvNLuw9VtplE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpGxYeSqtBGvhmWC8b4q5konXV5wcFWa8dvPzzfzVkzFmAn61aFrWGMrE8zCmlvOG 6FJtAGjWVVIhlv4ZyKgE+R51Qo+JFwMiSqyVXxNdiOM9tTU44lpnVSGtnSBVi4RYWt 5myIzttw0SB1ven8vn/2GzlfNjLvNfP5S4FZgH74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , Matthias Kaehlcke , Hsin-Yi Wang , Tzung-Bi Shih , Guenter Roeck , Evan Green , Stephen Boyd , Sasha Levin Subject: [PATCH 5.18 0582/1095] platform/chrome: cros_ec: Always expose last resume result Date: Mon, 15 Aug 2022 19:59:41 +0200 Message-Id: <20220815180453.664185027@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ Upstream commit 74bb746407bf0d7c7d126c7731dbcd66d467619b ] The last resume result exposing logic in cros_ec_sleep_event() incorrectly requires S0ix support, which doesn't work on ARM based systems where S0ix doesn't exist. That's because cros_ec_sleep_event() only reports the last resume result when the EC indicates the last sleep event was an S0ix resume. On ARM systems, the last sleep event is always S3 resume, but the EC can still detect sleep hang events in case some other part of the AP is blocking sleep. Always expose the last resume result if the EC supports it so that this works on all devices regardless of S0ix support. This fixes sleep hang detection on ARM based chromebooks like Trogdor. Cc: Rajat Jain Cc: Matthias Kaehlcke Cc: Hsin-Yi Wang Cc: Tzung-Bi Shih Reviewed-by: Guenter Roeck Reviewed-by: Evan Green Fixes: 7235560ac77a ("platform/chrome: Add support for v1 of host sleep event") Signed-off-by: Stephen Boyd Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220614075726.2729987-1-swboyd@chromium.org Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index a5cc8f24299e..4168d7f5f273 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -135,16 +135,16 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event) buf.msg.command = EC_CMD_HOST_SLEEP_EVENT; ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg); - - /* For now, report failure to transition to S0ix with a warning. */ + /* Report failure to transition to system wide suspend with a warning. */ if (ret >= 0 && ec_dev->host_sleep_v1 && - (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME)) { + (sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME || + sleep_event == HOST_SLEEP_EVENT_S3_RESUME)) { ec_dev->last_resume_result = buf.u.resp1.resume_response.sleep_transitions; WARN_ONCE(buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TIMEOUT, - "EC detected sleep transition timeout. Total slp_s0 transitions: %d", + "EC detected sleep transition timeout. Total sleep transitions: %d", buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK); } -- 2.35.1