Commit 2c75f9a5 authored by Asutosh Das's avatar Asutosh Das Committed by Martin K. Petersen

scsi: ufshcd: Let vendor override devfreq parameters

Vendor drivers may have a need to update the polling interval and
thresholds.  Provide a vops for vendor drivers to use.

Link: https://lore.kernel.org/r/acd79e00396cff855256adad47f615ccdbde85ac.1585160616.git.asutoshd@codeaurora.orgAcked-by: default avatarAvri Altman <Avri.Altman@wdc.com>
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 91831d33
...@@ -1315,6 +1315,17 @@ static struct devfreq_dev_profile ufs_devfreq_profile = { ...@@ -1315,6 +1315,17 @@ static struct devfreq_dev_profile ufs_devfreq_profile = {
.get_dev_status = ufshcd_devfreq_get_dev_status, .get_dev_status = ufshcd_devfreq_get_dev_status,
}; };
#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
static struct devfreq_simple_ondemand_data ufs_ondemand_data = {
.upthreshold = 70,
.downdifferential = 5,
};
static void *gov_data = &ufs_ondemand_data;
#else
static void *gov_data; /* NULL */
#endif
static int ufshcd_devfreq_init(struct ufs_hba *hba) static int ufshcd_devfreq_init(struct ufs_hba *hba)
{ {
struct list_head *clk_list = &hba->clk_list_head; struct list_head *clk_list = &hba->clk_list_head;
...@@ -1330,10 +1341,12 @@ static int ufshcd_devfreq_init(struct ufs_hba *hba) ...@@ -1330,10 +1341,12 @@ static int ufshcd_devfreq_init(struct ufs_hba *hba)
dev_pm_opp_add(hba->dev, clki->min_freq, 0); dev_pm_opp_add(hba->dev, clki->min_freq, 0);
dev_pm_opp_add(hba->dev, clki->max_freq, 0); dev_pm_opp_add(hba->dev, clki->max_freq, 0);
ufshcd_vops_config_scaling_param(hba, &ufs_devfreq_profile,
gov_data);
devfreq = devfreq_add_device(hba->dev, devfreq = devfreq_add_device(hba->dev,
&ufs_devfreq_profile, &ufs_devfreq_profile,
DEVFREQ_GOV_SIMPLE_ONDEMAND, DEVFREQ_GOV_SIMPLE_ONDEMAND,
NULL); gov_data);
if (IS_ERR(devfreq)) { if (IS_ERR(devfreq)) {
ret = PTR_ERR(devfreq); ret = PTR_ERR(devfreq);
dev_err(hba->dev, "Unable to register with devfreq %d\n", ret); dev_err(hba->dev, "Unable to register with devfreq %d\n", ret);
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/devfreq.h>
#include "unipro.h" #include "unipro.h"
#include <asm/irq.h> #include <asm/irq.h>
...@@ -327,6 +328,9 @@ struct ufs_hba_variant_ops { ...@@ -327,6 +328,9 @@ struct ufs_hba_variant_ops {
void (*dbg_register_dump)(struct ufs_hba *hba); void (*dbg_register_dump)(struct ufs_hba *hba);
int (*phy_initialization)(struct ufs_hba *); int (*phy_initialization)(struct ufs_hba *);
void (*device_reset)(struct ufs_hba *hba); void (*device_reset)(struct ufs_hba *hba);
void (*config_scaling_param)(struct ufs_hba *hba,
struct devfreq_dev_profile *profile,
void *data);
}; };
/* clock gating state */ /* clock gating state */
...@@ -1094,6 +1098,14 @@ static inline void ufshcd_vops_device_reset(struct ufs_hba *hba) ...@@ -1094,6 +1098,14 @@ static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
} }
} }
static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
struct devfreq_dev_profile
*profile, void *data)
{
if (hba->vops && hba->vops->config_scaling_param)
hba->vops->config_scaling_param(hba, profile, data);
}
extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment