Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp86027ybb; Tue, 24 Mar 2020 17:08:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtku4dX/1NL4JX0rVDMWedhsjfV/9NN0hIxBu3pQpHWtPLs/XqHgIXFFf34DVW5fcmGeVmi X-Received: by 2002:a54:4388:: with SMTP id u8mr626557oiv.67.1585094929523; Tue, 24 Mar 2020 17:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585094929; cv=none; d=google.com; s=arc-20160816; b=T8WHBx6k/OvY0pwzhfrIq/jWo2AkYkhIkg6hJCGH5G+3+S7ZKy+TnjDypSJtTdIqEQ 5hcsH9eTZ7sBXUOf4cAVSMTjHfM8eGWyjuB3IVb7KOz34uVh54hCcf+GrrNuRklAru5y 14BCJ4IMdI8ewekC/6cWj5TZREIhFfc2jYwgfjEus8RNTBnr0w/YrYX//68hiVYZdQmA 2VB6ddXruiBxGKkgeuCQQRqFcFeqRDVSFFgUzWFs74HxivOxdEgjTTtNxoE5sv11xJTS 0ZrohnDpHlX66Z5LnQy/uwipbEGyh6A9NFQH9ZpRnXzVd8bRGp38fPHKd1JLvI/sEaxt jk3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=CHmWqbtfWjCpVm3c74F2WYa7vXBgYxK1nNTlts82NKk=; b=ecjdutOwSqDG7hxUvx6CeL2hgpKWAkrd/PSX99eIPG00i3Wy8r7cdSZ4fR7zq3xTh+ IXTTZvMI0pI3uehpo9YiMsGX3EqfL5RRDYnpfbNh5itVbhDNrDwV/LEYzITW9FalWDXe +j6HRLuwOPbveiTwD9VreJp1D1okjR6SUxw6IY8s8SIgKHdkmKXt1LqxV/YKZ7Xcq/UM LUGXq0s5O8LKmxG8D9UT7DqWzMxZuQcySAlsTDQdum1jzWD0SV2JLFNusGZIHCIyCJSq iaiwgqdTRBBpMiBcWGe88BzITp0xEUItYP7g6CJzEjGNObbALh35Q6SLVoy9pmnEYCnD SKpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si1385598oth.117.2020.03.24.17.08.37; Tue, 24 Mar 2020 17:08:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbgCYAHU (ORCPT + 99 others); Tue, 24 Mar 2020 20:07:20 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:11975 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbgCYAHU (ORCPT ); Tue, 24 Mar 2020 20:07:20 -0400 Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 24 Mar 2020 17:07:19 -0700 Received: from asutoshd-linux1.qualcomm.com ([10.46.160.39]) by ironmsg04-sd.qualcomm.com with ESMTP; 24 Mar 2020 17:07:18 -0700 Received: by asutoshd-linux1.qualcomm.com (Postfix, from userid 92687) id 89E5D1F79D; Tue, 24 Mar 2020 17:07:18 -0700 (PDT) From: Asutosh Das To: cang@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: Asutosh Das , linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Stanley Chu , Bean Huo , Bart Van Assche , Venkat Gopalakrishnan , Tomas Winkler , Bjorn Andersson , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 2/3] scsi: ufshcd: Let vendor override devfreq parameters Date: Tue, 24 Mar 2020 17:07:04 -0700 Message-Id: <59a83a2dba7d7f2be4bd4af56267fee8d1c5bb7c.1585094538.git.asutoshd@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vendor drivers may have a need to update the polling interval and thresholds. Provide a vops for vendor drivers to use. Signed-off-by: Asutosh Das --- drivers/scsi/ufs/ufshcd.c | 11 ++++++++++- drivers/scsi/ufs/ufshcd.h | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4607bc6..7643ef5 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1300,6 +1300,13 @@ 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; +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; @@ -1315,10 +1322,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); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index d45a044..e8e8ee2 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -56,6 +56,7 @@ #include #include #include +#include #include "unipro.h" #include @@ -327,6 +328,9 @@ struct ufs_hba_variant_ops { void (*dbg_register_dump)(struct ufs_hba *hba); int (*phy_initialization)(struct ufs_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 */ @@ -1083,6 +1087,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[]; /* -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.