diff mbox series

[1/3] ASoC: samsung: Document DT bindings for Midas sound subsystem

Message ID 20200710173500.22365-1-s.nawrocki@samsung.com
State Changes Requested, archived
Headers show
Series [1/3] ASoC: samsung: Document DT bindings for Midas sound subsystem | expand

Checks

Context Check Description
robh/checkpatch success
robh/dt-meta-schema fail build log

Commit Message

Sylwester Nawrocki July 10, 2020, 5:34 p.m. UTC
This patch adds documentation of DT biding for the Midas sound complex.
Partially based on the *txt version by Simon Shields <simon@lineageos.org>.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 .../bindings/sound/samsung,midas-audio.yaml        | 105 +++++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml

Comments

Rob Herring July 13, 2020, 2:59 p.m. UTC | #1
On Fri, 10 Jul 2020 19:34:58 +0200, Sylwester Nawrocki wrote:
> This patch adds documentation of DT biding for the Midas sound complex.
> Partially based on the *txt version by Simon Shields <simon@lineageos.org>.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  .../bindings/sound/samsung,midas-audio.yaml        | 105 +++++++++++++++++++++
>  1 file changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
> 


My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/samsung,midas-audio.example.dt.yaml: sound: 'mic-bias-gpios', 'submic-bias-gpios' do not match any of the regexes: 'pinctrl-[0-9]+'


See https://patchwork.ozlabs.org/patch/1327065

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.
Krzysztof Kozlowski July 20, 2020, 2:30 p.m. UTC | #2
On Fri, Jul 10, 2020 at 07:34:59PM +0200, Sylwester Nawrocki wrote:
> From: Simon Shields <simon@lineageos.org>
> 
> This patch adds support for voice and BT calls, along with standard
> audio output via the speaker, earpiece, headphone jack, HDMI, and
> any accessories compatible with Midas boards. This patch also supports
> headphone/headset detection and headsets with inline buttons.
> 
> Signed-off-by: Simon Shields <simon@lineageos.org>
> [m.szyprowski: adaptation to v5.1+ kernels (DAI links initialization)]
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> [s.nawrocki: removal of the clk API calls for CODEC MCLK, the jack data
>  structure moved to struct midas_priv, coding style and typo fixes,
>  conversion to new cpu/codec/dai-node binding]
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  sound/soc/samsung/Kconfig        |   8 +
>  sound/soc/samsung/Makefile       |   2 +
>  sound/soc/samsung/midas_wm1811.c | 543 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 553 insertions(+)
>  create mode 100644 sound/soc/samsung/midas_wm1811.c

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof
Krzysztof Kozlowski July 20, 2020, 2:34 p.m. UTC | #3
On Fri, Jul 10, 2020 at 07:35:00PM +0200, Sylwester Nawrocki wrote:
> From: Simon Shields <simon@lineageos.org>
> 
> Update the never-mainlined "samsung,trats2-audio" binding and instead
> use the new "samsung,midas-audio" binding.
> 
> Signed-off-by: Simon Shields <simon@lineageos.org>
> [s.nawrocki: fixed DAPM routing entries for MICBIAS1/2, adjusted to
>  changes in the DT binding]
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi | 38 ++++++++++++++
>  arch/arm/boot/dts/exynos4412-i9300.dts      |  4 ++
>  arch/arm/boot/dts/exynos4412-midas.dtsi     | 78 ++++++++++++++++++++++++-----
>  arch/arm/boot/dts/exynos4412-n710x.dts      | 35 +++++++++++++
>  4 files changed, 142 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi b/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
> index 53b3ca3..cff0980 100644
> --- a/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
> +++ b/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
> @@ -175,3 +175,41 @@
>  	gpio = <&gpm0 0 GPIO_ACTIVE_HIGH>;
>  	status = "okay";
>  };
> +
> +&submic_bias_reg {

Put them in alphabetical order against oder phandle overrides. Same for
n710x.dts.

> +	gpio = <&gpf2 0 GPIO_ACTIVE_HIGH>;
> +	enable-active-high;
> +};
> +
> +&sound {
> +	samsung,audio-routing =
> +		"HP", "HPOUT1L",
> +		"HP", "HPOUT1R",
> +
> +		"SPK", "SPKOUTLN",
> +		"SPK", "SPKOUTLP",
> +		"SPK", "SPKOUTRN",
> +		"SPK", "SPKOUTRP",
> +
> +		"RCV", "HPOUT2N",
> +		"RCV", "HPOUT2P",
> +
> +		"HDMI", "LINEOUT1N",
> +		"HDMI", "LINEOUT1P",
> +
> +		"LINE", "LINEOUT2N",
> +		"LINE", "LINEOUT2P",
> +
> +		"IN1LP", "MICBIAS1",
> +		"IN1LN", "MICBIAS1",
> +		"Main Mic", "MICBIAS1",
> +
> +		"IN1RP", "Sub Mic",
> +		"IN1RN", "Sub Mic",
> +
> +		"IN2LP:VXRN", "MICBIAS2",
> +		"Headset Mic", "MICBIAS2",
> +
> +		"IN2RN", "FM In",
> +		"IN2RP:VXRP", "FM In";
> +};
> diff --git a/arch/arm/boot/dts/exynos4412-i9300.dts b/arch/arm/boot/dts/exynos4412-i9300.dts
> index f8125a9..3691802 100644
> --- a/arch/arm/boot/dts/exynos4412-i9300.dts
> +++ b/arch/arm/boot/dts/exynos4412-i9300.dts
> @@ -20,3 +20,7 @@
>  		reg =  <0x40000000 0x40000000>;
>  	};
>  };
> +
> +&sound {
> +	fm-sel-gpios = <&gpl0 3 GPIO_ACTIVE_HIGH>;
> +};
> diff --git a/arch/arm/boot/dts/exynos4412-midas.dtsi b/arch/arm/boot/dts/exynos4412-midas.dtsi
> index 2c8111c..2752363 100644
> --- a/arch/arm/boot/dts/exynos4412-midas.dtsi
> +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi
> @@ -102,6 +102,30 @@
>  		status = "disabled";
>  	};
>  
> +	vbatt_reg: voltage-regulator-9 {

Since this is the basic DTSI for multiple boards, the numbering here
should be consistent. You will have to rename the ones in Galaxy S3 and
N710 DTSI.

> +		compatible = "regulator-fixed";
> +		regulator-name = "VBATT";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +		regulator-always-on;
> +	};
> +
> +	mic_bias_reg: voltage-regulator-10 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "MICBIAS_LDO_2.8V";
> +		regulator-min-microvolt = <2800000>;
> +		regulator-max-microvolt = <2800000>;
> +		gpio = <&gpf1 7 GPIO_ACTIVE_HIGH>;
> +		enable-active-high;
> +	};
> +
> +	submic_bias_reg: voltage-regulator-11 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "SUB_MICBIAS_LDO_2.8V";
> +		regulator-min-microvolt = <2800000>;
> +		regulator-max-microvolt = <2800000>;
> +	};
> +
>  	gpio-keys {
>  		compatible = "gpio-keys";
>  		pinctrl-names = "default";
> @@ -266,16 +290,18 @@
>  		clock-names = "ext_clock";
>  	};
>  
> -	sound {
> -		compatible = "samsung,trats2-audio";
> -		samsung,i2s-controller = <&i2s0>;
> -		samsung,model = "Trats2";
> -		samsung,audio-codec = <&wm1811>;
> -		samsung,audio-routing =
> -			"SPK", "SPKOUTLN",
> -			"SPK", "SPKOUTLP",
> -			"SPK", "SPKOUTRN",
> -			"SPK", "SPKOUTRP";
> +	sound: sound {
> +		compatible = "samsung,midas-audio";
> +		model = "Midas";
> +		mic-bias-supply = <&mic_bias_reg>;
> +		submic-bias-supply = <&submic_bias_reg>;
> +
> +		cpu {
> +			sound-dai =  <&i2s0 0>;

Double space after '='.

Best regards,
Krzysztof
Sylwester Nawrocki July 27, 2020, 4:32 p.m. UTC | #4
On 20.07.2020 16:34, Krzysztof Kozlowski wrote:
> On Fri, Jul 10, 2020 at 07:35:00PM +0200, Sylwester Nawrocki wrote:

>> --- a/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
>> +++ b/arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi
>> @@ -175,3 +175,41 @@
>>  	gpio = <&gpm0 0 GPIO_ACTIVE_HIGH>;
>>  	status = "okay";
>>  };
>> +
>> +&submic_bias_reg {
> 
> Put them in alphabetical order against oder phandle overrides. Same for
> n710x.dts.

>> --- a/arch/arm/boot/dts/exynos4412-midas.dtsi
>> +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi
>> @@ -102,6 +102,30 @@
>>  		status = "disabled";
>>  	};
>>  
>> +	vbatt_reg: voltage-regulator-9 {
> 
> Since this is the basic DTSI for multiple boards, the numbering here
> should be consistent. You will have to rename the ones in Galaxy S3 and
> N710 DTSI.

>> @@ -266,16 +290,18 @@

>> +		cpu {
>> +			sound-dai =  <&i2s0 0>;
> 
> Double space after '='.

Thanks for your review, I have addressed all these issues in just
posted v2.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
new file mode 100644
index 0000000..4a82829
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
@@ -0,0 +1,105 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/samsung,midas-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung Midas audio complex with WM1811 codec
+
+maintainers:
+  - Sylwester Nawrocki <s.nawrocki@samsung.com>
+
+properties:
+  compatible:
+    const: samsung,midas-audio
+
+  model:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: The user-visible name of this sound complex.
+
+  cpu:
+    type: object
+    properties:
+      sound-dai:
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        description: phandle to the I2S controller
+
+  codec:
+    type: object
+    properties:
+      sound-dai:
+        $ref: /schemas/types.yaml#/definitions/phandle-array
+        description: phandle to the WM1811 CODEC node
+
+  samsung,audio-routing:
+    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+    description: |
+      List of the connections between audio components; each entry is
+      a pair of strings, the first being the connection's sink, the second
+      being the connection's source; valid names for sources and sinks are
+      the WM1811's pins (as documented in its binding), and the jacks
+      on the board: HP, SPK, Main Mic, Sub Mic, Headset Mic.
+
+  mic-bias-supply:
+    description: Supply for the micbias on the Main microphone
+
+  submic-bias-supply:
+    description: Supply for the micbias on the Sub microphone
+
+  fm-sel-gpios:
+    description: GPIO pin for FM selection
+
+  lineout-sel-gpios:
+    description: GPIO pin for line out selection
+
+required:
+  - compatible
+  - model
+  - cpu
+  - codec
+  - samsung,audio-routing
+  - mic-bias-supply
+  - submic-bias-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    sound {
+        compatible = "samsung,midas-audio";
+        model = "Midas";
+
+        mic-bias-gpios = <&gpf1 7 GPIO_ACTIVE_HIGH>;
+        submic-bias-gpios = <&gpf2 0 GPIO_ACTIVE_HIGH>;
+
+        mic-bias-supply = <&mic_bias_reg>;
+        submic-bias-supply = <&submic_bias_reg>;
+
+        samsung,audio-routing =
+                "HP", "HPOUT1L",
+                "HP", "HPOUT1R",
+
+                "SPK", "SPKOUTLN",
+                "SPK", "SPKOUTLP",
+                "SPK", "SPKOUTRN",
+                "SPK", "SPKOUTRP",
+
+                "RCV", "HPOUT2N",
+                "RCV", "HPOUT2P",
+
+                "IN1LP", "Main Mic",
+                "IN1LN", "Main Mic",
+                "IN1RP", "Sub Mic",
+                "IN1LP", "Sub Mic";
+
+        cpu {
+            sound-dai = <&i2s0>;
+        };
+
+        codec {
+            sound-dai = <&wm1811>;
+        };
+
+    };