From: Hans de Goede <hdegoede@redhat.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Rob Herring <robh@kernel.org>, Jeremy Cline <jeremy@jcline.org>,
linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org,
linux-acpi@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 01/13] dt-bindings: net: bluetooth: add support for Realtek Bluetooth chips
Date: Wed, 30 May 2018 10:04:37 +0200 [thread overview]
Message-ID: <16b7e10b-6816-f441-00e5-9e86d1df33a7@redhat.com> (raw)
In-Reply-To: <7A22F14E-9F45-4779-B7E5-CEB330A5601E@holtmann.org>
Hi,
On 30-05-18 08:42, Marcel Holtmann wrote:
> Hi Hans,
>
>> This adds the documentation for Bluetooth functionality of the Realtek
>> RTL8723BS and RTL8723DS.
>> Both are SDIO wifi chips with an additional Bluetooth module which is
>> connected via UART to the host.
>>
>> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>> Signed-off-by: Jeremy Cline <jeremy@jcline.org>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> .../bindings/net/realtek-bluetooth.txt | 41 +++++++++++++++++++
>> 1 file changed, 41 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/net/realtek-bluetooth.txt
>>
>> diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.txt b/Documentation/devicetree/bindings/net/realtek-bluetooth.txt
>> new file mode 100644
>> index 000000000000..1491329c4cd1
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.txt
>> @@ -0,0 +1,41 @@
>> +Realtek Bluetooth Chips
>> +-----------------------
>> +
>> +This documents the binding structure and common properties for serial
>> +attached Realtek devices.
>> +
>> +Serial attached Realtek devices shall be a child node of the host UART
>> +device the slave device is attached to. See ../serial/slave-device.txt
>> +for more information
>> +
>> +Required properties:
>> +- compatible: should contain one of the following:
>> + * "realtek,rtl8723bs-bluetooth"
>> + * "realtek,rtl8723ds-bluetooth"
>> +
>> +Optional properties:
>> +- realtek,config-data: Bluetooth chipset configuration data which is
>> + needed for communication (it typically contains
>> + board specific settings like the baudrate and
>> + whether flow-control is used).
>> + This is an array of u8 values.
>> +- enable-gpios: GPIO specifier, used to enable/disable the BT module
>> +- reset-gpios: GPIO specifier, used to reset the BT module
>> +
>> +
>> +Example:
>> +
>> +&uart {
>> + ...
>> +
>> + bluetooth {
>> + compatible = "realtek,rtl8723bs-bluetooth";
>> + enable-gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
>> + reset-gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
>> + realtek,config-data = /bits/ 8 <
>> + 0x55 0xab 0x23 0x87 0x29 0x00 0xf4 0x00 0x01 0x01 0xf6 0x00
>> + 0x02 0x81 0x00 0xfa 0x00 0x02 0x12 0x80 0x0c 0x00 0x10 0x02
>> + 0x80 0x92 0x04 0x50 0xc5 0xea 0x19 0xe1 0x1b 0xfd 0xaf 0x5f
>> + 0x01 0xa4 0x0b 0xd9 0x00 0x01 0x0f 0xe4 0x00 0x01 0x08>;
>> + };
>> +};
>
> we actually need to agree on this config-data. As I wrote in an earlier email some time ago, the actual config-data files are just memory portions that will overload the default config area. I wrote tools/rtlfw.c to parse these.
>
> So now I wonder if we can just read the current configuration and run with that when no extra blob is provided. That way it would always work and we might just give the config-data filename here. Mostly this is the for PCM and UART settings anyway.
I've been thinking about this too and 2 different solutions come to mind.
Note this is all x86 specific, I think it best to solve this for x86 first
and then we can apply the lessons learned there to ARM/devicetree when
someone comes along who wants to hook-up things on ARM.
My first idea was to stick with a config blob using the firmware_load
mechanism, but to add a postfix to the filename based on the ACPI
HID (hardware-id) of the serdev device, so in practice this means
we would try to load:
/lib/firmware/rtl_bt/rtl8723bs_config-OBDA8723.bin
On most x86 devices, so far all my testing on a bunch of different
devices has shown that the same config works for all x86 devices
(I took the config from a Chuwi Vi8 tablet which uses 3000000bps
+ hardware flowcontrol).
This way we can put the config in linux-firmware, without it
getting loaded on ARM boards where it might very well be wrong.
My second idea is to include a default config inside the driver,
which can be optionally overridden by a file in
/lib/firmware/rtl_bt and/or dt. Combined with module-options to
override the baudrate and flowcontrol setting (and patch the
builtin config accordingly).
Your idea to read back the config from the device is also
interesting, but I don't think that will gain us anything because
AFAIK the whole purpose of the board specific config file
bits is that the chip lack eeprom space to store this info,
so we will just always get some generic defaults.
I've run your rtlfw tool on a bunch of different config files and
there are a lot of unknown fields, and even of the known fields
I don't think we understand all the bits. So all in all the
config file is a bit of a black box and as such I believe it
would be best to just treat it as such and I personally
prefer my first idea, which is to add a postfix to the
firmware filename request, so on x86 load:
/lib/firmware/rtl_bt/rtl8723bs_config-OBDA8723.bin
And on devicetree we could postfix things with the machine
model string (as returned by of_flat_dt_get_machine_name())
So Marcel, which direction do you think we should go?
Regards,
Hans
next prev parent reply other threads:[~2018-05-30 8:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-27 19:04 [PATCH 00/13] Bluetooth: Add RTL8723BS support Hans de Goede
2018-05-27 19:04 ` [PATCH 01/13] dt-bindings: net: bluetooth: add support for Realtek Bluetooth chips Hans de Goede
2018-05-30 6:42 ` Marcel Holtmann
2018-05-30 8:04 ` Hans de Goede [this message]
2018-05-31 16:42 ` Rob Herring
2018-05-31 20:50 ` Hans de Goede
2018-06-04 10:17 ` Marcel Holtmann
2018-06-04 13:58 ` Hans de Goede
2018-06-04 19:11 ` Marcel Holtmann
2018-06-09 11:29 ` Hans de Goede
2018-06-11 13:32 ` Marcel Holtmann
2018-05-27 19:04 ` [PATCH 02/13] Bluetooth: btrtl: add MODULE_FIRMWARE declarations Hans de Goede
2018-05-27 19:04 ` [PATCH 03/13] Bluetooth: btrtl: split the device initialization into smaller parts Hans de Goede
2018-05-27 19:04 ` [PATCH 04/13] Bluetooth: btrtl: add support for retrieving the UART settings Hans de Goede
2018-05-30 12:14 ` kbuild test robot
2018-05-30 12:14 ` [RFC PATCH] Bluetooth: btrtl: btrtl_convert_baudrate() can be static kbuild test robot
2018-05-27 19:04 ` [PATCH 05/13] Bluetooth: btrtl: add support for the RTL8723BS and RTL8723DS chips Hans de Goede
2018-05-27 19:04 ` [PATCH 06/13] Bluetooth: btrtl: load the config blob from devicetree when available Hans de Goede
2018-05-27 19:04 ` [PATCH 07/13] Bluetooth: hci_uart: Restore hci_dev->flush callback on open() Hans de Goede
2018-05-30 6:47 ` Marcel Holtmann
2018-05-27 19:04 ` [PATCH 08/13] Bluetooth: hci_serdev: Move serdev_device_close/open into common hci_serdev code Hans de Goede
2018-05-30 6:48 ` Marcel Holtmann
2018-05-27 19:04 ` [PATCH 09/13] Bluetooth: hci_serdev: Fix HCI_UART_INIT_PENDING not working Hans de Goede
2018-05-30 6:49 ` Marcel Holtmann
2018-05-30 13:25 ` Rob Herring
2018-05-30 17:31 ` Hans de Goede
2018-05-27 19:04 ` [PATCH 10/13] Bluetooth: hci_h5: Add support for serdev enumerated devices Hans de Goede
2018-05-27 19:04 ` [PATCH 11/13] Bluetooth: hci_h5: Add vendor setup, open, and close callbacks Hans de Goede
2018-05-27 19:04 ` [PATCH 12/13] Bluetooth: hci_h5: Add support for the RTL8723BS Hans de Goede
2018-05-30 7:40 ` kbuild test robot
2018-05-27 19:04 ` [PATCH 13/13] Bluetooth: hci_h5: Add support for enable and device-wake GPIOs Hans de Goede
2018-05-29 12:34 ` [PATCH 00/13] Bluetooth: Add RTL8723BS support Ian W MORRISON
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=16b7e10b-6816-f441-00e5-9e86d1df33a7@redhat.com \
--to=hdegoede@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=jeremy@jcline.org \
--cc=johan.hedberg@gmail.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 \
--cc=robh@kernel.org \
/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).