ANDROID: vendor_hooks: Add hook for partial_init

Need this vendor hook to support patial init functionality. This hook needs to be restricted as the additional vendor handling need to perform operations (such as wait_for_completion) in non-atomic context.
One of the main functionality of Partial init feature is to reduce latency during resume.

Bug: 231654364
Link: https://lore.kernel.org/lkml/ea318551ec0b43429ce47bfac9ebf285@quicinc.com/#r

Change-Id: Ia1cb0b7173db3318d2d6686f4bd4719f3cfefd8b
Signed-off-by: kamasali <quic_kamasali@quicinc.com>
This commit is contained in:
kamasali
2022-05-30 17:06:04 +05:30
parent 854f840411
commit e8b5afb658
6 changed files with 24 additions and 3 deletions

View File

@@ -333,3 +333,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_recvmsg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_partial_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mmc_cache_card_properties);

View File

@@ -950,6 +950,7 @@ int mmc_execute_tuning(struct mmc_card *card)
return err;
}
EXPORT_SYMBOL_GPL(mmc_execute_tuning);
/*
* Change the bus mode (open drain/push-pull) of a host.
@@ -959,6 +960,7 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
host->ios.bus_mode = mode;
mmc_set_ios(host);
}
EXPORT_SYMBOL_GPL(mmc_set_bus_mode);
/*
* Change data bus width of a host.
@@ -968,6 +970,7 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
host->ios.bus_width = width;
mmc_set_ios(host);
}
EXPORT_SYMBOL_GPL(mmc_set_bus_width);
/*
* Set initial state after a power cycle or a hw_reset.

View File

@@ -166,6 +166,7 @@ void mmc_retune_hold(struct mmc_host *host)
host->retune_now = 1;
host->hold_retune += 1;
}
EXPORT_SYMBOL(mmc_retune_hold);
void mmc_retune_release(struct mmc_host *host)
{

View File

@@ -16,6 +16,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"
@@ -2098,9 +2099,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_cache_card_properties(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) {
@@ -2135,6 +2137,7 @@ static int mmc_suspend(struct mmc_host *host)
static int _mmc_resume(struct mmc_host *host)
{
int err = 0;
bool partial_init = false;
mmc_claim_host(host);
@@ -2142,7 +2145,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_partial_init(host, &partial_init);
if (!partial_init)
err = mmc_init_card(host, host->card->ocr, host->card);
mmc_card_clr_suspended(host->card);
out:

View File

@@ -110,6 +110,7 @@ int mmc_select_card(struct mmc_card *card)
return _mmc_select_card(card->host, card);
}
EXPORT_SYMBOL_GPL(mmc_select_card);
int mmc_deselect_cards(struct mmc_host *host)
{
@@ -545,6 +546,7 @@ bool mmc_prepare_busy_cmd(struct mmc_host *host, struct mmc_command *cmd,
cmd->busy_timeout = timeout_ms;
return true;
}
EXPORT_SYMBOL_GPL(mmc_prepare_busy_cmd);
/**
* __mmc_switch - modify EXT_CSD register

View File

@@ -21,6 +21,14 @@ DECLARE_HOOK(android_vh_mmc_sdio_pm_flag_set,
TP_PROTO(struct mmc_host *host),
TP_ARGS(host));
DECLARE_RESTRICTED_HOOK(android_rvh_mmc_cache_card_properties,
TP_PROTO(struct mmc_host *host),
TP_ARGS(host), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_partial_init,
TP_PROTO(struct mmc_host *host, bool *partial_init),
TP_ARGS(host, partial_init), 1);
#endif /* _TRACE_HOOK_MMC_H */
/* This part must be outside protection */
#include <trace/define_trace.h>