[Freedreno] [PATCH v4 8/8] drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe()

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Tue Oct 3 17:24:00 UTC 2023


On Tue, 3 Oct 2023 at 20:16, Kuogee Hsieh <quic_khsieh at quicinc.com> wrote:
>
>
> On 9/27/2023 2:57 PM, Dmitry Baryshkov wrote:
> > On Wed, 27 Sept 2023 at 23:54, Kuogee Hsieh <quic_khsieh at quicinc.com> wrote:
> >> Currently eDP population is done at msm_dp_modeset_init() which happen
> >> at binding time. Move eDP population to be done at display probe time
> >> so that probe deferral cases can be handled effectively.
> >> wait_for_hpd_asserted callback is added during drm_dp_aux_init()
> >> to ensure eDP's HPD is up before proceeding eDP population.
> >>
> >> Changes in v4:
> >> -- delete duplicate initialize code to dp_aux before drm_dp_aux_register()
> >> -- delete of_get_child_by_name(dev->of_node, "aux-bus") and inline the function
> >> -- not initialize rc = 0
> >>
> >> Changes in v3:
> >> -- add done_probing callback into devm_of_dp_aux_populate_bus()
> >>
> >> Signed-off-by: Kuogee Hsieh <quic_khsieh at quicinc.com>
> >> ---
> >>   drivers/gpu/drm/msm/dp/dp_aux.c     | 34 ++++++++++++++----
> >>   drivers/gpu/drm/msm/dp/dp_display.c | 69 ++++++++++++++++++-------------------
> >>   2 files changed, 60 insertions(+), 43 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c
> >> index 22eb774..425b5c5 100644
> >> --- a/drivers/gpu/drm/msm/dp/dp_aux.c
> >> +++ b/drivers/gpu/drm/msm/dp/dp_aux.c
> >> @@ -480,7 +480,6 @@ void dp_aux_deinit(struct drm_dp_aux *dp_aux)
> >>
> >>   int dp_aux_register(struct drm_dp_aux *dp_aux)
> >>   {
> >> -       struct dp_aux_private *aux;
> >>          int ret;
> >>
> >>          if (!dp_aux) {
> >> @@ -488,12 +487,7 @@ int dp_aux_register(struct drm_dp_aux *dp_aux)
> >>                  return -EINVAL;
> >>          }
> >>
> >> -       aux = container_of(dp_aux, struct dp_aux_private, dp_aux);
> >> -
> >> -       aux->dp_aux.name = "dpu_dp_aux";
> >> -       aux->dp_aux.dev = aux->dev;
> >> -       aux->dp_aux.transfer = dp_aux_transfer;
> >> -       ret = drm_dp_aux_register(&aux->dp_aux);
> >> +       ret = drm_dp_aux_register(dp_aux);
> >>          if (ret) {
> >>                  DRM_ERROR("%s: failed to register drm aux: %d\n", __func__,
> >>                                  ret);
> >> @@ -508,6 +502,21 @@ void dp_aux_unregister(struct drm_dp_aux *dp_aux)
> >>          drm_dp_aux_unregister(dp_aux);
> >>   }
> >>
> >> +static int dp_wait_hpd_asserted(struct drm_dp_aux *dp_aux,
> >> +                                unsigned long wait_us)
> >> +{
> >> +       int ret;
> >> +       struct dp_aux_private *aux;
> >> +
> >> +       aux = container_of(dp_aux, struct dp_aux_private, dp_aux);
> >> +
> >> +       pm_runtime_get_sync(aux->dev);
> >> +       ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog);
> >> +       pm_runtime_put_sync(aux->dev);
> > Ok, so here you have used put_sync instead of autosuspend. Can we have
> > some uniformity? (I'd prefer to see put_sync or just put everywhere)
> >
> >> +
> >> +       return ret;
> >> +}
> >> +
> >>   struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog,
> >>                                bool is_edp)
> >>   {
> >> @@ -531,6 +540,17 @@ struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog,
> >>          aux->catalog = catalog;
> >>          aux->retry_cnt = 0;
> >>
> >> +       /*
> >> +        * Use the drm_dp_aux_init() to use the aux adapter
> >> +        * before registering aux with the DRM device so that
> >> +        * msm edp panel can be detected by generic_dep_panel_probe().
> > eDP, AUX, generic_edp_panel_probe().
> >
> >> +        */
> >> +       aux->dp_aux.name = "dpu_dp_aux";
> >> +       aux->dp_aux.dev = dev;
> >> +       aux->dp_aux.transfer = dp_aux_transfer;
> >> +       aux->dp_aux.wait_hpd_asserted = dp_wait_hpd_asserted;
> >> +       drm_dp_aux_init(&aux->dp_aux);
> >> +
> >>          return &aux->dp_aux;
> >>   }
> >>
> >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> >> index 711d262..9a2b403 100644
> >> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> >> @@ -1203,6 +1203,28 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde
> >>          return NULL;
> >>   }
> >>
> >> +static int dp_auxbus_done_probe(struct drm_dp_aux *aux)
> >> +{
> >> +       int rc;
> >> +
> >> +       rc = component_add(aux->dev, &dp_display_comp_ops);
> >> +       if (rc)
> >> +               DRM_ERROR("eDP component add failed, rc=%d\n", rc);
> > drop.
> are you mean dropping this line?
> >> +
> >> +       return rc;
> >> +}
> >> +
> >> +static inline int dp_display_auxbus_population(struct dp_display_private *dp)
> > It's not `population`. It is just `populate`.
> >
> > Also please inline this function.
> Are you means moving this function to header file?

No. I mean inlining this function.

-- 
With best wishes
Dmitry


More information about the Freedreno mailing list