netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
@ 2019-11-18 19:21 Abhishek Pandit-Subedi
  2019-11-18 19:21 ` [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
  2019-11-23 10:04 ` [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Marcel Holtmann
  0 siblings, 2 replies; 15+ messages in thread
From: Abhishek Pandit-Subedi @ 2019-11-18 19:21 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Rob Herring
  Cc: linux-bluetooth, dianders, Abhishek Pandit-Subedi, devicetree,
	David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai


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.


Changes in v6:
- Added btbcm_read_pcm_int_params and change pcm params to first read
  the pcm params before setting it

Changes in v5:
- Rename parameters to bt-* and read as integer instead of bytestring
- Update documentation with defaults and put values in header
- Changed patch order

Changes in v4:
- Fix incorrect function name in hci_bcm

Changes in v3:
- Change disallow baudrate setting to return -EBUSY if called before
  ready. bcm_proto is no longer modified and is back to being const.
- Changed btbcm_set_pcm_params to btbcm_set_pcm_int_params
- Changed brcm,sco-routing to brcm,bt-sco-routing

Changes in v2:
- Use match data to disallow baudrate setting
- Parse pcm parameters by name instead of as a byte string
- Fix prefix for dt-bindings commit

Abhishek Pandit-Subedi (4):
  Bluetooth: hci_bcm: Disallow set_baudrate for BCM4354
  Bluetooth: btbcm: Support pcm configuration
  dt-bindings: net: broadcom-bluetooth: Add pcm config
  Bluetooth: hci_bcm: Support pcm params in dts

 .../bindings/net/broadcom-bluetooth.txt       | 16 ++++
 drivers/bluetooth/btbcm.c                     | 47 ++++++++++
 drivers/bluetooth/btbcm.h                     | 16 ++++
 drivers/bluetooth/hci_bcm.c                   | 88 ++++++++++++++++++-
 include/dt-bindings/bluetooth/brcm.h          | 32 +++++++
 5 files changed, 197 insertions(+), 2 deletions(-)
 create mode 100644 include/dt-bindings/bluetooth/brcm.h

-- 
2.24.0.432.g9d3f5f5b63-goog


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-18 19:21 [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Abhishek Pandit-Subedi
@ 2019-11-18 19:21 ` Abhishek Pandit-Subedi
  2019-11-19  5:39   ` Marcel Holtmann
  2019-11-21 21:29   ` Rob Herring
  2019-11-23 10:04 ` [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Marcel Holtmann
  1 sibling, 2 replies; 15+ messages in thread
From: Abhishek Pandit-Subedi @ 2019-11-18 19:21 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Rob Herring
  Cc: linux-bluetooth, dianders, Abhishek Pandit-Subedi, devicetree,
	David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai

Add documentation for pcm parameters.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
 include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 include/dt-bindings/bluetooth/brcm.h

diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
index c749dc297624..8561e4684378 100644
--- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
@@ -29,10 +29,20 @@ Optional properties:
    - "lpo": external low power 32.768 kHz clock
  - vbat-supply: phandle to regulator supply for VBAT
  - vddio-supply: phandle to regulator supply for VDDIO
+ - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
+ - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
+ - brcm,bt-pcm-frame-type: short, long
+ - brcm,bt-pcm-sync-mode: slave, master
+ - brcm,bt-pcm-clock-mode: slave, master
 
+See include/dt-bindings/bluetooth/brcm.h for SCO/PCM parameters. The default
+value for all these values are 0 (except for brcm,bt-sco-routing which requires
+a value) if you choose to leave it out.
 
 Example:
 
+#include <dt-bindings/bluetooth/brcm.h>
+
 &uart2 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart2_pins>;
@@ -40,5 +50,11 @@ Example:
        bluetooth {
                compatible = "brcm,bcm43438-bt";
                max-speed = <921600>;
+
+               brcm,bt-sco-routing        = <BRCM_SCO_ROUTING_TRANSPORT>;
+               brcm,bt-pcm-interface-rate = <BRCM_PCM_IF_RATE_512KBPS>;
+               brcm,bt-pcm-frame-type     = <BRCM_PCM_FRAME_TYPE_SHORT>;
+               brcm,bt-pcm-sync-mode      = <BRCM_PCM_SYNC_MODE_MASTER>;
+               brcm,bt-pcm-clock-mode     = <BRCM_PCM_CLOCK_MODE_MASTER>;
        };
 };
diff --git a/include/dt-bindings/bluetooth/brcm.h b/include/dt-bindings/bluetooth/brcm.h
new file mode 100644
index 000000000000..8b86f90d7dd2
--- /dev/null
+++ b/include/dt-bindings/bluetooth/brcm.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+/*
+ * This header provides constants for Broadcom bluetooth dt-bindings.
+ */
+#ifndef _DT_BINDINGS_BLUETOOTH_BRCM_H
+#define _DT_BINDINGS_BLUETOOTH_BRCM_H
+
+#define BRCM_BT_SCO_ROUTING_PCM			0
+#define BRCM_BT_SCO_ROUTING_TRANSPORT		1
+#define BRCM_BT_SCO_ROUTING_CODEC		2
+#define BRCM_BT_SCO_ROUTING_I2S			3
+
+/* Default is 128KBPs */
+#define BRCM_BT_PCM_INTERFACE_RATE_128KBPS	0
+#define BRCM_BT_PCM_INTERFACE_RATE_256KBPS	1
+#define BRCM_BT_PCM_INTERFACE_RATE_512KBPS	2
+#define BRCM_BT_PCM_INTERFACE_RATE_1024KBPS	3
+#define BRCM_BT_PCM_INTERFACE_RATE_2048KBPS	4
+
+/* Default should be short */
+#define BRCM_BT_PCM_FRAME_TYPE_SHORT		0
+#define BRCM_BT_PCM_FRAME_TYPE_LONG		1
+
+/* Default should be master */
+#define BRCM_BT_PCM_SYNC_MODE_SLAVE		0
+#define BRCM_BT_PCM_SYNC_MODE_MASTER		1
+
+/* Default should be master */
+#define BRCM_BT_PCM_CLOCK_MODE_SLAVE		0
+#define BRCM_BT_PCM_CLOCK_MODE_MASTER		1
+
+#endif /* _DT_BINDINGS_BLUETOOTH_BRCM_H */
-- 
2.24.0.432.g9d3f5f5b63-goog


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-18 19:21 ` [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
@ 2019-11-19  5:39   ` Marcel Holtmann
  2019-11-19 16:50     ` Doug Anderson
  2019-11-21 21:29   ` Rob Herring
  1 sibling, 1 reply; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-19  5:39 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Johan Hedberg, Rob Herring, linux-bluetooth, dianders,
	devicetree, David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai

Hi Abhishek,

> Add documentation for pcm parameters.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
> .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
> include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
> 2 files changed, 48 insertions(+)
> create mode 100644 include/dt-bindings/bluetooth/brcm.h
> 
> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> index c749dc297624..8561e4684378 100644
> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> @@ -29,10 +29,20 @@ Optional properties:
>    - "lpo": external low power 32.768 kHz clock
>  - vbat-supply: phandle to regulator supply for VBAT
>  - vddio-supply: phandle to regulator supply for VDDIO
> + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
> + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
> + - brcm,bt-pcm-frame-type: short, long
> + - brcm,bt-pcm-sync-mode: slave, master
> + - brcm,bt-pcm-clock-mode: slave, master
> 
> +See include/dt-bindings/bluetooth/brcm.h for SCO/PCM parameters. The default
> +value for all these values are 0 (except for brcm,bt-sco-routing which requires
> +a value) if you choose to leave it out.
> 
> Example:
> 
> +#include <dt-bindings/bluetooth/brcm.h>
> +
> &uart2 {
>        pinctrl-names = "default";
>        pinctrl-0 = <&uart2_pins>;
> @@ -40,5 +50,11 @@ Example:
>        bluetooth {
>                compatible = "brcm,bcm43438-bt";
>                max-speed = <921600>;
> +
> +               brcm,bt-sco-routing        = <BRCM_SCO_ROUTING_TRANSPORT>;

in case you use transport which means HCI, you would not have values below. It is rather PCM here in the example.

> +               brcm,bt-pcm-interface-rate = <BRCM_PCM_IF_RATE_512KBPS>;
> +               brcm,bt-pcm-frame-type     = <BRCM_PCM_FRAME_TYPE_SHORT>;
> +               brcm,bt-pcm-sync-mode      = <BRCM_PCM_SYNC_MODE_MASTER>;
> +               brcm,bt-pcm-clock-mode     = <BRCM_PCM_CLOCK_MODE_MASTER>;
>        };
> };

And I am asking this again. Is this adding any value to use an extra include file? Inside the driver we are not really needing these values since they are handed to the hardware.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-19  5:39   ` Marcel Holtmann
@ 2019-11-19 16:50     ` Doug Anderson
  0 siblings, 0 replies; 15+ messages in thread
From: Doug Anderson @ 2019-11-19 16:50 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Abhishek Pandit-Subedi, Johan Hedberg, Rob Herring,
	linux-bluetooth,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hi,

On Mon, Nov 18, 2019 at 9:39 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Abhishek,
>
> > Add documentation for pcm parameters.
> >
> > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> > ---
> >
> > Changes in v6: None
> > Changes in v5: None
> > Changes in v4: None
> > Changes in v3: None
> > Changes in v2: None
> >
> > .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
> > include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
> > 2 files changed, 48 insertions(+)
> > create mode 100644 include/dt-bindings/bluetooth/brcm.h
> >
> > diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> > index c749dc297624..8561e4684378 100644
> > --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> > +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> > @@ -29,10 +29,20 @@ Optional properties:
> >    - "lpo": external low power 32.768 kHz clock
> >  - vbat-supply: phandle to regulator supply for VBAT
> >  - vddio-supply: phandle to regulator supply for VDDIO
> > + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
> > + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
> > + - brcm,bt-pcm-frame-type: short, long
> > + - brcm,bt-pcm-sync-mode: slave, master
> > + - brcm,bt-pcm-clock-mode: slave, master
> >
> > +See include/dt-bindings/bluetooth/brcm.h for SCO/PCM parameters. The default
> > +value for all these values are 0 (except for brcm,bt-sco-routing which requires
> > +a value) if you choose to leave it out.
> >
> > Example:
> >
> > +#include <dt-bindings/bluetooth/brcm.h>
> > +
> > &uart2 {
> >        pinctrl-names = "default";
> >        pinctrl-0 = <&uart2_pins>;
> > @@ -40,5 +50,11 @@ Example:
> >        bluetooth {
> >                compatible = "brcm,bcm43438-bt";
> >                max-speed = <921600>;
> > +
> > +               brcm,bt-sco-routing        = <BRCM_SCO_ROUTING_TRANSPORT>;
>
> in case you use transport which means HCI, you would not have values below. It is rather PCM here in the example.
>
> > +               brcm,bt-pcm-interface-rate = <BRCM_PCM_IF_RATE_512KBPS>;
> > +               brcm,bt-pcm-frame-type     = <BRCM_PCM_FRAME_TYPE_SHORT>;
> > +               brcm,bt-pcm-sync-mode      = <BRCM_PCM_SYNC_MODE_MASTER>;
> > +               brcm,bt-pcm-clock-mode     = <BRCM_PCM_CLOCK_MODE_MASTER>;
> >        };
> > };
>
> And I am asking this again. Is this adding any value to use an extra include file? Inside the driver we are not really needing these values since they are handed to the hardware.

Personally I find that they add value in that it makes it easier for
someone tweaking the device tree to know what the expected valid
values are and what they mean.  I think Matthias also found value in
them since he suggested them in:

https://lore.kernel.org/r/20191114175836.GI27773@google.com

There, he said:

> I'd suggest to define constants in include/dt-bindings/bluetooth/brcm.h
> and use them instead of literals, with this we wouldn't rely on (optional)
> comments to make the configuration human readable.

...which seems to make sense to me.

-Doug

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-18 19:21 ` [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
  2019-11-19  5:39   ` Marcel Holtmann
@ 2019-11-21 21:29   ` Rob Herring
  2019-11-22 12:34     ` Marcel Holtmann
  1 sibling, 1 reply; 15+ messages in thread
From: Rob Herring @ 2019-11-21 21:29 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, dianders,
	devicetree, David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai

On Mon, Nov 18, 2019 at 11:21:22AM -0800, Abhishek Pandit-Subedi wrote:
> Add documentation for pcm parameters.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None

Really? I'm staring at v2 that looks a bit different.

>  .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
>  include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
>  2 files changed, 48 insertions(+)
>  create mode 100644 include/dt-bindings/bluetooth/brcm.h
> 
> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> index c749dc297624..8561e4684378 100644
> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> @@ -29,10 +29,20 @@ Optional properties:
>     - "lpo": external low power 32.768 kHz clock
>   - vbat-supply: phandle to regulator supply for VBAT
>   - vddio-supply: phandle to regulator supply for VDDIO
> + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
> + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
> + - brcm,bt-pcm-frame-type: short, long
> + - brcm,bt-pcm-sync-mode: slave, master
> + - brcm,bt-pcm-clock-mode: slave, master

Little of this seems unique to Broadcom. We already have some standard 
audio related properties for audio interfaces such as 'format', 
'frame-master' and 'bitclock-master'. Ultimately, this would be tied 
into the audio complex of SoCs and need to work with the audio 
bindings. We also have HDMI audio bindings. 

Maybe sco-routing is unique to BT and still needed in some form though 
if you describe the connection to the SoC audio complex, then maybe 
not? I'd assume every BT chip has some audio routing configuration.

Rob

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-21 21:29   ` Rob Herring
@ 2019-11-22 12:34     ` Marcel Holtmann
  2019-11-22 15:50       ` Rob Herring
  0 siblings, 1 reply; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-22 12:34 UTC (permalink / raw)
  To: Rob Herring
  Cc: Abhishek Pandit-Subedi, Johan Hedberg, linux-bluetooth,
	Douglas Anderson, devicetree, David S. Miller, netdev,
	linux-kernel, Ondrej Jirman, Mark Rutland, Chen-Yu Tsai

Hi Rob,

>> Add documentation for pcm parameters.
>> 
>> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
>> ---
>> 
>> Changes in v6: None
>> Changes in v5: None
>> Changes in v4: None
>> Changes in v3: None
>> Changes in v2: None
> 
> Really? I'm staring at v2 that looks a bit different.
> 
>> .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
>> include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
>> 2 files changed, 48 insertions(+)
>> create mode 100644 include/dt-bindings/bluetooth/brcm.h
>> 
>> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>> index c749dc297624..8561e4684378 100644
>> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>> @@ -29,10 +29,20 @@ Optional properties:
>>    - "lpo": external low power 32.768 kHz clock
>>  - vbat-supply: phandle to regulator supply for VBAT
>>  - vddio-supply: phandle to regulator supply for VDDIO
>> + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
>> + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
>> + - brcm,bt-pcm-frame-type: short, long
>> + - brcm,bt-pcm-sync-mode: slave, master
>> + - brcm,bt-pcm-clock-mode: slave, master
> 
> Little of this seems unique to Broadcom. We already have some standard 
> audio related properties for audio interfaces such as 'format', 
> 'frame-master' and 'bitclock-master'. Ultimately, this would be tied 
> into the audio complex of SoCs and need to work with the audio 
> bindings. We also have HDMI audio bindings. 
> 
> Maybe sco-routing is unique to BT and still needed in some form though 
> if you describe the connection to the SoC audio complex, then maybe 
> not? I'd assume every BT chip has some audio routing configuration.

so we tried to generalize this some time before and failed to get a proper consensus.

In general I am with you that we should just expose generic properties from the attached audio codec, but nobody has come up with anything like that. And I think aligning all chip manufacturers will take some time.

Maybe in the interim we just use brcm,bt-pcm-int-params = [00 00 ..] as initially proposed.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-22 12:34     ` Marcel Holtmann
@ 2019-11-22 15:50       ` Rob Herring
  2019-11-22 16:14         ` Marcel Holtmann
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2019-11-22 15:50 UTC (permalink / raw)
  To: Marcel Holtmann, Abhishek Pandit-Subedi
  Cc: Johan Hedberg, linux-bluetooth, Douglas Anderson, devicetree,
	David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai

On Fri, Nov 22, 2019 at 6:34 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Rob,
>
> >> Add documentation for pcm parameters.
> >>
> >> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> >> ---
> >>
> >> Changes in v6: None
> >> Changes in v5: None
> >> Changes in v4: None
> >> Changes in v3: None
> >> Changes in v2: None
> >
> > Really? I'm staring at v2 that looks a bit different.
> >
> >> .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
> >> include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
> >> 2 files changed, 48 insertions(+)
> >> create mode 100644 include/dt-bindings/bluetooth/brcm.h
> >>
> >> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> >> index c749dc297624..8561e4684378 100644
> >> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> >> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> >> @@ -29,10 +29,20 @@ Optional properties:
> >>    - "lpo": external low power 32.768 kHz clock
> >>  - vbat-supply: phandle to regulator supply for VBAT
> >>  - vddio-supply: phandle to regulator supply for VDDIO
> >> + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
> >> + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
> >> + - brcm,bt-pcm-frame-type: short, long
> >> + - brcm,bt-pcm-sync-mode: slave, master
> >> + - brcm,bt-pcm-clock-mode: slave, master
> >
> > Little of this seems unique to Broadcom. We already have some standard
> > audio related properties for audio interfaces such as 'format',
> > 'frame-master' and 'bitclock-master'. Ultimately, this would be tied
> > into the audio complex of SoCs and need to work with the audio
> > bindings. We also have HDMI audio bindings.
> >
> > Maybe sco-routing is unique to BT and still needed in some form though
> > if you describe the connection to the SoC audio complex, then maybe
> > not? I'd assume every BT chip has some audio routing configuration.
>
> so we tried to generalize this some time before and failed to get a proper consensus.
>
> In general I am with you that we should just expose generic properties from the attached audio codec, but nobody has come up with anything like that. And I think aligning all chip manufacturers will take some time.
>

That shouldn't be hard. It's a solved problem for codecs and HDMI. I
don't think BT is any more complicated (ignoring phones). I suspect
it's not solved simply because no one wants to do the work beyond
their 1 BT device they care about ATM.

> Maybe in the interim we just use brcm,bt-pcm-int-params = [00 00 ..] as initially proposed.

What's the device using this? Some chromebook I suppose. I think it
would be better to first see how this fits in with the rest of the
audio subsystem. Until then, the driver should probably just default
to "transport" mode which I assume is audio routed over the UART
interface. That should work on any platform at least, but may not be
optimal.

Rob

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config
  2019-11-22 15:50       ` Rob Herring
@ 2019-11-22 16:14         ` Marcel Holtmann
  0 siblings, 0 replies; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-22 16:14 UTC (permalink / raw)
  To: Rob Herring
  Cc: Abhishek Pandit-Subedi, Johan Hedberg, linux-bluetooth,
	Douglas Anderson, devicetree, David S. Miller, netdev,
	linux-kernel, Ondrej Jirman, Mark Rutland, Chen-Yu Tsai

Hi Rob,

>>>> Add documentation for pcm parameters.
>>>> 
>>>> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
>>>> ---
>>>> 
>>>> Changes in v6: None
>>>> Changes in v5: None
>>>> Changes in v4: None
>>>> Changes in v3: None
>>>> Changes in v2: None
>>> 
>>> Really? I'm staring at v2 that looks a bit different.
>>> 
>>>> .../bindings/net/broadcom-bluetooth.txt       | 16 ++++++++++
>>>> include/dt-bindings/bluetooth/brcm.h          | 32 +++++++++++++++++++
>>>> 2 files changed, 48 insertions(+)
>>>> create mode 100644 include/dt-bindings/bluetooth/brcm.h
>>>> 
>>>> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>>>> index c749dc297624..8561e4684378 100644
>>>> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>>>> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
>>>> @@ -29,10 +29,20 @@ Optional properties:
>>>>   - "lpo": external low power 32.768 kHz clock
>>>> - vbat-supply: phandle to regulator supply for VBAT
>>>> - vddio-supply: phandle to regulator supply for VDDIO
>>>> + - brcm,bt-sco-routing: PCM, Transport, Codec, I2S
>>>> + - brcm,bt-pcm-interface-rate: 128KBps, 256KBps, 512KBps, 1024KBps, 2048KBps
>>>> + - brcm,bt-pcm-frame-type: short, long
>>>> + - brcm,bt-pcm-sync-mode: slave, master
>>>> + - brcm,bt-pcm-clock-mode: slave, master
>>> 
>>> Little of this seems unique to Broadcom. We already have some standard
>>> audio related properties for audio interfaces such as 'format',
>>> 'frame-master' and 'bitclock-master'. Ultimately, this would be tied
>>> into the audio complex of SoCs and need to work with the audio
>>> bindings. We also have HDMI audio bindings.
>>> 
>>> Maybe sco-routing is unique to BT and still needed in some form though
>>> if you describe the connection to the SoC audio complex, then maybe
>>> not? I'd assume every BT chip has some audio routing configuration.
>> 
>> so we tried to generalize this some time before and failed to get a proper consensus.
>> 
>> In general I am with you that we should just expose generic properties from the attached audio codec, but nobody has come up with anything like that. And I think aligning all chip manufacturers will take some time.
>> 
> 
> That shouldn't be hard. It's a solved problem for codecs and HDMI. I
> don't think BT is any more complicated (ignoring phones). I suspect
> it's not solved simply because no one wants to do the work beyond
> their 1 BT device they care about ATM.

we tried, but nobody can agree on these right now. I would be happy if others come forward and tell us how they wired up their hardware, but it hasn’t happened yet.

>> Maybe in the interim we just use brcm,bt-pcm-int-params = [00 00 ..] as initially proposed.
> 
> What's the device using this? Some chromebook I suppose. I think it
> would be better to first see how this fits in with the rest of the
> audio subsystem. Until then, the driver should probably just default
> to "transport" mode which I assume is audio routed over the UART
> interface. That should work on any platform at least, but may not be
> optimal.

SCO over UART doesn’t really work. Long time ago, some car kits might have done it, but in the Chromebook cases this will just not work. We need to configure the PCM settings of the Bluetooth chip.

If we don’t do it via DT, then this gets hardcoded in the driver source and that is not helping either. So until we get anything better, lets use brcm,bt-pcm-int-params = [00 00 ..] and get this supported upstream.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-18 19:21 [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Abhishek Pandit-Subedi
  2019-11-18 19:21 ` [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
@ 2019-11-23 10:04 ` Marcel Holtmann
  2019-11-25 18:20   ` Abhishek Pandit-Subedi
  1 sibling, 1 reply; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-23 10:04 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Johan Hedberg, Rob Herring, linux-bluetooth, dianders,
	devicetree, David S. Miller, netdev, linux-kernel, Ondrej Jirman,
	Mark Rutland, Chen-Yu Tsai

Hi Abhishek,

> 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.

so I have re-factored your patch set now to apply to latest bluetooth-next tree and posted it to the mailing list. Please have a look at it if this works for you. If it does, then we might just apply it this way and focus on getting detailed PCM codec configuration for all vendors in once we have a second vendor to unify it.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-23 10:04 ` [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Marcel Holtmann
@ 2019-11-25 18:20   ` Abhishek Pandit-Subedi
  2019-11-26  7:19     ` Marcel Holtmann
  0 siblings, 1 reply; 15+ messages in thread
From: Abhishek Pandit-Subedi @ 2019-11-25 18:20 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Rob Herring, linux-bluetooth, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hey,

It looks about the same as one of my earlier patch series. Outside a
few nitpicks, I'm ok with merging this.

Thanks
Abhishek

On Sat, Nov 23, 2019 at 2:04 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Abhishek,
>
> > 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.
>
> so I have re-factored your patch set now to apply to latest bluetooth-next tree and posted it to the mailing list. Please have a look at it if this works for you. If it does, then we might just apply it this way and focus on getting detailed PCM codec configuration for all vendors in once we have a second vendor to unify it.
>
> Regards
>
> Marcel
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-25 18:20   ` Abhishek Pandit-Subedi
@ 2019-11-26  7:19     ` Marcel Holtmann
  2019-11-26 20:40       ` Abhishek Pandit-Subedi
  0 siblings, 1 reply; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-26  7:19 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Johan Hedberg, Rob Herring, Bluez mailing list, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hi Abhishek,

> It looks about the same as one of my earlier patch series. Outside a
> few nitpicks, I'm ok with merging this.

I fixed the nitpicks up and send a v2.

However we should still work towards a generic description of Bluetooth PCM settings for all vendors. Any ideas are welcome.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-26  7:19     ` Marcel Holtmann
@ 2019-11-26 20:40       ` Abhishek Pandit-Subedi
  2019-11-27  5:37         ` Marcel Holtmann
  0 siblings, 1 reply; 15+ messages in thread
From: Abhishek Pandit-Subedi @ 2019-11-26 20:40 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Rob Herring, Bluez mailing list, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hey Marcel,

The series looks good to me.

Thanks
Abhishek

On Mon, Nov 25, 2019 at 11:19 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Abhishek,
>
> > It looks about the same as one of my earlier patch series. Outside a
> > few nitpicks, I'm ok with merging this.
>
> I fixed the nitpicks up and send a v2.
>
> However we should still work towards a generic description of Bluetooth PCM settings for all vendors. Any ideas are welcome.
>
> Regards
>
> Marcel
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-26 20:40       ` Abhishek Pandit-Subedi
@ 2019-11-27  5:37         ` Marcel Holtmann
  2019-11-27 22:14           ` Abhishek Pandit-Subedi
  0 siblings, 1 reply; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-27  5:37 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Johan Hedberg, Rob Herring, Bluez mailing list, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hi Abhishek,

> The series looks good to me.

you also tested it on your hardware?

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-27  5:37         ` Marcel Holtmann
@ 2019-11-27 22:14           ` Abhishek Pandit-Subedi
  2019-11-27 22:18             ` Marcel Holtmann
  0 siblings, 1 reply; 15+ messages in thread
From: Abhishek Pandit-Subedi @ 2019-11-27 22:14 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Rob Herring, Bluez mailing list, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

On Tue, Nov 26, 2019 at 9:37 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Abhishek,
>
> > The series looks good to me.
>
> you also tested it on your hardware?
>
> Regards
>
> Marcel
>

I have tested it on my hardware and it looks good now.

Only problem is it looks like the documentation is slightly wrong:

+               brcm,bt-pcm-int-params = [1 2 0 1 1];
should be
+               brcm,bt-pcm-int-params = [01 02 00 01 01];
or
+               brcm,bt-pcm-int-params = /bits/ 8 <1 2 0 1 1>;

Thanks
Abhishek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support
  2019-11-27 22:14           ` Abhishek Pandit-Subedi
@ 2019-11-27 22:18             ` Marcel Holtmann
  0 siblings, 0 replies; 15+ messages in thread
From: Marcel Holtmann @ 2019-11-27 22:18 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Johan Hedberg, Rob Herring, Bluez mailing list, Douglas Anderson,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	David S. Miller, netdev, LKML, Ondrej Jirman, Mark Rutland,
	Chen-Yu Tsai

Hi Abhishek,

>>> The series looks good to me.
>> 
>> you also tested it on your hardware?
>> 
>> Regards
>> 
>> Marcel
>> 
> 
> I have tested it on my hardware and it looks good now.
> 
> Only problem is it looks like the documentation is slightly wrong:
> 
> +               brcm,bt-pcm-int-params = [1 2 0 1 1];
> should be
> +               brcm,bt-pcm-int-params = [01 02 00 01 01];
> or
> +               brcm,bt-pcm-int-params = /bits/ 8 <1 2 0 1 1>;
> 

since Johan already applied the patches, send a follow up patch for the docs.

Regards

Marcel


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-11-27 22:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 19:21 [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Abhishek Pandit-Subedi
2019-11-18 19:21 ` [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
2019-11-19  5:39   ` Marcel Holtmann
2019-11-19 16:50     ` Doug Anderson
2019-11-21 21:29   ` Rob Herring
2019-11-22 12:34     ` Marcel Holtmann
2019-11-22 15:50       ` Rob Herring
2019-11-22 16:14         ` Marcel Holtmann
2019-11-23 10:04 ` [PATCH v6 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Marcel Holtmann
2019-11-25 18:20   ` Abhishek Pandit-Subedi
2019-11-26  7:19     ` Marcel Holtmann
2019-11-26 20:40       ` Abhishek Pandit-Subedi
2019-11-27  5:37         ` Marcel Holtmann
2019-11-27 22:14           ` Abhishek Pandit-Subedi
2019-11-27 22:18             ` Marcel Holtmann

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).