Re: [PATCH 2/3] drm/ingenic: Reset pixclock rate when parent clock rate changes
From: Stephen Boyd
Date: Tue Oct 13 2020 - 19:17:59 EST
Quoting Paul Cercueil (2020-09-25 05:29:12)
> >> +static int ingenic_drm_update_pixclk(struct notifier_block *nb,
> >> + unsigned long action,
> >> + void *data)
> >> +{
> >> + struct ingenic_drm *priv = drm_nb_get_priv(nb);
> >> +
> >> + switch (action) {
> >> + case PRE_RATE_CHANGE:
> >> + mutex_lock(&priv->clk_mutex);
> >> + priv->update_clk_rate = true;
> >> + drm_crtc_wait_one_vblank(&priv->crtc);
> >> + return NOTIFY_OK;
> >> + default:
> >> + mutex_unlock(&priv->clk_mutex);
> > Any risk the POST_RATE_CHANGE or ABORT_RATE_CHANGE may go missing so
> > we
> > fail to unlock the mutex?
> > I think not but wanted to make sure you had thought about it.
>
> My assumption was that you always get POST_RATE_CHANGE or
> ABORT_RATE_CHANGE. But I am not 100% sure about that.
>
> Michael, Stephen: is it safe to assume that I will always get notified
> with POST_RATE_CHANGE or ABORT_RATE_CHANGE, after I got notified with
> PRE_RATE_CHANGE?
>
I think one or the other will happen. Of course, the notifiers are sort
of shunned so if you can avoid using notifiers entirely it would be
better.