ANDROID: scsi: ufs: Add hook to influence the UFS clock scaling policy
Add a vendor hook in ufshcd_devfreq_target() to allow vendor modules to influence the UFS clock scaling policy. Bug: 234112523 Change-Id: I64b9b77661fffc6cc96fa610985483e6cfc6542b Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com> Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
This commit is contained in:
@@ -185,6 +185,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_uic_command);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sdev);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sdev);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_clock_scaling);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_iovad_alloc_iova);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_iommu_iovad_alloc_iova);
|
||||||
|
|||||||
@@ -1313,6 +1313,8 @@ static int ufshcd_devfreq_target(struct device *dev,
|
|||||||
struct list_head *clk_list = &hba->clk_list_head;
|
struct list_head *clk_list = &hba->clk_list_head;
|
||||||
struct ufs_clk_info *clki;
|
struct ufs_clk_info *clki;
|
||||||
unsigned long irq_flags;
|
unsigned long irq_flags;
|
||||||
|
bool force_out = false;
|
||||||
|
bool force_scaling = false;
|
||||||
|
|
||||||
if (!ufshcd_is_clkscaling_supported(hba))
|
if (!ufshcd_is_clkscaling_supported(hba))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -1338,8 +1340,11 @@ static int ufshcd_devfreq_target(struct device *dev,
|
|||||||
scale_up = (*freq == clki->max_freq) ? true : false;
|
scale_up = (*freq == clki->max_freq) ? true : false;
|
||||||
if (!scale_up)
|
if (!scale_up)
|
||||||
*freq = clki->min_freq;
|
*freq = clki->min_freq;
|
||||||
|
|
||||||
|
trace_android_vh_ufs_clock_scaling(hba, &force_out, &force_scaling, &scale_up);
|
||||||
|
|
||||||
/* Update the frequency */
|
/* Update the frequency */
|
||||||
if (!ufshcd_is_devfreq_scaling_required(hba, scale_up)) {
|
if (force_out || (!force_scaling && !ufshcd_is_devfreq_scaling_required(hba, scale_up))) {
|
||||||
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out; /* no state change required */
|
goto out; /* no state change required */
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ DECLARE_HOOK(android_vh_ufs_update_sdev,
|
|||||||
TP_PROTO(struct scsi_device *sdev),
|
TP_PROTO(struct scsi_device *sdev),
|
||||||
TP_ARGS(sdev));
|
TP_ARGS(sdev));
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_ufs_clock_scaling,
|
||||||
|
TP_PROTO(struct ufs_hba *hba, bool *force_out, bool *force_scaling, bool *scale_up),
|
||||||
|
TP_ARGS(hba, force_out, force_scaling, scale_up));
|
||||||
#endif /* _TRACE_HOOK_UFSHCD_H */
|
#endif /* _TRACE_HOOK_UFSHCD_H */
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user