drm/mediatek: dp: Avoid mutex locks if audio is not supported/enabled
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 25 Jul 2023 07:32:30 +0000 (09:32 +0200)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Wed, 9 Aug 2023 23:20:30 +0000 (23:20 +0000)
commit848bc59f7713ef76d5f812bd1e95d21e9b422cc2
tree41738300ccf37bde633787c17145bcc3f36d119f
parent779b8d20ca6fe62fe45da726c86ed1a1368cf313
drm/mediatek: dp: Avoid mutex locks if audio is not supported/enabled

If a controller (usually, eDP!) does not support audio, or audio is not
enabled because the endpoint has no audio support, it's useless to lock
a mutex only to unlock it right after because there's no .plugged_cb().

Check if the audio is supported and enabled before locking the mutex in
mtk_dp_update_plugged_status(): if not, we simply return immediately.

While at it, since the update_plugged_status_lock mutex would not be
used if the controller doesn't support audio at all, initialize it
only if `audio_supported` is true.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230725073234.55892-8-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dp.c