Re: [PATCH v13 06/10] drm/mediatek: Add MT8195 External DisplayPort support

From: Rex-BC Chen
Date: Tue Jul 05 2022 - 05:54:31 EST


On Fri, 2022-07-01 at 16:14 +0800, AngeloGioacchino Del Regno wrote:
> Il 01/07/22 08:28, Bo-Chen Chen ha scritto:
> > From: Guillaume Ranquet <granquet@xxxxxxxxxxxx>
> >
> > This patch adds External DisplayPort support to the mt8195 eDP
> > driver.
> >
> > Signed-off-by: Guillaume Ranquet <granquet@xxxxxxxxxxxx>
> > Signed-off-by: Bo-Chen Chen <rex-bc.chen@xxxxxxxxxxxx>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dp.c | 197
> > +++++++++++++++++++++-----
> > drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 +
> > 2 files changed, 161 insertions(+), 37 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> > b/drivers/gpu/drm/mediatek/mtk_dp.c
> > index b672d5a6f5bd..c3be97dd055c 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> > @@ -105,6 +105,7 @@ struct mtk_dp {
> > struct regmap *regs;
> >
> > bool enabled;
> > + bool has_fec;
>
> You're introducing this has_fec variable here....
>
> >
> > struct drm_connector *conn;
> > };
>
>
> > @@ -1018,6 +1074,8 @@ static void
> > mtk_dp_initialize_priv_data(struct mtk_dp *mtk_dp)
> > mtk_dp->info.depth = DP_MSA_MISC_8_BPC;
> > memset(&mtk_dp->info.timings, 0, sizeof(struct
> > mtk_dp_timings));
> > mtk_dp->info.timings.frame_rate = 60;
> > +
> > + mtk_dp->has_fec = false;
>
> .... setting it as false here ....
>
> > }
> >
> > static void mtk_dp_setup_tu(struct mtk_dp *mtk_dp)
> > @@ -1498,15 +1562,38 @@ static int mtk_dp_init_port(struct mtk_dp
> > *mtk_dp)
> > static irqreturn_t mtk_dp_hpd_event_thread(int hpd, void *dev)
> > {
> > struct mtk_dp *mtk_dp = dev;
> > + int event;
> > u8 buf[DP_RECEIVER_CAP_SIZE] = {};
> >
> > + event = mtk_dp_plug_state(mtk_dp) ?
> > + connector_status_connected :
> > connector_status_disconnected;
> > +
> > + if (event < 0)
> > + return IRQ_HANDLED;
> > +
> > + dev_info(mtk_dp->dev, "drm_helper_hpd_irq_event\n");
>
> P.S.: This should be a dev_dbg().
>
> > + drm_helper_hpd_irq_event(mtk_dp->bridge.dev);
> > +
> > if (mtk_dp->train_info.cable_state_change) {
> > mtk_dp->train_info.cable_state_change = false;
> >
> > - mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> > - DP_PWR_STATE_BANDGAP_TPLL_LANE,
> > - DP_PWR_STATE_MASK);
> > - drm_dp_read_dpcd_caps(&mtk_dp->aux, buf);
> > + if (!mtk_dp->train_info.cable_plugged_in) {
> > + mtk_dp_video_mute(mtk_dp, true);
> > +
> > + mtk_dp_initialize_priv_data(mtk_dp);
> > + mtk_dp_set_idle_pattern(mtk_dp, true);
> > + if (mtk_dp->has_fec)
>
> ...and you're checking it here, but there's nothing ever setting that
> as true!
>
> Is there anything you forgot? :-)
>
> Cheers,
> Angelo

Hello Angelo,

Thanks for your review.
We do not support fec currently, so I will drop them.

Thanks!

BRs,
Bo-Chen