[PATCH 3/3] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection

Artur Weber posted 3 patches 1 year, 7 months ago
There is a newer version of this series
[PATCH 3/3] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection
Posted by Artur Weber 1 year, 7 months ago
Add the necessary properties to the samsung,midas-audio node to allow
for headset jack detection, set up the mic bias regulator GPIO and fix
some other small issues with the sound setup.

Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
 arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi
index e5254e32aa8f..a059857e3054 100644
--- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi
+++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi
@@ -285,6 +285,8 @@ mic_bias_reg: voltage-regulator-4 {
 		regulator-name = "MICBIAS_LDO_2.8V";
 		regulator-min-microvolt = <2800000>;
 		regulator-max-microvolt = <2800000>;
+		gpio = <&gpm0 0 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
 	};
 
 	submic_bias_reg: voltage-regulator-5 {
@@ -297,8 +299,17 @@ submic_bias_reg: voltage-regulator-5 {
 	sound: sound {
 		compatible = "samsung,midas-audio";
 		model = "TAB3";
+
 		mic-bias-supply = <&mic_bias_reg>;
 		submic-bias-supply = <&submic_bias_reg>;
+		lineout-sel-gpios = <&gpj1 2 GPIO_ACTIVE_HIGH>;
+
+		headset-detect-gpios = <&gpx0 4 GPIO_ACTIVE_LOW>;
+		headset-key-gpios = <&gpx3 6 GPIO_ACTIVE_LOW>;
+		headset-4pole-threshold-microvolt = <710 2000>;
+		headset-button-threshold-microvolt = <0 130 260>;
+		io-channel-names = "headset-detect";
+		io-channels = <&adc 0>;
 
 		audio-routing = "HP", "HPOUT1L",
 				"HP", "HPOUT1R",
@@ -345,6 +356,11 @@ wlan_pwrseq: sdhci3-pwrseq {
 	};
 };
 
+&adc {
+	vdd-supply = <&ldo3_reg>;
+	status = "okay";
+};
+
 &bus_acp {
 	devfreq = <&bus_dmc>;
 	status = "okay";
@@ -505,12 +521,11 @@ &i2c_4 {
 	wm1811: audio-codec@1a {
 		compatible = "wlf,wm1811";
 		reg = <0x1a>;
-		clocks = <&pmu_system_controller 0>;
-		clock-names = "MCLK1";
+		clocks = <&pmu_system_controller 0>,
+			 <&s5m8767_osc S2MPS11_CLK_BT>;
+		clock-names = "MCLK1", "MCLK2";
 		interrupt-controller;
 		#interrupt-cells = <2>;
-		interrupt-parent = <&gpx3>;
-		interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
 
 		gpio-controller;
 		#gpio-cells = <2>;

-- 
2.45.0
Re: [PATCH 3/3] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection
Posted by Krzysztof Kozlowski 1 year, 7 months ago
On 03/05/2024 20:55, Artur Weber wrote:
> Add the necessary properties to the samsung,midas-audio node to allow
> for headset jack detection, set up the mic bias regulator GPIO and fix
> some other small issues with the sound setup.
> 
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>

...

> +
>  &bus_acp {
>  	devfreq = <&bus_dmc>;
>  	status = "okay";
> @@ -505,12 +521,11 @@ &i2c_4 {
>  	wm1811: audio-codec@1a {
>  		compatible = "wlf,wm1811";
>  		reg = <0x1a>;
> -		clocks = <&pmu_system_controller 0>;
> -		clock-names = "MCLK1";
> +		clocks = <&pmu_system_controller 0>,
> +			 <&s5m8767_osc S2MPS11_CLK_BT>;
> +		clock-names = "MCLK1", "MCLK2";
>  		interrupt-controller;
>  		#interrupt-cells = <2>;
> -		interrupt-parent = <&gpx3>;
> -		interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;

Does not look related at all to the patch.


Best regards,
Krzysztof
Re: [PATCH 3/3] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection
Posted by Artur Weber 1 year, 7 months ago
On 6.05.2024 08:31, Krzysztof Kozlowski wrote:
> On 03/05/2024 20:55, Artur Weber wrote:
>> Add the necessary properties to the samsung,midas-audio node to allow
>> for headset jack detection, set up the mic bias regulator GPIO and fix
>> some other small issues with the sound setup.
>>
>> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
> 
> ...
> 
>> +
>>   &bus_acp {
>>   	devfreq = <&bus_dmc>;
>>   	status = "okay";
>> @@ -505,12 +521,11 @@ &i2c_4 {
>>   	wm1811: audio-codec@1a {
>>   		compatible = "wlf,wm1811";
>>   		reg = <0x1a>;
>> -		clocks = <&pmu_system_controller 0>;
>> -		clock-names = "MCLK1";
>> +		clocks = <&pmu_system_controller 0>,
>> +			 <&s5m8767_osc S2MPS11_CLK_BT>;
>> +		clock-names = "MCLK1", "MCLK2";
>>   		interrupt-controller;
>>   		#interrupt-cells = <2>;
>> -		interrupt-parent = <&gpx3>;
>> -		interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
> 
> Does not look related at all to the patch.

I rolled up two small changes to the wm1811 audio codec config here:

- Dropped incorrect interrupt parent - GPX3-6 is the headset key GPIO,
   and does not seem to be the interrupt parent like on Midas (downstream
   calls it GPIO_HDMI_CEC on Midas, whereas for Tab 3 it's
   GPIO_EAR_SEND_END, so they definitely serve different functions).

- Added the MCLK2 clock as specified in the schematics, to more
   accurately describe the hardware.

I included them here since the whole patch modifies properties related
to audio (this section is what "fix some other small issues with the
sound setup" in the commit message refers to), but I can split it up
into a separate commit if it's necessary.

Best regards
Artur
Re: [PATCH 3/3] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection
Posted by Krzysztof Kozlowski 1 year, 7 months ago
On 07/05/2024 14:44, Artur Weber wrote:
> On 6.05.2024 08:31, Krzysztof Kozlowski wrote:
>> On 03/05/2024 20:55, Artur Weber wrote:
>>> Add the necessary properties to the samsung,midas-audio node to allow
>>> for headset jack detection, set up the mic bias regulator GPIO and fix
>>> some other small issues with the sound setup.
>>>
>>> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
>>
>> ...
>>
>>> +
>>>   &bus_acp {
>>>   	devfreq = <&bus_dmc>;
>>>   	status = "okay";
>>> @@ -505,12 +521,11 @@ &i2c_4 {
>>>   	wm1811: audio-codec@1a {
>>>   		compatible = "wlf,wm1811";
>>>   		reg = <0x1a>;
>>> -		clocks = <&pmu_system_controller 0>;
>>> -		clock-names = "MCLK1";
>>> +		clocks = <&pmu_system_controller 0>,
>>> +			 <&s5m8767_osc S2MPS11_CLK_BT>;
>>> +		clock-names = "MCLK1", "MCLK2";
>>>   		interrupt-controller;
>>>   		#interrupt-cells = <2>;
>>> -		interrupt-parent = <&gpx3>;
>>> -		interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
>>
>> Does not look related at all to the patch.
> 
> I rolled up two small changes to the wm1811 audio codec config here:


https://elixir.bootlin.com/linux/v6.8-rc5/source/Documentation/process/submitting-patches.rst#L171



Best regards,
Krzysztof