ANDROID: vendor_hooks: Define new hooks in _mmc_suspend/resume

Define new hooks in _mmc_suspend/resume to control few things in card
suspend/resume paths which further allows to enable some additional
steps in mmc_suspend/resume paths as per host specific requirements.

Bug: 283922495
Link:
https://patchwork.kernel.org/project/linux-mmc/patch/20230401165723.19762-2-quic_sartgarg@quicinc.com/

Change-Id: Ief52d1dc6b01e9866f004b46687dffa4eb1e7bc1
Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
This commit is contained in:
Sarthak Garg 2023-05-22 12:43:31 +05:30 committed by Todd Kjos
parent e82e89e170
commit 631a2db5a3
3 changed files with 36 additions and 3 deletions

View File

@ -29,6 +29,7 @@
#include <trace/hooks/preemptirq.h>
#include <trace/hooks/ftrace_dump.h>
#include <trace/hooks/ufshcd.h>
#include <trace/hooks/mmc.h>
#include <trace/hooks/cgroup.h>
#include <trace/hooks/sys.h>
#include <trace/hooks/iommu.h>
@ -264,6 +265,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_psci_cpu_suspend);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_acct_update_power);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mmc_resume);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mmc_suspend);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_request_freq);

View File

@ -18,6 +18,7 @@
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <linux/mmc/mmc.h>
#include <trace/hooks/mmc.h>
#include "core.h"
#include "card.h"
@ -2112,9 +2113,10 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend ||
(host->caps2 & MMC_CAP2_FULL_PWR_CYCLE_IN_SUSPEND)))
err = mmc_poweroff_notify(host->card, notify_type);
else if (mmc_can_sleep(host->card))
else if (mmc_can_sleep(host->card)) {
trace_android_rvh_mmc_suspend(host);
err = mmc_sleep(host);
else if (!mmc_host_is_spi(host))
} else if (!mmc_host_is_spi(host))
err = mmc_deselect_cards(host);
if (!err) {
@ -2149,6 +2151,7 @@ static int mmc_suspend(struct mmc_host *host)
static int _mmc_resume(struct mmc_host *host)
{
int err = 0;
bool resume_success = false;
mmc_claim_host(host);
@ -2156,7 +2159,9 @@ static int _mmc_resume(struct mmc_host *host)
goto out;
mmc_power_up(host, host->card->ocr);
err = mmc_init_card(host, host->card->ocr, host->card);
trace_android_rvh_mmc_resume(host, &resume_success);
if (!resume_success)
err = mmc_init_card(host, host->card->ocr, host->card);
mmc_card_clr_suspended(host->card);
out:

25
include/trace/hooks/mmc.h Normal file
View File

@ -0,0 +1,25 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM mmc
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_MMC_H
#include <trace/hooks/vendor_hooks.h>
struct mmc_host;
/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
DECLARE_RESTRICTED_HOOK(android_rvh_mmc_suspend,
TP_PROTO(struct mmc_host *host),
TP_ARGS(host), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_mmc_resume,
TP_PROTO(struct mmc_host *host, bool *resume_success),
TP_ARGS(host, resume_success), 1);
#endif /* _TRACE_HOOK_MMC_H */
/* This part must be outside protection */
#include <trace/define_trace.h>