Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: btmtk: add MT7902 SDIO support

Add MT7902 Bluetooth SDIO support by introducing chip data and
registering the device ID.

Runtime PM is not yet supported by the driver, but normal operation
is unaffected.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Sean Wang and committed by
Luiz Augusto von Dentz
7f2c3c49 22fd19bf

+29 -13
+29 -13
drivers/bluetooth/btmtksdio.c
··· 42 42 const char *fwname; 43 43 u16 chipid; 44 44 bool lp_mbox_supported; 45 + bool pm_runtime_supported; 45 46 }; 46 47 47 48 static const struct btmtksdio_data mt7663_data = { 48 49 .fwname = FIRMWARE_MT7663, 49 50 .chipid = 0x7663, 50 51 .lp_mbox_supported = false, 52 + .pm_runtime_supported = true, 51 53 }; 52 54 53 55 static const struct btmtksdio_data mt7668_data = { 54 56 .fwname = FIRMWARE_MT7668, 55 57 .chipid = 0x7668, 56 58 .lp_mbox_supported = false, 59 + .pm_runtime_supported = true, 57 60 }; 58 61 59 62 static const struct btmtksdio_data mt7921_data = { 60 63 .fwname = FIRMWARE_MT7961, 61 64 .chipid = 0x7921, 62 65 .lp_mbox_supported = true, 66 + .pm_runtime_supported = true, 67 + }; 68 + 69 + static const struct btmtksdio_data mt7902_data = { 70 + .fwname = FIRMWARE_MT7902, 71 + .chipid = 0x7902, 72 + .lp_mbox_supported = false, 73 + .pm_runtime_supported = false, 63 74 }; 64 75 65 76 static const struct sdio_device_id btmtksdio_table[] = { ··· 80 69 .driver_data = (kernel_ulong_t)&mt7668_data }, 81 70 {SDIO_DEVICE(SDIO_VENDOR_ID_MEDIATEK, SDIO_DEVICE_ID_MEDIATEK_MT7961), 82 71 .driver_data = (kernel_ulong_t)&mt7921_data }, 72 + {SDIO_DEVICE(SDIO_VENDOR_ID_MEDIATEK, SDIO_DEVICE_ID_MEDIATEK_MT7902), 73 + .driver_data = (kernel_ulong_t)&mt7902_data }, 83 74 { } /* Terminating entry */ 84 75 }; 85 76 MODULE_DEVICE_TABLE(sdio, btmtksdio_table); ··· 1103 1090 set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state); 1104 1091 1105 1092 switch (bdev->data->chipid) { 1093 + case 0x7902: 1106 1094 case 0x7921: 1107 1095 if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state)) { 1108 1096 err = btmtksdio_mtk_reg_read(hdev, MT7921_DLSTATUS, ··· 1181 1167 delta = ktime_sub(rettime, calltime); 1182 1168 duration = (unsigned long long)ktime_to_ns(delta) >> 10; 1183 1169 1184 - pm_runtime_set_autosuspend_delay(bdev->dev, 1185 - MTKBTSDIO_AUTOSUSPEND_DELAY); 1186 - pm_runtime_use_autosuspend(bdev->dev); 1170 + if (bdev->data->pm_runtime_supported) { 1171 + pm_runtime_set_autosuspend_delay(bdev->dev, 1172 + MTKBTSDIO_AUTOSUSPEND_DELAY); 1173 + pm_runtime_use_autosuspend(bdev->dev); 1187 1174 1188 - err = pm_runtime_set_active(bdev->dev); 1189 - if (err < 0) 1190 - return err; 1175 + err = pm_runtime_set_active(bdev->dev); 1176 + if (err < 0) 1177 + return err; 1191 1178 1192 - /* Default forbid runtime auto suspend, that can be allowed by 1193 - * enable_autosuspend flag or the PM runtime entry under sysfs. 1194 - */ 1195 - pm_runtime_forbid(bdev->dev); 1196 - pm_runtime_enable(bdev->dev); 1179 + /* Default forbid runtime auto suspend, that can be allowed by 1180 + * enable_autosuspend flag or the PM runtime entry under sysfs. 1181 + */ 1182 + pm_runtime_forbid(bdev->dev); 1183 + pm_runtime_enable(bdev->dev); 1197 1184 1198 - if (enable_autosuspend) 1199 - pm_runtime_allow(bdev->dev); 1185 + if (enable_autosuspend) 1186 + pm_runtime_allow(bdev->dev); 1187 + } 1200 1188 1201 1189 bt_dev_info(hdev, "Device setup in %llu usecs", duration); 1202 1190