media: imx: imx7-media-csi: Fix source type identification
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 15 Feb 2021 04:27:02 +0000 (05:27 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Mar 2021 10:59:50 +0000 (11:59 +0100)
commitc6f02291d114b76b081930ba0e0bacd655ad4128
tree18e3397e3fa987d03519029829b6c6dc5d8f953b
parent66f469c1b4843b4797c1aba2955c44abc58bdc54
media: imx: imx7-media-csi: Fix source type identification

The code in imx7_csi_pad_link_validate() that checks the type of the
source incorrectly handles devices that have no parallel input. In that
case, the source entity of the CSI is the CSI-2 receiver, not the video
mux, and the driver will proceed to check the type of the source of the
CSI-2 receiver.

Make the code more explicit to fix this, by handling the three cases
(parallel input only, CSI-2 receiver only, and video mux) separately.

Note that the driver will not correctly handle the case where only a
parallel input is present, and the external entity connected to the
parallel input reports a MEDIA_ENT_F_VID_IF_BRIDGE or
MEDIA_ENT_F_VID_MUX function. This was broken already, and should be
fixed separately.

Fixes: f5ffb81f5137 ("media: imx7: csi: Fix pad link validation")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/imx/imx7-media-csi.c