diff options
author | Subhash Jadavani <subhashj@codeaurora.org> | 2015-07-16 17:20:07 -0700 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:00:25 -0700 |
commit | 4f4ab265a8fbf1429e9ee5a334b8b91848a7efbe (patch) | |
tree | 2304bacc742999e806c5b20ea459ce619cfc9a33 /drivers/scsi/ufs/ufshcd.c | |
parent | 0cdd14268fa188435c8fb2daa6336a0c9c132134 (diff) |
scsi: ufs-qcom: do clock gating and hibern8 @10ms
This change enables the aggressive clock gating along with hibern8 at
every 10ms. As hibern8 enter was already @10ms, we are now merging it
with clock gating which will also be @10ms after this change. This change
is needed to save power for real life usecases.
Change-Id: I297d0f7d1c379f0b402298dc5dddd92ac33f6f25
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.c')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b42f3856596b..9db4fcc3ed5b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1332,6 +1332,8 @@ out: /* host lock must be held before calling this variant */ static void __ufshcd_release(struct ufs_hba *hba, bool no_sched) { + unsigned long delay_in_jiffies; + if (!ufshcd_is_clkgating_allowed(hba)) return; @@ -1346,8 +1348,20 @@ static void __ufshcd_release(struct ufs_hba *hba, bool no_sched) hba->clk_gating.state = REQ_CLKS_OFF; trace_ufshcd_clk_gating(dev_name(hba->dev), hba->clk_gating.state); - schedule_delayed_work(&hba->clk_gating.gate_work, - msecs_to_jiffies(hba->clk_gating.delay_ms)); + + /* + * Scheduling the delayed work after 1 jiffies will make the work to + * get schedule any time from 0ms to 1000/HZ ms which is not desirable + * for hibern8 enter work as it may impact the performance if it gets + * scheduled almost immediately. Hence make sure that hibern8 enter + * work gets scheduled atleast after 2 jiffies (any time between + * 1000/HZ ms to 2000/HZ ms). + */ + delay_in_jiffies = msecs_to_jiffies(hba->clk_gating.delay_ms); + if (delay_in_jiffies == 1) + delay_in_jiffies++; + + schedule_delayed_work(&hba->clk_gating.gate_work, delay_in_jiffies); } void ufshcd_release(struct ufs_hba *hba, bool no_sched) @@ -1423,7 +1437,7 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba) if (!ufshcd_is_clkgating_allowed(hba)) return; - hba->clk_gating.delay_ms = 50; + hba->clk_gating.delay_ms = 10; INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work); INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work); |