diff mbox series

Bluetooth: btusb: mediatek: Support auto revert for MT7922

Message ID 20240412095713.25641-1-hao.qin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: btusb: mediatek: Support auto revert for MT7922 | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch fail CheckSparse: FAIL: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester fail TestRunner_mgmt-tester: Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Hao Qin April 12, 2024, 9:57 a.m. UTC
Add support for auto reverting MT7922 during reset process.

Signed-off-by: Hao Qin <hao.qin@mediatek.com>
---
 drivers/bluetooth/btusb.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com April 12, 2024, 10:32 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=843968

---Test result---

Test Summary:
CheckPatch                    PASS      0.65 seconds
GitLint                       PASS      0.30 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      30.20 seconds
CheckAllWarning               PASS      32.67 seconds
CheckSparse                   PASS      37.98 seconds
CheckSmatch                   FAIL      34.57 seconds
BuildKernel32                 PASS      28.89 seconds
TestRunnerSetup               PASS      520.17 seconds
TestRunner_l2cap-tester       PASS      18.41 seconds
TestRunner_iso-tester         PASS      31.10 seconds
TestRunner_bnep-tester        PASS      4.85 seconds
TestRunner_mgmt-tester        FAIL      111.40 seconds
TestRunner_rfcomm-tester      PASS      7.44 seconds
TestRunner_sco-tester         PASS      15.13 seconds
TestRunner_ioctl-tester       PASS      7.83 seconds
TestRunner_mesh-tester        PASS      6.05 seconds
TestRunner_smp-tester         PASS      6.88 seconds
TestRunner_userchan-tester    PASS      6.20 seconds
IncrementalBuild              PASS      28.97 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
LL Privacy - Remove Device 4 (Disable Adv)           Timed out    1.886 seconds


---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz April 17, 2024, 9:17 p.m. UTC | #2
Hi,

On Fri, Apr 12, 2024 at 5:57 AM Hao Qin <hao.qin@mediatek.com> wrote:
>
> Add support for auto reverting MT7922 during reset process.

Need some more information of what auto reverting means in this
context and what problem does it solves?

>
> Signed-off-by: Hao Qin <hao.qin@mediatek.com>
> ---
>  drivers/bluetooth/btusb.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 4c0cc13adb47..0ad96ec8d31d 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3032,7 +3032,16 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
>         usb_kill_anchored_urbs(&data->tx_anchor);
>         mediatek = hci_get_priv(hdev);
>
> -       if (mediatek->dev_id == 0x7925) {
> +       if (mediatek->dev_id == 0x7922) {
> +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> +               val |= 0x00002020;
> +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> +               btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
> +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> +               val |= BIT(0);
> +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> +               msleep(100);
> +       } else if (mediatek->dev_id == 0x7925) {
>                 btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
>                 val |= (1 << 5);
>                 btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
> @@ -3072,6 +3081,9 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
>         if (err < 0)
>                 bt_dev_err(hdev, "Reset timeout");
>
> +       if (mediatek->dev_id == 0x7922)
> +               btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
> +
>         btusb_mtk_id_get(data, 0x70010200, &val);
>         if (!val)
>                 bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
> --
> 2.18.0
>
Sean Wang May 7, 2024, 7:29 p.m. UTC | #3
Hi Luiz,

Please disregard the patch. We will proceed with the journey using the
latest patchset I provided in the following link
https://lists.infradead.org/pipermail/linux-mediatek/2024-May/079017.html

                 Sean

On Wed, Apr 17, 2024 at 2:18 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi,
>
> On Fri, Apr 12, 2024 at 5:57 AM Hao Qin <hao.qin@mediatek.com> wrote:
> >
> > Add support for auto reverting MT7922 during reset process.
>
> Need some more information of what auto reverting means in this
> context and what problem does it solves?
>
> >
> > Signed-off-by: Hao Qin <hao.qin@mediatek.com>
> > ---
> >  drivers/bluetooth/btusb.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> > index 4c0cc13adb47..0ad96ec8d31d 100644
> > --- a/drivers/bluetooth/btusb.c
> > +++ b/drivers/bluetooth/btusb.c
> > @@ -3032,7 +3032,16 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
> >         usb_kill_anchored_urbs(&data->tx_anchor);
> >         mediatek = hci_get_priv(hdev);
> >
> > -       if (mediatek->dev_id == 0x7925) {
> > +       if (mediatek->dev_id == 0x7922) {
> > +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> > +               val |= 0x00002020;
> > +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> > +               btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
> > +               btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
> > +               val |= BIT(0);
> > +               btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
> > +               msleep(100);
> > +       } else if (mediatek->dev_id == 0x7925) {
> >                 btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
> >                 val |= (1 << 5);
> >                 btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
> > @@ -3072,6 +3081,9 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
> >         if (err < 0)
> >                 bt_dev_err(hdev, "Reset timeout");
> >
> > +       if (mediatek->dev_id == 0x7922)
> > +               btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
> > +
> >         btusb_mtk_id_get(data, 0x70010200, &val);
> >         if (!val)
> >                 bt_dev_err(hdev, "Can't get device id, subsys reset fail.");
> > --
> > 2.18.0
> >
>
>
> --
> Luiz Augusto von Dentz
>
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4c0cc13adb47..0ad96ec8d31d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3032,7 +3032,16 @@  static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 	usb_kill_anchored_urbs(&data->tx_anchor);
 	mediatek = hci_get_priv(hdev);
 
-	if (mediatek->dev_id == 0x7925) {
+	if (mediatek->dev_id == 0x7922) {
+		btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
+		val |= 0x00002020;
+		btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
+		btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT, 0x00010001);
+		btusb_mtk_uhw_reg_read(data, MTK_BT_SUBSYS_RST, &val);
+		val |= BIT(0);
+		btusb_mtk_uhw_reg_write(data, MTK_BT_SUBSYS_RST, val);
+		msleep(100);
+	} else if (mediatek->dev_id == 0x7925) {
 		btusb_mtk_uhw_reg_read(data, MTK_BT_RESET_REG_CONNV3, &val);
 		val |= (1 << 5);
 		btusb_mtk_uhw_reg_write(data, MTK_BT_RESET_REG_CONNV3, val);
@@ -3072,6 +3081,9 @@  static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 	if (err < 0)
 		bt_dev_err(hdev, "Reset timeout");
 
+	if (mediatek->dev_id == 0x7922)
+		btusb_mtk_uhw_reg_write(data, MTK_UDMA_INT_STA_BT, 0x000000FF);
+
 	btusb_mtk_id_get(data, 0x70010200, &val);
 	if (!val)
 		bt_dev_err(hdev, "Can't get device id, subsys reset fail.");