[v3,1/3] loongarch: export some arch-specific pm interfaces
Commit Message
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 <zhuyinbo@loongson.cn>
---
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
Comments
Hi, Yinbo,
I think this patch should go through the loongarch tree and the others
to go through the soc tree, so I just applied this one. The next
version you can only send the other two, thanks.
Huacai
On Thu, Jun 15, 2023 at 5:18 PM Yinbo Zhu <zhuyinbo@loongson.cn> wrote:
>
> 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 <zhuyinbo@loongson.cn>
> ---
> 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 <asm/suspend.h>
> #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;
> }
> --
> 2.20.1
>
在 2023/6/16 下午12:04, Huacai Chen 写道:
> Hi, Yinbo,
>
> I think this patch should go through the loongarch tree and the others
> to go through the soc tree, so I just applied this one. The next
> version you can only send the other two, thanks.
okay, I got it.
Thanks,
Yinbo
@@ -8,6 +8,7 @@
#ifndef _ASM_LOONGARCH_ACPI_H
#define _ASM_LOONGARCH_ACPI_H
+#include <asm/suspend.h>
#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;
new file mode 100644
@@ -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
@@ -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;
}