drivers/card_reader/rtsx_usb: Restore interrupt based detection
PATCH 1/1 drivers/card_reader/rtsx_usb: Restore interrupt based detection
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.
--- drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/misc/cardreader/rtsx_usb.c +15 -0
@@ -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;
Signature · 1 line
2.45.2
Greg Kroah-Hartman
maintainerQuoted 8 lines · Sean Rhodes
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_rescanhas to be frozen.
Quoted 6 lines
Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Sean Rhodes <[email protected]>--- 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