/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2021. All rights reserved. * Description: pmoc api code for application */ #define LOG_MODULE_ID SOC_ID_PM #define LOG_UNF_TRACE 0 #define LOG_FUNC_TRACE 0 #include "uapi_pmoc.h" #include "mpi_pmoc_ext.h" #include "soc_log.h" td_s32 uapi_pmoc_init(td_void) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_init(); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_init, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_deinit(td_void) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_deinit(); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_deinit, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_suspend_param(uapi_pmoc_wakeup_src source, td_bool enable, uapi_pmoc_suspend_param *param) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_suspend_param((ext_pmoc_wakeup_src)source, enable, (ext_pmoc_suspend_param *)param); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_suspend_param, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_get_suspend_param(uapi_pmoc_wakeup_src source, td_bool *enable, uapi_pmoc_suspend_param *param) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_get_suspend_param((ext_pmoc_wakeup_src)source, enable, (ext_pmoc_suspend_param *)param); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_get_suspend_param, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_wakeup_type(uapi_pmoc_wakeup_type wakeup_type) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_wakeup_type((ext_pmoc_wakeup_type)wakeup_type); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_wakeup_type, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_enter_standby(uapi_pmoc_wakeup_src *wakeup_src) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_enter_standby((ext_pmoc_wakeup_src *)wakeup_src); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_enter_standby, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_get_wakeup_attr(uapi_pmoc_wakeup_attr *attr) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_get_wakeup_attr((ext_pmoc_wakeup_attr *)attr); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_get_wakeup_attr, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_get_standby_period(td_u32 *standby_period) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_get_standby_period(standby_period); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_get_standby_period, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_enter_active_standby(uapi_pmoc_active_standby_modle model) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_enter_active_standby((ext_pmoc_active_standby_modle)model); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_enter_active_standby, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_quit_active_standby(td_void) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_quit_active_standby(); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_quit_active_standby, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_standby_display_param(uapi_pmoc_display_param *display_param) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_standby_display_param((ext_pmoc_display_param *)display_param); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_standby_display_param, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_gpio_power_off(uapi_pmoc_poweroff_gpio_param *param) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_gpio_power_off((ext_pmoc_poweroff_gpio_param *)param); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_gpio_power_off, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_breath_led(td_u8 group, td_u8 bit, td_u32 led_breath_cycle) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_breath_led(group, bit, led_breath_cycle); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_breath_led, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_standby_led(td_u8 group, td_u8 bit, td_u8 level) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_standby_led(group, bit, level); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_standby_led, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_set_mcu_msg(td_u32 msg_index, td_u32 value) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_set_mcu_msg(msg_index, value); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_set_mcu_msg, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_get_mcu_msg(td_u32 msg_index, td_u32 *value) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_get_mcu_msg(msg_index, value); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_get_mcu_msg, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; } td_s32 uapi_pmoc_get_chip_temperature(uapi_pmoc_chip_temperature *chip_temprature) { td_s32 ret; soc_dbg_func_enter(); ret = ext_mpi_pmoc_get_chip_temperature((ext_mpi_pmoc_chip_temperature *)chip_temprature); if (ret != TD_SUCCESS) { soc_err_print_call_fun_err(ext_mpi_pmoc_get_chip_temperature, ret); return ret; } soc_dbg_func_exit(); return TD_SUCCESS; }