xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/display/include/audio_types.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: audio_types.h,v 1.2 2021/12/18 23:45:07 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2012-15 Advanced Micro Devices, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors: AMD
25  *
26  */
27 
28 #ifndef __AUDIO_TYPES_H__
29 #define __AUDIO_TYPES_H__
30 
31 #include "signal_types.h"
32 
33 #define AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 20
34 #define MAX_HW_AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 18
35 #define MULTI_CHANNEL_SPLIT_NO_ASSO_INFO 0xFFFFFFFF
36 
37 
38 struct audio_crtc_info {
39 	uint32_t h_total;
40 	uint32_t h_active;
41 	uint32_t v_active;
42 	uint32_t pixel_repetition;
43 	uint32_t requested_pixel_clock_100Hz; /* in 100Hz */
44 	uint32_t calculated_pixel_clock_100Hz; /* in 100Hz */
45 	uint32_t refresh_rate;
46 	enum dc_color_depth color_depth;
47 	bool interlaced;
48 };
49 struct azalia_clock_info {
50 	uint32_t pixel_clock_in_10khz;
51 	uint32_t audio_dto_phase;
52 	uint32_t audio_dto_module;
53 	uint32_t audio_dto_wall_clock_ratio;
54 };
55 
56 enum audio_dto_source {
57 	DTO_SOURCE_UNKNOWN = 0,
58 	DTO_SOURCE_ID0,
59 	DTO_SOURCE_ID1,
60 	DTO_SOURCE_ID2,
61 	DTO_SOURCE_ID3,
62 	DTO_SOURCE_ID4,
63 	DTO_SOURCE_ID5
64 };
65 
66 /* PLL information required for AZALIA DTO calculation */
67 
68 struct audio_pll_info {
69 	uint32_t dp_dto_source_clock_in_khz;
70 	uint32_t feed_back_divider;
71 	enum audio_dto_source dto_source;
72 	bool ss_enabled;
73 	uint32_t ss_percentage;
74 	uint32_t ss_percentage_divider;
75 };
76 
77 struct audio_channel_associate_info {
78 	union {
79 		struct {
80 			uint32_t ALL_CHANNEL_FL:4;
81 			uint32_t ALL_CHANNEL_FR:4;
82 			uint32_t ALL_CHANNEL_FC:4;
83 			uint32_t ALL_CHANNEL_Sub:4;
84 			uint32_t ALL_CHANNEL_SL:4;
85 			uint32_t ALL_CHANNEL_SR:4;
86 			uint32_t ALL_CHANNEL_BL:4;
87 			uint32_t ALL_CHANNEL_BR:4;
88 		} bits;
89 		uint32_t u32all;
90 	};
91 };
92 
93 struct audio_output {
94 	/* Front DIG id. */
95 	enum engine_id engine_id;
96 	/* encoder output signal */
97 	enum signal_type signal;
98 	/* video timing */
99 	struct audio_crtc_info crtc_info;
100 	/* PLL for audio */
101 	struct audio_pll_info pll_info;
102 };
103 
104 enum audio_payload {
105 	CHANNEL_SPLIT_MAPPINGCHANG = 0x9,
106 };
107 
108 #endif /* __AUDIO_TYPES_H__ */
109