Message ID | 20240324-x1e80100-display-refactor-connector-v4-1-e0ebaea66a78@linaro.org |
---|---|
State | Accepted |
Commit | d8f177ba1b983e478a8d83ca94b49371129e2c34 |
Headers | show |
Series | drm/msm/dp: Rework the eDP/DP modes and add support for X1E80100 | expand |
On Sun, Mar 24, 2024 at 08:56:51PM +0200, Abel Vesa wrote: > Instead of relying on different compatibles for eDP and DP, lookup > the panel node in devicetree to figure out the connector type and > then pass on that information to the PHY. External DP doesn't have > a panel described in DT, therefore, assume it's eDP if panel node > is present. > Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com> Regards, Bjorn > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/gpu/drm/msm/dp/dp_display.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index c4cb82af5c2f..9169a739cc54 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -726,6 +726,14 @@ static int dp_init_sub_modules(struct dp_display_private *dp) > if (IS_ERR(phy)) > return PTR_ERR(phy); > > + rc = phy_set_mode_ext(phy, PHY_MODE_DP, > + dp->dp_display.is_edp ? PHY_SUBMODE_EDP : PHY_SUBMODE_DP); > + if (rc) { > + DRM_ERROR("failed to set phy submode, rc = %d\n", rc); > + dp->catalog = NULL; > + goto error; > + } > + > dp->catalog = dp_catalog_get(dev); > if (IS_ERR(dp->catalog)) { > rc = PTR_ERR(dp->catalog); > @@ -1241,6 +1249,25 @@ static int dp_auxbus_done_probe(struct drm_dp_aux *aux) > return dp_display_probe_tail(aux->dev); > } > > +static int dp_display_get_connector_type(struct platform_device *pdev, > + const struct msm_dp_desc *desc) > +{ > + struct device_node *node = pdev->dev.of_node; > + struct device_node *aux_bus = of_get_child_by_name(node, "aux-bus"); > + struct device_node *panel = of_get_child_by_name(aux_bus, "panel"); > + int connector_type; > + > + if (panel) > + connector_type = DRM_MODE_CONNECTOR_eDP; > + else > + connector_type = DRM_MODE_SUBCONNECTOR_DisplayPort; > + > + of_node_put(panel); > + of_node_put(aux_bus); > + > + return connector_type; > +} > + > static int dp_display_probe(struct platform_device *pdev) > { > int rc = 0; > @@ -1263,7 +1290,7 @@ static int dp_display_probe(struct platform_device *pdev) > dp->dp_display.pdev = pdev; > dp->name = "drm_dp"; > dp->id = desc->id; > - dp->dp_display.connector_type = desc->connector_type; > + dp->dp_display.connector_type = dp_display_get_connector_type(pdev, desc); > dp->wide_bus_supported = desc->wide_bus_supported; > dp->dp_display.is_edp = > (dp->dp_display.connector_type == DRM_MODE_CONNECTOR_eDP); > > -- > 2.34.1 >
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index c4cb82af5c2f..9169a739cc54 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -726,6 +726,14 @@ static int dp_init_sub_modules(struct dp_display_private *dp) if (IS_ERR(phy)) return PTR_ERR(phy); + rc = phy_set_mode_ext(phy, PHY_MODE_DP, + dp->dp_display.is_edp ? PHY_SUBMODE_EDP : PHY_SUBMODE_DP); + if (rc) { + DRM_ERROR("failed to set phy submode, rc = %d\n", rc); + dp->catalog = NULL; + goto error; + } + dp->catalog = dp_catalog_get(dev); if (IS_ERR(dp->catalog)) { rc = PTR_ERR(dp->catalog); @@ -1241,6 +1249,25 @@ static int dp_auxbus_done_probe(struct drm_dp_aux *aux) return dp_display_probe_tail(aux->dev); } +static int dp_display_get_connector_type(struct platform_device *pdev, + const struct msm_dp_desc *desc) +{ + struct device_node *node = pdev->dev.of_node; + struct device_node *aux_bus = of_get_child_by_name(node, "aux-bus"); + struct device_node *panel = of_get_child_by_name(aux_bus, "panel"); + int connector_type; + + if (panel) + connector_type = DRM_MODE_CONNECTOR_eDP; + else + connector_type = DRM_MODE_SUBCONNECTOR_DisplayPort; + + of_node_put(panel); + of_node_put(aux_bus); + + return connector_type; +} + static int dp_display_probe(struct platform_device *pdev) { int rc = 0; @@ -1263,7 +1290,7 @@ static int dp_display_probe(struct platform_device *pdev) dp->dp_display.pdev = pdev; dp->name = "drm_dp"; dp->id = desc->id; - dp->dp_display.connector_type = desc->connector_type; + dp->dp_display.connector_type = dp_display_get_connector_type(pdev, desc); dp->wide_bus_supported = desc->wide_bus_supported; dp->dp_display.is_edp = (dp->dp_display.connector_type == DRM_MODE_CONNECTOR_eDP);
Instead of relying on different compatibles for eDP and DP, lookup the panel node in devicetree to figure out the connector type and then pass on that information to the PHY. External DP doesn't have a panel described in DT, therefore, assume it's eDP if panel node is present. Signed-off-by: Abel Vesa <abel.vesa@linaro.org> --- drivers/gpu/drm/msm/dp/dp_display.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)