• Laurent Pinchart's avatar
    drm: mxsfb: Don't touch AXI clock in IRQ context · 07b7fd77
    Laurent Pinchart authored
    The driver attempts agressive power management by enabling and disabling
    the AXI clock around register accesses. This results in attempts to
    enable and disable the clock in the IRQ handler, which is a no-go as
    preparing or unpreparing the clock may sleep.
    
    On the other hand, the driver enables the AXI clock when enabling the
    CRTC and keeps it enabled until the CRTC is disabled. This is correct,
    and renders the power management attempt pointless, as interrupts are
    not supposed to occur when the CRTC is off.
    
    The same reasoning can be applied to the CRTC .enable_vblank() and
    .disable_vblank() that are not supposed to be called when the CRTC off
    and thus don't require manual handling of the AXI clock. Furthermore,
    vblank handling is never enabled, which results in the vblank enable and
    disable handlers never being called.
    
    To fix this, remove the manual clock handling in the IRQ, the CRTC
    .enable_vblank() and .disable_vblank() handlers and the plane
    .atomic_update() handler. We however need to handle the clock manually
    in mxsfb_irq_disable() as is calls .disable_vblank() manually and is
    used both at probe and remove time.
    
    The clock disabling is also moved to the last step of the
    mxsfb_crtc_atomic_disable() function, to prepare for enabling vblank
    handling.
    Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: default avatarStefan Agner <stefan@agner.ch>
    Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
    Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200727020654.8231-14-laurent.pinchart@ideasonboard.com
    07b7fd77
mxsfb_kms.c 13.7 KB