Skip to contentSkip to conversation

mmc: rtsx_pci: add quirk to disable MMC_CAP_AGGRESSIVE_PM for RTS525A

PATCH In review Matthew Schwartz 1 participant 2 messages Jan 3 – Jan 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: rtsx_pci: add quirk to disable MMC_CAP_AGGRESSIVE_PM for RTS525A

Using MMC_CAP_AGGRESSIVE_PM on RTS525A card readers causes game performance issues when the card reader comes back from idle into active use. This can be observed in Hades II when loading new sections of the game or menu after the card reader puts itself into idle, and presents as a 1-2 second hang.

Add EXTRA_CAPS_NO_AGGRESSIVE_PM quirk to allow cardreader drivers to opt-out of aggressive PM, and set it for RTS525A.

---
 drivers/misc/cardreader/rts5249.c | 3 +++
 drivers/mmc/host/rtsx_pci_sdmmc.c | 4 ++--
 include/linux/rtsx_pci.h          | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/misc/cardreader/rts5249.c +3 -0
index 38aefd8db452..87d576a03e68 100644
@@ -78,6 +78,9 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
 	if (CHK_PCI_PID(pcr, PID_524A) || CHK_PCI_PID(pcr, PID_525A))
 		pcr->rtd3_en = rtsx_reg_to_rtd3_uhsii(reg);
 
+	if (CHK_PCI_PID(pcr, PID_525A))
+		pcr->extra_caps |= EXTRA_CAPS_NO_AGGRESSIVE_PM;
+
 	if (rtsx_check_mmc_support(reg))
 		pcr->extra_caps |= EXTRA_CAPS_NO_MMC;
 	pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -2
index dc2587ff8519..5d3599ee06bf 100644
@@ -1456,8 +1456,8 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
 	mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
 		MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
-	if (pcr->rtd3_en)
-		mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
+	if (pcr->rtd3_en && !(pcr->extra_caps & EXTRA_CAPS_NO_AGGRESSIVE_PM))
+		mmc->caps |= MMC_CAP_AGGRESSIVE_PM;
 	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
 		MMC_CAP2_NO_SDIO;
 	mmc->max_current_330 = 400;
include/linux/rtsx_pci.h +1 -0
index 3c5689356004..f6122349c00e 100644
@@ -1230,6 +1230,7 @@ struct rtsx_pcr {
 #define EXTRA_CAPS_MMC_8BIT		(1 << 5)
 #define EXTRA_CAPS_NO_MMC		(1 << 7)
 #define EXTRA_CAPS_SD_EXPRESS		(1 << 8)
+#define EXTRA_CAPS_NO_AGGRESSIVE_PM	(1 << 9)
 	u32				extra_caps;
 
 #define IC_VER_A			0
Signature · 1 line
2.52.0
#1 lore raw
Quoted 8 lines · Matthew Schwartz

Using MMC_CAP_AGGRESSIVE_PM on RTS525A card readers causes game performance issues when the card reader comes back from idle into active use. This can be observed in Hades II when loading new sections of the game or menu after the card reader puts itself into idle, and presents as a 1-2 second hang.

Add EXTRA_CAPS_NO_AGGRESSIVE_PM quirk to allow cardreader drivers to opt-out of aggressive PM, and set it for RTS525A.

Bit of an update: I dug up an old laptop that has a Realtek RTS5261 PCI card reader, and that has the exact same issue under identical circumstances. It might make more sense to skip the quirking and just make no MMC_CAP_AGGRESSIVE_PM the default in rtsx_pci_sdmmc unless another solution can be found.

Matt

Quoted 50 lines
---
 drivers/misc/cardreader/rts5249.c | 3 +++
 drivers/mmc/host/rtsx_pci_sdmmc.c | 4 ++--
 include/linux/rtsx_pci.h          | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/misc/cardreader/rts5249.c +3 -0
index 38aefd8db452..87d576a03e68 100644
@@ -78,6 +78,9 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr)
 	if (CHK_PCI_PID(pcr, PID_524A) || CHK_PCI_PID(pcr, PID_525A))
 		pcr->rtd3_en = rtsx_reg_to_rtd3_uhsii(reg);
 
+	if (CHK_PCI_PID(pcr, PID_525A))
+		pcr->extra_caps |= EXTRA_CAPS_NO_AGGRESSIVE_PM;
+
 	if (rtsx_check_mmc_support(reg))
 		pcr->extra_caps |= EXTRA_CAPS_NO_MMC;
 	pcr->sd30_drive_sel_3v3 = rtsx_reg_to_sd30_drive_sel_3v3(reg);
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -2
index dc2587ff8519..5d3599ee06bf 100644
@@ -1456,8 +1456,8 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
 	mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
 		MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
-	if (pcr->rtd3_en)
-		mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
+	if (pcr->rtd3_en && !(pcr->extra_caps & EXTRA_CAPS_NO_AGGRESSIVE_PM))
+		mmc->caps |= MMC_CAP_AGGRESSIVE_PM;
 	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
 		MMC_CAP2_NO_SDIO;
 	mmc->max_current_330 = 400;
include/linux/rtsx_pci.h +1 -0
index 3c5689356004..f6122349c00e 100644
@@ -1230,6 +1230,7 @@ struct rtsx_pcr {
 #define EXTRA_CAPS_MMC_8BIT		(1 << 5)
 #define EXTRA_CAPS_NO_MMC		(1 << 7)
 #define EXTRA_CAPS_SD_EXPRESS		(1 << 8)
+#define EXTRA_CAPS_NO_AGGRESSIVE_PM	(1 << 9)
 	u32				extra_caps;
 
 #define IC_VER_A			0