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