ANDROID: power: add vendor hook to handle hibernate failures

The driver or external module may need handling due to hibernate failure.
This error cannot be detected outside of the hibernate() function.
so Add a vendor hook to receive and handle errors in hibernate().

Bug: 342523877
Change-Id: I221e26f571d94e5d5c5aae19937945bb8981f85b
Signed-off-by: karam.lee <karam.lee@lge.com>
This commit is contained in:
karam.lee
2024-07-25 15:35:02 +09:00
committed by Treehugger Robot
parent d7387786c2
commit f571d0bdaa
3 changed files with 8 additions and 0 deletions

View File

@@ -440,3 +440,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_folio_trylock_result);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_clear);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_trylock_failed_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernate_state);

View File

@@ -33,6 +33,10 @@ DECLARE_HOOK(android_vh_freq_qos_remove_request,
TP_PROTO(struct freq_qos_request *req),
TP_ARGS(req));
DECLARE_HOOK(android_vh_hibernate_state,
TP_PROTO(int error),
TP_ARGS(error));
#endif /* _TRACE_HOOK_POWER_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -16,6 +16,8 @@
#include <linux/suspend.h>
#include <linux/syscalls.h>
#include <linux/pm_runtime.h>
#include <trace/events/power.h>
#include <trace/hooks/power.h>
#include "power.h"
@@ -639,6 +641,7 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
error = pm_suspend(state);
} else if (state == PM_SUSPEND_MAX) {
error = hibernate();
trace_android_vh_hibernate_state(error);
} else {
error = -EINVAL;
}