mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "LIANKUN YANG (杨连坤)" <Liankun.Yang@mediatek.com>
To: "Peng Liu (刘鹏)" <Peng.Liu@mediatek.com>,
	"Mac Shen (沈俊)" <Mac.Shen@mediatek.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 2/2] drm/mediatek: Add isolation to edp
Date: Tue, 23 Dec 2025 06:34:33 +0000	[thread overview]
Message-ID: <d26f894c12ae21a64dcf5926ebf0fc1cffbb39d5.camel@mediatek.com> (raw)
In-Reply-To: <e9f167c88c29fa30ef3a22995c2955cde478b41d.camel@mediatek.com>

On Wed, 2025-12-17 at 10:08 +0000, CK Hu (胡俊光) wrote:
> 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@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.
> 

`mtk_dp_parse_capabilities` is related to DP training, it is
used in `mtk_dp_hpd_event_thread` before DP training, and then only
used by eDP when read edid.

Read edid continued according to its original logic and was unaffected.
	...
	drm_edid = drm_edid_read_ddc(connector, &mtk_dp->aux.ddc);

	/*
	 * 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)) {
		drm_err(mtk_dp->drm_dev, "Can't parse capabilities\n");
		drm_edid_free(drm_edid);
		drm_edid = NULL;
	}

	if (drm_edid) {
	...

> >  		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?
> 

The modification to `mtk_dp_bridge_atomic_disable` here is base on
the same logic as `mtk_dp_aux_panel_poweron(mtk_dp, false);`.

Modify part of in `mtk_dp_bridge_atomic_disable`
  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);
  }

  /* power off aux */
  mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
		DP_PWR_STATE_BANDGAP_TPLL,
		DP_PWR_STATE_MASK);

Modify part of in `mtk_dp_aux_panel_poweron(mtk_dp, false);`
  if (pwron) {
    ....
  } else {
    /* power off panel */
    drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
    usleep_range(2000, 3000);

    /* power off aux */
    mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
			DP_PWR_STATE_BANDGAP_TPLL,
			DP_PWR_STATE_MASK);
  }

The `mtk_dp_aux_panel_poweron` function fails to align.
Within the `mtk_dp_hpd_event_thread`, if DP is disconnected,
the `mtk_dp_aux_panel_poweron` function will write from `aux`
to `DPRX`, causing a failure and thus preventing symmetry.

> > -	}
> > -
> > -	/* 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);
> >  
> 
> 

      reply	other threads:[~2025-12-23  6:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  8:55 [PATCH v7 0/2] Adjust bandwidth limit for DP Liankun Yang
2025-11-04  8:55 ` [PATCH v7 1/2] drm/mediatek: " Liankun Yang
2025-11-19  9:18   ` CK Hu (胡俊光)
2025-11-24  9:14     ` LIANKUN YANG (杨连坤)
2025-11-26  3:11       ` CK Hu (胡俊光)
2025-12-01  6:39         ` LIANKUN YANG (杨连坤)
2025-12-17  9:59           ` CK Hu (胡俊光)
2025-12-18  1:13           ` CK Hu (胡俊光)
2025-11-04  8:55 ` [PATCH v7 2/2] drm/mediatek: Add isolation to edp Liankun Yang
2025-12-17 10:08   ` CK Hu (胡俊光)
2025-12-23  6:34     ` LIANKUN YANG (杨连坤) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d26f894c12ae21a64dcf5926ebf0fc1cffbb39d5.camel@mediatek.com \
    --to=liankun.yang@mediatek.com \
    --cc=Mac.Shen@mediatek.com \
    --cc=Peng.Liu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®