Commit b3b1d122 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dp: move next_bridge handling to dp_display

Remove two levels of indirection and fetch next bridge directly in
dp_display_probe_tail().
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Tested-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/576126/
Link: https://lore.kernel.org/r/20240126-dp-power-parser-cleanup-v3-14-098d5f581dd3@linaro.org
parent 3ffe15b3
......@@ -1196,16 +1196,25 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde
return NULL;
}
static int dp_display_get_next_bridge(struct msm_dp *dp);
static int dp_display_probe_tail(struct device *dev)
{
struct msm_dp *dp = dev_get_drvdata(dev);
int ret;
ret = dp_display_get_next_bridge(dp);
if (ret)
/*
* External bridges are mandatory for eDP interfaces: one has to
* provide at least an eDP panel (which gets wrapped into panel-bridge).
*
* For DisplayPort interfaces external bridges are optional, so
* silently ignore an error if one is not present (-ENODEV).
*/
dp->next_bridge = devm_drm_of_get_bridge(&dp->pdev->dev, dp->pdev->dev.of_node, 1, 0);
if (IS_ERR(dp->next_bridge)) {
ret = PTR_ERR(dp->next_bridge);
dp->next_bridge = NULL;
if (dp->is_edp || ret != -ENODEV)
return ret;
}
ret = component_add(dev, &dp_display_comp_ops);
if (ret)
......@@ -1398,30 +1407,6 @@ void dp_display_debugfs_init(struct msm_dp *dp_display, struct dentry *root, boo
}
}
static int dp_display_get_next_bridge(struct msm_dp *dp)
{
int rc;
struct dp_display_private *dp_priv;
dp_priv = container_of(dp, struct dp_display_private, dp_display);
/*
* External bridges are mandatory for eDP interfaces: one has to
* provide at least an eDP panel (which gets wrapped into panel-bridge).
*
* For DisplayPort interfaces external bridges are optional, so
* silently ignore an error if one is not present (-ENODEV).
*/
rc = devm_dp_parser_find_next_bridge(&dp->pdev->dev, dp_priv->parser);
if (!dp->is_edp && rc == -ENODEV)
return 0;
if (!rc)
dp->next_bridge = dp_priv->parser->next_bridge;
return rc;
}
int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
struct drm_encoder *encoder)
{
......
......@@ -24,20 +24,6 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
return 0;
}
int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser)
{
struct platform_device *pdev = parser->pdev;
struct drm_bridge *bridge;
bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0);
if (IS_ERR(bridge))
return PTR_ERR(bridge);
parser->next_bridge = bridge;
return 0;
}
static int dp_parser_parse(struct dp_parser *parser)
{
int rc = 0;
......
......@@ -21,7 +21,6 @@
struct dp_parser {
struct platform_device *pdev;
struct phy *phy;
struct drm_bridge *next_bridge;
};
/**
......@@ -37,17 +36,4 @@ struct dp_parser {
*/
struct dp_parser *dp_parser_get(struct platform_device *pdev);
/**
* devm_dp_parser_find_next_bridge() - find an additional bridge to DP
*
* @dev: device to tie bridge lifetime to
* @parser: dp_parser data from client
*
* This function is used to find any additional bridge attached to
* the DP controller. The eDP interface requires a panel bridge.
*
* Return: 0 if able to get the bridge, otherwise negative errno for failure.
*/
int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment