linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jeremy Cline <jcline@redhat.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-acpi <linux-acpi@vger.kernel.org>
Subject: RTL8723BS bluetooth almost working with serdev enumeration, need help
Date: Wed, 23 May 2018 23:04:48 +0200	[thread overview]
Message-ID: <208ad44f-ade6-5f27-47f1-7fe012be1bdc@redhat.com> (raw)

Hi All,

The last 2 evenings I've been working on
$subject, based on:

1) The btrtl patches from Martin Blumenstingl; +
2) The bt3wire driver from Marcel Holtmann; +
3) ACPI serdev binding support for the bt3wire driver
    by Jeremy Cline

See: https://github.com/jwrdegoede/linux-sunxi/commits/master
for the code, although there is not much to
see there really.

I have this almost working, the problem I have
is really weird.

If I start up a tablet with a RTL8723BS wifi
chip and then log in using a bluetooth keyboard
everything works.

But if I log in with an USB keyboard, then I get
the following messages, first in journal we see
pulseaudio doing some setup to support bluetooth
audio (it seems to do this as soon as I login):

Bluetoothd[1282]: Endpoint registered: sender=:1.51 path=/MediaEndpoint/A2DPSource
Bluetoothd[1282]: Endpoint registered: sender=:1.51 path=/MediaEndpoint/A2DPSink

And then 2 seconds later I get:

[  191.177256] Bluetooth: hci0: command 0x0c24 tx timeout
[  191.179538] Bluetooth: hci0: Acknowledgement packet
[  193.226082] Bluetooth: hci0: command 0x0c52 tx timeout

And if I press a key on the bluetooth keyboard after this:

[ 1739.156758] Bluetooth: hci0: Acknowledgement packet
[ 1741.182473] Bluetooth: hci0: command 0x0409 tx timeout

Unloading and reloading the bt3wire module fixes this. Note
that the bt controller sends Acknowledgement packets instead
of a regular reply it seems, at least after the initial
timeout.

If I hack the kernel to not do serdev enumeration for the uart
so I get a /dev/ttyS4 and then use:

https://github.com/lwfinger/rtl8723bs_bt

I do not get this problem.

It almost is as if after we've initialized the bt controller
through bt3wire.c it is in a sleep state or something
and the bt keyboard sending data first wakes it up...?

One thing which I found is that the hciattach_rtk.c
userspace code sends an ack to the controller after
it completes uploading the firmware. I tried to
duplicate this like this:

--- a/drivers/bluetooth/bt3wire.c
+++ b/drivers/bluetooth/bt3wire.c

@@ -788,6 +808,9 @@ static int bt3wire_btrtl_setup(struct bt3wire_dev *bdev)

         err = btrtl_download_firmware(bdev->hdev, btrtl_dev);

+       bt3wire_queue_pkt(bdev, PKT_TYPE_ACK, NULL, 0);
+       bt3wire_tx_wakeup(bdev);
+
  out_free:
         btrtl_free(btrtl_dev);


But I believe that is not the right way, I think that instead I should
__hci_cmd_sync() but it is not entirely clear to me what I need to
pass to that function to get the equivalent of bt3wire_queue_pkt(bdev, PKT_TYPE_ACK, NULL, 0);

Regards,

Hans

             reply	other threads:[~2018-05-23 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 21:04 Hans de Goede [this message]
2018-05-24  7:36 ` RTL8723BS bluetooth almost working with serdev enumeration, need help Marcel Holtmann
2018-05-24 20:22   ` Hans de Goede
2018-05-27 18:48 ` Hans de Goede

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=208ad44f-ade6-5f27-47f1-7fe012be1bdc@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=jcline@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=martin.blumenstingl@googlemail.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;
as well as URLs for NNTP newsgroup(s).