drm/vc4: hdmi: Add a spinlock to protect register access
authorMaxime Ripard <maxime@cerno.tech>
Mon, 25 Oct 2021 14:11:08 +0000 (16:11 +0200)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:03:44 +0000 (16:03 +0000)
commit0a69972f206fa72357764bb2d1d2661975b61455
tree2e80a8d5fbc9329ea60c1ed74a040ecf1b29f758
parentda6af99230058c9f1429c8eeb845cb6d6021f70a
drm/vc4: hdmi: Add a spinlock to protect register access

The vc4 HDMI driver has multiple path shared between the CEC, ALSA and
KMS frameworks, plus two interrupt handlers (CEC and hotplug) that will
read and modify a number of registers.

Even though not bug has been reported so far, it's definitely unsafe, so
let's just add a spinlock to protect the register access of the HDMI
controller.

Link: https://lore.kernel.org/r/20211025141113.702757-5-maxime@cerno.tech
Fixes: c8b75bca92cb ("drm/vc4: Add KMS support for Raspberry Pi.")
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hdmi.h
drivers/gpu/drm/vc4/vc4_hdmi_phy.c
drivers/gpu/drm/vc4/vc4_hdmi_regs.h