Message ID | 20220106070656.482882-1-dmitry.baryshkov@linaro.org |
---|---|
State | Accepted |
Commit | b00e53f548ff6fbf66b096c6e6fa8352c61d9237 |
Headers | show |
Series | [v2] drm/msm: reduce usage of round_pixclk callback | expand |
Quoting Dmitry Baryshkov (2022-01-05 23:06:56) > The round_pixclk() callback returns different rate only on MDP4 in HDMI > (DTV) case. Stop using this callback in other cases to simplify > mode_valid callbacks. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- Reviewed-by: Stephen Boyd <swboyd@chromium.org>
On 1/5/2022 11:06 PM, Dmitry Baryshkov wrote: > The round_pixclk() callback returns different rate only on MDP4 in HDMI > (DTV) case. Stop using this callback in other cases to simplify > mode_valid callbacks. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> > --- > Changes since v1: > - Rebased on top of HDMI changes > - Dropped eDP part, driver got removed > > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 ------- > drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 7 ------- > drivers/gpu/drm/msm/dsi/dsi_manager.c | 22 ---------------------- > drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 11 +++++++---- > 4 files changed, 7 insertions(+), 40 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > index 47fe11a84a77..ebbee5f103e1 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > @@ -774,12 +774,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) > return ret; > } > > -static long dpu_kms_round_pixclk(struct msm_kms *kms, unsigned long rate, > - struct drm_encoder *encoder) > -{ > - return rate; > -} > - > static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) > { > int i; > @@ -948,7 +942,6 @@ static const struct msm_kms_funcs kms_funcs = { > .disable_vblank = dpu_kms_disable_vblank, > .check_modified_format = dpu_format_check_modified_format, > .get_format = dpu_get_msm_format, > - .round_pixclk = dpu_kms_round_pixclk, > .destroy = dpu_kms_destroy, > .snapshot = dpu_kms_mdp_snapshot, > #ifdef CONFIG_DEBUG_FS > diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > index 12a5f81e402b..20859fd7af4a 100644 > --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c > @@ -190,12 +190,6 @@ static void mdp5_complete_commit(struct msm_kms *kms, unsigned crtc_mask) > mdp5_smp_complete_commit(mdp5_kms->smp, &global_state->smp); > } > > -static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate, > - struct drm_encoder *encoder) > -{ > - return rate; > -} > - > static int mdp5_set_split_display(struct msm_kms *kms, > struct drm_encoder *encoder, > struct drm_encoder *slave_encoder, > @@ -278,7 +272,6 @@ static const struct mdp_kms_funcs kms_funcs = { > .wait_flush = mdp5_wait_flush, > .complete_commit = mdp5_complete_commit, > .get_format = mdp_get_format, > - .round_pixclk = mdp5_round_pixclk, > .set_split_display = mdp5_set_split_display, > .destroy = mdp5_kms_destroy, > #ifdef CONFIG_DEBUG_FS > diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c > index f19bae475c96..1dbbfca163d9 100644 > --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c > +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c > @@ -305,27 +305,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector) > return num; > } > > -static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector, > - struct drm_display_mode *mode) > -{ > - int id = dsi_mgr_connector_get_id(connector); > - struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); > - struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi); > - struct msm_drm_private *priv = connector->dev->dev_private; > - struct msm_kms *kms = priv->kms; > - long actual, requested; > - > - DBG(""); > - requested = 1000 * mode->clock; > - actual = kms->funcs->round_pixclk(kms, requested, encoder); > - > - DBG("requested=%ld, actual=%ld", requested, actual); > - if (actual != requested) > - return MODE_CLOCK_RANGE; > - > - return MODE_OK; > -} > - > static struct drm_encoder * > dsi_mgr_connector_best_encoder(struct drm_connector *connector) > { > @@ -586,7 +565,6 @@ static const struct drm_connector_funcs dsi_mgr_connector_funcs = { > > static const struct drm_connector_helper_funcs dsi_mgr_conn_helper_funcs = { > .get_modes = dsi_mgr_connector_get_modes, > - .mode_valid = dsi_mgr_connector_mode_valid, > .best_encoder = dsi_mgr_connector_best_encoder, > }; > > diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c > index 68fba4bf7212..10ebe2089cb6 100644 > --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c > +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c > @@ -282,15 +282,18 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge > long actual, requested; > > requested = 1000 * mode->clock; > - actual = kms->funcs->round_pixclk(kms, > - requested, hdmi_bridge->hdmi->encoder); > > /* for mdp5/apq8074, we manage our own pixel clk (as opposed to > * mdp4/dtv stuff where pixel clk is assigned to mdp/encoder > * instead): > */ > - if (config->pwr_clk_cnt > 0) > - actual = clk_round_rate(hdmi->pwr_clks[0], actual); > + if (kms->funcs->round_pixclk) > + actual = kms->funcs->round_pixclk(kms, > + requested, hdmi_bridge->hdmi->encoder); > + else if (config->pwr_clk_cnt > 0) > + actual = clk_round_rate(hdmi->pwr_clks[0], requested); > + else > + actual = requested; > > DBG("requested=%ld, actual=%ld", requested, actual); >
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 47fe11a84a77..ebbee5f103e1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -774,12 +774,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) return ret; } -static long dpu_kms_round_pixclk(struct msm_kms *kms, unsigned long rate, - struct drm_encoder *encoder) -{ - return rate; -} - static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) { int i; @@ -948,7 +942,6 @@ static const struct msm_kms_funcs kms_funcs = { .disable_vblank = dpu_kms_disable_vblank, .check_modified_format = dpu_format_check_modified_format, .get_format = dpu_get_msm_format, - .round_pixclk = dpu_kms_round_pixclk, .destroy = dpu_kms_destroy, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 12a5f81e402b..20859fd7af4a 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -190,12 +190,6 @@ static void mdp5_complete_commit(struct msm_kms *kms, unsigned crtc_mask) mdp5_smp_complete_commit(mdp5_kms->smp, &global_state->smp); } -static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate, - struct drm_encoder *encoder) -{ - return rate; -} - static int mdp5_set_split_display(struct msm_kms *kms, struct drm_encoder *encoder, struct drm_encoder *slave_encoder, @@ -278,7 +272,6 @@ static const struct mdp_kms_funcs kms_funcs = { .wait_flush = mdp5_wait_flush, .complete_commit = mdp5_complete_commit, .get_format = mdp_get_format, - .round_pixclk = mdp5_round_pixclk, .set_split_display = mdp5_set_split_display, .destroy = mdp5_kms_destroy, #ifdef CONFIG_DEBUG_FS diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index f19bae475c96..1dbbfca163d9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -305,27 +305,6 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector) return num; } -static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - int id = dsi_mgr_connector_get_id(connector); - struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi); - struct msm_drm_private *priv = connector->dev->dev_private; - struct msm_kms *kms = priv->kms; - long actual, requested; - - DBG(""); - requested = 1000 * mode->clock; - actual = kms->funcs->round_pixclk(kms, requested, encoder); - - DBG("requested=%ld, actual=%ld", requested, actual); - if (actual != requested) - return MODE_CLOCK_RANGE; - - return MODE_OK; -} - static struct drm_encoder * dsi_mgr_connector_best_encoder(struct drm_connector *connector) { @@ -586,7 +565,6 @@ static const struct drm_connector_funcs dsi_mgr_connector_funcs = { static const struct drm_connector_helper_funcs dsi_mgr_conn_helper_funcs = { .get_modes = dsi_mgr_connector_get_modes, - .mode_valid = dsi_mgr_connector_mode_valid, .best_encoder = dsi_mgr_connector_best_encoder, }; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 68fba4bf7212..10ebe2089cb6 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -282,15 +282,18 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge long actual, requested; requested = 1000 * mode->clock; - actual = kms->funcs->round_pixclk(kms, - requested, hdmi_bridge->hdmi->encoder); /* for mdp5/apq8074, we manage our own pixel clk (as opposed to * mdp4/dtv stuff where pixel clk is assigned to mdp/encoder * instead): */ - if (config->pwr_clk_cnt > 0) - actual = clk_round_rate(hdmi->pwr_clks[0], actual); + if (kms->funcs->round_pixclk) + actual = kms->funcs->round_pixclk(kms, + requested, hdmi_bridge->hdmi->encoder); + else if (config->pwr_clk_cnt > 0) + actual = clk_round_rate(hdmi->pwr_clks[0], requested); + else + actual = requested; DBG("requested=%ld, actual=%ld", requested, actual);
The round_pixclk() callback returns different rate only on MDP4 in HDMI (DTV) case. Stop using this callback in other cases to simplify mode_valid callbacks. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- Changes since v1: - Rebased on top of HDMI changes - Dropped eDP part, driver got removed --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 ------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 7 ------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 22 ---------------------- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 11 +++++++---- 4 files changed, 7 insertions(+), 40 deletions(-)