* [PATCH] drivers/card_reader/rtsx_usb: Restore interrupt based detection
@ 2024-11-18 19:52 Sean Rhodes
2024-11-19 1:24 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Sean Rhodes @ 2024-11-18 19:52 UTC (permalink / raw)
To: linux-kernel; +Cc: Sean Rhodes, Arnd Bergmann, Greg Kroah-Hartman
This commit reintroduces interrupt-based card detection previously
used in the rts5139 driver. This functionality was removed in commit
00d8521dcd23 ("staging: remove rts5139 driver code").
Reintroducing this mechanism fixes presence detection for certain card
readers, which with the current driver, will taken approximately 20
seconds to enter S3 as `mmc_rescan` has to be frozen.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index f150d8769f19..285a748748d7 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -286,6 +286,7 @@ static int rtsx_usb_get_status_with_bulk(struct rtsx_ucr *ucr, u16 *status)
int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status)
{
int ret;
+ u8 interrupt_val = 0;
u16 *buf;
if (!status)
@@ -308,6 +309,20 @@ int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status)
ret = rtsx_usb_get_status_with_bulk(ucr, status);
}
+ rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val);
+ /* Cross check presence with interrupts */
+ if (*status & XD_CD)
+ if (!(interrupt_val & XD_INT))
+ *status &= ~XD_CD;
+
+ if (*status & SD_CD)
+ if (!(interrupt_val & SD_INT))
+ *status &= ~SD_CD;
+
+ if (*status & MS_CD)
+ if (!(interrupt_val & MS_INT))
+ *status &= ~MS_CD;
+
/* usb_control_msg may return positive when success */
if (ret < 0)
return ret;
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/card_reader/rtsx_usb: Restore interrupt based detection
2024-11-18 19:52 [PATCH] drivers/card_reader/rtsx_usb: Restore interrupt based detection Sean Rhodes
@ 2024-11-19 1:24 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2024-11-19 1:24 UTC (permalink / raw)
To: Sean Rhodes; +Cc: linux-kernel, Arnd Bergmann
On Mon, Nov 18, 2024 at 07:52:01PM +0000, Sean Rhodes wrote:
> This commit reintroduces interrupt-based card detection previously
> used in the rts5139 driver. This functionality was removed in commit
> 00d8521dcd23 ("staging: remove rts5139 driver code").
>
> Reintroducing this mechanism fixes presence detection for certain card
> readers, which with the current driver, will taken approximately 20
> seconds to enter S3 as `mmc_rescan` has to be frozen.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
> drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
So this fixes the referenced commit? If so, shouldn't that get a Fixes:
tag and cc: stable if needed?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-19 1:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 19:52 [PATCH] drivers/card_reader/rtsx_usb: Restore interrupt based detection Sean Rhodes
2024-11-19 1:24 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox