1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <dt-bindings/usb/audio.h>
8
9/ {
10	uac2_headset: usb_audio2 {
11		compatible = "zephyr,uac2";
12		status = "okay";
13		full-speed;
14		high-speed;
15		audio-function = <AUDIO_FUNCTION_HEADSET>;
16
17		uac_aclk: aclk {
18			compatible = "zephyr,uac2-clock-source";
19			clock-type = "internal-programmable";
20			frequency-control = "host-programmable";
21			sampling-frequencies = <48000>;
22		};
23
24		out_terminal: out_terminal {
25			compatible = "zephyr,uac2-input-terminal";
26			clock-source = <&uac_aclk>;
27			terminal-type = <USB_TERMINAL_STREAMING>;
28			front-left;
29			front-right;
30		};
31
32		out_feature_unit: out_feature_unit {
33			compatible = "zephyr,uac2-feature-unit";
34			data-source = <&out_terminal>;
35			mute-control = "host-programmable";
36			automatic-gain-control =
37				"host-programmable" /* Primary */,
38				"host-programmable" /* Channel 1 */,
39				"host-programmable" /* Channel 2 */;
40		};
41
42		headphones_output: headphones {
43			compatible = "zephyr,uac2-output-terminal";
44			data-source = <&out_feature_unit>;
45			clock-source = <&uac_aclk>;
46			terminal-type = <BIDIRECTIONAL_TERMINAL_HEADSET>;
47			assoc-terminal = <&mic_input>;
48		};
49
50		mic_input: microphone {
51			compatible = "zephyr,uac2-input-terminal";
52			clock-source = <&uac_aclk>;
53			terminal-type = <BIDIRECTIONAL_TERMINAL_HEADSET>;
54			/* Circular reference, macros will figure it out and
55			 * provide correct associated terminal ID because the
56			 * terminals associations are always 1-to-1.
57			 *
58			 * assoc-terminal = <&headphones_output>;
59			 */
60			front-left;
61		};
62
63		in_feature_unit: in_feature_unit {
64			compatible = "zephyr,uac2-feature-unit";
65			data-source = <&mic_input>;
66			mute-control = "host-programmable";
67			automatic-gain-control =
68				"not-present" /* Primary */,
69				"host-programmable" /* Channel 1 */;
70		};
71
72		in_terminal: in_terminal {
73			compatible = "zephyr,uac2-output-terminal";
74			data-source = <&in_feature_unit>;
75			clock-source = <&uac_aclk>;
76			terminal-type = <USB_TERMINAL_STREAMING>;
77		};
78
79		as_iso_out: out_interface {
80			compatible = "zephyr,uac2-audio-streaming";
81			linked-terminal = <&out_terminal>;
82			implicit-feedback;
83			subslot-size = <2>;
84			bit-resolution = <16>;
85		};
86
87		as_iso_in: in_interface {
88			compatible = "zephyr,uac2-audio-streaming";
89			linked-terminal = <&in_terminal>;
90			implicit-feedback;
91			subslot-size = <2>;
92			bit-resolution = <16>;
93		};
94	};
95};
96
97/ {
98	hs_uac2_headphones: hs_usb_audio2 {
99		compatible = "zephyr,uac2";
100		status = "okay";
101		high-speed;
102		audio-function = <AUDIO_FUNCTION_OTHER>;
103
104		hs_uac_aclk: hs_aclk {
105			compatible = "zephyr,uac2-clock-source";
106			clock-type = "internal-programmable";
107			frequency-control = "host-programmable";
108			sampling-frequencies = <192000>;
109		};
110
111		hs_out_terminal: hs_out_terminal {
112			compatible = "zephyr,uac2-input-terminal";
113			clock-source = <&hs_uac_aclk>;
114			terminal-type = <USB_TERMINAL_STREAMING>;
115			front-left;
116			front-right;
117		};
118
119		hs_headphones_output: hs_headphones {
120			compatible = "zephyr,uac2-output-terminal";
121			data-source = <&hs_out_terminal>;
122			clock-source = <&hs_uac_aclk>;
123			terminal-type = <OUTPUT_TERMINAL_HEADPHONES>;
124		};
125
126		hs_as_iso_out: hs_out_interface {
127			compatible = "zephyr,uac2-audio-streaming";
128			linked-terminal = <&hs_out_terminal>;
129			subslot-size = <3>;
130			bit-resolution = <24>;
131		};
132	};
133};
134