mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ziqi Chen <quic_ziqichen@quicinc.com>
To: "Peter Wang (王信友)" <peter.wang@mediatek.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"quic_rampraka@quicinc.com" <quic_rampraka@quicinc.com>,
	"quic_cang@quicinc.com" <quic_cang@quicinc.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"quic_nitirawa@quicinc.com" <quic_nitirawa@quicinc.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"junwoo80.lee@samsung.com" <junwoo80.lee@samsung.com>,
	"mani@kernel.org" <mani@kernel.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "ebiggers@google.com" <ebiggers@google.com>,
	"neil.armstrong@linaro.org" <neil.armstrong@linaro.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"manivannan.sadhasivam@linaro.org"
	<manivannan.sadhasivam@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"minwoo.im@samsung.com" <minwoo.im@samsung.com>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v4 3/8] scsi: ufs: core: Add a vop to map clock frequency to gear speed
Date: Tue, 11 Feb 2025 18:14:14 +0800	[thread overview]
Message-ID: <c20ff2ea-5546-4e4a-b813-f5736696b042@quicinc.com> (raw)
In-Reply-To: <cb88b16e4207c649da8eba66f976c5039df7c77c.camel@mediatek.com>



On 2/11/2025 2:02 PM, Peter Wang (王信友) wrote:
> On Mon, 2025-02-10 at 18:02 +0800, Ziqi Chen wrote:
>>
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>
>>
>> From: Can Guo <quic_cang@quicinc.com>
>>
>> Add a vop to map UFS host controller clock frequencies to the
>> corresponding
>> maximum supported UFS high speed gear speeds. During clock scaling,
>> we can
>> map the target clock frequency, demanded by devfreq, to the maximum
>> supported gear speed, so that devfreq can scale the gear to the
>> highest
>> gear speed supported at the target clock frequency, instead of just
>> scaling
>> up/down the gear between the min and max gear speeds.
>>
>> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com>
>> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com>
>> Signed-off-by: Can Guo <quic_cang@quicinc.com>
>> Reviewed-by: Bean Huo <beanhuo@micron.com>
>> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
>> Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>> v2 ->v3:
>> 1. Remove the parameter 'gear' and use it as function return result.
>> 2. Change "vops" into "vop" in commit message.
>> ---
>>   drivers/ufs/core/ufshcd-priv.h | 8 ++++++++
>>   include/ufs/ufshcd.h           | 2 ++
>>   2 files changed, 10 insertions(+)
>>
>> diff --git a/drivers/ufs/core/ufshcd-priv.h
>> b/drivers/ufs/core/ufshcd-priv.h
>> index 0549b65f71ed..4da3e65c6735 100644
>> --- a/drivers/ufs/core/ufshcd-priv.h
>> +++ b/drivers/ufs/core/ufshcd-priv.h
>> @@ -277,6 +277,14 @@ static inline int
>> ufshcd_mcq_vops_config_esi(struct ufs_hba *hba)
>>          return -EOPNOTSUPP;
>>   }
>>
>> +static inline int ufshcd_vops_freq_to_gear_speed(struct ufs_hba
> 
> Hi Ziqi,
> 
> Gear speed type in struct ufs_pa_layer_attr is u32.
> I think it would be better to unify the type here.
> 
> 
Hi Peter,

I changed the type of new_gear since V3 sue to I use it as return result 
of vop ufshcd_vops_freq_to_gear_speed(). I think you already find the 
reason in patch 4/8 and 5/8. I think your suggestion in patch 5/8 is 
make sense. Let me discuss more with you in the patch 5/8.

-Ziqi

> 
>> *hba, unsigned long freq)
>> +{
>> +       if (hba->vops && hba->vops->freq_to_gear_speed)
>> +               return hba->vops->freq_to_gear_speed(hba, freq);
>> +
>> +       return -EOPNOTSUPP;
>> +}
>> +
>>   extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[];
>>
>>   /**
>> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
>> index f51d425696e7..cdb853f5b871 100644
>> --- a/include/ufs/ufshcd.h
>> +++ b/include/ufs/ufshcd.h
>> @@ -336,6 +336,7 @@ struct ufs_pwr_mode_info {
>>    * @get_outstanding_cqs: called to get outstanding completion queues
>>    * @config_esi: called to config Event Specific Interrupt
>>    * @config_scsi_dev: called to configure SCSI device parameters
>> + * @freq_to_gear_speed: called to map clock frequency to the max
>> supported gear speed
>>    */
>>   struct ufs_hba_variant_ops {
>>          const char *name;
>> @@ -387,6 +388,7 @@ struct ufs_hba_variant_ops {
>>                                         unsigned long *ocqs);
>>          int     (*config_esi)(struct ufs_hba *hba);
>>          void    (*config_scsi_dev)(struct scsi_device *sdev);
>> +       int (*freq_to_gear_speed)(struct ufs_hba *hba, unsigned long
>> freq);
>>
> 
> Please keep the indentation consistent too.
> 
> Thanks
> Peter
> 
>>   };
>>
>>   /* clock gating state  */
>> --
>> 2.34.1
>>
> 


  reply	other threads:[~2025-02-11 10:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 10:02 [PATCH v4 0/8] Support Multi-frequency scale for UFS Ziqi Chen
2025-02-10 10:02 ` [PATCH v4 1/8] scsi: ufs: core: Pass target_freq to clk_scale_notify() vop Ziqi Chen
2025-02-11  3:52   ` Peter Wang (王信友)
2025-02-11 10:04     ` Ziqi Chen
2025-02-10 10:02 ` [PATCH v4 2/8] scsi: ufs: qcom: Pass target_freq to clk scale pre and post change Ziqi Chen
2025-02-10 10:02 ` [PATCH v4 3/8] scsi: ufs: core: Add a vop to map clock frequency to gear speed Ziqi Chen
2025-02-11  6:02   ` Peter Wang (王信友)
2025-02-11 10:14     ` Ziqi Chen [this message]
2025-02-10 10:02 ` [PATCH v4 4/8] scsi: ufs: qcom: Implement the freq_to_gear_speed() vop Ziqi Chen
2025-02-10 10:02 ` [PATCH v4 5/8] scsi: ufs: core: Enable multi-level gear scaling Ziqi Chen
2025-02-11  9:28   ` Peter Wang (王信友)
2025-02-11 10:28     ` Ziqi Chen
2025-02-10 10:02 ` [PATCH v4 6/8] scsi: ufs: core: Check if scaling up is required when disable clkscale Ziqi Chen
2025-02-10 18:17   ` Bean Huo
2025-02-11 12:58   ` Peter Wang (王信友)
2025-02-10 10:02 ` [PATCH v4 7/8] scsi: ufs: core: Toggle Write Booster during clock scaling base on gear speed Ziqi Chen
2025-02-11 12:59   ` Peter Wang (王信友)
2025-02-10 10:02 ` [PATCH v4 8/8] ABI: sysfs-driver-ufs: Add missing UFS sysfs attributes Ziqi Chen
2025-02-10 18:24   ` Bean Huo
2025-02-13  7:55     ` Ziqi Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c20ff2ea-5546-4e4a-b813-f5736696b042@quicinc.com \
    --to=quic_ziqichen@quicinc.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@google.com \
    --cc=junwoo80.lee@samsung.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=minwoo.im@samsung.com \
    --cc=neil.armstrong@linaro.org \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_rampraka@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®