From patchwork Thu Jun 15 09:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinbo Zhu X-Patchwork-Id: 108366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp501310vqr; Thu, 15 Jun 2023 02:29:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PzYw6Y7KCD3yt3X01dq/XyEnVtwzNmrl+v6o2ZydcbOh7swEB4cJV52Oaivg7zVto90qm X-Received: by 2002:a05:6870:8785:b0:19f:12a4:ea89 with SMTP id r5-20020a056870878500b0019f12a4ea89mr14229732oam.53.1686821365434; Thu, 15 Jun 2023 02:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686821365; cv=none; d=google.com; s=arc-20160816; b=oyOTbU8BU1tf3ccT053O03i2CexnVAMB0jthde5d0cengq+mUwmyRUawGiSHs4tkKr JyKLG1F89Ti+GkIs10YeNQYY84ryVdSsoDlKpR9GtuQ2tMG4HhCdSqX+lneEw0Pm/70H r9CXjvNV69oHr64k/dNM+OUFNaY21ACM4tNW+PsAsulqKe2r0lD/n6KmVE8A37mRcvEu VdY/TKuaQaKy3t9Rt21/rhhcpDVRKfzYu1Rxg+7BGtQ4oObAHoBmlAOzkeGE2M2O20oR 6vsnggVri/ys4d0v8VMYrXPteJC0wKsjR0l1zIxNkPtqykfF8B5dBkvgaAq/0f/+e3+O 4i5g== 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; bh=oO25GXSlyEAyRa52OqqK5/BaMtS/BRm34FcSpRAad7E=; b=X6pzz/asNkTVh6ogvmSOzCuOhYm++oNqpVSpPEkl/HzhHebN6/z+42HkaZSx+6Ob8s L1DLAsYEezPVhAPnlJVlYXNo/yzJ0ErIhSlD5tVhW4l1SQYTYiSO2t0cSIOg1pMRxNcW gRG8kMu8xNZCiJtNKylYI1dSu3/Nr7dOee+T5iPJg+C1ukgIcn/6gCqMz0KWPCDna6+4 GzhjQ7wbgcbW57mg4THwLlE6V6PcNq9YeH/2VZL6LhmE60jwjgdp/quGn0t20GMZacfu aP6fZuG0LbQSWLO9EZNZhm6Y51+c9X4B+Qtjwn8R7rNp/J5+BBgJRc1njs5EgNeCkxW/ 8JYA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020aa798c7000000b00666878f8de7si1514406pfm.397.2023.06.15.02.29.12; Thu, 15 Jun 2023 02:29:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245498AbjFOJSX (ORCPT + 99 others); Thu, 15 Jun 2023 05:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245399AbjFOJSR (ORCPT ); Thu, 15 Jun 2023 05:18:17 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D530C1BC3; Thu, 15 Jun 2023 02:18:13 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.35]) by gateway (Coremail) with SMTP id _____8BxLutN14pkSoAFAA--.11919S3; Thu, 15 Jun 2023 17:18:05 +0800 (CST) Received: from user-pc.202.106.0.20 (unknown [10.20.42.35]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxVeRH14pkxssbAA--.13716S3; Thu, 15 Jun 2023 17:18:03 +0800 (CST) From: Yinbo Zhu To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Huacai Chen , WANG Xuerui , "Rafael J . Wysocki" , Pavel Machek , Marc Zyngier , Arnd Bergmann , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev Cc: Jianmin Lv , wanghongliang@loongson.cn, Liu Peibao , loongson-kernel@lists.loongnix.cn, Yinbo Zhu Subject: [PATCH v3 1/3] loongarch: export some arch-specific pm interfaces Date: Thu, 15 Jun 2023 17:17:55 +0800 Message-Id: <20230615091757.24686-2-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230615091757.24686-1-zhuyinbo@loongson.cn> References: <20230615091757.24686-1-zhuyinbo@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxVeRH14pkxssbAA--.13716S3 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768760400166191318?= X-GMAIL-MSGID: =?utf-8?q?1768760400166191318?= Some power management controllers need to support DTS and will use the suspend interface thus this patch was to export such interface for their use. Signed-off-by: Yinbo Zhu --- arch/loongarch/include/asm/acpi.h | 3 +-- arch/loongarch/include/asm/suspend.h | 10 ++++++++++ arch/loongarch/power/suspend.c | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 arch/loongarch/include/asm/suspend.h diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h index 976a810352c6..1d7810798c08 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -8,6 +8,7 @@ #ifndef _ASM_LOONGARCH_ACPI_H #define _ASM_LOONGARCH_ACPI_H +#include #ifdef CONFIG_ACPI extern int acpi_strict; extern int acpi_disabled; @@ -37,12 +38,10 @@ extern struct list_head acpi_wakeup_device_list; extern int loongarch_acpi_suspend(void); extern int (*acpi_suspend_lowlevel)(void); -extern void loongarch_suspend_enter(void); static inline unsigned long acpi_get_wakeup_address(void) { #ifdef CONFIG_SUSPEND - extern void loongarch_wakeup_start(void); return (unsigned long)loongarch_wakeup_start; #endif return 0UL; diff --git a/arch/loongarch/include/asm/suspend.h b/arch/loongarch/include/asm/suspend.h new file mode 100644 index 000000000000..fc64089fefaa --- /dev/null +++ b/arch/loongarch/include/asm/suspend.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SUSPEND_H +#define __ASM_SUSPEND_H + +void loongarch_common_resume(void); +void loongarch_common_suspend(void); +void loongarch_suspend_enter(void); +void loongarch_wakeup_start(void); + +#endif diff --git a/arch/loongarch/power/suspend.c b/arch/loongarch/power/suspend.c index 5e19733e5e05..166d9e06a64b 100644 --- a/arch/loongarch/power/suspend.c +++ b/arch/loongarch/power/suspend.c @@ -27,7 +27,7 @@ struct saved_registers { }; static struct saved_registers saved_regs; -static void arch_common_suspend(void) +void loongarch_common_suspend(void) { save_counter(); saved_regs.pgd = csr_read64(LOONGARCH_CSR_PGDL); @@ -40,7 +40,7 @@ static void arch_common_suspend(void) loongarch_suspend_addr = loongson_sysconf.suspend_addr; } -static void arch_common_resume(void) +void loongarch_common_resume(void) { sync_counter(); local_flush_tlb_all(); @@ -62,12 +62,12 @@ int loongarch_acpi_suspend(void) enable_gpe_wakeup(); enable_pci_wakeup(); - arch_common_suspend(); + loongarch_common_suspend(); /* processor specific suspend */ loongarch_suspend_enter(); - arch_common_resume(); + loongarch_common_resume(); return 0; }