1 From 8b4d7321625cc8403a9ce7f050bd8d1b4ef7446d Mon Sep 17 00:00:00 2001
2 From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
3 Date: Tue, 26 Nov 2019 08:17:32 +0100
4 Subject: [PATCH] Bluetooth: hci_bcm: Support pcm params in dts
6 commit eb762b94111b646b4f116ebfdbfcadbad14e12b3 upstream.
8 BCM chips may require configuration of PCM to operate correctly and
9 there is a vendor specific HCI command to do this. Add support in the
10 hci_bcm driver to parse this from devicetree and configure the chip.
12 Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
13 Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
16 drivers/bluetooth/hci_bcm.c | 19 +++++++++++++++++++
17 1 file changed, 19 insertions(+)
19 --- a/drivers/bluetooth/hci_bcm.c
20 +++ b/drivers/bluetooth/hci_bcm.c
21 @@ -123,6 +123,7 @@ struct bcm_device {
24 bool no_early_set_baudrate;
25 + u8 pcm_int_params[5];
28 /* generic bcm uart resources */
29 @@ -597,6 +598,16 @@ static int bcm_setup(struct hci_uart *hu
30 host_set_baudrate(hu, speed);
33 + /* PCM parameters if provided */
34 + if (bcm->dev && bcm->dev->pcm_int_params[0] != 0xff) {
35 + struct bcm_set_pcm_int_params params;
37 + btbcm_read_pcm_int_params(hu->hdev, ¶ms);
39 + memcpy(¶ms, bcm->dev->pcm_int_params, 5);
40 + btbcm_write_pcm_int_params(hu->hdev, ¶ms);
46 @@ -1134,6 +1145,8 @@ static int bcm_acpi_probe(struct bcm_dev
47 static int bcm_of_probe(struct bcm_device *bdev)
49 device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
50 + device_property_read_u8_array(bdev->dev, "brcm,bt-pcm-int-params",
51 + bdev->pcm_int_params, 5);
55 @@ -1149,6 +1162,9 @@ static int bcm_probe(struct platform_dev
56 dev->dev = &pdev->dev;
57 dev->irq = platform_get_irq(pdev, 0);
59 + /* Initialize routing field to an unused value */
60 + dev->pcm_int_params[0] = 0xff;
62 if (has_acpi_companion(&pdev->dev)) {
63 ret = bcm_acpi_probe(dev);
65 @@ -1409,6 +1425,9 @@ static int bcm_serdev_probe(struct serde
66 bcmdev->serdev_hu.serdev = serdev;
67 serdev_device_set_drvdata(serdev, bcmdev);
69 + /* Initialize routing field to an unused value */
70 + bcmdev->pcm_int_params[0] = 0xff;
72 if (has_acpi_companion(&serdev->dev))
73 err = bcm_acpi_probe(bcmdev);