* [PATCH v1 0/2] scsi: allow host change auto suspend timer
@ 2024-01-09 12:40 peter.wang
2024-01-09 12:40 ` [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host peter.wang
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: peter.wang @ 2024-01-09 12:40 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, peter.wang, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu,
chu.stanley
From: Peter Wang <peter.wang@mediatek.com>
This patch allow MediaTek platform driver change auto suspend timer.
Peter Wang (2):
scsi: core: move auto suspend timer to Scsi_Host
ufs: host: mediatek: change default auto suspend timer
drivers/scsi/sd.c | 2 +-
drivers/ufs/core/ufshcd.c | 9 +++++++--
drivers/ufs/host/ufs-mediatek.c | 4 ++++
drivers/ufs/host/ufs-mediatek.h | 3 +++
include/scsi/scsi_host.h | 6 +++---
5 files changed, 18 insertions(+), 6 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host
2024-01-09 12:40 [PATCH v1 0/2] scsi: allow host change auto suspend timer peter.wang
@ 2024-01-09 12:40 ` peter.wang
2024-01-09 21:34 ` Bart Van Assche
2024-01-09 12:40 ` [PATCH v1 2/2] ufs: host: mediatek: change default auto suspend timer peter.wang
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: peter.wang @ 2024-01-09 12:40 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, peter.wang, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu,
chu.stanley
From: Peter Wang <peter.wang@mediatek.com>
Runtime suspend timer is a const value in scsi_host_template, which
host cannot modify this value.
Move it to Scsi_Host for host flexible use.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/scsi/sd.c | 2 +-
drivers/ufs/core/ufshcd.c | 9 +++++++--
include/scsi/scsi_host.h | 6 +++---
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 542a4bbb21bc..c1dc96331225 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3731,7 +3731,7 @@ static int sd_probe(struct device *dev)
blk_pm_runtime_init(sdp->request_queue, dev);
if (sdp->rpm_autosuspend) {
pm_runtime_set_autosuspend_delay(dev,
- sdp->host->hostt->rpm_autosuspend_delay);
+ sdp->host->rpm_autosuspend_delay);
}
error = device_add_disk(dev, gd, NULL);
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 16d76325039a..f9436d6560c4 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -7982,11 +7982,13 @@ static void ufshcd_set_active_icc_lvl(struct ufs_hba *hba)
static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
{
+ struct Scsi_Host *shost = sdev->host;
+
scsi_autopm_get_device(sdev);
blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
if (sdev->rpm_autosuspend)
pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
- RPM_AUTOSUSPEND_DELAY_MS);
+ shost->rpm_autosuspend_delay);
scsi_autopm_put_device(sdev);
}
@@ -8988,7 +8990,6 @@ static const struct scsi_host_template ufshcd_driver_template = {
.track_queue_depth = 1,
.skip_settle_delay = 1,
.sdev_groups = ufshcd_driver_groups,
- .rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS,
};
static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
@@ -10439,6 +10440,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
host->max_cmd_len = UFS_CDB_SIZE;
host->queuecommand_may_block = !!(hba->caps & UFSHCD_CAP_CLK_GATING);
+ /* Use default RPM delay if host not set */
+ if (host->rpm_autosuspend_delay == 0)
+ host->rpm_autosuspend_delay = RPM_AUTOSUSPEND_DELAY_MS;
+
hba->max_pwr_info.is_valid = false;
/* Initialize work queues */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 3b907fc2ef08..b259d42a1e1a 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -497,9 +497,6 @@ struct scsi_host_template {
* scsi_netlink.h
*/
u64 vendor_id;
-
- /* Delay for runtime autosuspend */
- int rpm_autosuspend_delay;
};
/*
@@ -713,6 +710,9 @@ struct Scsi_Host {
*/
struct device *dma_dev;
+ /* Delay for runtime autosuspend */
+ int rpm_autosuspend_delay;
+
/*
* We should ensure that this is aligned, both for better performance
* and also because some compilers (m68k) don't automatically force
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] ufs: host: mediatek: change default auto suspend timer
2024-01-09 12:40 [PATCH v1 0/2] scsi: allow host change auto suspend timer peter.wang
2024-01-09 12:40 ` [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host peter.wang
@ 2024-01-09 12:40 ` peter.wang
2024-01-24 2:12 ` [PATCH v1 0/2] scsi: allow host change " Martin K. Petersen
2024-01-30 2:27 ` Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: peter.wang @ 2024-01-09 12:40 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, peter.wang, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu,
chu.stanley
From: Peter Wang <peter.wang@mediatek.com>
Mediatek ufs driver change default auto suspend timer from 2000 ms
to 500 ms.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/ufs/host/ufs-mediatek.c | 4 ++++
drivers/ufs/host/ufs-mediatek.h | 3 +++
2 files changed, 7 insertions(+)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index fc61790d289b..1bcf75dd13fc 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -893,6 +893,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
const struct of_device_id *id;
struct device *dev = hba->dev;
struct ufs_mtk_host *host;
+ struct Scsi_Host *shost = hba->host;
int err = 0;
host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
@@ -937,6 +938,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)
/* Enable clk scaling*/
hba->caps |= UFSHCD_CAP_CLK_SCALING;
+ /* Set runtime pm delay to replace default */
+ shost->rpm_autosuspend_delay = MTK_RPM_AUTOSUSPEND_DELAY_MS;
+
hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
hba->quirks |= UFSHCD_QUIRK_MCQ_BROKEN_INTR;
hba->quirks |= UFSHCD_QUIRK_MCQ_BROKEN_RTC;
diff --git a/drivers/ufs/host/ufs-mediatek.h b/drivers/ufs/host/ufs-mediatek.h
index f76e80d91729..596edadfe747 100644
--- a/drivers/ufs/host/ufs-mediatek.h
+++ b/drivers/ufs/host/ufs-mediatek.h
@@ -190,6 +190,9 @@ struct ufs_mtk_host {
struct ufs_mtk_mcq_intr_info mcq_intr_info[UFSHCD_MAX_Q_NR];
};
+/* MTK delay of autosuspend: 500 ms */
+#define MTK_RPM_AUTOSUSPEND_DELAY_MS 500
+
/*
* Multi-VCC by Numbering
*/
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host
2024-01-09 12:40 ` [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host peter.wang
@ 2024-01-09 21:34 ` Bart Van Assche
0 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2024-01-09 21:34 UTC (permalink / raw)
To: peter.wang, linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao, powen.kao, qilin.tan, lin.gui,
tun-yu.yu, eddie.huang, naomi.chu, chu.stanley
On 1/9/24 04:40, peter.wang@mediatek.com wrote:
> Runtime suspend timer is a const value in scsi_host_template, which
> host cannot modify this value.
> Move it to Scsi_Host for host flexible use.
It would help to mention in the cover letter that the UFSHCI driver is
the only driver that sets .rpm_autosuspend_delay in the SCSI host template
and hence that this patch does not break any SCSI drivers. Anyway:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 0/2] scsi: allow host change auto suspend timer
2024-01-09 12:40 [PATCH v1 0/2] scsi: allow host change auto suspend timer peter.wang
2024-01-09 12:40 ` [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host peter.wang
2024-01-09 12:40 ` [PATCH v1 2/2] ufs: host: mediatek: change default auto suspend timer peter.wang
@ 2024-01-24 2:12 ` Martin K. Petersen
2024-01-30 2:27 ` Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2024-01-24 2:12 UTC (permalink / raw)
To: peter.wang
Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
wsd_upstream, linux-mediatek, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao, powen.kao, qilin.tan, lin.gui,
tun-yu.yu, eddie.huang, naomi.chu, chu.stanley
> This patch allow MediaTek platform driver change auto suspend timer.
Applied to 6.9/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 0/2] scsi: allow host change auto suspend timer
2024-01-09 12:40 [PATCH v1 0/2] scsi: allow host change auto suspend timer peter.wang
` (2 preceding siblings ...)
2024-01-24 2:12 ` [PATCH v1 0/2] scsi: allow host change " Martin K. Petersen
@ 2024-01-30 2:27 ` Martin K. Petersen
3 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2024-01-30 2:27 UTC (permalink / raw)
To: linux-scsi, avri.altman, alim.akhtar, jejb, peter.wang
Cc: Martin K . Petersen, wsd_upstream, linux-mediatek, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu,
chu.stanley
On Tue, 09 Jan 2024 20:40:13 +0800, peter.wang@mediatek.com wrote:
> This patch allow MediaTek platform driver change auto suspend timer.
>
> Peter Wang (2):
> scsi: core: move auto suspend timer to Scsi_Host
> ufs: host: mediatek: change default auto suspend timer
>
> drivers/scsi/sd.c | 2 +-
> drivers/ufs/core/ufshcd.c | 9 +++++++--
> drivers/ufs/host/ufs-mediatek.c | 4 ++++
> drivers/ufs/host/ufs-mediatek.h | 3 +++
> include/scsi/scsi_host.h | 6 +++---
> 5 files changed, 18 insertions(+), 6 deletions(-)
>
> [...]
Applied to 6.9/scsi-queue, thanks!
[1/2] scsi: core: move auto suspend timer to Scsi_Host
https://git.kernel.org/mkp/scsi/c/4380e64a94e1
[2/2] ufs: host: mediatek: change default auto suspend timer
https://git.kernel.org/mkp/scsi/c/332973850054
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-30 2:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 12:40 [PATCH v1 0/2] scsi: allow host change auto suspend timer peter.wang
2024-01-09 12:40 ` [PATCH v1 1/2] scsi: core: move auto suspend timer to Scsi_Host peter.wang
2024-01-09 21:34 ` Bart Van Assche
2024-01-09 12:40 ` [PATCH v1 2/2] ufs: host: mediatek: change default auto suspend timer peter.wang
2024-01-24 2:12 ` [PATCH v1 0/2] scsi: allow host change " Martin K. Petersen
2024-01-30 2:27 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).