int rc = 0;
        struct edid *edid;
 
-       dp->panel->max_dp_lanes = dp->parser->max_dp_lanes;
-       dp->panel->max_dp_link_rate = dp->parser->max_dp_link_rate;
-
-       drm_dbg_dp(dp->drm_dev, "max_lanes=%d max_link_rate=%d\n",
-               dp->panel->max_dp_lanes, dp->panel->max_dp_link_rate);
-
        rc = dp_panel_read_sink_caps(dp->panel, dp->dp_display.connector);
        if (rc)
                goto end;
        dp->audio_supported = drm_detect_monitor_audio(edid);
        dp_panel_handle_sink_request(dp->panel);
 
-       dp->dp_display.max_dp_lanes = dp->parser->max_dp_lanes;
-
        /*
         * set sink to normal operation mode -- D0
         * before dpcd read
 
 
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
+#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 dp_panel_private {
        struct device *dev;
        struct drm_device *drm_dev;
 
        panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
 
+       drm_dbg_dp(panel->drm_dev, "max_lanes=%d max_link_rate=%d\n",
+               dp_panel->max_dp_lanes, dp_panel->max_dp_link_rate);
+
        rc = dp_panel_read_dpcd(dp_panel);
        if (rc) {
                DRM_ERROR("read dpcd failed %d\n", rc);
        return 0;
 }
 
+static u32 dp_panel_link_frequencies(struct device_node *of_node)
+{
+       struct device_node *endpoint;
+       u64 frequency = 0;
+       int cnt;
+
+       endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */
+       if (!endpoint)
+               return 0;
+
+       cnt = of_property_count_u64_elems(endpoint, "link-frequencies");
+
+       if (cnt > 0)
+               of_property_read_u64_index(endpoint, "link-frequencies",
+                                               cnt - 1, &frequency);
+       of_node_put(endpoint);
+
+       do_div(frequency,
+               10 * /* from symbol rate to link rate */
+               1000); /* kbytes */
+
+       return frequency;
+}
+
+static int dp_panel_parse_dt(struct dp_panel *dp_panel)
+{
+       struct dp_panel_private *panel;
+       struct device_node *of_node;
+       int cnt;
+
+       panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
+       of_node = panel->dev->of_node;
+
+       /*
+        * data-lanes is the property of dp_out endpoint
+        */
+       cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES);
+       if (cnt < 0) {
+               /* legacy code, data-lanes is the property of mdss_dp node */
+               cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
+       }
+
+       if (cnt > 0)
+               dp_panel->max_dp_lanes = cnt;
+       else
+               dp_panel->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */
+
+       dp_panel->max_dp_link_rate = dp_panel_link_frequencies(of_node);
+       if (!dp_panel->max_dp_link_rate)
+               dp_panel->max_dp_link_rate = DP_LINK_RATE_HBR2;
+
+       return 0;
+}
+
 struct dp_panel *dp_panel_get(struct dp_panel_in *in)
 {
        struct dp_panel_private *panel;
        struct dp_panel *dp_panel;
+       int ret;
 
        if (!in->dev || !in->catalog || !in->aux || !in->link) {
                DRM_ERROR("invalid input\n");
        dp_panel = &panel->dp_panel;
        dp_panel->max_bw_code = DP_LINK_BW_8_1;
 
+       ret = dp_panel_parse_dt(dp_panel);
+       if (ret)
+               return ERR_PTR(ret);
+
        return dp_panel;
 }
 
 
        return 0;
 }
 
-static u32 dp_parser_link_frequencies(struct device_node *of_node)
-{
-       struct device_node *endpoint;
-       u64 frequency = 0;
-       int cnt;
-
-       endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */
-       if (!endpoint)
-               return 0;
-
-       cnt = of_property_count_u64_elems(endpoint, "link-frequencies");
-
-       if (cnt > 0)
-               of_property_read_u64_index(endpoint, "link-frequencies",
-                                               cnt - 1, &frequency);
-       of_node_put(endpoint);
-
-       do_div(frequency,
-               10 * /* from symbol rate to link rate */
-               1000); /* kbytes */
-
-       return frequency;
-}
-
-static int dp_parser_misc(struct dp_parser *parser)
-{
-       struct device_node *of_node = parser->pdev->dev.of_node;
-       int cnt;
-
-       /*
-        * data-lanes is the property of dp_out endpoint
-        */
-       cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES);
-       if (cnt < 0) {
-               /* legacy code, data-lanes is the property of mdss_dp node */
-               cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
-       }
-
-       if (cnt > 0)
-               parser->max_dp_lanes = cnt;
-       else
-               parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */
-
-       parser->max_dp_link_rate = dp_parser_link_frequencies(of_node);
-       if (!parser->max_dp_link_rate)
-               parser->max_dp_link_rate = DP_LINK_RATE_HBR2;
-
-       return 0;
-}
-
 int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser)
 {
        struct platform_device *pdev = parser->pdev;
        if (rc)
                return rc;
 
-       rc = dp_parser_misc(parser);
-       if (rc)
-               return rc;
-
        return 0;
 }