diff options
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 26 | ||||
-rw-r--r-- | drivers/scsi/ufs/ufshcd.h | 7 |
2 files changed, 25 insertions, 8 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index df525e3b2c19..3a2de56fe080 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -4884,13 +4884,19 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) | |||
4884 | } | 4884 | } |
4885 | 4885 | ||
4886 | if (ufshcd_is_runtime_pm(pm_op)) { | 4886 | if (ufshcd_is_runtime_pm(pm_op)) { |
4887 | /* | 4887 | if (ufshcd_can_autobkops_during_suspend(hba)) { |
4888 | * The device is idle with no requests in the queue, | 4888 | /* |
4889 | * allow background operations if needed. | 4889 | * The device is idle with no requests in the queue, |
4890 | */ | 4890 | * allow background operations if bkops status shows |
4891 | ret = ufshcd_bkops_ctrl(hba, BKOPS_STATUS_NON_CRITICAL); | 4891 | * that performance might be impacted. |
4892 | if (ret) | 4892 | */ |
4893 | goto enable_gating; | 4893 | ret = ufshcd_urgent_bkops(hba); |
4894 | if (ret) | ||
4895 | goto enable_gating; | ||
4896 | } else { | ||
4897 | /* make sure that auto bkops is disabled */ | ||
4898 | ufshcd_disable_auto_bkops(hba); | ||
4899 | } | ||
4894 | } | 4900 | } |
4895 | 4901 | ||
4896 | if ((req_dev_pwr_mode != hba->curr_dev_pwr_mode) && | 4902 | if ((req_dev_pwr_mode != hba->curr_dev_pwr_mode) && |
@@ -5038,7 +5044,11 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) | |||
5038 | goto set_old_link_state; | 5044 | goto set_old_link_state; |
5039 | } | 5045 | } |
5040 | 5046 | ||
5041 | ufshcd_disable_auto_bkops(hba); | 5047 | /* |
5048 | * If BKOPs operations are urgently needed at this moment then | ||
5049 | * keep auto-bkops enabled or else disable it. | ||
5050 | */ | ||
5051 | ufshcd_urgent_bkops(hba); | ||
5042 | hba->clk_gating.is_suspended = false; | 5052 | hba->clk_gating.is_suspended = false; |
5043 | 5053 | ||
5044 | if (ufshcd_is_clkscaling_enabled(hba)) | 5054 | if (ufshcd_is_clkscaling_enabled(hba)) |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 908db3eb0609..d7fec869d590 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
@@ -469,6 +469,8 @@ struct ufs_hba { | |||
469 | #define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1) | 469 | #define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1) |
470 | /* Allow dynamic clk scaling */ | 470 | /* Allow dynamic clk scaling */ |
471 | #define UFSHCD_CAP_CLK_SCALING (1 << 2) | 471 | #define UFSHCD_CAP_CLK_SCALING (1 << 2) |
472 | /* Allow auto bkops to enabled during runtime suspend */ | ||
473 | #define UFSHCD_CAP_AUTO_BKOPS_SUSPEND (1 << 3) | ||
472 | 474 | ||
473 | struct devfreq *devfreq; | 475 | struct devfreq *devfreq; |
474 | struct ufs_clk_scaling clk_scaling; | 476 | struct ufs_clk_scaling clk_scaling; |
@@ -487,6 +489,11 @@ static inline int ufshcd_is_clkscaling_enabled(struct ufs_hba *hba) | |||
487 | { | 489 | { |
488 | return hba->caps & UFSHCD_CAP_CLK_SCALING; | 490 | return hba->caps & UFSHCD_CAP_CLK_SCALING; |
489 | } | 491 | } |
492 | static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba) | ||
493 | { | ||
494 | return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; | ||
495 | } | ||
496 | |||
490 | #define ufshcd_writel(hba, val, reg) \ | 497 | #define ufshcd_writel(hba, val, reg) \ |
491 | writel((val), (hba)->mmio_base + (reg)) | 498 | writel((val), (hba)->mmio_base + (reg)) |
492 | #define ufshcd_readl(hba, reg) \ | 499 | #define ufshcd_readl(hba, reg) \ |