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] [day] [month] [year] [list]
Message-ID: <5f3e7d3b-f720-43e3-9c75-7e0f5230be2a@kernel.org>
Date: Tue, 8 Jul 2025 08:07:19 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
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>,
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>
Cc: Sean Wang <sean.wang@...iatek.com>, Jiande Lu <jiande.lu@...iatek.com>,
 Deren Wu <deren.Wu@...iatek.com>, Chris Lu <chris.lu@...iatek.com>,
 Hao Qin <Hao.qin@...iatek.com>, Wallace Yu <Wallace.Yu@...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>,
 devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH v6 1/1] Bluetooth: mediatek: add gpio pin to reset bt

On 08/07/2025 08:01, Zhangchao Zhang wrote:
> Makes the platform Bluetooth to be reset by hardware pin,
> it provides two methods to do it for mediatek controller,
> and it has been tested locally many times and can reset normally.
> 
> When an exception occurs, resetting Bluetooth by hardware pin
> is more stable than resetting Bluetooth by software.
> If the corresponding pin is not found in dts,
> bluetooth can also be reset successfully.
> 
> Co-developed: Hao Qin <hao.qin@...iatek.com>
> Co-developed: Chris Lu <chris.lu@...iatek.com>
> Co-developed: Jiande Lu <jiande.lu@...iatek.com>
> Signed-off-by: Zhangchao Zhang <ot_zhangchao.zhang@...iatek.com>
> ---
>  drivers/bluetooth/btmtk.c | 69 +++++++++++++++++++++++++++++++++++++++
>  drivers/bluetooth/btmtk.h |  5 +++
>  2 files changed, 74 insertions(+)
> 
> diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
> index 4390fd571dbd..cdb90143be61 100644
> --- a/drivers/bluetooth/btmtk.c
> +++ b/drivers/bluetooth/btmtk.c
> @@ -6,6 +6,8 @@
>  #include <linux/firmware.h>
>  #include <linux/usb.h>
>  #include <linux/iopoll.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
>  #include <linux/unaligned.h>
>  
>  #include <net/bluetooth/bluetooth.h>
> @@ -109,6 +111,65 @@ static void btmtk_coredump_notify(struct hci_dev *hdev, int state)
>  	}
>  }
>  
> +static void btmtk_reset_by_gpio_work(struct work_struct *work)
> +{
> +	struct btmtk_reset_gpio *reset_gpio_data =
> +			container_of(work, struct btmtk_reset_gpio, reset_work.work);
> +
> +	gpio_direction_output(reset_gpio_data->gpio_number, 1);
> +	kfree(reset_gpio_data);
> +}
> +
> +static int btmtk_reset_by_gpio(struct hci_dev *hdev)
> +{
> +	struct btmtk_data *data = hci_get_priv(hdev);
> +	struct btmtk_reset_gpio *reset_gpio_data;
> +	struct device_node *node;
> +	int reset_gpio_number;
> +
> +	node = of_find_compatible_node(NULL, NULL, "mediatek,mt7925-bluetooth");

No. You don't take GPIOs from random node. You take them from your
device with proper API, instead of:

> +	if (node) {
> +		reset_gpio_number = of_get_named_gpio(node, "reset-gpios", 0);

legacy OF API. This only points that your driver model is broken or your
hardware description is wrong.


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ