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

Commit 3bd8feb1 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: modify devfreq profile to support multiple UFS hosts"

parents 643c0858 7cde6c8d
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@

#include <linux/async.h>
#include <scsi/ufs/ioctl.h>
#include <linux/devfreq.h>
#include <linux/nls.h>
#include <linux/of.h>
#include <linux/bitfield.h>
@@ -490,12 +489,6 @@ static void *gov_data = &ufshcd_ondemand_data;
static void *gov_data;
#endif

static struct devfreq_dev_profile ufs_devfreq_profile = {
	.polling_ms	= 60,
	.target		= ufshcd_devfreq_target,
	.get_dev_status	= ufshcd_devfreq_get_dev_status,
};

static inline bool ufshcd_valid_tag(struct ufs_hba *hba, int tag)
{
	return tag >= 0 && tag < hba->nutrs;
@@ -1957,6 +1950,7 @@ static int ufshcd_devfreq_init(struct ufs_hba *hba)
	struct list_head *clk_list = &hba->clk_list_head;
	struct ufs_clk_info *clki;
	struct devfreq *devfreq;
	struct ufs_clk_scaling *scaling = &hba->clk_scaling;
	int ret;

	/* Skip devfreq if we don't have any clocks in the list */
@@ -1967,8 +1961,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);

	scaling->profile.polling_ms = 60;
	scaling->profile.target = ufshcd_devfreq_target;
	scaling->profile.get_dev_status = ufshcd_devfreq_get_dev_status;

	devfreq = devfreq_add_device(hba->dev,
			&ufs_devfreq_profile,
			&scaling->profile,
			DEVFREQ_GOV_SIMPLE_ONDEMAND,
			gov_data);
	if (IS_ERR(devfreq)) {
+4 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 * This code is based on drivers/scsi/ufs/ufshcd.h
 * Copyright (C) 2011-2013 Samsung India Software Operations
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * Authors:
 *	Santosh Yaraganavi <santosh.sy@samsung.com>
@@ -59,6 +59,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/reset.h>
#include <linux/extcon.h>
#include <linux/devfreq.h>
#include "unipro.h"

#include <asm/irq.h>
@@ -518,6 +519,7 @@ struct ufs_hibern8_on_idle {
 * @workq: workqueue to schedule devfreq suspend/resume work
 * @suspend_work: worker to suspend devfreq
 * @resume_work: worker to resume devfreq
 * @profile: devfreq profile
 * @is_allowed: tracks if scaling is currently allowed or not
 * @is_busy_started: tracks if busy period has started or not
 * @is_suspended: tracks if devfreq is suspended or not
@@ -533,6 +535,7 @@ struct ufs_clk_scaling {
	struct workqueue_struct *workq;
	struct work_struct suspend_work;
	struct work_struct resume_work;
	struct devfreq_dev_profile profile;
	bool is_allowed;
	bool is_busy_started;
	bool is_suspended;