media: rcar-vin: Add check that input interface and format are valid
Add a check to make sure the input interface (CSI-2 or parallel) allow for the requested input bus format. If not inform the user and error out rather then try to continue with incorrect settings. While at it add the missing define for RGB666 that is not yet supported in the driver but we can preemptively check for it in this context already. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
e386038aff
commit
78b3f9d75a
|
@ -77,6 +77,7 @@
|
||||||
|
|
||||||
/* Register bit fields for R-Car VIN */
|
/* Register bit fields for R-Car VIN */
|
||||||
/* Video n Main Control Register bits */
|
/* Video n Main Control Register bits */
|
||||||
|
#define VNMC_INF_MASK (7 << 16)
|
||||||
#define VNMC_DPINE (1 << 27) /* Gen3 specific */
|
#define VNMC_DPINE (1 << 27) /* Gen3 specific */
|
||||||
#define VNMC_SCLE (1 << 26) /* Gen3 specific */
|
#define VNMC_SCLE (1 << 26) /* Gen3 specific */
|
||||||
#define VNMC_FOC (1 << 21)
|
#define VNMC_FOC (1 << 21)
|
||||||
|
@ -88,6 +89,7 @@
|
||||||
#define VNMC_INF_RAW8 (4 << 16)
|
#define VNMC_INF_RAW8 (4 << 16)
|
||||||
#define VNMC_INF_YUV16 (5 << 16)
|
#define VNMC_INF_YUV16 (5 << 16)
|
||||||
#define VNMC_INF_RGB888 (6 << 16)
|
#define VNMC_INF_RGB888 (6 << 16)
|
||||||
|
#define VNMC_INF_RGB666 (7 << 16)
|
||||||
#define VNMC_VUP (1 << 10)
|
#define VNMC_VUP (1 << 10)
|
||||||
#define VNMC_IM_ODD (0 << 3)
|
#define VNMC_IM_ODD (0 << 3)
|
||||||
#define VNMC_IM_ODD_EVEN (1 << 3)
|
#define VNMC_IM_ODD_EVEN (1 << 3)
|
||||||
|
@ -707,6 +709,29 @@ static int rvin_setup(struct rvin_dev *vin)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Make sure input interface and input format is valid. */
|
||||||
|
if (vin->info->model == RCAR_GEN3) {
|
||||||
|
switch (vnmc & VNMC_INF_MASK) {
|
||||||
|
case VNMC_INF_YUV8_BT656:
|
||||||
|
case VNMC_INF_YUV10_BT656:
|
||||||
|
case VNMC_INF_YUV16:
|
||||||
|
case VNMC_INF_RGB666:
|
||||||
|
if (vin->is_csi) {
|
||||||
|
vin_err(vin, "Invalid setting in MIPI CSI2\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VNMC_INF_RAW8:
|
||||||
|
if (!vin->is_csi) {
|
||||||
|
vin_err(vin, "Invalid setting in Digital Pins\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable VSYNC Field Toggle mode after one VSYNC input */
|
/* Enable VSYNC Field Toggle mode after one VSYNC input */
|
||||||
if (vin->info->model == RCAR_GEN3)
|
if (vin->info->model == RCAR_GEN3)
|
||||||
dmr2 = VNDMR2_FTEV;
|
dmr2 = VNDMR2_FTEV;
|
||||||
|
|
Loading…
Reference in New Issue