Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090868rwb; Mon, 15 Aug 2022 17:54:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR73aIbrHWKOUKa+gPMjU92iIhVvgGh8dwphKV4s0xgs0bP6ei2bS3XUc/Q6vWKrWn2VlzQM X-Received: by 2002:a17:906:5a49:b0:730:aced:aa0e with SMTP id my9-20020a1709065a4900b00730acedaa0emr11976370ejc.31.1660611257819; Mon, 15 Aug 2022 17:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611257; cv=none; d=google.com; s=arc-20160816; b=IE39iKSuyHQrggMR9dmMuqS0NB1Bxnnm6niL6oWnYOdYm7BamqaSf8Y5o2kwjKLhAT KJJvlur/3lnNjmG0T0OtO0r29rcwRCvCAZlC7SJrG3JSqmMZwNK3vL8qutr+QS3LPm9o KKL2r5Z340iTNLrXtBEVZ696J/d2Aa6omOgAwyHwd1z8CxRK6tubrUtrDmbD/Uyqtyhz ueYvqxmAcVSIK7yeKfF4roNN/emIHIn/BLbpcIqAFaTDD6rdQlmb1rV7AE58QHKc/A/l BjYeTtvnRc0nGjvguQBsh9K83q7zgnNmGRpftsdZI33e+OpIGvBO8NuHLi/ioT5D2FXz HeGw== 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=EkyycOlGhgwParpgyZUDl1fqwe1mdU8ewsKFO1f4bco=; b=eVv9j7oBOeWrSaF7oTLMeVxets3tDHcVBZ3UeoGFC8VNMMYoTNnhLa4LKK2morfUpK RSpvXHkCRHqTvDkXweqTUjGx1UdU2ynqaF1q+mSxuhCMwhD8f2yt5s4srvI3KrSi15wy 007KyW9THmSAm0zk2pcJ9ARVNi27JuBsO534mQY5R0ix2Zx7FUZn5m8qhbGVSsKXkqy0 khOkKtkgAm8s8I+3k/bCGpUKfEfu4fS151pfCGp049y8DRqtgRR36y2sP8XsG5EzydsX uL/LdjKn/BogY6WpGa1dt4OmtFP/iNb1rZcovErFz3cklSgrl+xgdBmtQu9VIztjM++k Khvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JzSSULSC; 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 b8-20020a056402084800b0043defd3ed96si10972243edz.237.2022.08.15.17.53.51; Mon, 15 Aug 2022 17:54:17 -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=JzSSULSC; 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 S1351348AbiHPAKg (ORCPT + 99 others); Mon, 15 Aug 2022 20:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356014AbiHPABy (ORCPT ); Mon, 15 Aug 2022 20:01:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF761168147; Mon, 15 Aug 2022 13:23:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5D3E2B8119D; Mon, 15 Aug 2022 20:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0BEAC433C1; Mon, 15 Aug 2022 20:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595001; bh=deLeL89S1PDC0d+Bk9oRQzN77DD6XWdco28/ZFe8ajs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JzSSULSCFbqaYPp1uD/t7XEuX0VgFv19PRGcj5kfOSBCFyZ8VmXFztP9rj7HNW2U+ oKCnRrYwgnDr9/Rd1KJjY/jYhkd3bA3yElTtkHPg88oKlope4xyZJARFt5WaRlbq6r iJ6PUYgJ692+SffVxftpn1WRYMyZnFNioczbSUfE= 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.19 0626/1157] platform/chrome: cros_ec: Always expose last resume result Date: Mon, 15 Aug 2022 19:59:42 +0200 Message-Id: <20220815180504.705824534@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 b3e94cdf7d1a..00381490dd3e 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