1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2021, Microchip 4 */ 5 #ifndef __DRIVERS_PM_SAM_ATMEL_PM_H 6 #define __DRIVERS_PM_SAM_ATMEL_PM_H 7 8 #include <compiler.h> 9 #include <kernel/thread.h> 10 #include <sm/sm.h> 11 #include <stdbool.h> 12 #include <tee_api_types.h> 13 #include <types_ext.h> 14 15 struct sm_nsec_ctx; 16 17 #if defined(CFG_ATMEL_PM) 18 atmel_pm_suspend_available(void)19static inline bool atmel_pm_suspend_available(void) 20 { 21 return true; 22 } 23 24 void atmel_pm_cpu_idle(void); 25 26 TEE_Result atmel_pm_suspend(uintptr_t entry, struct sm_nsec_ctx *nsec); 27 28 TEE_Result sama5d2_pm_init(const void *fdt, vaddr_t shdwc); 29 30 enum sm_handler_ret at91_pm_set_suspend_mode(struct thread_smc_args *args); 31 32 enum sm_handler_ret at91_pm_get_suspend_mode(struct thread_smc_args *args); 33 34 #else 35 atmel_pm_cpu_idle(void)36static inline void atmel_pm_cpu_idle(void) {}; 37 atmel_pm_suspend_available(void)38static inline bool atmel_pm_suspend_available(void) 39 { 40 return false; 41 } 42 atmel_pm_suspend(uintptr_t entry __unused,struct sm_nsec_ctx * nsec __unused)43static inline TEE_Result atmel_pm_suspend(uintptr_t entry __unused, 44 struct sm_nsec_ctx *nsec __unused) 45 { 46 return TEE_ERROR_NOT_SUPPORTED; 47 } 48 sama5d2_pm_init(const void * fdt __unused,vaddr_t shdwc __unused)49static inline TEE_Result sama5d2_pm_init(const void *fdt __unused, 50 vaddr_t shdwc __unused) 51 { 52 return TEE_SUCCESS; 53 } 54 55 static inline enum sm_handler_ret at91_pm_set_suspend_mode(struct thread_smc_args * args __unused)56at91_pm_set_suspend_mode(struct thread_smc_args *args __unused) 57 { 58 return SM_HANDLER_PENDING_SMC; 59 } 60 61 static inline enum sm_handler_ret at91_pm_get_suspend_mode(struct thread_smc_args * args __unused)62at91_pm_get_suspend_mode(struct thread_smc_args *args __unused) 63 { 64 return SM_HANDLER_PENDING_SMC; 65 } 66 67 #endif 68 69 #endif /* __DRIVERS_PM_SAM_ATMEL_PM_H */ 70