Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: move get_link_hwss to dc_resource

[why]
Isolate the way to obtain link_hwss from the actual implemenation of
link_hwss. So the caller can call link_hwss without knowing the
implementation detail of link_hwss.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenjing Liu and committed by
Alex Deucher
2750caff dfabe597

+85 -19
+33
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 3310 3310 #endif 3311 3311 return phy_idx; 3312 3312 } 3313 + 3314 + const struct link_hwss *get_link_hwss(const struct dc_link *link, 3315 + const struct link_resource *link_res) 3316 + { 3317 + /* Link_hwss is only accessible by getter function instead of accessing 3318 + * by pointers in dc with the intent to protect against breaking polymorphism. 3319 + */ 3320 + if (can_use_hpo_dp_link_hwss(link, link_res)) 3321 + /* TODO: some assumes that if decided link settings is 128b/132b 3322 + * channel coding format hpo_dp_link_enc should be used. 3323 + * Others believe that if hpo_dp_link_enc is available in link 3324 + * resource then hpo_dp_link_enc must be used. This bound between 3325 + * hpo_dp_link_enc != NULL and decided link settings is loosely coupled 3326 + * with a premise that both hpo_dp_link_enc pointer and decided link 3327 + * settings are determined based on single policy function like 3328 + * "decide_link_settings" from upper layer. This "convention" 3329 + * cannot be maintained and enforced at current level. 3330 + * Therefore a refactor is due so we can enforce a strong bound 3331 + * between those two parameters at this level. 3332 + * 3333 + * To put it simple, we want to make enforcement at low level so that 3334 + * we will not return link hwss if caller plans to do 8b/10b 3335 + * with an hpo encoder. Or we can return a very dummy one that doesn't 3336 + * do work for all functions 3337 + */ 3338 + return get_hpo_dp_link_hwss(); 3339 + else if (can_use_dpia_link_hwss(link, link_res)) 3340 + return get_dpia_link_hwss(); 3341 + else if (can_use_dio_link_hwss(link, link_res)) 3342 + return get_dio_link_hwss(); 3343 + else 3344 + return get_virtual_link_hwss(); 3345 + }
+3
drivers/gpu/drm/amd/display/dc/inc/resource.h
··· 213 213 uint8_t disabled_master_pipe_idx); 214 214 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter); 215 215 216 + const struct link_hwss *get_link_hwss(const struct dc_link *link, 217 + const struct link_resource *link_res); 218 + 216 219 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */