From: "Asutosh Das (asd)" <asutoshd@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>,
linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
avri.altman@wdc.com, alim.akhtar@samsung.com,
pedrom.sousa@synopsys.com, jejb@linux.ibm.com,
matthias.bgg@gmail.com
Cc: linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, beanhuo@micron.com,
kuohong.wang@mediatek.com, peter.wang@mediatek.com,
chun-hung.wu@mediatek.com, andy.teng@mediatek.com
Subject: Re: [PATCH v1 2/4] scsi: ufs: export ufshcd_auto_hibern8_update for vendor usage
Date: Wed, 18 Dec 2019 15:53:37 -0800 [thread overview]
Message-ID: <ad0153db-93ad-0ecf-c2f3-1b76dda778d3@codeaurora.org> (raw)
In-Reply-To: <1576224695-22657-3-git-send-email-stanley.chu@mediatek.com>
On 12/13/2019 12:11 AM, Stanley Chu wrote:
> Export ufshcd_auto_hibern8_update to allow vendors to use common
> interface to customize auto-hibernate timer.
>
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
> drivers/scsi/ufs/ufs-sysfs.c | 20 --------------------
> drivers/scsi/ufs/ufshcd.c | 18 ++++++++++++++++++
> drivers/scsi/ufs/ufshcd.h | 1 +
> 3 files changed, 19 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
> index ad2abc96c0f1..720be3f64be7 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -118,26 +118,6 @@ static ssize_t spm_target_link_state_show(struct device *dev,
> ufs_pm_lvl_states[hba->spm_lvl].link_state));
> }
>
> -static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
> -{
> - unsigned long flags;
> -
> - if (!ufshcd_is_auto_hibern8_supported(hba))
> - return;
> -
> - spin_lock_irqsave(hba->host->host_lock, flags);
> - if (hba->ahit != ahit)
> - hba->ahit = ahit;
> - spin_unlock_irqrestore(hba->host->host_lock, flags);
> - if (!pm_runtime_suspended(hba->dev)) {
> - pm_runtime_get_sync(hba->dev);
> - ufshcd_hold(hba, false);
> - ufshcd_auto_hibern8_enable(hba);
> - ufshcd_release(hba);
> - pm_runtime_put(hba->dev);
> - }
> -}
> -
> /* Convert Auto-Hibernate Idle Timer register value to microseconds */
> static int ufshcd_ahit_to_us(u32 ahit)
> {
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index b5966faf3e98..589f519316aa 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3956,6 +3956,24 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
> return ret;
> }
>
> +void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
> +{
> + unsigned long flags;
> +
> + if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
> + return;
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (hba->ahit == ahit)
> + goto out_unlock;
> + hba->ahit = ahit;
> + if (!pm_runtime_suspended(hba->dev))
> + ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER);
> +out_unlock:
> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> +}
> +EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update);
> +
> void ufshcd_auto_hibern8_enable(struct ufs_hba *hba)
> {
> unsigned long flags;
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index 2740f6941ec6..86586a0b9aa5 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -927,6 +927,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
> enum flag_idn idn, bool *flag_res);
>
> void ufshcd_auto_hibern8_enable(struct ufs_hba *hba);
> +void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit);
>
> #define SD_ASCII_STD true
> #define SD_RAW false
>
Looks good to me.
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
next prev parent reply other threads:[~2019-12-18 23:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 8:11 [PATCH v1 0/4] scsi: ufs-mediatek: provide power management Stanley Chu
2019-12-13 8:11 ` [PATCH v1 1/4] scsi: ufs-mediatek: introduce reference clock control Stanley Chu
2019-12-19 18:17 ` Alim Akhtar
2019-12-13 8:11 ` [PATCH v1 2/4] scsi: ufs: export ufshcd_auto_hibern8_update for vendor usage Stanley Chu
2019-12-18 23:53 ` Asutosh Das (asd) [this message]
2019-12-19 18:32 ` Alim Akhtar
2019-12-13 8:11 ` [PATCH v1 3/4] scsi: ufs-mediatek: configure customized auto-hibern8 timer Stanley Chu
2019-12-19 18:25 ` Alim Akhtar
2019-12-13 8:11 ` [PATCH v1 4/4] scsi: ufs-mediatek: configure and enable clk-gating Stanley Chu
2019-12-19 18:33 ` Alim Akhtar
2019-12-19 23:17 ` [PATCH v1 0/4] scsi: ufs-mediatek: provide power management Martin K. Petersen
2019-12-20 1:25 ` Stanley Chu
2019-12-20 2:25 ` Martin K. Petersen
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=ad0153db-93ad-0ecf-c2f3-1b76dda778d3@codeaurora.org \
--to=asutoshd@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=andy.teng@mediatek.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=chun-hung.wu@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=kuohong.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=pedrom.sousa@synopsys.com \
--cc=peter.wang@mediatek.com \
--cc=stanley.chu@mediatek.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
Powered by JetHome