diff mbox series

[3/3] ARM: dts: exynos: Add sound support to Midas

Message ID 20200710173500.22365-3-s.nawrocki@samsung.com (mailing list archive)
State Superseded
Headers show
Series [1/3] ASoC: samsung: Document DT bindings for Midas sound subsystem | expand

Commit Message

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

Comments

Krzysztof Kozlowski July 20, 2020, 2:34 p.m. UTC | #1
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
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/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 {
+	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 {
+		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>;
+		};
+		codec {
+			sound-dai = <&wm1811>;
+		};
 	};
 
 	thermistor-ap {
@@ -597,11 +623,37 @@ 
 	wm1811: wm1811@1a {
 		compatible = "wlf,wm1811";
 		reg = <0x1a>;
-		clocks = <&pmu_system_controller 0>;
-		clock-names = "MCLK1";
-		DCVDD-supply = <&ldo3_reg>;
+		clocks = <&pmu_system_controller 0>,
+			<&max77686 MAX77686_CLK_PMIC>;
+		clock-names = "MCLK1", "MCLK2";
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		interrupt-parent = <&gpx3>;
+		interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+		#sound-dai-cells = <0>;
+
+		wlf,gpio-cfg = <0x3 0x0 0x0 0x0 0x0 0x0
+			0x0 0x8000 0x0 0x0 0x0>;
+		wlf,micbias-cfg = <0x2f 0x2b>;
+
+		wlf,lineout1-feedback;
+		wlf,lineout1-se;
+		wlf,lineout2-se;
+		wlf,ldoena-always-driven;
+
+		AVDD2-supply = <&vbatt_reg>;
 		DBVDD1-supply = <&ldo3_reg>;
+		DBVDD2-supply = <&vbatt_reg>;
+		DBVDD3-supply = <&vbatt_reg>;
+		DCVDD-supply = <&ldo3_reg>;
+		CPVDD-supply = <&vbatt_reg>;
+		SPKVDD1-supply = <&vbatt_reg>;
+		SPKVDD2-supply = <&vbatt_reg>;
 		wlf,ldo1ena = <&gpj0 4 0>;
+		wlf,ldo2ena = <&gpj0 4 0>;
 	};
 };
 
diff --git a/arch/arm/boot/dts/exynos4412-n710x.dts b/arch/arm/boot/dts/exynos4412-n710x.dts
index 4189e1f..e0c907e 100644
--- a/arch/arm/boot/dts/exynos4412-n710x.dts
+++ b/arch/arm/boot/dts/exynos4412-n710x.dts
@@ -78,3 +78,38 @@ 
 	gpio = <&gpm0 5 GPIO_ACTIVE_HIGH>;
 	status = "okay";
 };
+
+&sound {
+	samsung,audio-routing =
+		"HP", "HPOUT1L",
+		"HP", "HPOUT1R",
+
+		"SPK", "SPKOUTLN",
+		"SPK", "SPKOUTLP",
+
+		"RCV", "HPOUT2N",
+		"RCV", "HPOUT2P",
+
+		"HDMI", "LINEOUT1N",
+		"HDMI", "LINEOUT1P",
+
+		"LINE", "LINEOUT2N",
+		"LINE", "LINEOUT2P",
+
+		"IN1LP", "MICBIAS2",
+		"IN1LN", "MICBIAS2",
+		"Headset Mic", "MICBIAS2",
+
+		"IN1RP", "Sub Mic",
+		"IN1RN", "Sub Mic",
+
+		"IN2LP:VXRN", "Main Mic",
+		"IN2LN", "Main Mic",
+
+		"IN2RN", "FM In",
+		"IN2RP:VXRP", "FM In";
+};
+
+&submic_bias_reg {
+	regulator-always-on;
+};