[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGOxZ52ffkFwkcrdyq+gjuXarjr-aqGRw2ck25Yu0QgppGh9hQ@mail.gmail.com>
Date: Fri, 20 Dec 2019 00:02:22 +0530
From: Alim Akhtar <alim.akhtar@...il.com>
To: Stanley Chu <stanley.chu@...iatek.com>
Cc: linux-scsi@...r.kernel.org,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Avri Altman <avri.altman@....com>,
Alim Akhtar <alim.akhtar@...sung.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
open list <linux-kernel@...r.kernel.org>,
"Bean Huo (beanhuo)" <beanhuo@...ron.com>,
Kuohong Wang <kuohong.wang@...iatek.com>,
peter.wang@...iatek.com, chun-hung.wu@...iatek.com,
andy.teng@...iatek.com
Subject: Re: [PATCH v1 2/4] scsi: ufs: export ufshcd_auto_hibern8_update for
vendor usage
On Fri, Dec 13, 2019 at 2:07 PM Stanley Chu <stanley.chu@...iatek.com> 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@...iatek.com>
Reviewed-by: Alim Akhtar <alim.akhtar@...sung.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
> --
> 2.18.0
--
Regards,
Alim
Powered by blists - more mailing lists