Skip to content

Commit c156fe2

Browse files
alexVinarskislumag
authored andcommitted
drm/msm/dp: Account for LTTPRs capabilities
Take into account LTTPR capabilities when selecting maximum allowed link rate, number of data lines. Fixes: 72d0af4 ("drm/msm/dp: Add support for LTTPR handling") Reviewed-by: Abel Vesa <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Aleksandrs Vinarskis <[email protected]> Tested-by: Jessica Zhang <[email protected]> # SA8775P Tested-by: Johan Hovold <[email protected]> Tested-by: Rob Clark <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/652302/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 9351d3d commit c156fe2

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,12 @@ static int msm_dp_display_send_hpd_notification(struct msm_dp_display_private *d
362362

363363
static void msm_dp_display_lttpr_init(struct msm_dp_display_private *dp, u8 *dpcd)
364364
{
365-
u8 lttpr_caps[DP_LTTPR_COMMON_CAP_SIZE];
366365
int rc;
367366

368-
if (drm_dp_read_lttpr_common_caps(dp->aux, dpcd, lttpr_caps))
367+
if (drm_dp_read_lttpr_common_caps(dp->aux, dpcd, dp->link->lttpr_common_caps))
369368
return;
370369

371-
rc = drm_dp_lttpr_init(dp->aux, drm_dp_lttpr_count(lttpr_caps));
370+
rc = drm_dp_lttpr_init(dp->aux, drm_dp_lttpr_count(dp->link->lttpr_common_caps));
372371
if (rc)
373372
DRM_ERROR("failed to set LTTPRs transparency mode, rc=%d\n", rc);
374373
}

drivers/gpu/drm/msm/dp/dp_link.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define _DP_LINK_H_
88

99
#include "dp_aux.h"
10+
#include <drm/display/drm_dp_helper.h>
1011

1112
#define DS_PORT_STATUS_CHANGED 0x200
1213
#define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF
@@ -60,6 +61,8 @@ struct msm_dp_link_phy_params {
6061
};
6162

6263
struct msm_dp_link {
64+
u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE];
65+
6366
u32 sink_request;
6467
u32 test_response;
6568

drivers/gpu/drm/msm/dp/dp_panel.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static void msm_dp_panel_read_psr_cap(struct msm_dp_panel_private *panel)
4747

4848
static int msm_dp_panel_read_dpcd(struct msm_dp_panel *msm_dp_panel)
4949
{
50-
int rc;
50+
int rc, max_lttpr_lanes, max_lttpr_rate;
5151
struct msm_dp_panel_private *panel;
5252
struct msm_dp_link_info *link_info;
5353
u8 *dpcd, major, minor;
@@ -75,6 +75,16 @@ static int msm_dp_panel_read_dpcd(struct msm_dp_panel *msm_dp_panel)
7575
if (link_info->rate > msm_dp_panel->max_dp_link_rate)
7676
link_info->rate = msm_dp_panel->max_dp_link_rate;
7777

78+
/* Limit data lanes from LTTPR capabilities, if any */
79+
max_lttpr_lanes = drm_dp_lttpr_max_lane_count(panel->link->lttpr_common_caps);
80+
if (max_lttpr_lanes && max_lttpr_lanes < link_info->num_lanes)
81+
link_info->num_lanes = max_lttpr_lanes;
82+
83+
/* Limit link rate from LTTPR capabilities, if any */
84+
max_lttpr_rate = drm_dp_lttpr_max_link_rate(panel->link->lttpr_common_caps);
85+
if (max_lttpr_rate && max_lttpr_rate < link_info->rate)
86+
link_info->rate = max_lttpr_rate;
87+
7888
drm_dbg_dp(panel->drm_dev, "version: %d.%d\n", major, minor);
7989
drm_dbg_dp(panel->drm_dev, "link_rate=%d\n", link_info->rate);
8090
drm_dbg_dp(panel->drm_dev, "lane_count=%d\n", link_info->num_lanes);

0 commit comments

Comments
 (0)