Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a28bda47 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab
Browse files

media: rcar-vin: align pixelformat check



If the pixelformat is not supported it should not fail but be set to
something that works. While we are at it move the two different
checks of the pixelformat to the same statement.

Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 9f324784
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -189,12 +189,10 @@ static int __rvin_try_format(struct rvin_dev *vin,
	u32 walign;
	int ret;

	/* If requested format is not supported fallback to the default */
	if (!rvin_format_from_pixel(pix->pixelformat)) {
		vin_dbg(vin, "Format 0x%x not found, using default 0x%x\n",
			pix->pixelformat, RVIN_DEFAULT_FORMAT);
	if (!rvin_format_from_pixel(pix->pixelformat) ||
	    (vin->info->model == RCAR_M1 &&
	     pix->pixelformat == V4L2_PIX_FMT_XBGR32))
		pix->pixelformat = RVIN_DEFAULT_FORMAT;
	}

	/* Limit to source capabilities */
	ret = __rvin_try_format_source(vin, which, pix, source);
@@ -233,12 +231,6 @@ static int __rvin_try_format(struct rvin_dev *vin,
	pix->bytesperline = rvin_format_bytesperline(pix);
	pix->sizeimage = rvin_format_sizeimage(pix);

	if (vin->info->model == RCAR_M1 &&
	    pix->pixelformat == V4L2_PIX_FMT_XBGR32) {
		vin_err(vin, "pixel format XBGR32 not supported on M1\n");
		return -EINVAL;
	}

	vin_dbg(vin, "Format %ux%u bpl: %d size: %d\n",
		pix->width, pix->height, pix->bytesperline, pix->sizeimage);