linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshihiro Kaneko <ykaneko0929@gmail.com>
To: linux-media@vger.kernel.org
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org
Subject: [PATCH v2 3/3] media: soc_camera: rcar_vin: Add NV16 horizontal scaling-up support
Date: Thu, 16 Oct 2014 06:12:48 +0000	[thread overview]
Message-ID: <1413439968-6349-4-git-send-email-ykaneko0929@gmail.com> (raw)
In-Reply-To: <1413439968-6349-1-git-send-email-ykaneko0929@gmail.com>

From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>

Up until now scaling has been forbidden for the NV16 capture format.
This patch adds support for horizontal scaling-up for NV16. Vertical
scaling-up for NV16 is forbidden by the H/W specification.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---

v2 [Yoshihiro Kaneko]
* Updated change log text from Simon Horman
* Code-style fixes as suggested by Sergei Shtylyov

 drivers/media/platform/soc_camera/rcar_vin.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index ff5f80a..234cf86 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -646,7 +646,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
 	/* output format */
 	switch (icd->current_fmt->host_fmt->fourcc) {
 	case V4L2_PIX_FMT_NV16:
-		iowrite32(ALIGN(ALIGN(cam->width, 0x20) * cam->height, 0x80),
+		iowrite32(ALIGN((cam->out_width * cam->out_height), 0x80),
 			  priv->base + VNUVAOF_REG);
 		dmr = VNDMR_DTMD_YCSEP;
 		output_is_yuv = true;
@@ -1619,9 +1619,15 @@ static int rcar_vin_set_fmt(struct soc_camera_device *icd,
 	   width of the multiple of 32 for H/W specification. */
 	if (priv->error_flag = false)
 		priv->error_flag = true;
-	else {
-		if ((pixfmt = V4L2_PIX_FMT_NV16) && (pix->width & 0x1F)) {
-			dev_err(icd->parent, "Specified width error in NV16 format.\n");
+	else if (pixfmt = V4L2_PIX_FMT_NV16) {
+		if (pix->width & 0x1F) {
+			dev_err(icd->parent,
+				"Specified width error in NV16 format. Please specify the multiple of 32.\n");
+			return -EINVAL;
+		}
+		if (pix->height != cam->height) {
+			dev_err(icd->parent,
+				"Vertical scaling-up error in NV16 format. Please specify input height size.\n");
 			return -EINVAL;
 		}
 	}
@@ -1668,6 +1674,7 @@ static int rcar_vin_set_fmt(struct soc_camera_device *icd,
 	case V4L2_PIX_FMT_YUYV:
 	case V4L2_PIX_FMT_RGB565:
 	case V4L2_PIX_FMT_RGB555X:
+	case V4L2_PIX_FMT_NV16: /* horizontal scaling-up only is supported */
 		can_scale = true;
 		break;
 	default:
-- 
1.9.1


      parent reply	other threads:[~2014-10-16  6:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  6:12 [PATCH v2 0/3] media: soc_camera: rcar_vin: Add scaling support Yoshihiro Kaneko
2014-10-16  6:12 ` [PATCH v2 1/3] " Yoshihiro Kaneko
2014-10-16  6:12 ` [PATCH v2 2/3] media: soc_camera: rcar_vin: Add capture width check for NV16 format Yoshihiro Kaneko
2014-10-18 14:46   ` Sergei Shtylyov
2014-10-18 15:05   ` Sergei Shtylyov
2014-10-16  6:12 ` Yoshihiro Kaneko [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=1413439968-6349-4-git-send-email-ykaneko0929@gmail.com \
    --to=ykaneko0929@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=horms@verge.net.au \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    /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).