lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46d6132c-c4e8-40e3-9ee0-cee7436797ee@collabora.com>
Date: Mon, 29 Sep 2025 12:40:13 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Zhangchao Zhang <ot_zhangchao.zhang@...iatek.com>,
 Marcel Holtmann <marcel@...tmann.org>,
 Matthias Brugger <matthias.bgg@...il.com>,
 Luiz Von Dentz <luiz.dentz@...il.com>
Cc: Krzysztof Kozlowski <krzk@...nel.org>, Sean Wang
 <sean.wang@...iatek.com>, Deren Wu <deren.Wu@...iatek.com>,
 Chris Lu <chris.lu@...iatek.com>, Hao Qin <Hao.qin@...iatek.com>,
 linux-bluetooth <linux-bluetooth@...r.kernel.org>,
 linux-kernel <linux-kernel@...r.kernel.org>,
 linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
 linux-mediatek <linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v9] Bluetooth: mediatek: add gpio pin to reset bt

Il 26/09/25 12:10, Zhangchao Zhang ha scritto:
> 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@...iatek.com>
> Co-developed: Hao Qin <hao.qin@...iatek.com>
> Co-developed: Chris Lu <chris.lu@...iatek.com>
> Signed-off-by: Zhangchao Zhang <ot_zhangchao.zhang@...iatek.com>
> 

The changelog should come after the "---" otherwise this will get included
into the commit message.

My only complaint is about the changelog, really, so after moving it, you
can add my

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>

> V8-->V9 modifications:
> -Corrected the if judgment in the patch from data->rest_gpio
>     to data->reset_gpio.
> 
> V7-->V8 modifications:
> -Currently, the universal reset GPIO can be found by configuring DTS.
>     USB bus can get the device node and reset GPIO in the probe phase.
>     It is fully compatible with other vendors' methods of getting reset
>     GPIO. Therefore, the previous complex methods of adding the compatible
>     string in btmtk.c to get GPIO is discarded. Abi files and yaml files
>     are no longer needed. When a Bluetooth exception occurs, the existence
>     of GPIO will be determined first. This change improves the robustness
>     of Bluetooth recovery on platforms that support hardware reset, while
>     maintaining support for platforms that do not.
> 
> V6-->V7 modifications:
> -Change the gpio_direction_output interface to the gpiod_set_value_cansleep
>     and gpiod_put interface.
> -Remove the schedule_delayed_work asynchronous operation.
> -Delete the #gpio-cell attribute in the yaml file, remove the #gpio-cell
>     in the required field, and simplify the contents of the descriptions.
> 
> V5-->V6 modifications:
> -Add specific revisions in the changes from v4 to v5.
> -Add hardware pin title and descriptions to dt-binding submission
>     information.
> -Modify the title descriptions in the dt-binding file.
> -Add 7925 what is it.
> -Wrap the descriptions of MT7925 chip uses the USB bus appropriately.
> -Change the compatible string to mediatek,mt7925-bluetooth in
>     the dt-binding file and driver code.
> -Drop gpio-controlelr properties in the dt-binding file.
> -Modify the descriptions of the reset-gpios
>     properties in the dt-binding file.
> -Change the node information of reset-gpios in bluetooth
>     from high level valid to low level valid.
> 
> V4-->V5 modifications:
> -Correct the spelling error of word provides mentioned in V1.
> -Drop the xhci0 node and status property in the dt-binding file.
> -Modify the bt_reset tag node to bluetooth in the dt-binding file.
> -Add #gpio-cell descriptions to properties, nodes and requests.
> -Make a separate patch for the changes to dt-binding.
> 
> V3-->V4 modifications:
> -Modify submission information why use hardware pin to reset Bluetooth.
> -Write historical commit information into the cover letter.
> -Modify dt binding format information and
>     the explanation text in the dt-binding file.
> 
> V2-->V3 modifications:
> -Changed the capitalization of co-developer names,
>     using the correct capitalization of abbreviations and full
>     name, and corrected obvious spelling errors.
> -Add a revision history.
> -Remove the "BT Driver" in the prefix.
> -Add the bt-binding document, include inforamtion related to reset
>     pin and compatibility matching.
> -Add a comment before the schedule_delayed_work function call,
>     although schedule_delayed_work is asynchronous, there is no risk.
>     Even if it is not completed within 200ms, it will only postpone
>     the subsequent probe and will not have any impact.
> -Add a comment before the btmtk_reset_by_gpio function call,
>     if the compatibility filed or pin cannot be found in the dts
>     files, it can still reset bluetooth using software reset.
> 
> V2 modifications:
> -Modify gpio to GPIO, SW to software,
>     and fix other obvious spelling errors.
> ---

(changelog goes here)

Regards,
Angelo

>   drivers/bluetooth/btusb.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index ef44817cad34..f972332840f5 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2745,6 +2745,19 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
>   	btusb_stop_traffic(data);
>   	usb_kill_anchored_urbs(&data->tx_anchor);
>   
> +	/* Toggle the hard reset line. The MediaTek device is going to
> +	 * yank itself off the USB and then replug. The cleanup is handled
> +	 * correctly on the way out (standard USB disconnect), and the new
> +	 * device is detected cleanly and bound to the driver again like
> +	 * it should be.
> +	 */
> +	if (data->reset_gpio) {
> +		gpiod_set_value_cansleep(data->reset_gpio, 1);
> +		msleep(200);
> +		gpiod_set_value_cansleep(data->reset_gpio, 0);
> +		return 0;
> +	}
> +
>   	err = btmtk_usb_subsys_reset(hdev, btmtk_data->dev_id);
>   
>   	usb_queue_reset_device(data->intf);



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ