Take mode config lock while updating the crtc clock rate. To avoid a race in tilcdc_crtc_update_clk(), we do not want the mode to change while we update crtc clock. Signed-off-by: Jyri Sarha <jsarha@xxxxxx> --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 5 +++++ drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index f8892e9..882d9b5 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -184,10 +184,14 @@ static int cpufreq_transition(struct notifier_block *nb, { struct tilcdc_drm_private *priv = container_of(nb, struct tilcdc_drm_private, freq_transition); + struct drm_mode_config *config = &priv->dev->mode_config; + if (val == CPUFREQ_POSTCHANGE) { if (priv->lcd_fck_rate != clk_get_rate(priv->clk)) { + mutex_lock(&config->mutex); priv->lcd_fck_rate = clk_get_rate(priv->clk); tilcdc_crtc_update_clk(priv->crtc); + mutex_unlock(&config->mutex); } } @@ -251,6 +255,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) } dev->dev_private = priv; + priv->dev = dev; priv->is_componentized = tilcdc_get_external_components(dev->dev, NULL) > 0; diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index a6e5e6d..6caecfc 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h @@ -49,6 +49,8 @@ struct tilcdc_drm_private { void __iomem *mmio; + struct drm_device *dev; + struct clk *clk; /* functional clock */ int rev; /* IP revision */ -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel