1/*
2 * Copyright (c) 2025 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/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_SUBCLASS_UNDEFINED>;
16
17		/* Clock supporting 48KHz
18		 *
19		 * Since the incoming audio may be between 8 and 48 KHz, we always upsample to 48KHz
20		 */
21		uac_aclk: aclk {
22			compatible = "zephyr,uac2-clock-source";
23			clock-type = "internal-programmable";
24			frequency-control = "read-only";
25			sampling-frequencies = <48000>;
26			/* Falsely claim synchronous audio because we
27			 * currently don't calculate feedback value
28			 */
29			sof-synchronized;
30		};
31
32		/* USB Audio terminal from USB host to USB device */
33		out_terminal: out_terminal {
34			compatible = "zephyr,uac2-input-terminal";
35			clock-source = <&uac_aclk>;
36			terminal-type = <USB_TERMINAL_STREAMING>;
37			front-left;
38			front-right;
39		};
40
41		as_iso_out: out_interface {
42			compatible = "zephyr,uac2-audio-streaming";
43			linked-terminal = <&out_terminal>;
44			subslot-size = <2>;
45			bit-resolution = <16>;
46		};
47
48		/* USB Audio terminal from USB device to USB host */
49		in_terminal: in_terminal {
50			compatible = "zephyr,uac2-output-terminal";
51			data-source = <&bt_input>;
52			clock-source = <&uac_aclk>;
53			terminal-type = <USB_TERMINAL_STREAMING>;
54		};
55
56		as_iso_in: in_interface {
57			compatible = "zephyr,uac2-audio-streaming";
58			linked-terminal = <&in_terminal>;
59			subslot-size = <2>;
60			bit-resolution = <16>;
61		};
62
63		/* The bt_output terminal defines what we are sending over Bluetooth */
64		bt_output: headphones {
65			compatible = "zephyr,uac2-output-terminal";
66			data-source = <&out_terminal>;
67			clock-source = <&uac_aclk>;
68			terminal-type = <BIDIRECTIONAL_TERMINAL_UNDEFINED>;
69			assoc-terminal = <&bt_input>;
70		};
71
72		/* The bt_input terminal defines what we are receiving over Bluetooth */
73		bt_input: microphone {
74			compatible = "zephyr,uac2-input-terminal";
75			clock-source = <&uac_aclk>;
76			terminal-type = <BIDIRECTIONAL_TERMINAL_UNDEFINED>;
77			/* Circular reference, macros will figure it out and
78			 * provide correct associated terminal ID because the
79			 * terminals associations are always 1-to-1.
80			 *
81			 * assoc-terminal = <&bt_output>;
82			 */
83			front-left;
84			front-right;
85		};
86	};
87};
88