From b6322f77e63220d1b8198ffdfca69a2b97c39487 Mon Sep 17 00:00:00 2001 From: Ziqi Chen Date: Wed, 25 Nov 2020 11:23:03 +0800 Subject: [PATCH] scsi: ufs: Don't disable core_clk_unipro if the link is active If we want to disable clocks but still keep the link active, both ref_clk and core_clk_unipro should be skipped. Commit 284fa080cb5f ("scsi: ufs: fix broken hibern8_on_idle sysfs nodes") is the original change from msm-4.14. We pick it up to msm-5.4 due to upstream missed this change. To follow GKI policy on 5.4, we simplifed it and kept parameters name to avoid breaking ABI. Change-Id: I5f86775c150e495322d14ec57ebf76a710257931 Signed-off-by: Ziqi Chen --- drivers/scsi/ufs/ufshcd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e0e9019f890d..7c118fb9106f 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8246,7 +8246,17 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, list_for_each_entry(clki, head, list) { if (!IS_ERR_OR_NULL(clki->clk)) { +#if defined(CONFIG_SCSI_UFSHCD_QTI) + /* + * To keep link active, ref_clk and core_clk_unipro + * should be kept ON. + */ + if (skip_ref_clk && + (!strcmp(clki->name, "ref_clk") || + !strcmp(clki->name, "core_clk_unipro"))) +#else if (skip_ref_clk && !strcmp(clki->name, "ref_clk")) +#endif continue; clk_state_changed = on ^ clki->enabled;