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

Bluetooth: mediatek: add gpio pin to reset bt

Support the platform Bluetooth to be reset by hardware pin,
when a Bluetooth exception occurs, attempt to reset the
Bluetooth module using the hardware reset pin, as this
method is generally more stable and reliable than a
software reset. If the hardware reset pin is not specified
in the device tree, fall back to the existing software
reset mechanism to ensure backward compatibility.

Co-developed: Sean Wang <Sean.Wang@mediatek.com>
Co-developed: Hao Qin <hao.qin@mediatek.com>
Co-developed: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Zhangchao Zhang <ot_zhangchao.zhang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Zhangchao Zhang and committed by
Luiz Augusto von Dentz
484f1176 cbca440d

+13
+13
drivers/bluetooth/btusb.c
··· 2808 2808 btusb_stop_traffic(data); 2809 2809 usb_kill_anchored_urbs(&data->tx_anchor); 2810 2810 2811 + /* Toggle the hard reset line. The MediaTek device is going to 2812 + * yank itself off the USB and then replug. The cleanup is handled 2813 + * correctly on the way out (standard USB disconnect), and the new 2814 + * device is detected cleanly and bound to the driver again like 2815 + * it should be. 2816 + */ 2817 + if (data->reset_gpio) { 2818 + gpiod_set_value_cansleep(data->reset_gpio, 1); 2819 + msleep(200); 2820 + gpiod_set_value_cansleep(data->reset_gpio, 0); 2821 + return 0; 2822 + } 2823 + 2811 2824 err = btmtk_usb_subsys_reset(hdev, btmtk_data->dev_id); 2812 2825 2813 2826 usb_queue_reset_device(data->intf);