forked from Mirrors/opensbi
lib: utils: Add simple FDT based system suspend driver framework
The generic platform can have multiple system suspend drivers so add a simple FDT based system suspend driver framework. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
This commit is contained in:
@@ -22,6 +22,8 @@ source "$(OPENSBI_SRC_DIR)/lib/utils/reset/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/serial/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/suspend/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/sys/Kconfig"
|
||||
|
||||
source "$(OPENSBI_SRC_DIR)/lib/utils/timer/Kconfig"
|
||||
|
10
lib/utils/suspend/Kconfig
Normal file
10
lib/utils/suspend/Kconfig
Normal file
@@ -0,0 +1,10 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
menu "System Suspend Support"
|
||||
|
||||
config FDT_SUSPEND
|
||||
bool "FDT based suspend drivers"
|
||||
depends on FDT
|
||||
default n
|
||||
|
||||
endmenu
|
22
lib/utils/suspend/fdt_suspend.c
Normal file
22
lib/utils/suspend/fdt_suspend.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2024 Ventana Micro Systems Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Anup Patel <apatel@ventanamicro.com>
|
||||
*/
|
||||
|
||||
#include <sbi_utils/suspend/fdt_suspend.h>
|
||||
|
||||
/* List of FDT suspend drivers generated at compile time */
|
||||
extern const struct fdt_driver *const fdt_suspend_drivers[];
|
||||
|
||||
void fdt_suspend_init(const void *fdt)
|
||||
{
|
||||
/*
|
||||
* Platforms might have multiple system suspend devices or
|
||||
* might not have any so probe all and don't fail.
|
||||
*/
|
||||
fdt_driver_init_all(fdt, fdt_suspend_drivers);
|
||||
}
|
3
lib/utils/suspend/fdt_suspend_drivers.carray
Normal file
3
lib/utils/suspend/fdt_suspend_drivers.carray
Normal file
@@ -0,0 +1,3 @@
|
||||
HEADER: sbi_utils/suspend/fdt_suspend.h
|
||||
TYPE: const struct fdt_driver
|
||||
NAME: fdt_suspend_drivers
|
11
lib/utils/suspend/objects.mk
Normal file
11
lib/utils/suspend/objects.mk
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Copyright (c) 2024 Ventana Micro Systems Inc.
|
||||
#
|
||||
# Authors:
|
||||
# Anup Patel <apatel@ventanamicro.com>
|
||||
#
|
||||
|
||||
libsbiutils-objs-$(CONFIG_FDT_SUSPEND) += suspend/fdt_suspend.o
|
||||
libsbiutils-objs-$(CONFIG_FDT_SUSPEND) += suspend/fdt_suspend_drivers.carray.o
|
Reference in New Issue
Block a user