2 * Copyright 2018 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #ifndef __DAL_DCCG_H__
27 #define __DAL_DCCG_H__
30 #include "hw_shared.h"
32 enum phyd32clk_clock_source {
42 enum physymclk_clock_source {
43 PHYSYMCLK_FORCE_SRC_SYMCLK, // Select symclk as source of clock which is output to PHY through DCIO.
44 PHYSYMCLK_FORCE_SRC_PHYD18CLK, // Select phyd18clk as the source of clock which is output to PHY through DCIO.
45 PHYSYMCLK_FORCE_SRC_PHYD32CLK, // Select phyd32clk as the source of clock which is output to PHY through DCIO.
48 enum streamclk_source {
49 REFCLK, // Selects REFCLK as source for hdmistreamclk.
50 DTBCLK0, // Selects DTBCLK0 as source for hdmistreamclk.
51 DPREFCLK, // Selects DPREFCLK as source for hdmistreamclk
54 enum dentist_dispclk_change_mode {
55 DISPCLK_CHANGE_MODE_IMMEDIATE,
56 DISPCLK_CHANGE_MODE_RAMPING,
59 struct dp_dto_params {
61 enum signal_type signal;
62 enum streamclk_source clk_src;
68 PIXEL_RATE_DIV_BY_1 = 0,
69 PIXEL_RATE_DIV_BY_2 = 1,
70 PIXEL_RATE_DIV_BY_4 = 3,
71 PIXEL_RATE_DIV_NA = 0xF
75 struct dc_context *ctx;
76 const struct dccg_funcs *funcs;
77 int pipe_dppclk_khz[MAX_PIPES];
79 bool dpp_clock_gated[MAX_PIPES];
80 //int dtbclk_khz[MAX_PIPES];/* TODO needs to be removed */
81 //int audio_dtbclk_khz;/* TODO needs to be removed */
82 //int ref_dtbclk_khz;/* TODO needs to be removed */
85 struct dtbclk_dto_params {
86 const struct dc_crtc_timing *timing;
89 int req_audio_dtbclk_khz;
96 void (*update_dpp_dto)(struct dccg *dccg,
99 void (*get_dccg_ref_freq)(struct dccg *dccg,
100 unsigned int xtalin_freq_inKhz,
101 unsigned int *dccg_ref_freq_inKhz);
102 void (*set_fifo_errdet_ovr_en)(struct dccg *dccg,
104 void (*otg_add_pixel)(struct dccg *dccg,
106 void (*otg_drop_pixel)(struct dccg *dccg,
108 void (*dccg_init)(struct dccg *dccg);
109 void (*set_dpstreamclk_root_clock_gating)(
114 void (*set_dpstreamclk)(
116 enum streamclk_source src,
120 void (*enable_symclk32_se)(
123 enum phyd32clk_clock_source phyd32clk);
125 void (*disable_symclk32_se)(
129 void (*enable_symclk32_le)(
132 enum phyd32clk_clock_source phyd32clk);
134 void (*disable_symclk32_le)(
138 void (*set_symclk32_le_root_clock_gating)(
143 void (*set_physymclk)(
146 enum physymclk_clock_source clk_src,
149 void (*set_physymclk_root_clock_gating)(
154 void (*set_dtbclk_dto)(
156 const struct dtbclk_dto_params *params);
158 void (*set_audio_dtbclk_dto)(
160 const struct dtbclk_dto_params *params);
162 void (*set_dispclk_change_mode)(
164 enum dentist_dispclk_change_mode change_mode);
174 void (*set_pixel_rate_div)(struct dccg *dccg,
176 enum pixel_rate_div k1,
177 enum pixel_rate_div k2);
179 void (*get_pixel_rate_div)(struct dccg *dccg,
181 uint32_t *div_factor1,
182 uint32_t *div_factor2);
184 void (*set_valid_pixel_rate)(
190 void (*trigger_dio_fifo_resync)(
193 void (*dpp_root_clock_control)(
195 unsigned int dpp_inst,
198 void (*enable_symclk_se)(
200 uint32_t stream_enc_inst,
201 uint32_t link_enc_inst);
203 void (*disable_symclk_se)(
205 uint32_t stream_enc_inst,
206 uint32_t link_enc_inst);
209 const struct dp_dto_params *params);
210 void (*set_dtbclk_p_src)(
212 enum streamclk_source src,
214 void (*set_dto_dscclk)(struct dccg *dccg, uint32_t dsc_inst);
215 void (*set_ref_dscclk)(struct dccg *dccg, uint32_t dsc_inst);
216 void (*dccg_root_gate_disable_control)(struct dccg *dccg, uint32_t pipe_idx, uint32_t disable_clock_gating);
219 #endif //__DAL_DCCG_H__