From: Krzysztof Kozlowski <krzk@kernel.org>
To: Zhangchao Zhang <ot_zhangchao.zhang@mediatek.com>,
Marcel Holtmann <marcel@holtmann.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Luiz Von Dentz <luiz.dentz@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: Sean Wang <sean.wang@mediatek.com>,
Jiande Lu <jiande.lu@mediatek.com>,
Deren Wu <deren.Wu@mediatek.com>,
Chris Lu <chris.lu@mediatek.com>, Hao Qin <Hao.qin@mediatek.com>,
Wallace Yu <Wallace.Yu@mediatek.com>,
linux-bluetooth <linux-bluetooth@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-mediatek <linux-mediatek@lists.infradead.org>,
devicetree <devicetree@vger.kernel.org>
Subject: Re: [PATCH v6 1/1] Bluetooth: mediatek: add gpio pin to reset bt
Date: Tue, 8 Jul 2025 08:07:19 +0200 [thread overview]
Message-ID: <5f3e7d3b-f720-43e3-9c75-7e0f5230be2a@kernel.org> (raw)
In-Reply-To: <20250708060150.27375-2-ot_zhangchao.zhang@mediatek.com>
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@mediatek.com>
> Co-developed: Chris Lu <chris.lu@mediatek.com>
> Co-developed: Jiande Lu <jiande.lu@mediatek.com>
> Signed-off-by: Zhangchao Zhang <ot_zhangchao.zhang@mediatek.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
next prev parent reply other threads:[~2025-07-08 6:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 6:01 [PATCH v6 0/1] " Zhangchao Zhang
2025-07-08 6:01 ` [PATCH v6 1/1] " Zhangchao Zhang
2025-07-08 6:07 ` Krzysztof Kozlowski [this message]
2025-07-08 6:01 ` [PATCH v6] dt-bindings: net: mediatek,mt7925-bluetooth.yaml Zhangchao Zhang
2025-07-08 6:05 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f3e7d3b-f720-43e3-9c75-7e0f5230be2a@kernel.org \
--to=krzk@kernel.org \
--cc=Hao.qin@mediatek.com \
--cc=Wallace.Yu@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chris.lu@mediatek.com \
--cc=conor+dt@kernel.org \
--cc=deren.Wu@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=jiande.lu@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=matthias.bgg@gmail.com \
--cc=ot_zhangchao.zhang@mediatek.com \
--cc=robh@kernel.org \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®