mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
drm/bridge: analogix_dp: Apply panel_bridge helper
In order to unify the handling of the panel and bridge, apply panel_bridge helpers for Analogix DP driver. With this patch, the bridge support will also become available. The following changes have ben made: - Apply plane_bridge helper to wrap the panel as the bridge. - Remove the explicit panel APIs calls, which can be replaced with the automic bridge APIs calls wrapped by the panel. - Remove the unnecessary analogix_dp_bridge_get_modes(). Signed-off-by: Damon Ding <damon.ding@rock-chips.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Heiko Stuebner <heiko@sntech.de> # rk3588 Link: https://patch.msgid.link/20260413132551.1049307-9-damon.ding@rock-chips.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
parent
2bfc4e192f
commit
1b86a69b61
|
|
@ -750,9 +750,6 @@ static int analogix_dp_commit(struct analogix_dp_device *dp)
|
|||
{
|
||||
int ret;
|
||||
|
||||
/* Keep the panel disabled while we configure video */
|
||||
drm_panel_disable(dp->plat_data->panel);
|
||||
|
||||
ret = analogix_dp_train_link(dp);
|
||||
if (ret) {
|
||||
dev_err(dp->dev, "unable to do link train, ret=%d\n", ret);
|
||||
|
|
@ -772,9 +769,6 @@ static int analogix_dp_commit(struct analogix_dp_device *dp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Safe to enable the panel now */
|
||||
drm_panel_enable(dp->plat_data->panel);
|
||||
|
||||
/* Check whether panel supports fast training */
|
||||
ret = analogix_dp_fast_link_train_detection(dp);
|
||||
if (ret)
|
||||
|
|
@ -859,17 +853,6 @@ static int analogix_dp_disable_psr(struct analogix_dp_device *dp)
|
|||
return analogix_dp_send_psr_spd(dp, &psr_vsc, true);
|
||||
}
|
||||
|
||||
static int analogix_dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector)
|
||||
{
|
||||
struct analogix_dp_device *dp = to_dp(bridge);
|
||||
int num_modes = 0;
|
||||
|
||||
if (dp->plat_data->panel)
|
||||
num_modes += drm_panel_get_modes(dp->plat_data->panel, connector);
|
||||
|
||||
return num_modes;
|
||||
}
|
||||
|
||||
static const struct drm_edid *analogix_dp_bridge_edid_read(struct drm_bridge *bridge,
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
|
|
@ -910,7 +893,7 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne
|
|||
struct analogix_dp_device *dp = to_dp(bridge);
|
||||
enum drm_connector_status status = connector_status_disconnected;
|
||||
|
||||
if (dp->plat_data->panel || dp->plat_data->next_bridge)
|
||||
if (dp->plat_data->next_bridge)
|
||||
return connector_status_connected;
|
||||
|
||||
if (!analogix_dp_detect_hpd(dp))
|
||||
|
|
@ -996,8 +979,6 @@ static void analogix_dp_bridge_atomic_pre_enable(struct drm_bridge *bridge,
|
|||
/* Don't touch the panel if we're coming back from PSR */
|
||||
if (old_crtc_state && old_crtc_state->self_refresh_active)
|
||||
return;
|
||||
|
||||
drm_panel_prepare(dp->plat_data->panel);
|
||||
}
|
||||
|
||||
static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
|
||||
|
|
@ -1169,16 +1150,12 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
|
|||
if (dp->dpms_mode != DRM_MODE_DPMS_ON)
|
||||
return;
|
||||
|
||||
drm_panel_disable(dp->plat_data->panel);
|
||||
|
||||
disable_irq(dp->irq);
|
||||
|
||||
analogix_dp_set_analog_power_down(dp, POWER_ALL, 1);
|
||||
|
||||
pm_runtime_put_sync(dp->dev);
|
||||
|
||||
drm_panel_unprepare(dp->plat_data->panel);
|
||||
|
||||
dp->fast_train_enable = false;
|
||||
dp->psr_supported = false;
|
||||
dp->dpms_mode = DRM_MODE_DPMS_OFF;
|
||||
|
|
@ -1253,7 +1230,6 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
|
|||
.atomic_post_disable = analogix_dp_bridge_atomic_post_disable,
|
||||
.atomic_check = analogix_dp_bridge_atomic_check,
|
||||
.attach = analogix_dp_bridge_attach,
|
||||
.get_modes = analogix_dp_bridge_get_modes,
|
||||
.edid_read = analogix_dp_bridge_edid_read,
|
||||
.detect = analogix_dp_bridge_detect,
|
||||
};
|
||||
|
|
@ -1499,17 +1475,22 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (dp->plat_data->panel)
|
||||
bridge->ops = DRM_BRIDGE_OP_MODES | DRM_BRIDGE_OP_DETECT;
|
||||
else
|
||||
bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
|
||||
|
||||
bridge->ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT;
|
||||
bridge->of_node = dp->dev->of_node;
|
||||
bridge->type = DRM_MODE_CONNECTOR_eDP;
|
||||
ret = devm_drm_bridge_add(dp->dev, &dp->bridge);
|
||||
if (ret)
|
||||
goto err_unregister_aux;
|
||||
|
||||
if (dp->plat_data->panel) {
|
||||
dp->plat_data->next_bridge = devm_drm_panel_bridge_add(dp->dev,
|
||||
dp->plat_data->panel);
|
||||
if (IS_ERR(dp->plat_data->next_bridge)) {
|
||||
ret = PTR_ERR(bridge);
|
||||
goto err_unregister_aux;
|
||||
}
|
||||
}
|
||||
|
||||
ret = drm_bridge_attach(dp->encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to create bridge (%d)\n", ret);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user