Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp865287pxb; Fri, 22 Apr 2022 12:59:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMVc/8osU9a19HFDaL3pqVvoNyD+bd7bleefhze+O+j4IPLvvogrNC9eKlQ7N0s5oFFwY3 X-Received: by 2002:a17:902:bd05:b0:158:544d:6557 with SMTP id p5-20020a170902bd0500b00158544d6557mr6130670pls.70.1650657558582; Fri, 22 Apr 2022 12:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650657558; cv=none; d=google.com; s=arc-20160816; b=ZYjLMds6KTa/9DbtlWoLHW/9c2XxTWpp0kKNrL/5q1bjeJjLJqEhgz7rgjkXSQ7RG/ IttNtBXPoIn6OhPjDURYBXIaMGFdTR1SU9o9JUhpW6zK8WWTUmtvAXGEeI1Fehq8PlR2 YC/X2qSrGPSoCeCqS0F+DfSZkveWC9zZDwlkmo5jJPcTegt3F7gSZBR6rPqVOkJOK/DM SHODSL7ewRLPpheoSRn7YhdJezgufAL2YiKs868c8df6oUsyFoqFvepJj4O6qVOdPNxX wjKaq3mdgA1J2VRNL2quyTVpUiYvi1IrgcbTJaRtdnjEzltcm7ohpPj9H4PChbKLKdk6 bq2A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0d5eQnd+UR9U9jPUjFIONA+8xaxiU9xXTiPVUnEhXc4=; b=kL5axc23EVISIyU3Lb3DsxTfUf0VLMgQTTjIsu8zfzulaj9qCqKBoM7NTURTRBnNrM 4tfvoqMyFmrB3jjslRkShg1NPemMs6Nhs60Wv1jhzbA8ODgMJOUW2Ztr4+yU02Jk/Wsh JL5H6FJ2w+LxXJjlpyrxFW3G9hOT/BvUnqjjpV4cY+ENwQ3gHFM1hmVp0241gJxKccvU 4KqxAZ3H2nMeExr3EiIP6cp6BcNM/xNj9PPc9VZU9CR8U5Z3ATD+MQfbhFT3PV+S0YII MO7mxgucU7SU/OgDpU5llucuxZSz7Q1Pixo1dNHcter9l9pwUOMjXMYGNLRjYJ2ReV6k ZVUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Vc5jk9sV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s6-20020a170902988600b001582cdefa07si8349452plp.208.2022.04.22.12.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:59:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Vc5jk9sV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A8D2B10FF1F; Fri, 22 Apr 2022 11:57:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392520AbiDUUlP (ORCPT + 99 others); Thu, 21 Apr 2022 16:41:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392468AbiDUUkw (ORCPT ); Thu, 21 Apr 2022 16:40:52 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2424DF76; Thu, 21 Apr 2022 13:37:59 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 23LKbl8p090016; Thu, 21 Apr 2022 15:37:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1650573467; bh=0d5eQnd+UR9U9jPUjFIONA+8xaxiU9xXTiPVUnEhXc4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Vc5jk9sV9XyEevpIGBybWpxJH2n/iCl6PeAJw/y73wgs4/bIuOCyWGw0A8Tyb2m5w 1Dz9Ro2EbsU+abZ0ZUaDw2+UdvQ4987Pk4+MezAXNp+CtZoeR9PwI2JXqODv8sI2iS qbBu73f9jgb7jr3aJgGmUsu33dVAyS6WQ7mXZbXM= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 23LKbll4001174 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Apr 2022 15:37:47 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 21 Apr 2022 15:37:46 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Thu, 21 Apr 2022 15:37:47 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 23LKbkZm093984; Thu, 21 Apr 2022 15:37:46 -0500 From: Dave Gerlach To: Rob Herring , Santosh Shilimkar , Krzysztof Kozlowski , Tero Kristo , Nishanth Menon CC: , , , Vignesh Raghavendra , Dave Gerlach Subject: [PATCH 6/6] firmware: ti_sci: Introduce prepare system suspend call Date: Thu, 21 Apr 2022 15:36:59 -0500 Message-ID: <20220421203659.27853-7-d-gerlach@ti.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220421203659.27853-1-d-gerlach@ti.com> References: <20220421203659.27853-1-d-gerlach@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 Introduce a ti_sci_prepare_system_suspend call to be used in the driver suspend handler to allow the system to identify the low power mode being entered and if nevessary, send TI_SCI_MSG_BEGIN_SLEEP with information about the mode is being entered and the address for DDR memory carveout. Signed-off-by: Dave Gerlach --- drivers/firmware/ti_sci.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 772643cb940c..07b6fa98bb45 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "ti_sci.h" @@ -3388,11 +3389,41 @@ static void ti_sci_set_is_suspending(struct ti_sci_info *info, bool is_suspendin info->is_suspending = is_suspending; } +static int ti_sci_prepare_system_suspend(struct ti_sci_info *info) +{ + int ret = 0; + int mode; + + switch (pm_suspend_target_state) { + case PM_SUSPEND_MEM: + mode = TISCI_MSG_VALUE_SLEEP_MODE_DEEP_SLEEP; + break; + default: + ret = -EINVAL; + } + + /* + * Do not fail if we don't have action to take for a + * specific suspend mode. + */ + if (ret) + return 0; + + ret = ti_sci_cmd_prepare_sleep(&info->handle, mode, info->mem_ctx_lo, + info->mem_ctx_hi, 0); + + return ret; +} + static int ti_sci_suspend(struct device *dev) { struct ti_sci_info *info = dev_get_drvdata(dev); int ret = 0; + ret = ti_sci_prepare_system_suspend(info); + if (ret) + return ret; + /* * We must switch operation to polled mode now as drivers and the genpd * layer may make late TI SCI calls to change clock and device states -- 2.35.0