diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index d51173056a9ef56f365e9dbb420c98152d6f7793..e35e10758556a8171b8b4839fdab1987c20097e8 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1066,11 +1066,19 @@ static int tegra_crtc_setup_clk(struct drm_crtc *crtc, if (!output) return -ENODEV; + /* + * The ->setup_clock() callback is optional, but if encoders don't + * implement it they most likely need to do the equivalent within the + * ->mode_fixup() callback. + */ + if (!output->ops || !output->ops->setup_clock) + return 0; + /* * This assumes that the parent clock is pll_d_out0 or pll_d2_out * respectively, each of which divides the base pll_d by 2. */ - err = tegra_output_setup_clock(output, dc->clk, pclk, &div); + err = output->ops->setup_clock(output, dc->clk, pclk, &div); if (err < 0) { dev_err(dc->dev, "failed to setup clock: %ld\n", err); return err; diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index bf749ac4a3449df4a234cc7f74bee4dec9e8ed51..d7433976a40b2b8bae46a87adff71fbc79434a62 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -240,16 +240,6 @@ static inline int tegra_output_disable(struct tegra_output *output) return output ? -ENOSYS : -EINVAL; } -static inline int tegra_output_setup_clock(struct tegra_output *output, - struct clk *clk, unsigned long pclk, - unsigned int *div) -{ - if (output && output->ops && output->ops->setup_clock) - return output->ops->setup_clock(output, clk, pclk, div); - - return output ? -ENOSYS : -EINVAL; -} - static inline int tegra_output_check_mode(struct tegra_output *output, struct drm_display_mode *mode, enum drm_mode_status *status)