Message ID | 20230829184735.2841739-8-swboyd@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/msm/dp: Simplify DPCD related code with helpers | expand |
On 8/29/2023 11:47 AM, Stephen Boyd wrote: > This function is simply drm_dp_is_branch() so use that instead of > open-coding it. > > Cc: Vinod Polimera <quic_vpolimer@quicinc.com> > Cc: Kuogee Hsieh <quic_khsieh@quicinc.com> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com> Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com> > --- > drivers/gpu/drm/msm/dp/dp_display.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index 76f13954015b..96bbf6fec2f1 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -341,19 +341,12 @@ static const struct component_ops dp_display_comp_ops = { > .unbind = dp_display_unbind, > }; > > -static bool dp_display_is_ds_bridge(struct dp_panel *panel) > -{ > - return (panel->dpcd[DP_DOWNSTREAMPORT_PRESENT] & > - DP_DWN_STRM_PORT_PRESENT); > -} > - > static bool dp_display_is_sink_count_zero(struct dp_display_private *dp) > { > drm_dbg_dp(dp->drm_dev, "present=%#x sink_count=%d\n", > dp->panel->dpcd[DP_DOWNSTREAMPORT_PRESENT], > dp->link->sink_count); > - return dp_display_is_ds_bridge(dp->panel) && > - (dp->link->sink_count == 0); > + return drm_dp_is_branch(dp->panel->dpcd) && dp->link->sink_count == 0; > } > > static void dp_display_send_hpd_event(struct msm_dp *dp_display)
On 29/08/2023 21:47, Stephen Boyd wrote: > This function is simply drm_dp_is_branch() so use that instead of > open-coding it. > > Cc: Vinod Polimera <quic_vpolimer@quicinc.com> > Cc: Kuogee Hsieh <quic_khsieh@quicinc.com> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > --- > drivers/gpu/drm/msm/dp/dp_display.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index 76f13954015b..96bbf6fec2f1 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -341,19 +341,12 @@ static const struct component_ops dp_display_comp_ops = { > .unbind = dp_display_unbind, > }; > > -static bool dp_display_is_ds_bridge(struct dp_panel *panel) > -{ > - return (panel->dpcd[DP_DOWNSTREAMPORT_PRESENT] & > - DP_DWN_STRM_PORT_PRESENT); > -} > - > static bool dp_display_is_sink_count_zero(struct dp_display_private *dp) Nit: you might as well inline this function > { > drm_dbg_dp(dp->drm_dev, "present=%#x sink_count=%d\n", > dp->panel->dpcd[DP_DOWNSTREAMPORT_PRESENT], > dp->link->sink_count); > - return dp_display_is_ds_bridge(dp->panel) && > - (dp->link->sink_count == 0); > + return drm_dp_is_branch(dp->panel->dpcd) && dp->link->sink_count == 0; > } > > static void dp_display_send_hpd_event(struct msm_dp *dp_display)
Quoting Dmitry Baryshkov (2023-09-03 15:40:49) > On 29/08/2023 21:47, Stephen Boyd wrote: > > This function is simply drm_dp_is_branch() so use that instead of > > open-coding it. > > > > Cc: Vinod Polimera <quic_vpolimer@quicinc.com> > > Cc: Kuogee Hsieh <quic_khsieh@quicinc.com> > > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > > --- > > drivers/gpu/drm/msm/dp/dp_display.c | 9 +-------- > > 1 file changed, 1 insertion(+), 8 deletions(-) > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Thanks. > > > > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > > index 76f13954015b..96bbf6fec2f1 100644 > > --- a/drivers/gpu/drm/msm/dp/dp_display.c > > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > > @@ -341,19 +341,12 @@ static const struct component_ops dp_display_comp_ops = { > > .unbind = dp_display_unbind, > > }; > > > > -static bool dp_display_is_ds_bridge(struct dp_panel *panel) > > -{ > > - return (panel->dpcd[DP_DOWNSTREAMPORT_PRESENT] & > > - DP_DWN_STRM_PORT_PRESENT); > > -} > > - > > static bool dp_display_is_sink_count_zero(struct dp_display_private *dp) > > Nit: you might as well inline this function Ok. I'll send a followup to this series with a patch for that. I found that with an Apple dongle it always prints out a message to the kernel log when I have HDMI disconnected that there isn't a sink connected, which is annoying. So at least two more patches are incoming.
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 76f13954015b..96bbf6fec2f1 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -341,19 +341,12 @@ static const struct component_ops dp_display_comp_ops = { .unbind = dp_display_unbind, }; -static bool dp_display_is_ds_bridge(struct dp_panel *panel) -{ - return (panel->dpcd[DP_DOWNSTREAMPORT_PRESENT] & - DP_DWN_STRM_PORT_PRESENT); -} - static bool dp_display_is_sink_count_zero(struct dp_display_private *dp) { drm_dbg_dp(dp->drm_dev, "present=%#x sink_count=%d\n", dp->panel->dpcd[DP_DOWNSTREAMPORT_PRESENT], dp->link->sink_count); - return dp_display_is_ds_bridge(dp->panel) && - (dp->link->sink_count == 0); + return drm_dp_is_branch(dp->panel->dpcd) && dp->link->sink_count == 0; } static void dp_display_send_hpd_event(struct msm_dp *dp_display)
This function is simply drm_dp_is_branch() so use that instead of open-coding it. Cc: Vinod Polimera <quic_vpolimer@quicinc.com> Cc: Kuogee Hsieh <quic_khsieh@quicinc.com> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- drivers/gpu/drm/msm/dp/dp_display.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)