@@ -361,17 +361,16 @@ void msm_dp_catalog_ctrl_config_ctrl(struct msm_dp_catalog *msm_dp_catalog, u32
msm_dp_write_link(catalog, REG_DP_CONFIGURATION_CTRL, cfg);
}
-void msm_dp_catalog_ctrl_lane_mapping(struct msm_dp_catalog *msm_dp_catalog)
+void msm_dp_catalog_ctrl_lane_mapping(struct msm_dp_catalog *msm_dp_catalog, u32 *l_map)
{
struct msm_dp_catalog_private *catalog = container_of(msm_dp_catalog,
struct msm_dp_catalog_private, msm_dp_catalog);
- u32 ln_0 = 0, ln_1 = 1, ln_2 = 2, ln_3 = 3; /* One-to-One mapping */
u32 ln_mapping;
- ln_mapping = ln_0 << LANE0_MAPPING_SHIFT;
- ln_mapping |= ln_1 << LANE1_MAPPING_SHIFT;
- ln_mapping |= ln_2 << LANE2_MAPPING_SHIFT;
- ln_mapping |= ln_3 << LANE3_MAPPING_SHIFT;
+ ln_mapping = l_map[0] << LANE0_MAPPING_SHIFT;
+ ln_mapping |= l_map[1] << LANE1_MAPPING_SHIFT;
+ ln_mapping |= l_map[2] << LANE2_MAPPING_SHIFT;
+ ln_mapping |= l_map[3] << LANE3_MAPPING_SHIFT;
msm_dp_write_link(catalog, REG_DP_LOGICAL2PHYSICAL_LANE_MAPPING,
ln_mapping);
@@ -69,7 +69,7 @@ u32 msm_dp_catalog_aux_get_irq(struct msm_dp_catalog *msm_dp_catalog);
/* DP Controller APIs */
void msm_dp_catalog_ctrl_state_ctrl(struct msm_dp_catalog *msm_dp_catalog, u32 state);
void msm_dp_catalog_ctrl_config_ctrl(struct msm_dp_catalog *msm_dp_catalog, u32 config);
-void msm_dp_catalog_ctrl_lane_mapping(struct msm_dp_catalog *msm_dp_catalog);
+void msm_dp_catalog_ctrl_lane_mapping(struct msm_dp_catalog *msm_dp_catalog, u32 *l_map);
void msm_dp_catalog_ctrl_mainlink_ctrl(struct msm_dp_catalog *msm_dp_catalog, bool enable);
void msm_dp_catalog_ctrl_psr_mainlink_enable(struct msm_dp_catalog *msm_dp_catalog, bool enable);
void msm_dp_catalog_setup_peripheral_flush(struct msm_dp_catalog *msm_dp_catalog);
@@ -177,7 +177,7 @@ static void msm_dp_ctrl_configure_source_params(struct msm_dp_ctrl_private *ctrl
{
u32 cc, tb;
- msm_dp_catalog_ctrl_lane_mapping(ctrl->catalog);
+ msm_dp_catalog_ctrl_lane_mapping(ctrl->catalog, ctrl->panel->lane_map);
msm_dp_catalog_ctrl_mainlink_ctrl(ctrl->catalog, true);
msm_dp_catalog_setup_peripheral_flush(ctrl->catalog);
@@ -11,7 +11,6 @@
#include <drm/drm_of.h>
#include <drm/drm_print.h>
-#define DP_MAX_NUM_DP_LANES 4
#define DP_LINK_RATE_HBR2 540000 /* kbytes */
struct msm_dp_panel_private {
@@ -461,6 +460,7 @@ static int msm_dp_panel_parse_dt(struct msm_dp_panel *msm_dp_panel)
struct msm_dp_panel_private *panel;
struct device_node *of_node;
int cnt;
+ u32 lane_map[DP_MAX_NUM_DP_LANES] = {0, 1, 2, 3};
panel = container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel);
of_node = panel->dev->of_node;
@@ -474,10 +474,17 @@ static int msm_dp_panel_parse_dt(struct msm_dp_panel *msm_dp_panel)
cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
}
- if (cnt > 0)
+ if (cnt > 0) {
+ struct device_node *endpoint;
+
msm_dp_panel->max_dp_lanes = cnt;
- else
+ endpoint = of_graph_get_endpoint_by_regs(of_node, 1, -1);
+ of_property_read_u32_array(endpoint, "data-lanes", lane_map, cnt);
+ } else {
msm_dp_panel->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */
+ }
+
+ memcpy(msm_dp_panel->lane_map, lane_map, msm_dp_panel->max_dp_lanes * sizeof(u32));
msm_dp_panel->max_dp_link_rate = msm_dp_panel_link_frequencies(of_node);
if (!msm_dp_panel->max_dp_link_rate)
@@ -11,6 +11,8 @@
#include "dp_aux.h"
#include "dp_link.h"
+#define DP_MAX_NUM_DP_LANES 4
+
struct edid;
struct msm_dp_display_mode {
@@ -46,6 +48,7 @@ struct msm_dp_panel {
bool video_test;
bool vsc_sdp_supported;
+ u32 lane_map[DP_MAX_NUM_DP_LANES];
u32 max_dp_lanes;
u32 max_dp_link_rate;
Add the ability to configure lane mapping for the DP controller. This is required when the platform's lane mapping does not follow the default order (0, 1, 2, 3). The mapping rules are now configurable via the `data-lane` property in the devicetree. This property defines the logical-to-physical lane mapping sequence, ensuring correct lane assignment for non-default configurations. Signed-off-by: Xiangxu Yin <quic_xiangxuy@quicinc.com> --- drivers/gpu/drm/msm/dp/dp_catalog.c | 11 +++++------ drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +- drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 +- drivers/gpu/drm/msm/dp/dp_panel.c | 13 ++++++++++--- drivers/gpu/drm/msm/dp/dp_panel.h | 3 +++ 5 files changed, 20 insertions(+), 11 deletions(-)