1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #ifndef __DC_CLOCK_SOURCE_H__
27 #define __DC_CLOCK_SOURCE_H__
28
29 #include "dc_types.h"
30 #include "include/grph_object_id.h"
31 #include "include/bios_parser_types.h"
32
33 struct clock_source;
34
35 struct spread_spectrum_data {
36 uint32_t percentage;
37 uint32_t percentage_divider;
38 uint32_t freq_range_khz;
39 uint32_t modulation_freq_hz;
40
41 struct spread_spectrum_flags flags;
42 };
43
44 struct delta_sigma_data {
45 uint32_t feedback_amount;
46 uint32_t nfrac_amount;
47 uint32_t ds_frac_size;
48 uint32_t ds_frac_amount;
49 };
50
51
52
53
54
55
56 struct pixel_clk_flags {
57 uint32_t ENABLE_SS:1;
58 uint32_t DISPLAY_BLANKED:1;
59 uint32_t PROGRAM_PIXEL_CLOCK:1;
60 uint32_t PROGRAM_ID_CLOCK:1;
61 uint32_t SUPPORT_YCBCR420:1;
62 };
63
64
65
66
67
68 struct csdp_ref_clk_ds_params {
69 bool hw_dso_n_dp_ref_clk;
70
71 uint32_t avg_dp_ref_clk_khz;
72
73 uint32_t ss_percentage_on_dp_ref_clk;
74
75
76 uint32_t ss_percentage_divider;
77
78 };
79
80 struct pixel_clk_params {
81 uint32_t requested_pix_clk_100hz;
82
83
84 uint32_t requested_sym_clk;
85
86 uint32_t dp_ref_clk;
87
88 struct graphics_object_id encoder_object_id;
89
90 enum signal_type signal_type;
91
92 enum controller_id controller_id;
93
94 enum dc_color_depth color_depth;
95 struct csdp_ref_clk_ds_params de_spread_params;
96
97 enum dc_pixel_encoding pixel_encoding;
98 struct pixel_clk_flags flags;
99 };
100
101
102
103
104
105
106 struct pll_settings {
107 uint32_t actual_pix_clk_100hz;
108 uint32_t adjusted_pix_clk_100hz;
109 uint32_t calculated_pix_clk_100hz;
110 uint32_t vco_freq;
111 uint32_t reference_freq;
112 uint32_t reference_divider;
113 uint32_t feedback_divider;
114 uint32_t fract_feedback_divider;
115 uint32_t pix_clk_post_divider;
116 uint32_t ss_percentage;
117 bool use_external_clk;
118 };
119
120 struct calc_pll_clock_source_init_data {
121 struct dc_bios *bp;
122 uint32_t min_pix_clk_pll_post_divider;
123 uint32_t max_pix_clk_pll_post_divider;
124 uint32_t min_pll_ref_divider;
125 uint32_t max_pll_ref_divider;
126 uint32_t min_override_input_pxl_clk_pll_freq_khz;
127
128
129 uint32_t max_override_input_pxl_clk_pll_freq_khz;
130
131
132 uint32_t num_fract_fb_divider_decimal_point;
133
134
135 uint32_t num_fract_fb_divider_decimal_point_precision;
136
137 struct dc_context *ctx;
138
139 };
140
141 struct calc_pll_clock_source {
142 uint32_t ref_freq_khz;
143 uint32_t min_pix_clock_pll_post_divider;
144 uint32_t max_pix_clock_pll_post_divider;
145 uint32_t min_pll_ref_divider;
146 uint32_t max_pll_ref_divider;
147
148 uint32_t max_vco_khz;
149 uint32_t min_vco_khz;
150 uint32_t min_pll_input_freq_khz;
151 uint32_t max_pll_input_freq_khz;
152
153 uint32_t fract_fb_divider_decimal_points_num;
154 uint32_t fract_fb_divider_factor;
155 uint32_t fract_fb_divider_precision;
156 uint32_t fract_fb_divider_precision_factor;
157 struct dc_context *ctx;
158 };
159
160 struct clock_source_funcs {
161 bool (*cs_power_down)(
162 struct clock_source *);
163 bool (*program_pix_clk)(struct clock_source *,
164 struct pixel_clk_params *, struct pll_settings *);
165 uint32_t (*get_pix_clk_dividers)(
166 struct clock_source *,
167 struct pixel_clk_params *,
168 struct pll_settings *);
169 bool (*get_pixel_clk_frequency_100hz)(
170 const struct clock_source *clock_source,
171 unsigned int inst,
172 unsigned int *pixel_clk_khz);
173 };
174
175 struct clock_source {
176 const struct clock_source_funcs *funcs;
177 struct dc_context *ctx;
178 enum clock_source_id id;
179 bool dp_clk_src;
180 };
181
182 #endif