Skip to content

Commit ffc12bd

Browse files
Peichen Huanggregkh
authored andcommitted
drm/amd/display: Add dc cap for dp tunneling
commit 3251b69 upstream. [WHAT] 1. add dc cap for dp tunneling 2. add function to get index of host router Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Cruise Hung <cruise.hung@amd.com> Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 29e178d) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3f4e601 commit ffc12bd

7 files changed

Lines changed: 55 additions & 1 deletion

File tree

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ static bool create_links(
239239
DC_LOG_DC("BIOS object table - end");
240240

241241
/* Create a link for each usb4 dpia port */
242+
dc->lowest_dpia_link_index = MAX_LINKS;
242243
for (i = 0; i < dc->res_pool->usb4_dpia_count; i++) {
243244
struct link_init_data link_init_params = {0};
244245
struct dc_link *link;
@@ -251,6 +252,9 @@ static bool create_links(
251252

252253
link = dc->link_srv->create_link(&link_init_params);
253254
if (link) {
255+
if (dc->lowest_dpia_link_index > dc->link_count)
256+
dc->lowest_dpia_link_index = dc->link_count;
257+
254258
dc->links[dc->link_count] = link;
255259
link->dc = dc;
256260
++dc->link_count;
@@ -6247,6 +6251,35 @@ struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state
62476251
profile.power_level = dc->res_pool->funcs->get_power_profile(context);
62486252
return profile;
62496253
}
6254+
/**
6255+
***********************************************************************************************
6256+
* dc_get_host_router_index: Get index of host router from a dpia link
6257+
*
6258+
* This function return a host router index of the target link. If the target link is dpia link.
6259+
*
6260+
* @param [in] link: target link
6261+
* @param [out] host_router_index: host router index of the target link
6262+
*
6263+
* @return: true if the host router index is found and valid.
6264+
*
6265+
***********************************************************************************************
6266+
*/
6267+
bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index)
6268+
{
6269+
struct dc *dc = link->ctx->dc;
6270+
6271+
if (link->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
6272+
return false;
6273+
6274+
if (link->link_index < dc->lowest_dpia_link_index)
6275+
return false;
6276+
6277+
*host_router_index = (link->link_index - dc->lowest_dpia_link_index) / dc->caps.num_of_dpias_per_host_router;
6278+
if (*host_router_index < dc->caps.num_of_host_routers)
6279+
return true;
6280+
else
6281+
return false;
6282+
}
62506283

62516284
/*
62526285
**********************************************************************************

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct dmub_notification;
6666
#define MAX_STREAMS 6
6767
#define MIN_VIEWPORT_SIZE 12
6868
#define MAX_NUM_EDP 2
69-
#define MAX_HOST_ROUTERS_NUM 2
69+
#define MAX_HOST_ROUTERS_NUM 3
70+
#define MAX_DPIA_PER_HOST_ROUTER 2
7071

7172
/* Display Core Interfaces */
7273
struct dc_versions {
@@ -303,6 +304,8 @@ struct dc_caps {
303304
/* Conservative limit for DCC cases which require ODM4:1 to support*/
304305
uint32_t dcc_plane_width_limit;
305306
struct dc_scl_caps scl_caps;
307+
uint8_t num_of_host_routers;
308+
uint8_t num_of_dpias_per_host_router;
306309
};
307310

308311
struct dc_bug_wa {
@@ -1431,6 +1434,7 @@ struct dc {
14311434

14321435
uint8_t link_count;
14331436
struct dc_link *links[MAX_LINKS];
1437+
uint8_t lowest_dpia_link_index;
14341438
struct link_service *link_srv;
14351439

14361440
struct dc_state *current_state;
@@ -2586,6 +2590,8 @@ struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state
25862590

25872591
unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context);
25882592

2593+
bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index);
2594+
25892595
/* DSC Interfaces */
25902596
#include "dc_dsc.h"
25912597

drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,9 @@ static bool dcn31_resource_construct(
19541954
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
19551955
dc->caps.color.mpc.ocsc = 1;
19561956

1957+
dc->caps.num_of_host_routers = 2;
1958+
dc->caps.num_of_dpias_per_host_router = 2;
1959+
19571960
/* Use pipe context based otg sync logic */
19581961
dc->config.use_pipe_ctx_sync_logic = true;
19591962
dc->config.disable_hbr_audio_dp2 = true;

drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,9 @@ static bool dcn314_resource_construct(
18851885

18861886
dc->caps.max_disp_clock_khz_at_vmin = 650000;
18871887

1888+
dc->caps.num_of_host_routers = 2;
1889+
dc->caps.num_of_dpias_per_host_router = 2;
1890+
18881891
/* Use pipe context based otg sync logic */
18891892
dc->config.use_pipe_ctx_sync_logic = true;
18901893

drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,9 @@ static bool dcn35_resource_construct(
18941894
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18951895
dc->caps.color.mpc.ocsc = 1;
18961896

1897+
dc->caps.num_of_host_routers = 2;
1898+
dc->caps.num_of_dpias_per_host_router = 2;
1899+
18971900
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18981901
* to provide some margin.
18991902
* It's expected for furture ASIC to have equal or higher value, in order to

drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,9 @@ static bool dcn351_resource_construct(
18661866
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18671867
dc->caps.color.mpc.ocsc = 1;
18681868

1869+
dc->caps.num_of_host_routers = 2;
1870+
dc->caps.num_of_dpias_per_host_router = 2;
1871+
18691872
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18701873
* to provide some margin.
18711874
* It's expected for furture ASIC to have equal or higher value, in order to

drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,9 @@ static bool dcn36_resource_construct(
18671867
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18681868
dc->caps.color.mpc.ocsc = 1;
18691869

1870+
dc->caps.num_of_host_routers = 2;
1871+
dc->caps.num_of_dpias_per_host_router = 2;
1872+
18701873
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18711874
* to provide some margin.
18721875
* It's expected for furture ASIC to have equal or higher value, in order to

0 commit comments

Comments
 (0)