Messages in this thread | | | Date | Mon, 27 Jun 2022 12:17:52 +0200 | Subject | Re: [PATCH v12 06/10] drm/mediatek: Add MT8195 External DisplayPort support | From | AngeloGioacchino Del Regno <> |
| |
Il 27/06/22 10:03, Bo-Chen Chen ha scritto: > From: Guillaume Ranquet <granquet@baylibre.com> > > This patch adds External DisplayPort support to the mt8195 eDP driver. > > Signed-off-by: Guillaume Ranquet <granquet@baylibre.com> > [Bo-Chen: Move some dp features here and modify for reviewers' comments.] > Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_dp.c | 217 ++++++++++++++++++++++++------ > 1 file changed, 174 insertions(+), 43 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c > index 9e9b516409e2..1697c61462b7 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -111,6 +111,7 @@ struct mtk_dp { > struct regmap *regs; > > bool enabled; > + bool has_fec; > > struct drm_connector *conn; > }; > @@ -123,6 +124,11 @@ static struct regmap_config mtk_dp_regmap_config = { > .name = "mtk-dp-registers", > }; > > +static bool mtk_dp_is_edp(struct mtk_dp *mtk_dp) > +{ > + return mtk_dp->next_bridge; > +} > + > static struct mtk_dp *mtk_dp_from_bridge(struct drm_bridge *b) > { > return container_of(b, struct mtk_dp, bridge); > @@ -401,6 +407,20 @@ static bool mtk_dp_plug_state(struct mtk_dp *mtk_dp) > HPD_DB_DP_TRANS_P0_MASK); > } > > +static bool mtk_dp_plug_state_avoid_pulse(struct mtk_dp *mtk_dp) > +{ > + int wait; > + > + for (wait = 7; !mtk_dp_plug_state(mtk_dp) && wait > 0; --wait) > + /* Avoid short pulses on the HPD isr */ > + usleep_range(1000, 5000); > + > + if (wait == 0) > + return false; > +
You can as well use existing APIs for that:
static bool mtk_dp_plug_state_avoid_pulse(struct mtk_dp *mtk_dp) { int ret;
return !!(readx_poll_timeout(mtk_dp_plug_state, mtk_dp, ret, ret, 4000, (7 * 4000))); }
P.S.: I've used 4000 instead of 5000 on purpose, check the definition of readx_poll_timeout for more information.
All the rest of this commit looks good to me.
Cheers, Angelo
| |