Re: [PATCH v6 3/4] dt-bindings: net: broadcom-bluetooth: Add pcm config

From: Doug Anderson
Date: Tue Nov 19 2019 - 11:50:30 EST


Hi,

On Mon, Nov 18, 2019 at 9:39 PM Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
>
> Hi Abhishek,
>
> > Add documentation for pcm parameters.
> >
> > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
> > ---
> >
> > 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@xxxxxxxxxx

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