Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02eb2102 authored by Can Guo's avatar Can Guo Committed by Todd Kjos
Browse files

BACKPORT: FROMGIT: 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.

Bug: 152781094
(cherry picked from commit 2c75f9a5be53501a6e733cd72c1c46281eaa49a0
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/log/?h=5.7/scsi-queue)
Link: https://lore.kernel.org/r/acd79e00396cff855256adad47f615ccdbde85ac.1585160616.git.asutoshd@codeaurora.org


Acked-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>

Change-Id: Iaa41b1861a95d686fa0db6d5b7eb045ed14b531f
[can: Resolved minor conflict in drivers/scsi/ufs/ufshcd.h ]
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 78e51a29
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1349,6 +1349,17 @@ static struct devfreq_dev_profile ufs_devfreq_profile = {
	.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)
{
	struct list_head *clk_list = &hba->clk_list_head;
@@ -1364,10 +1375,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->max_freq, 0);

	ufshcd_vops_config_scaling_param(hba, &ufs_devfreq_profile,
					 gov_data);
	devfreq = devfreq_add_device(hba->dev,
			&ufs_devfreq_profile,
			DEVFREQ_GOV_SIMPLE_ONDEMAND,
			NULL);
			gov_data);
	if (IS_ERR(devfreq)) {
		ret = PTR_ERR(devfreq);
		dev_err(hba->dev, "Unable to register with devfreq %d\n", ret);
+12 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/regulator/consumer.h>
#include <linux/devfreq.h>
#include <linux/bitfield.h>
#include "unipro.h"

@@ -355,6 +356,9 @@ struct ufs_hba_variant_ops {
	void	(*device_reset)(struct ufs_hba *hba);
	int	(*program_key)(struct ufs_hba *hba,
			       const union ufs_crypto_cfg_entry *cfg, int slot);
	void	(*config_scaling_param)(struct ufs_hba *hba,
					struct devfreq_dev_profile *profile,
					void *data);
};

struct keyslot_mgmt_ll_ops;
@@ -1181,6 +1185,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[];

/*