Skip to contentSkip to conversation

mt76: sdio: lock sdio when it is needed

PATCH [email protected] 1 participant 1 message Dec 22, 2021 1 message not in the archive Arm MediaTek

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): YcMJDdDrDVIT0Y55@lore-desk--annotate

#1 lore raw

From: Sean Wang <[email protected]>

Quoted 24 lines
Quoted 24 lines

From: Sean Wang <[email protected]>

Acquire the SDIO as needed as possible because either MT7663S or MT7921S is a multiple-function device that always includes Bluetooth that would share with the same SDIO bus. So not to avoid breaking Bluetooth pairing, audio, and HID such kind of time critical application on that, we only lock sdio bus when it is necessary in WiFi driver.

---
 drivers/net/wireless/mediatek/mt76/mt7615/sdio.c | 3 +++
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 3 +++
 drivers/net/wireless/mediatek/mt76/sdio_txrx.c   | 8 ++++++++
 3 files changed, 14 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +0 -0
index 31c4a76b7f91..71162befdae8 100644
@@ -56,7 +56,10 @@ static int mt7663s_parse_intr(struct mt76_dev *dev, struct mt76s_intr *intr)
 	struct mt7663s_intr *irq_data = sdio->intr_data;
 	int i, err;
 
Quoted 7 lines

drivers/net/wireless/mediatek/mt76/mt7615/sdio.c static int mt7663s_parse_intr(struct mt76_dev *dev, struct mt76s_intr *intr) · line 62

Quoted 4 lines
drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +2 -0
+	sdio_claim_host(sdio->func);
 	err = sdio_readsb(sdio->func, irq_data, MCR_WHISR,
 sizeof(*irq_data));
+	sdio_release_host(sdio->func);

I guess you can move this in mt76s_rx_handler() and remove the duplicated code in mt7921_sdio.c

I got your point, but I still prefer we can release sdio lock as early as possible when WiFi driver doesn't need it to allow BT driver has the chance to get the lock quickly.

Quoted 6 lines

Regards,
Lorenzo

Quoted 3 lines
drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +1 -0
+
 	if (err)
 		return err;

<snip>