Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp684889pxv; Thu, 22 Jul 2021 09:41:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsBzoHDj7m8pCeXnIeH9Tu+Ky3QNk6+Bhy8msf+m9OAXjubIhrqytNa1WX3mSoWpO7tvdN X-Received: by 2002:a05:6e02:68c:: with SMTP id o12mr479120ils.261.1626972091219; Thu, 22 Jul 2021 09:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626972091; cv=none; d=google.com; s=arc-20160816; b=toXzNToo/ybO7ORhRGPZGq46XbVt16jBsC/CGNk3vp0e+R+8rxwlZ5jMoCi0KylICf 5ElC8QtGh9ehMPQ1W5j4WfVTrYnMf/8pchtFXde0DBWLMql44AU3790dxWcns8TaNbyc LreIbaSVhZ57wKlZ2xvTxBglY/LJ0htRZe4ah7UYv7RUW7tkqs144GhpWA1NsRaVXvSj myLCTRJ+tFSJRk4WWpam1kOjXn7vM79e++Uxct7bZQ8YKVMCzmMRO+rtztYJASYf8ofp 0nuLcdbOxFJOMfKqBaD+shHGICJvyX2lY+eK3QL9BNRFjvfPRApqVCiT3+KocdDosya5 SWYA== 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=sf6Uvy69wuwBQ+5vAxRnQIKz4wplVZhdW0+dCu7z8YQ=; b=Ysm2GkTmxzO5PWNpm9i+6eMqwshoA1ZGMuxTZPwcsB4LpkTDdL/k3d55Gyr3tM2Jij BE7wdBD5CqqSeREAlCjnTvwfH9XzaRP0jm3kf/Jc+OKJRGKz8dnMgWiegXRNmDFThucE p5FlYUDaKhnhxMqJcm6uD+NA8/sbjGD99jqCuXfY59r90fmxt2RMA6C6MfW1ZMnPGDfQ SmGbn+SaahTQB/aLMJOxGYNsGFo5Ht2sAJlX5koCCAd7aXvd3JMGTaAY2Mr9mkzb3lFE Elg45p55u7C0KodQBul2e3G9Twm4JGhqmEWp7P9DD2O7gmKD+ueO9RxMidA5Grm84/qe WNZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nJw0H23L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si32261411jaj.20.2021.07.22.09.41.18; Thu, 22 Jul 2021 09:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nJw0H23L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232730AbhGVP7C (ORCPT + 99 others); Thu, 22 Jul 2021 11:59:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:33114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbhGVP5T (ORCPT ); Thu, 22 Jul 2021 11:57:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EAF86136E; Thu, 22 Jul 2021 16:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626971873; bh=iZXOwNIqvRVUKE7MeSSXOxAuhXS62VInPViWbCCromQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJw0H23L6OptqSe8CwlnClxhZEKGx0OpL5Q7vEgLEC5fKfiXp2TsAZ6o8e/Ul8dpp KLLqR4EO3vhkdJFT1EadC1MT9VeBBdJcz3lrL1CzrrsZli/pPMiZnju1KHYisf0Oc4 n4IHgPfaDrfo3dsC5W7/+3lopmxmKOd8EbFOtFrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Gerlach , Suman Anna , Tony Lindgren , Sasha Levin Subject: [PATCH 5.10 059/125] ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured Date: Thu, 22 Jul 2021 18:30:50 +0200 Message-Id: <20210722155626.663081950@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210722155624.672583740@linuxfoundation.org> References: <20210722155624.672583740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 093a474ce10d8ea3db3ef2922aca5a38f34bab1b ] If the PM related modules are not loaded and PM firmware not configured, the system suspend fails to resume. Let's fix this by adding initial platform_suspend_ops to block suspend and warn about missing modules. When pm33xx and wkup_m3_ipc have been loaded and m3 coprocessor booted with it's firmware, pm33xx sets up working platform_suspend_ops. Note that we need to configure at least PM_SUSPEND_STANDBY to have suspend_set_ops(). Cc: Dave Gerlach Cc: Suman Anna Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin --- arch/arm/mach-omap2/pm33xx-core.c | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm/mach-omap2/pm33xx-core.c b/arch/arm/mach-omap2/pm33xx-core.c index 56f2c0bcae5a..bf0d25fd2cea 100644 --- a/arch/arm/mach-omap2/pm33xx-core.c +++ b/arch/arm/mach-omap2/pm33xx-core.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -324,6 +325,44 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void) return NULL; } +#ifdef CONFIG_SUSPEND +/* + * Block system suspend initially. Later on pm33xx sets up it's own + * platform_suspend_ops after probe. That depends also on loaded + * wkup_m3_ipc and booted am335x-pm-firmware.elf. + */ +static int amx3_suspend_block(suspend_state_t state) +{ + pr_warn("PM not initialized for pm33xx, wkup_m3_ipc, or am335x-pm-firmware.elf\n"); + + return -EINVAL; +} + +static int amx3_pm_valid(suspend_state_t state) +{ + switch (state) { + case PM_SUSPEND_STANDBY: + return 1; + default: + return 0; + } +} + +static const struct platform_suspend_ops amx3_blocked_pm_ops = { + .begin = amx3_suspend_block, + .valid = amx3_pm_valid, +}; + +static void __init amx3_block_suspend(void) +{ + suspend_set_ops(&amx3_blocked_pm_ops); +} +#else +static inline void amx3_block_suspend(void) +{ +} +#endif /* CONFIG_SUSPEND */ + int __init amx3_common_pm_init(void) { struct am33xx_pm_platform_data *pdata; @@ -337,6 +376,7 @@ int __init amx3_common_pm_init(void) devinfo.size_data = sizeof(*pdata); devinfo.id = -1; platform_device_register_full(&devinfo); + amx3_block_suspend(); return 0; } -- 2.30.2