While adding support for the BCM4354, I discovered a few more things
that weren't working as they should have.
First, we disallow serdev from setting the baudrate on BCM4354. Serdev
sets the oper_speed first before calling hu->setup() in
hci_uart_setup(). On the BCM4354, this results in bcm_setup() failing
when the hci reset times out.
Next, we add support for setting the PCM parameters, which consists of
a pair of vendor specific opcodes to set the pcm parameters. The
documentation for these params are available in the brcm_patchram_plus
package (i.e. https://github.com/balena-os/brcm_patchram_plus). This is
necessary for PCM to work properly.
All changes were tested with rk3288-veyron-minnie.dts.
Abhishek Pandit-Subedi (4):
Bluetooth: hci_bcm: Disallow set_baudrate for BCM4354
Bluetooth: btbcm: Support pcm configuration
Bluetooth: hci_bcm: Support pcm params in dts
dt-bindings: net: bluetooth: update broadcom-bluetooth
.../bindings/net/broadcom-bluetooth.txt | 4 ++
drivers/bluetooth/btbcm.c | 27 ++++++++++
drivers/bluetooth/btbcm.h | 12 +++++
drivers/bluetooth/hci_bcm.c | 52 ++++++++++++++++++-
4 files changed, 94 insertions(+), 1 deletion(-)
--
2.24.0.rc1.363.gb1bccd3e3d-goog
BCM chips may require configuration of PCM to operate correctly and
there is a vendor specific HCI command to do this. Add support in the
hci_bcm driver to parse this from devicetree and configure the chip.
Signed-off-by: Abhishek Pandit-Subedi <[email protected]>
---
drivers/bluetooth/hci_bcm.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 4fe66e52927d..e94908a7e407 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -79,6 +79,7 @@
* @hu: pointer to HCI UART controller struct,
* used to disable flow control during runtime suspend and system sleep
* @is_suspended: whether flow control is currently disabled
+ * @pcm_params: Bytestring of pcm int and format params.
*/
struct bcm_device {
/* Must be the first member, hci_serdev.c expects this. */
@@ -112,6 +113,9 @@ struct bcm_device {
struct hci_uart *hu;
bool is_suspended;
#endif
+
+ bool has_pcm_params;
+ u8 pcm_params[BCM_PCM_PARAMS_COUNT];
};
/* generic bcm uart resources */
@@ -529,6 +533,8 @@ static int bcm_setup(struct hci_uart *hu)
const struct firmware *fw;
unsigned int speed;
int err;
+ struct bcm_set_pcm_int_params int_params;
+ struct bcm_set_pcm_format_params format_params;
bt_dev_dbg(hu->hdev, "hu %p", hu);
@@ -576,6 +582,23 @@ static int bcm_setup(struct hci_uart *hu)
host_set_baudrate(hu, speed);
}
+ /* PCM parameters if any*/
+ if (bcm->dev && bcm->dev->has_pcm_params) {
+ memcpy(&int_params, &(bcm->dev->pcm_params[0]),
+ sizeof(int_params));
+ memcpy(&format_params, &(bcm->dev->pcm_params[5]),
+ sizeof(format_params));
+
+ err = btbcm_set_pcm_params(hu->hdev, &int_params,
+ &format_params);
+
+ if (err) {
+ bt_dev_info(hu->hdev, "BCM: Set pcm params failed (%d)",
+ err);
+ }
+
+ }
+
finalize:
release_firmware(fw);
@@ -1112,7 +1135,15 @@ static int bcm_acpi_probe(struct bcm_device *dev)
static int bcm_of_probe(struct bcm_device *bdev)
{
+ int plen;
+
device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
+ plen = device_property_read_u8_array(bdev->dev, "pcm-parameters",
+ bdev->pcm_params,
+ BCM_PCM_PARAMS_COUNT);
+ if (plen == 0)
+ bdev->has_pcm_params = true;
+
return 0;
}
--
2.24.0.rc1.363.gb1bccd3e3d-goog