diff mbox series

[2/2] arm64: tegra: Audio codec support on Jetson AGX Orin

Message ID 1675953417-8686-3-git-send-email-spujar@nvidia.com
State Changes Requested
Headers show
Series Codec support on Jetson AGX Orin | expand

Commit Message

Sameer Pujar Feb. 9, 2023, 2:36 p.m. UTC
Jetson AGX Orin has onboard RT5640 audio codec. This patch adds the
codec device node and the bindings to I2S1 interface.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts  | 47 +++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski Feb. 10, 2023, 8:45 a.m. UTC | #1
On 09/02/2023 15:36, Sameer Pujar wrote:
> Jetson AGX Orin has onboard RT5640 audio codec. This patch adds the
> codec device node and the bindings to I2S1 interface.
> 
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
>  .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts  | 47 +++++++++++++++++++++-
>  1 file changed, 46 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
> index 8a97478..5881fbf 100644
> --- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
> +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
> @@ -3,6 +3,7 @@
>  
>  #include <dt-bindings/input/linux-event-codes.h>
>  #include <dt-bindings/input/gpio-keys.h>
> +#include <dt-bindings/sound/rt5640.h>
>  
>  #include "tegra234-p3701-0000.dtsi"
>  #include "tegra234-p3737-0000.dtsi"
> @@ -49,7 +50,7 @@
>  
>  							i2s1_dap: endpoint {
>  								dai-format = "i2s";
> -								/* placeholder for external codec */
> +								remote-endpoint = <&rt5640_ep>;
>  							};
>  						};
>  					};
> @@ -2017,6 +2018,32 @@
>  			status = "okay";
>  		};
>  
> +		i2c@31e0000 {
> +			status = "okay";
> +
> +			audio-codec@1c {
> +				status = "okay";

Are you sure you need this?

Best regards,
Krzysztof
Sameer Pujar Feb. 10, 2023, 9:02 a.m. UTC | #2
On 10-02-2023 14:15, Krzysztof Kozlowski wrote:
> On 09/02/2023 15:36, Sameer Pujar wrote:
>> Jetson AGX Orin has onboard RT5640 audio codec. This patch adds the
>> codec device node and the bindings to I2S1 interface.
>>
>> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
>> ---
>>   .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts  | 47 +++++++++++++++++++++-
>>   1 file changed, 46 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
>> index 8a97478..5881fbf 100644
>> --- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
>> +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
>> @@ -3,6 +3,7 @@
>>
>>   #include <dt-bindings/input/linux-event-codes.h>
>>   #include <dt-bindings/input/gpio-keys.h>
>> +#include <dt-bindings/sound/rt5640.h>
>>
>>   #include "tegra234-p3701-0000.dtsi"
>>   #include "tegra234-p3737-0000.dtsi"
>> @@ -49,7 +50,7 @@
>>
>>                                                        i2s1_dap: endpoint {
>>                                                                dai-format = "i2s";
>> -                                                             /* placeholder for external codec */
>> +                                                             remote-endpoint = <&rt5640_ep>;
>>                                                        };
>>                                                };
>>                                        };
>> @@ -2017,6 +2018,32 @@
>>                        status = "okay";
>>                };
>>
>> +             i2c@31e0000 {
>> +                     status = "okay";
>> +

>> +                     audio-codec@1c {
>> +                             status = "okay";
> Are you sure you need this?
I can drop this in v2 as it would be the default state and it is not 
disabled anywhere else. Thanks.
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
index 8a97478..5881fbf 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
@@ -3,6 +3,7 @@ 
 
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/sound/rt5640.h>
 
 #include "tegra234-p3701-0000.dtsi"
 #include "tegra234-p3737-0000.dtsi"
@@ -49,7 +50,7 @@ 
 
 							i2s1_dap: endpoint {
 								dai-format = "i2s";
-								/* placeholder for external codec */
+								remote-endpoint = <&rt5640_ep>;
 							};
 						};
 					};
@@ -2017,6 +2018,32 @@ 
 			status = "okay";
 		};
 
+		i2c@31e0000 {
+			status = "okay";
+
+			audio-codec@1c {
+				status = "okay";
+
+				compatible = "realtek,rt5640";
+				reg = <0x1c>;
+				interrupt-parent = <&gpio>;
+				interrupts = <TEGRA234_MAIN_GPIO(AC, 5) GPIO_ACTIVE_HIGH>;
+				clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
+				clock-names = "mclk";
+				realtek,dmic1-data-pin = <RT5640_DMIC1_DATA_PIN_NONE>;
+				realtek,dmic2-data-pin = <RT5640_DMIC2_DATA_PIN_NONE>;
+				realtek,jack-detect-source = <RT5640_JD_SRC_HDA_HEADER>;
+				sound-name-prefix = "CVB-RT";
+
+				port {
+					rt5640_ep: endpoint {
+						remote-endpoint = <&i2s1_dap>;
+						mclk-fs = <256>;
+					};
+				};
+			};
+		};
+
 		pwm@32a0000 {
 			assigned-clocks = <&bpmp TEGRA234_CLK_PWM3>;
 			assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>;
@@ -2293,5 +2320,23 @@ 
 		       <&dmic3_port>;
 
 		label = "NVIDIA Jetson AGX Orin APE";
+
+		widgets = "Microphone",	"CVB-RT MIC Jack",
+			  "Microphone",	"CVB-RT MIC",
+			  "Headphone",	"CVB-RT HP Jack",
+			  "Speaker",	"CVB-RT SPK";
+
+		routing = /* I2S1 <-> RT5640 */
+			  "CVB-RT AIF1 Playback",	"I2S1 DAP-Playback",
+			  "I2S1 DAP-Capture",		"CVB-RT AIF1 Capture",
+			  /* RT5640 codec controls */
+			  "CVB-RT HP Jack",		"CVB-RT HPOL",
+			  "CVB-RT HP Jack",		"CVB-RT HPOR",
+			  "CVB-RT IN1P",		"CVB-RT MIC Jack",
+			  "CVB-RT IN2P",		"CVB-RT MIC Jack",
+			  "CVB-RT SPK",			"CVB-RT SPOLP",
+			  "CVB-RT SPK",			"CVB-RT SPORP",
+			  "CVB-RT DMIC1",		"CVB-RT MIC",
+			  "CVB-RT DMIC2",		"CVB-RT MIC";
 	};
 };