From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 823FFC49ECD for ; Wed, 14 Jul 2021 19:52:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D0DD613D0 for ; Wed, 14 Jul 2021 19:52:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241525AbhGNTyX (ORCPT ); Wed, 14 Jul 2021 15:54:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:45124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240063AbhGNTta (ORCPT ); Wed, 14 Jul 2021 15:49:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A466A6141A; Wed, 14 Jul 2021 19:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626291883; bh=iZXOwNIqvRVUKE7MeSSXOxAuhXS62VInPViWbCCromQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqsJbgp2xI55gsawECLdmfyUrx9Xw3bcKUjt82wmCz8yDNcPcoG5g7vGb5kP6vFc8 dyJsnbzV0yaoOW9rjYPL/wLsup366GctGDOEvGJ6YiVD38swZ70ERk7GPix6TbIMDP wsXD31a//AQrieQqyoBoifZdX8mY22R3LJUlmRFHQqaBXPFpaICeTafmioyt1/bpmt dlTm7Uyh6YzgiTnsGS7E81ZDYXNeVX3GN2g68PulI1zq9YFhPYbdJMmrxCCiBPkM4V JHYSfbA0a2YVUYXN1Uyu0XAZeQ7PcuNGkAgD/sEan3C+d2pChzWlMApkrvGtEcIzzu UZEkJV/O8suNA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tony Lindgren , Dave Gerlach , Suman Anna , Sasha Levin , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.10 66/88] ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured Date: Wed, 14 Jul 2021 15:42:41 -0400 Message-Id: <20210714194303.54028-66-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210714194303.54028-1-sashal@kernel.org> References: <20210714194303.54028-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C081C12002 for ; Wed, 14 Jul 2021 22:09:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 271E3613A9 for ; Wed, 14 Jul 2021 22:09:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 271E3613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2rnYllqsF7Qw/ZBmKS5vzHOgqP9eQyXEoQPwnTctm4c=; b=1m6XNMxpPBpTbA LHJRzS0O7Rny07B2MEyYIJWTbcfP9IB8Lz4WCG2+NOouvfsJpTZ/uiTt9nqx1qlMB2ijpuTH7zlae t72NmUXA3euizSNv3A7gJwKH0AMbX4xb5ys4+/mnqpjrIbWPeErUs9fK1FUjC51cEIjSCEOA3HsqK 15gxc3x55SH7/bEWF61LSUpsst7RjF0/bRe5zFHHcqG63ocKoo/ScQ2BTaA2o5SOUo3fFwfRRQaA1 29vL+Tl7YUEMyqKI+rq+rIWNn8J5Qkk9UpuTnjknlxVdsXX6od/mlajdoVtROLu33kfvyD8B3zOto wVx9KN3g2FRdELz0Ka6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3n1p-00FhBd-Jx; Wed, 14 Jul 2021 22:06:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3koF-00EfOM-Sy for linux-arm-kernel@lists.infradead.org; Wed, 14 Jul 2021 19:44:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A466A6141A; Wed, 14 Jul 2021 19:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626291883; bh=iZXOwNIqvRVUKE7MeSSXOxAuhXS62VInPViWbCCromQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqsJbgp2xI55gsawECLdmfyUrx9Xw3bcKUjt82wmCz8yDNcPcoG5g7vGb5kP6vFc8 dyJsnbzV0yaoOW9rjYPL/wLsup366GctGDOEvGJ6YiVD38swZ70ERk7GPix6TbIMDP wsXD31a//AQrieQqyoBoifZdX8mY22R3LJUlmRFHQqaBXPFpaICeTafmioyt1/bpmt dlTm7Uyh6YzgiTnsGS7E81ZDYXNeVX3GN2g68PulI1zq9YFhPYbdJMmrxCCiBPkM4V JHYSfbA0a2YVUYXN1Uyu0XAZeQ7PcuNGkAgD/sEan3C+d2pChzWlMApkrvGtEcIzzu UZEkJV/O8suNA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 66/88] ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured Date: Wed, 14 Jul 2021 15:42:41 -0400 Message-Id: <20210714194303.54028-66-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210714194303.54028-1-sashal@kernel.org> References: <20210714194303.54028-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210714_124443_974234_DEA06BCD X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Dave Gerlach , Tony Lindgren , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel