[PATCH v7 2/2] drm/mediatek: Add isolation to edp
CK Hu (胡俊光)
ck.hu at mediatek.com
Wed Dec 17 02:08:23 PST 2025
On Tue, 2025-11-04 at 16:55 +0800, Liankun Yang wrote:
> Because edp doesn't expect any (un)plug events during runtime and
> its process differs from DP. Therefore, it is necessary to isolate
> the parsing capability, panel power, training state and enable state.
>
> And DP related behaviors are adjusted to execute in the second half
> of the interrupt.
> For DP details, see drm/mediatek: Adjust bandwidth limit for DP
>
> Signed-off-by: Liankun Yang <liankun.yang at mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dp.c | 37 +++++++++++++++----------------
> 1 file changed, 18 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index 0ba2c208811c..efd4c45985ca 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -2187,7 +2187,8 @@ static const struct drm_edid *mtk_dp_edid_read(struct drm_bridge *bridge,
> * Parse capability here to let atomic_get_input_bus_fmts and
> * mode_valid use the capability to calculate sink bitrates.
> */
> - if (mtk_dp_parse_capabilities(mtk_dp)) {
> + if (mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP &&
> + mtk_dp_parse_capabilities(mtk_dp)) {
This is not related to dp training.
If dp does not need to parse edid, describe WHY and do not mix edid modification with dp training modification.
> drm_err(mtk_dp->drm_dev, "Can't parse capabilities\n");
> drm_edid_free(drm_edid);
> drm_edid = NULL;
> @@ -2385,13 +2386,15 @@ static void mtk_dp_bridge_atomic_enable(struct drm_bridge *bridge,
> return;
> }
>
> - mtk_dp_aux_panel_poweron(mtk_dp, true);
> + if (mtk_dp->data->bridge_type == DRM_MODE_CONNECTOR_eDP) {
> + mtk_dp_aux_panel_poweron(mtk_dp, true);
>
> - /* Training */
> - ret = mtk_dp_training(mtk_dp);
> - if (ret) {
> - drm_err(mtk_dp->drm_dev, "Training failed, %d\n", ret);
> - goto power_off_aux;
> + /* Training */
> + ret = mtk_dp_training(mtk_dp);
> + if (ret) {
> + drm_err(mtk_dp->drm_dev, "Training failed, %d\n", ret);
> + goto power_off_aux;
> + }
Merge this to previous patch.
> }
>
> ret = mtk_dp_video_config(mtk_dp);
> @@ -2411,7 +2414,9 @@ static void mtk_dp_bridge_atomic_enable(struct drm_bridge *bridge,
> sizeof(mtk_dp->info.audio_cur_cfg));
> }
>
> - mtk_dp->enabled = true;
> + if (mtk_dp->data->bridge_type == DRM_MODE_CONNECTOR_eDP)
> + mtk_dp->enabled = true;
Merge this to previous patch.
> +
> mtk_dp_update_plugged_status(mtk_dp);
>
> return;
> @@ -2426,21 +2431,15 @@ static void mtk_dp_bridge_atomic_disable(struct drm_bridge *bridge,
> {
> struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge);
>
> - mtk_dp->enabled = false;
> + if (mtk_dp->data->bridge_type == DRM_MODE_CONNECTOR_eDP) {
> + mtk_dp->enabled = false;
Merge this to previous patch.
> + mtk_dp_aux_panel_poweron(mtk_dp, false);
You change the code flow of DRM_MODE_CONNECTOR_eDP.
I think you should not change this.
> + }
> +
> mtk_dp_update_plugged_status(mtk_dp);
> mtk_dp_video_enable(mtk_dp, false);
> mtk_dp_audio_mute(mtk_dp, true);
>
> - if (mtk_dp->train_info.cable_plugged_in) {
> - drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
> - usleep_range(2000, 3000);
For DRM_MODE_CONNECTOR_DP, you remove this usleep. This may cause side effect.
Doesn't it?
> - }
> -
> - /* power off aux */
> - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> - DP_PWR_STATE_BANDGAP_TPLL,
> - DP_PWR_STATE_MASK);
if (mtk_dp->data->bridge_type == DRM_MODE_CONNECTOR_eDP) {
/* power off aux */
mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
DP_PWR_STATE_BANDGAP_TPLL,
DP_PWR_STATE_MASK);
}
Regards,
CK
> -
> /* SDP path reset sw*/
> mtk_dp_sdp_path_reset(mtk_dp);
>
More information about the Linux-mediatek
mailing list