linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Fricke <sebastian.fricke@posteo.net>
To: linux-media@vger.kernel.org
Cc: dafna.hirschfeld@collabora.com,
	laurent.pinchart@ideasonboard.com, helen.koike@collabora.com,
	heiko@sntech.de, Sebastian Fricke <sebastian.fricke@posteo.net>
Subject: [PATCH 2/2] media: rkisp1: Limit the sink pad crop size
Date: Thu, 25 Mar 2021 20:27:03 +0100	[thread overview]
Message-ID: <20210325192700.21393-3-sebastian.fricke@posteo.net> (raw)
In-Reply-To: <20210325192700.21393-1-sebastian.fricke@posteo.net>

The RkISP can take higher input resolutions than 4032x3024, but the TRM
declares this size as the maximum size for handling black level calibration.
Crop the input resolution down to the expected size.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
---
 drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index 2e5b57e3aedc..06d3cca0c00c 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -758,9 +758,13 @@ static void rkisp1_isp_set_sink_crop(struct rkisp1_isp *isp,
 					  which);
 
 	sink_crop->left = ALIGN(r->left, 2);
-	sink_crop->width = ALIGN(r->width, 2);
+	sink_crop->width = clamp_t(u32, ALIGN(r->width, 2),
+				   RKISP1_ISP_MIN_WIDTH,
+				   RKISP1_ISP_MAX_WIDTH_PROCESSING);
 	sink_crop->top = r->top;
-	sink_crop->height = r->height;
+	sink_crop->height = clamp_t(u32, r->height,
+				    RKISP1_ISP_MIN_HEIGHT,
+				    RKISP1_ISP_MAX_HEIGHT_PROCESSING);
 	rkisp1_sd_adjust_crop(sink_crop, sink_fmt);
 
 	*r = *sink_crop;
-- 
2.25.1


      parent reply	other threads:[~2021-03-25 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 19:26 [PATCH 0/2] Allow higher sink pad resolutions for the RkISP1 Sebastian Fricke
2021-03-25 19:27 ` [PATCH 1/2] media: rkisp1: Increase ISP input resolution limit Sebastian Fricke
2021-03-26  4:14   ` Laurent Pinchart
2021-03-26  5:55     ` Sebastian Fricke
2021-03-25 19:27 ` Sebastian Fricke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325192700.21393-3-sebastian.fricke@posteo.net \
    --to=sebastian.fricke@posteo.net \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=heiko@sntech.de \
    --cc=helen.koike@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).