diff mbox series

[02/54] ASoC: dt-bindings: Convert Bluetooth SCO Link binding to a schema

Message ID 20210721140424.725744-3-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series [01/54] ASoC: dt-bindings: Add WM8978 Binding | expand

Commit Message

Maxime Ripard July 21, 2021, 2:03 p.m. UTC
Bluetooth SCO Link are supported by Linux with a matching device tree
binding.

Now that we have the DT validation in place, let's convert the device
tree bindings for that driver over to a YAML schema.

The value expected for #sound-dai-cells wasn't documented though, and
the users were inconsistent. The example didn't list it, and across the
4 users we have in tree:
  - 1 had a cells value of 1, but using only 0 as argument
  - 1 had a cells value of 0,
  - 2 didn't have this property at all, behaving as if it was 0,

It seems like the consensus seems to be that it should be 0, so let's
enforce it.

Cc: alsa-devel@alsa-project.org
Cc: devicetree@vger.kernel.org
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Samuel Holland <samuel@sholland.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 .../devicetree/bindings/sound/bt-sco.txt      | 13 -------
 .../bindings/sound/linux,bt-sco.yaml          | 34 +++++++++++++++++++
 2 files changed, 34 insertions(+), 13 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/bt-sco.txt
 create mode 100644 Documentation/devicetree/bindings/sound/linux,bt-sco.yaml

Comments

Samuel Holland July 22, 2021, 5:35 a.m. UTC | #1
On 7/21/21 9:03 AM, Maxime Ripard wrote:
> Bluetooth SCO Link are supported by Linux with a matching device tree
> binding.
> 
> Now that we have the DT validation in place, let's convert the device
> tree bindings for that driver over to a YAML schema.
> 
> The value expected for #sound-dai-cells wasn't documented though, and
> the users were inconsistent. The example didn't list it, and across the
> 4 users we have in tree:
>   - 1 had a cells value of 1, but using only 0 as argument
>   - 1 had a cells value of 0,
>   - 2 didn't have this property at all, behaving as if it was 0,
> 
> It seems like the consensus seems to be that it should be 0, so let's
> enforce it.

The driver has two DAIs: "bt-sco-pcm" and "bt-sco-pcm-wb". If
#sound-dai-cells is 0, only the first DAI can be referenced from a
device tree. So to declare support for wideband PCM, or explicitly
declare a lack of support for it, #sound-dai-cells must be 1.

Regards,
Samuel

> Cc: alsa-devel@alsa-project.org
> Cc: devicetree@vger.kernel.org
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  .../devicetree/bindings/sound/bt-sco.txt      | 13 -------
>  .../bindings/sound/linux,bt-sco.yaml          | 34 +++++++++++++++++++
>  2 files changed, 34 insertions(+), 13 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/sound/bt-sco.txt
>  create mode 100644 Documentation/devicetree/bindings/sound/linux,bt-sco.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/bt-sco.txt b/Documentation/devicetree/bindings/sound/bt-sco.txt
> deleted file mode 100644
> index 641edf75e184..000000000000
> --- a/Documentation/devicetree/bindings/sound/bt-sco.txt
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -Bluetooth-SCO audio CODEC
> -
> -This device support generic Bluetooth SCO link.
> -
> -Required properties:
> -
> -  - compatible : "delta,dfbmcs320" or "linux,bt-sco"
> -
> -Example:
> -
> -codec: bt_sco {
> -	compatible = "delta,dfbmcs320";
> -};
> diff --git a/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml b/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml
> new file mode 100644
> index 000000000000..334b508205cd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml
> @@ -0,0 +1,34 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/linux,bt-sco.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Bluetooth SCO Audio Codec Device Tree Bindings
> +
> +maintainers:
> +  - Mark Brown <broonie@kernel.org>
> +
> +properties:
> +  '#sound-dai-cells':
> +    const: 0
> +
> +  compatible:
> +    enum:
> +      - delta,dfbmcs320
> +      - linux,bt-sco
> +
> +required:
> +  - '#sound-dai-cells'
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    codec {
> +        #sound-dai-cells = <0>;
> +        compatible = "linux,bt-sco";
> +    };
> +
> +...
>
Maxime Ripard July 22, 2021, 7:58 a.m. UTC | #2
Hi Samuel,

On Thu, Jul 22, 2021 at 12:35:33AM -0500, Samuel Holland wrote:
> On 7/21/21 9:03 AM, Maxime Ripard wrote:
> > Bluetooth SCO Link are supported by Linux with a matching device tree
> > binding.
> > 
> > Now that we have the DT validation in place, let's convert the device
> > tree bindings for that driver over to a YAML schema.
> > 
> > The value expected for #sound-dai-cells wasn't documented though, and
> > the users were inconsistent. The example didn't list it, and across the
> > 4 users we have in tree:
> >   - 1 had a cells value of 1, but using only 0 as argument
> >   - 1 had a cells value of 0,
> >   - 2 didn't have this property at all, behaving as if it was 0,
> > 
> > It seems like the consensus seems to be that it should be 0, so let's
> > enforce it.
> 
> The driver has two DAIs: "bt-sco-pcm" and "bt-sco-pcm-wb". If
> #sound-dai-cells is 0, only the first DAI can be referenced from a
> device tree. So to declare support for wideband PCM, or explicitly
> declare a lack of support for it, #sound-dai-cells must be 1.

Yeah, I knew there was something else to it :)

I'll fix it for the next iteration.

Thanks!
Maxime
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/bt-sco.txt b/Documentation/devicetree/bindings/sound/bt-sco.txt
deleted file mode 100644
index 641edf75e184..000000000000
--- a/Documentation/devicetree/bindings/sound/bt-sco.txt
+++ /dev/null
@@ -1,13 +0,0 @@ 
-Bluetooth-SCO audio CODEC
-
-This device support generic Bluetooth SCO link.
-
-Required properties:
-
-  - compatible : "delta,dfbmcs320" or "linux,bt-sco"
-
-Example:
-
-codec: bt_sco {
-	compatible = "delta,dfbmcs320";
-};
diff --git a/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml b/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml
new file mode 100644
index 000000000000..334b508205cd
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/linux,bt-sco.yaml
@@ -0,0 +1,34 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/linux,bt-sco.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bluetooth SCO Audio Codec Device Tree Bindings
+
+maintainers:
+  - Mark Brown <broonie@kernel.org>
+
+properties:
+  '#sound-dai-cells':
+    const: 0
+
+  compatible:
+    enum:
+      - delta,dfbmcs320
+      - linux,bt-sco
+
+required:
+  - '#sound-dai-cells'
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    codec {
+        #sound-dai-cells = <0>;
+        compatible = "linux,bt-sco";
+    };
+
+...