summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Armstrong <neil.armstrong@linaro.org>2024-09-10 11:50:11 +0200
committerNeil Armstrong <neil.armstrong@linaro.org>2024-10-14 08:56:03 +0200
commitb3f89c1d6ed47b7c7a6eaf854d3289dbfe31f332 (patch)
tree4596008d4824b322c23af10cd02d247ee2d39a48
parent182e19225bbf66bae2280173a177c569e131c0dc (diff)
ufs: add get_max_pwr_mode callback
Add a new get_max_pwr_mode callback to permit the UFS controller driver manipulate the max_pwr_mode struct right before setting the new pwr_mode to the UFS device. It can be used to limit the HS Gear with errata and hardware limitations on some UFS controllers. Tested-by: Julius Lehmann <lehmanju@devpi.de> Tested-by: Caleb Connolly <caleb.connolly@linaro.org> #rb3gen2 Link: https://lore.kernel.org/r/20240910-topic-ufs-qcom-controller-v1-2-54c0d2231b10@linaro.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-rw-r--r--drivers/ufs/ufs.c2
-rw-r--r--drivers/ufs/ufs.h11
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
index de8ba011d57..1edd31677b2 100644
--- a/drivers/ufs/ufs.c
+++ b/drivers/ufs/ufs.c
@@ -1744,7 +1744,7 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *hba)
}
hba->max_pwr_info.is_valid = true;
- return 0;
+ return ufshcd_ops_get_max_pwr_mode(hba, &hba->max_pwr_info);
}
static int ufshcd_change_power_mode(struct ufs_hba *hba,
diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h
index 8221812f6da..81107e5b37e 100644
--- a/drivers/ufs/ufs.h
+++ b/drivers/ufs/ufs.h
@@ -696,6 +696,8 @@ struct ufs_dev_cmd {
struct ufs_hba_ops {
int (*init)(struct ufs_hba *hba);
+ int (*get_max_pwr_mode)(struct ufs_hba *hba,
+ struct ufs_pwr_mode_info *max_pwr_info);
int (*hce_enable_notify)(struct ufs_hba *hba,
enum ufs_notify_change_status);
int (*link_startup_notify)(struct ufs_hba *hba,
@@ -903,6 +905,15 @@ static inline int ufshcd_ops_init(struct ufs_hba *hba)
return 0;
}
+static inline int ufshcd_ops_get_max_pwr_mode(struct ufs_hba *hba,
+ struct ufs_pwr_mode_info *max_pwr_info)
+{
+ if (hba->ops && hba->ops->get_max_pwr_mode)
+ return hba->ops->get_max_pwr_mode(hba, max_pwr_info);
+
+ return 0;
+}
+
static inline int ufshcd_ops_hce_enable_notify(struct ufs_hba *hba,
bool status)
{