summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i2c
diff options
context:
space:
mode:
authorRussell King2016-11-02 22:38:34 +0100
committerRussell King2016-11-18 01:00:40 +0100
commit2cae8e028ecb44003f607584e014c15a2f415e8a (patch)
tree5a62f28db697fcf1781312e99b73ac168a30e6e5 /drivers/gpu/drm/i2c
parentdrm/i2c: tda998x: avoid racy access to mode clock (diff)
downloadkernel-qcow2-linux-2cae8e028ecb44003f607584e014c15a2f415e8a.tar.gz
kernel-qcow2-linux-2cae8e028ecb44003f607584e014c15a2f415e8a.tar.xz
kernel-qcow2-linux-2cae8e028ecb44003f607584e014c15a2f415e8a.zip
drm/i2c: tda998x: avoid race when programming audio
Avoid a race between programming audio and an in-progress mode set. A mode set is complex, and disables the ability to send infoframes to the sink, and is disruptive to audio - we have to mute the audio FIFO while doing a mode set. If an attempt is made to start up the audio side, we will undo the audio FIFO mute before the mode set has completed. Move the lock so that we prevent audio interfering with an in-progress mode set. Tested-by: Jon Medhurst <tixy@linaro.org> Acked-by: Jon Medhurst <tixy@linaro.org> Tested-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r--drivers/gpu/drm/i2c/tda998x_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 422d63d5fb75..dd183cee98b0 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -971,6 +971,8 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
div = 3;
}
+ mutex_lock(&priv->audio_mutex);
+
/* mute the audio FIFO: */
reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
@@ -1064,8 +1066,6 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
/* must be last register set: */
reg_write(priv, REG_TBG_CNTRL_0, 0);
- mutex_lock(&priv->audio_mutex);
-
priv->tmds_clock = adjusted_mode->clock;
/* Only setup the info frames if the sink is HDMI */