All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support
@ 2016-02-29 13:12 Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support Yoshihiro Kaneko
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-02-29 13:12 UTC (permalink / raw)
  To: linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

This series adds UDS support, NV16 scaling support and callback functions
to be required by a clipping process.

This series is against the master branch of linuxtv.org/media_tree.git.

Koji Matsuoka (3):
  media: soc_camera: rcar_vin: Add get_selection callback function
  media: soc_camera: rcar_vin: Add cropcap callback function
  media: soc_camera: rcar_vin: Add NV16 scaling support

Yoshihiko Mori (1):
  media: soc_camera: rcar_vin: Add UDS support

 drivers/media/platform/soc_camera/rcar_vin.c | 220 ++++++++++++++++++++++-----
 1 file changed, 184 insertions(+), 36 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support
  2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
@ 2016-02-29 13:12 ` Yoshihiro Kaneko
  2016-02-29 13:31   ` Sergei Shtylyov
  2016-02-29 13:12 ` [PATCH/RFC 2/4] media: soc_camera: rcar_vin: Add get_selection callback function Yoshihiro Kaneko
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-02-29 13:12 UTC (permalink / raw)
  To: linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

From: Yoshihiko Mori <yoshihiko.mori.nx@renesas.com>

Add UDS control for R-Car Gen3. Up down scaler can be vertical and
horizontal scaling.

Signed-off-by: Yoshihiko Mori <yoshihiko.mori.nx@renesas.com>
Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 175 +++++++++++++++++++++------
 1 file changed, 140 insertions(+), 35 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index dc75a80..a22141b 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -90,6 +90,7 @@
 
 /* Register bit fields for R-Car VIN */
 /* Video n Main Control Register bits */
+#define VNMC_SCLE		(1 << 26)
 #define VNMC_FOC		(1 << 21)
 #define VNMC_YCAL		(1 << 19)
 #define VNMC_INF_YUV8_BT656	(0 << 16)
@@ -132,6 +133,17 @@
 #define VNDMR2_FTEV		(1 << 17)
 #define VNDMR2_VLV(n)		((n & 0xf) << 12)
 
+/* UDS */
+#define VNUDS_CTRL_REG		0x80	/* Scaling Control Registers */
+#define VNUDS_CTRL_AMD		(1 << 30)
+#define VNUDS_CTRL_BC		(1 << 20)
+#define VNUDS_CTRL_TDIPC	(1 << 1)
+
+#define VNUDS_SCALE_REG		0x84	/* Scaling Factor Register */
+#define VNUDS_PASS_BWIDTH_REG	0x90	/* Passband Registers */
+#define VNUDS_IPC_REG		0x98	/* 2D IPC Setting Register */
+#define VNUDS_CLIP_SIZE_REG	0xA4	/* UDS Output Size Clipping Register */
+
 #define VIN_MAX_WIDTH		2048
 #define VIN_MAX_HEIGHT		2048
 
@@ -526,6 +538,14 @@ struct rcar_vin_cam {
 	const struct soc_mbus_pixelfmt	*extra_fmt;
 };
 
+static inline int is_scaling(struct rcar_vin_cam *cam)
+{
+	if (cam->width != cam->out_width || cam->height != cam->out_height)
+		return 1;
+
+	return 0;
+}
+
 /*
  * .queue_setup() is called to check whether the driver can accept the requested
  * number of buffers and to fill in plane sizes for the current frame format if
@@ -667,6 +687,9 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
 	if (input_is_yuv == output_is_yuv)
 		vnmc |= VNMC_BPS;
 
+	if (priv->chip == RCAR_GEN3 && is_scaling(cam))
+		vnmc |= VNMC_SCLE;
+
 	/* progressive or interlaced mode */
 	interrupts = progressive ? VNIE_FIE : VNIE_EFE;
 
@@ -973,6 +996,75 @@ static void rcar_vin_remove_device(struct soc_camera_device *icd)
 		icd->devnum);
 }
 
+struct rcar_vin_uds_regs {
+	unsigned long ctrl;
+	unsigned long scale;
+	unsigned long pass_bwidth;
+	unsigned long clip_size;
+};
+
+static unsigned long rcar_vin_get_bwidth(unsigned long ratio)
+{
+	unsigned long bwidth;
+	unsigned long mant, frac;
+
+	mant = (ratio & 0xF000) >> 12;
+	frac = ratio & 0x0FFF;
+	if (mant)
+		bwidth = 64 * 4096 * mant / (4096 * mant + frac);
+	else
+		bwidth = 64;
+
+	return bwidth;
+}
+
+static unsigned long rcar_vin_compute_ratio(unsigned int input,
+		unsigned int output)
+{
+#ifdef DISABLE_UDS_CTRL_AMD
+	return (input - 1) * 4096 / (output - 1);
+#else
+	if (output > input)
+		return input * 4096 / output;
+	else
+		return (input - 1) * 4096 / (output - 1);
+#endif
+}
+
+int rcar_vin_uds_set(struct rcar_vin_priv *priv, struct rcar_vin_cam *cam)
+{
+	struct rcar_vin_uds_regs regs;
+	unsigned long ratio_h, ratio_v;
+	unsigned long bwidth_h, bwidth_v;
+	unsigned long ctrl;
+	unsigned long clip_size;
+	struct v4l2_rect *cam_subrect = &cam->subrect;
+	u32 vnmc;
+
+	ratio_h = rcar_vin_compute_ratio(cam_subrect->width, cam->out_width);
+	ratio_v = rcar_vin_compute_ratio(cam_subrect->height, cam->out_height);
+
+	bwidth_h = rcar_vin_get_bwidth(ratio_h);
+	bwidth_v = rcar_vin_get_bwidth(ratio_v);
+
+	ctrl = VNUDS_CTRL_AMD;
+	clip_size = (cam->out_width << 16) | cam->out_height;
+
+	regs.ctrl = ctrl;
+	regs.scale = (ratio_h << 16) | ratio_v;
+	regs.pass_bwidth = (bwidth_h << 16) | bwidth_v;
+	regs.clip_size = clip_size;
+
+	vnmc = ioread32(priv->base + VNMC_REG);
+	iowrite32(vnmc | VNMC_SCLE, priv->base + VNMC_REG);
+	iowrite32(regs.ctrl, priv->base + VNUDS_CTRL_REG);
+	iowrite32(regs.scale, priv->base + VNUDS_SCALE_REG);
+	iowrite32(regs.pass_bwidth, priv->base + VNUDS_PASS_BWIDTH_REG);
+	iowrite32(regs.clip_size, priv->base + VNUDS_CLIP_SIZE_REG);
+
+	return 0;
+}
+
 static void set_coeff(struct rcar_vin_priv *priv, unsigned short xs)
 {
 	int i;
@@ -1037,6 +1129,7 @@ static int rcar_vin_set_rect(struct soc_camera_device *icd)
 	unsigned char dsize = 0;
 	struct v4l2_rect *cam_subrect = &cam->subrect;
 	u32 value;
+	int ret;
 
 	dev_dbg(icd->parent, "Crop %ux%u@%u:%u\n",
 		icd->user_width, icd->user_height, cam->vin_left, cam->vin_top);
@@ -1073,48 +1166,60 @@ static int rcar_vin_set_rect(struct soc_camera_device *icd)
 		break;
 	}
 
-	/* Set scaling coefficient */
-	value = 0;
-	if (cam_subrect->height != cam->out_height)
-		value = (4096 * cam_subrect->height) / cam->out_height;
-	dev_dbg(icd->parent, "YS Value: %x\n", value);
-	iowrite32(value, priv->base + VNYS_REG);
-
-	value = 0;
-	if (cam_subrect->width != cam->out_width)
-		value = (4096 * cam_subrect->width) / cam->out_width;
+	if (priv->chip == RCAR_GEN3 && is_scaling(cam) {
+		ret = rcar_vin_uds_set(priv, cam);
+		if (ret < 0)
+			return ret;
+		iowrite32(ALIGN(cam->out_width, 0x20), priv->base + VNIS_REG);
+	} else {
+		/* Set scaling coefficient */
+		value = 0;
+		if (cam_subrect->height != cam->out_height)
+			value = (4096 * cam_subrect->height) / cam->out_height;
+		dev_dbg(icd->parent, "YS Value: %x\n", value);
+		iowrite32(value, priv->base + VNYS_REG);
 
-	/* Horizontal upscaling is up to double size */
-	if (0 < value && value < 2048)
-		value = 2048;
+		value = 0;
+		if (cam_subrect->width != cam->out_width)
+			value = (4096 * cam_subrect->width) / cam->out_width;
 
-	dev_dbg(icd->parent, "XS Value: %x\n", value);
-	iowrite32(value, priv->base + VNXS_REG);
+		/* Horizontal upscaling is up to double size */
+		if (value > 0 && value < 2048)
+			value = 2048;
 
-	/* Horizontal upscaling is carried out by scaling down from double size */
-	if (value < 4096)
-		value *= 2;
+		dev_dbg(icd->parent, "XS Value: %x\n", value);
+		iowrite32(value, priv->base + VNXS_REG);
 
-	set_coeff(priv, value);
+		/*
+		 * Horizontal upscaling is carried out
+		 * by scaling down from double size
+		 */
+		if (value < 4096)
+			value *= 2;
+
+		set_coeff(priv, value);
+
+		/* Set Start/End Pixel/Line Post-Clip */
+		iowrite32(0, priv->base + VNSPPOC_REG);
+		iowrite32(0, priv->base + VNSLPOC_REG);
+		iowrite32((cam->out_width - 1) << dsize,
+			priv->base + VNEPPOC_REG);
+		switch (priv->field) {
+		case V4L2_FIELD_INTERLACED:
+		case V4L2_FIELD_INTERLACED_TB:
+		case V4L2_FIELD_INTERLACED_BT:
+			iowrite32(cam->out_height / 2 - 1,
+				  priv->base + VNELPOC_REG);
+			break;
+		default:
+			iowrite32(cam->out_height - 1,
+				priv->base + VNELPOC_REG);
+			break;
+		}
 
-	/* Set Start/End Pixel/Line Post-Clip */
-	iowrite32(0, priv->base + VNSPPOC_REG);
-	iowrite32(0, priv->base + VNSLPOC_REG);
-	iowrite32((cam->out_width - 1) << dsize, priv->base + VNEPPOC_REG);
-	switch (priv->field) {
-	case V4L2_FIELD_INTERLACED:
-	case V4L2_FIELD_INTERLACED_TB:
-	case V4L2_FIELD_INTERLACED_BT:
-		iowrite32(cam->out_height / 2 - 1,
-			  priv->base + VNELPOC_REG);
-		break;
-	default:
-		iowrite32(cam->out_height - 1, priv->base + VNELPOC_REG);
-		break;
+		iowrite32(ALIGN(cam->out_width, 0x10), priv->base + VNIS_REG);
 	}
 
-	iowrite32(ALIGN(cam->out_width, 0x10), priv->base + VNIS_REG);
-
 	return 0;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH/RFC 2/4] media: soc_camera: rcar_vin: Add get_selection callback function
  2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support Yoshihiro Kaneko
@ 2016-02-29 13:12 ` Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 3/4] media: soc_camera: rcar_vin: Add cropcap " Yoshihiro Kaneko
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-02-29 13:12 UTC (permalink / raw)
  To: linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

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

Add get_selection callback function because it is required for
clipping processing.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index a22141b..9225992 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1906,6 +1906,13 @@ static int rcar_vin_init_videobuf2(struct vb2_queue *vq,
 	return vb2_queue_init(vq);
 }
 
+static int rcar_vin_get_selection(struct soc_camera_device *icd,
+				  struct v4l2_selection *sel)
+{
+	/* TODO */
+	return 0;
+}
+
 static struct soc_camera_host_ops rcar_vin_host_ops = {
 	.owner		= THIS_MODULE,
 	.add		= rcar_vin_add_device,
@@ -1920,6 +1927,7 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
 	.querycap	= rcar_vin_querycap,
 	.set_bus_param	= rcar_vin_set_bus_param,
 	.init_videobuf2	= rcar_vin_init_videobuf2,
+	.get_selection	= rcar_vin_get_selection,
 };
 
 #ifdef CONFIG_OF
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH/RFC 3/4] media: soc_camera: rcar_vin: Add cropcap callback function
  2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 2/4] media: soc_camera: rcar_vin: Add get_selection callback function Yoshihiro Kaneko
@ 2016-02-29 13:12 ` Yoshihiro Kaneko
  2016-02-29 13:12 ` [PATCH/RFC 4/4] media: soc_camera: rcar_vin: Add NV16 scaling support Yoshihiro Kaneko
  2016-02-29 13:27 ` [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and " Hans Verkuil
  4 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-02-29 13:12 UTC (permalink / raw)
  To: linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

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

Add cropcap callback function because it is required for
clipping processing.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 9225992..96f3c8a 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1913,6 +1913,13 @@ static int rcar_vin_get_selection(struct soc_camera_device *icd,
 	return 0;
 }
 
+static int rcar_vin_cropcap(struct soc_camera_device *icd,
+			    struct v4l2_cropcap *crop)
+{
+	/* TODO */
+	return 0;
+}
+
 static struct soc_camera_host_ops rcar_vin_host_ops = {
 	.owner		= THIS_MODULE,
 	.add		= rcar_vin_add_device,
@@ -1928,6 +1935,7 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
 	.set_bus_param	= rcar_vin_set_bus_param,
 	.init_videobuf2	= rcar_vin_init_videobuf2,
 	.get_selection	= rcar_vin_get_selection,
+	.cropcap	= rcar_vin_cropcap,
 };
 
 #ifdef CONFIG_OF
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH/RFC 4/4] media: soc_camera: rcar_vin: Add NV16 scaling support
  2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
                   ` (2 preceding siblings ...)
  2016-02-29 13:12 ` [PATCH/RFC 3/4] media: soc_camera: rcar_vin: Add cropcap " Yoshihiro Kaneko
@ 2016-02-29 13:12 ` Yoshihiro Kaneko
  2016-02-29 13:27 ` [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and " Hans Verkuil
  4 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-02-29 13:12 UTC (permalink / raw)
  To: linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

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

The scaling function had been forbidden for the capture format of NV16
until now. With this patch, a horizontal scaling-up function is
supported to the capture format of NV16.
This patch adds the check of the capture width for NV16 format, too.
At the time of NV16 capture format, the user has to specify the capture
output width of the multiple of 32 for H/W specification. At the time of
using ioctl of VIDIOC_S_FMT, this patch adds the error handling to forbid
specification of the capture output width which is not a multiple of 32.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 36 +++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 96f3c8a..979b28c 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -504,6 +504,7 @@ struct rcar_vin_priv {
 	bool				request_to_stop;
 	struct completion		capture_stop;
 	enum chip_id			chip;
+	bool				error_check_flag;
 };
 
 #define is_continuous_transfer(priv)	(priv->vb_count > MAX_BUFFER_NUM)
@@ -649,7 +650,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(cam->width * cam->height, 0x80),
+		iowrite32(ALIGN(cam->out_width * cam->out_height, 0x80),
 			  priv->base + VNUVAOF_REG);
 		dmr = VNDMR_DTMD_YCSEP;
 		output_is_yuv = true;
@@ -961,6 +962,8 @@ static int rcar_vin_add_device(struct soc_camera_device *icd)
 	dev_dbg(icd->parent, "R-Car VIN driver attached to camera %d\n",
 		icd->devnum);
 
+	priv->error_check_flag = false;
+
 	return 0;
 }
 
@@ -978,6 +981,7 @@ static void rcar_vin_remove_device(struct soc_camera_device *icd)
 
 	priv->state = STOPPED;
 	priv->request_to_stop = false;
+	priv->error_check_flag = false;
 
 	/* make sure active buffer is cancelled */
 	spin_lock_irq(&priv->lock);
@@ -1166,11 +1170,19 @@ static int rcar_vin_set_rect(struct soc_camera_device *icd)
 		break;
 	}
 
-	if (priv->chip == RCAR_GEN3 && is_scaling(cam) {
-		ret = rcar_vin_uds_set(priv, cam);
-		if (ret < 0)
-			return ret;
-		iowrite32(ALIGN(cam->out_width, 0x20), priv->base + VNIS_REG);
+	if (priv->chip == RCAR_GEN3) {
+		if (is_scaling(cam)) {
+			ret = rcar_vin_uds_set(priv, cam);
+			if (ret < 0)
+				return ret;
+		}
+		if (is_scaling(cam) ||
+		    icd->current_fmt->host_fmt->fourcc == V4L2_PIX_FMT_NV16)
+			iowrite32(ALIGN(cam->out_width, 0x20),
+				  priv->base + VNIS_REG);
+		else
+			iowrite32(ALIGN(cam->out_width, 0x10),
+				  priv->base + VNIS_REG);
 	} else {
 		/* Set scaling coefficient */
 		value = 0;
@@ -1674,6 +1686,17 @@ static int rcar_vin_set_fmt(struct soc_camera_device *icd,
 	dev_dbg(dev, "S_FMT(pix=0x%x, %ux%u)\n",
 		pixfmt, pix->width, pix->height);
 
+	/*
+	 * At the time of NV16 capture format, the user has to specify the
+	 * width of the multiple of 32 for H/W specification.
+	 */
+	if (priv->error_check_flag == false) {
+		priv->error_check_flag = true;
+	} else if (pixfmt == V4L2_PIX_FMT_NV16 && (pix->width & 0x1F)) {
+		dev_dbg(icd->parent, "specified width error in NV16 format.\n");
+		return -EINVAL;
+	}
+
 	switch (pix->field) {
 	default:
 		pix->field = V4L2_FIELD_NONE;
@@ -1720,6 +1743,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:
 		can_scale = true;
 		break;
 	default:
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support
  2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
                   ` (3 preceding siblings ...)
  2016-02-29 13:12 ` [PATCH/RFC 4/4] media: soc_camera: rcar_vin: Add NV16 scaling support Yoshihiro Kaneko
@ 2016-02-29 13:27 ` Hans Verkuil
  2016-03-02 17:26   ` Yoshihiro Kaneko
  4 siblings, 1 reply; 10+ messages in thread
From: Hans Verkuil @ 2016-02-29 13:27 UTC (permalink / raw)
  To: Yoshihiro Kaneko, linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

Huh, you must have missed Niklas's work the rcar-vin driver:

http://www.spinics.net/lists/linux-media/msg97816.html

I expect that the old soc-camera driver will be retired soon in favor of
the new driver, so I don't want to accept patches for that one.

I recommend that you check the new driver and see what (if anything) is needed
to get this functionality in there and work with Niklas on this.

This is all quite recent work, so it is not surprising that you missed it.

Regards,

	Hans

On 02/29/2016 02:12 PM, Yoshihiro Kaneko wrote:
> This series adds UDS support, NV16 scaling support and callback functions
> to be required by a clipping process.
> 
> This series is against the master branch of linuxtv.org/media_tree.git.
> 
> Koji Matsuoka (3):
>   media: soc_camera: rcar_vin: Add get_selection callback function
>   media: soc_camera: rcar_vin: Add cropcap callback function
>   media: soc_camera: rcar_vin: Add NV16 scaling support
> 
> Yoshihiko Mori (1):
>   media: soc_camera: rcar_vin: Add UDS support
> 
>  drivers/media/platform/soc_camera/rcar_vin.c | 220 ++++++++++++++++++++++-----
>  1 file changed, 184 insertions(+), 36 deletions(-)
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support
  2016-02-29 13:12 ` [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support Yoshihiro Kaneko
@ 2016-02-29 13:31   ` Sergei Shtylyov
  0 siblings, 0 replies; 10+ messages in thread
From: Sergei Shtylyov @ 2016-02-29 13:31 UTC (permalink / raw)
  To: Yoshihiro Kaneko, linux-media
  Cc: Guennadi Liakhovetski, Simon Horman, Magnus Damm, linux-renesas-soc

Hello.

On 2/29/2016 4:12 PM, Yoshihiro Kaneko wrote:

> From: Yoshihiko Mori <yoshihiko.mori.nx@renesas.com>
>
> Add UDS control for R-Car Gen3. Up down scaler can be vertical and
> horizontal scaling.
>
> Signed-off-by: Yoshihiko Mori <yoshihiko.mori.nx@renesas.com>
> Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---
>   drivers/media/platform/soc_camera/rcar_vin.c | 175 +++++++++++++++++++++------
>   1 file changed, 140 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
> index dc75a80..a22141b 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
> @@ -90,6 +90,7 @@
>
>   /* Register bit fields for R-Car VIN */
>   /* Video n Main Control Register bits */
> +#define VNMC_SCLE		(1 << 26)

    This is gen3 only, right? Please add a comment about that.

>   #define VNMC_FOC		(1 << 21)
>   #define VNMC_YCAL		(1 << 19)
>   #define VNMC_INF_YUV8_BT656	(0 << 16)
> @@ -132,6 +133,17 @@
>   #define VNDMR2_FTEV		(1 << 17)
>   #define VNDMR2_VLV(n)		((n & 0xf) << 12)
>
> +/* UDS */
> +#define VNUDS_CTRL_REG		0x80	/* Scaling Control Registers */
> +#define VNUDS_CTRL_AMD		(1 << 30)
> +#define VNUDS_CTRL_BC		(1 << 20)
> +#define VNUDS_CTRL_TDIPC	(1 << 1)
> +
> +#define VNUDS_SCALE_REG		0x84	/* Scaling Factor Register */
> +#define VNUDS_PASS_BWIDTH_REG	0x90	/* Passband Registers */
> +#define VNUDS_IPC_REG		0x98	/* 2D IPC Setting Register */
> +#define VNUDS_CLIP_SIZE_REG	0xA4	/* UDS Output Size Clipping Register */
> +
>   #define VIN_MAX_WIDTH		2048
>   #define VIN_MAX_HEIGHT		2048
>
> @@ -526,6 +538,14 @@ struct rcar_vin_cam {
>   	const struct soc_mbus_pixelfmt	*extra_fmt;
>   };
>
> +static inline int is_scaling(struct rcar_vin_cam *cam)

    s/int/bool/.

> +{
> +	if (cam->width != cam->out_width || cam->height != cam->out_height)
> +		return 1;

    s/1/true/.

> +
> +	return 0;

    s/0/false/.

[...]
> +static unsigned long rcar_vin_compute_ratio(unsigned int input,
> +		unsigned int output)
> +{
> +#ifdef DISABLE_UDS_CTRL_AMD

    This not #define'd, right?

> +	return (input - 1) * 4096 / (output - 1);
> +#else
> +	if (output > input)
> +		return input * 4096 / output;
> +	else
> +		return (input - 1) * 4096 / (output - 1);
> +#endif
> +}
[...]
> -	/* Horizontal upscaling is carried out by scaling down from double size */
> -	if (value < 4096)
> -		value *= 2;
> +		dev_dbg(icd->parent, "XS Value: %x\n", value);
> +		iowrite32(value, priv->base + VNXS_REG);
>
> -	set_coeff(priv, value);
> +		/*
> +		 * Horizontal upscaling is carried out
> +		 * by scaling down from double size
> +		 */
> +		if (value < 4096)
> +			value *= 2;
> +
> +		set_coeff(priv, value);
> +
> +		/* Set Start/End Pixel/Line Post-Clip */
> +		iowrite32(0, priv->base + VNSPPOC_REG);
> +		iowrite32(0, priv->base + VNSLPOC_REG);
> +		iowrite32((cam->out_width - 1) << dsize,
> +			priv->base + VNEPPOC_REG);

    Please align the continuation line to start under the second (.

[...]

MBR, Sergei


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support
  2016-02-29 13:27 ` [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and " Hans Verkuil
@ 2016-03-02 17:26   ` Yoshihiro Kaneko
  2016-03-02 21:45     ` Niklas Söderlund
  0 siblings, 1 reply; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-03-02 17:26 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Linux Media Mailing List, Guennadi Liakhovetski, Simon Horman,
	Magnus Damm, linux-renesas-soc

Hi Hans,

2016-02-29 22:27 GMT+09:00 Hans Verkuil <hverkuil@xs4all.nl>:
> Huh, you must have missed Niklas's work the rcar-vin driver:
>
> http://www.spinics.net/lists/linux-media/msg97816.html
>
> I expect that the old soc-camera driver will be retired soon in favor of
> the new driver, so I don't want to accept patches for that one.
>
> I recommend that you check the new driver and see what (if anything) is needed
> to get this functionality in there and work with Niklas on this.
>
> This is all quite recent work, so it is not surprising that you missed it.

Thank you for informing me!
I will check it.

>
> Regards,
>
>         Hans

Regards,
kaneko

>
> On 02/29/2016 02:12 PM, Yoshihiro Kaneko wrote:
>> This series adds UDS support, NV16 scaling support and callback functions
>> to be required by a clipping process.
>>
>> This series is against the master branch of linuxtv.org/media_tree.git.
>>
>> Koji Matsuoka (3):
>>   media: soc_camera: rcar_vin: Add get_selection callback function
>>   media: soc_camera: rcar_vin: Add cropcap callback function
>>   media: soc_camera: rcar_vin: Add NV16 scaling support
>>
>> Yoshihiko Mori (1):
>>   media: soc_camera: rcar_vin: Add UDS support
>>
>>  drivers/media/platform/soc_camera/rcar_vin.c | 220 ++++++++++++++++++++++-----
>>  1 file changed, 184 insertions(+), 36 deletions(-)
>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support
  2016-03-02 17:26   ` Yoshihiro Kaneko
@ 2016-03-02 21:45     ` Niklas Söderlund
  2016-03-10 15:50       ` Yoshihiro Kaneko
  0 siblings, 1 reply; 10+ messages in thread
From: Niklas Söderlund @ 2016-03-02 21:45 UTC (permalink / raw)
  To: Yoshihiro Kaneko
  Cc: Hans Verkuil, Linux Media Mailing List, Guennadi Liakhovetski,
	Simon Horman, Magnus Damm, linux-renesas-soc

Hi Kaneko-san,

On 2016-03-03 02:26:41 +0900, Yoshihiro Kaneko wrote:
> Hi Hans,
> 
> 2016-02-29 22:27 GMT+09:00 Hans Verkuil <hverkuil@xs4all.nl>:
> > Huh, you must have missed Niklas's work the rcar-vin driver:
> >
> > http://www.spinics.net/lists/linux-media/msg97816.html
> >
> > I expect that the old soc-camera driver will be retired soon in favor of
> > the new driver, so I don't want to accept patches for that one.
> >
> > I recommend that you check the new driver and see what (if anything) is needed
> > to get this functionality in there and work with Niklas on this.
> >
> > This is all quite recent work, so it is not surprising that you missed it.
> 
> Thank you for informing me!
> I will check it.

My plan is to look at VIN for Gen3 once Gen2 support is done. I have 
somewhat tried to keep the new driver prepared for Gen3. I have 
separating the Gen2 scaler och clipper out in its own corner since this 
will be different on Gen3.

My understanding is however that Gen3 don't provide UDS blocks 
(scaler+clipper) to all VIN instances. And the VIN instances that have 
access to a UDS block have to share it with one other VIN instance (only 
one user at a time). How to describe this in DT in a good way I do not 
yet know. If you have any ideas here or know more I would be glad to 
hear it, I have not yet started any work for Gen3.

My initial plan for Gen3 enablement is to ignore the UDS blocks all 
together. I feel there is enough to adapt VIN driver and get both the 
CSI2 and sensor driver to work to be able to test the whole chain 
without worrying about UDS too.

> 
> >
> > Regards,
> >
> >         Hans
> 
> Regards,
> kaneko
> 
> >
> > On 02/29/2016 02:12 PM, Yoshihiro Kaneko wrote:
> >> This series adds UDS support, NV16 scaling support and callback functions
> >> to be required by a clipping process.
> >>
> >> This series is against the master branch of linuxtv.org/media_tree.git.
> >>
> >> Koji Matsuoka (3):
> >>   media: soc_camera: rcar_vin: Add get_selection callback function
> >>   media: soc_camera: rcar_vin: Add cropcap callback function
> >>   media: soc_camera: rcar_vin: Add NV16 scaling support
> >>
> >> Yoshihiko Mori (1):
> >>   media: soc_camera: rcar_vin: Add UDS support
> >>
> >>  drivers/media/platform/soc_camera/rcar_vin.c | 220 ++++++++++++++++++++++-----
> >>  1 file changed, 184 insertions(+), 36 deletions(-)
> >>
> >

-- 
Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support
  2016-03-02 21:45     ` Niklas Söderlund
@ 2016-03-10 15:50       ` Yoshihiro Kaneko
  0 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Kaneko @ 2016-03-10 15:50 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Hans Verkuil, Linux Media Mailing List, Guennadi Liakhovetski,
	Magnus Damm, Simon Horman, linux-renesas-soc

Hi Niklas-san,

I'm very sorry for the long delay in my reply.

2016-03-03 6:45 GMT+09:00 Niklas Söderlund <niklas.soderlund@ragnatech.se>:
> Hi Kaneko-san,
>
> On 2016-03-03 02:26:41 +0900, Yoshihiro Kaneko wrote:
>> Hi Hans,
>>
>> 2016-02-29 22:27 GMT+09:00 Hans Verkuil <hverkuil@xs4all.nl>:
>> > Huh, you must have missed Niklas's work the rcar-vin driver:
>> >
>> > http://www.spinics.net/lists/linux-media/msg97816.html
>> >
>> > I expect that the old soc-camera driver will be retired soon in favor of
>> > the new driver, so I don't want to accept patches for that one.
>> >
>> > I recommend that you check the new driver and see what (if anything) is needed
>> > to get this functionality in there and work with Niklas on this.
>> >
>> > This is all quite recent work, so it is not surprising that you missed it.
>>
>> Thank you for informing me!
>> I will check it.
>
> My plan is to look at VIN for Gen3 once Gen2 support is done. I have
> somewhat tried to keep the new driver prepared for Gen3. I have
> separating the Gen2 scaler och clipper out in its own corner since this
> will be different on Gen3.
>
> My understanding is however that Gen3 don't provide UDS blocks
> (scaler+clipper) to all VIN instances. And the VIN instances that have
> access to a UDS block have to share it with one other VIN instance (only
> one user at a time). How to describe this in DT in a good way I do not
> yet know. If you have any ideas here or know more I would be glad to
> hear it, I have not yet started any work for Gen3.
>
> My initial plan for Gen3 enablement is to ignore the UDS blocks all
> together. I feel there is enough to adapt VIN driver and get both the
> CSI2 and sensor driver to work to be able to test the whole chain
> without worrying about UDS too.

Thanks for your detailed explanation.
I don't have any idea. Sorry that I can't help you.
I stop posting any patch for the current (old) VIN driver.

Thanks,
kaneko

>
>>
>> >
>> > Regards,
>> >
>> >         Hans
>>
>> Regards,
>> kaneko
>>
>> >
>> > On 02/29/2016 02:12 PM, Yoshihiro Kaneko wrote:
>> >> This series adds UDS support, NV16 scaling support and callback functions
>> >> to be required by a clipping process.
>> >>
>> >> This series is against the master branch of linuxtv.org/media_tree.git.
>> >>
>> >> Koji Matsuoka (3):
>> >>   media: soc_camera: rcar_vin: Add get_selection callback function
>> >>   media: soc_camera: rcar_vin: Add cropcap callback function
>> >>   media: soc_camera: rcar_vin: Add NV16 scaling support
>> >>
>> >> Yoshihiko Mori (1):
>> >>   media: soc_camera: rcar_vin: Add UDS support
>> >>
>> >>  drivers/media/platform/soc_camera/rcar_vin.c | 220 ++++++++++++++++++++++-----
>> >>  1 file changed, 184 insertions(+), 36 deletions(-)
>> >>
>> >
>
> --
> Regards,
> Niklas Söderlund

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-03-10 15:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-29 13:12 [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and NV16 scaling support Yoshihiro Kaneko
2016-02-29 13:12 ` [PATCH/RFC 1/4] media: soc_camera: rcar_vin: Add UDS support Yoshihiro Kaneko
2016-02-29 13:31   ` Sergei Shtylyov
2016-02-29 13:12 ` [PATCH/RFC 2/4] media: soc_camera: rcar_vin: Add get_selection callback function Yoshihiro Kaneko
2016-02-29 13:12 ` [PATCH/RFC 3/4] media: soc_camera: rcar_vin: Add cropcap " Yoshihiro Kaneko
2016-02-29 13:12 ` [PATCH/RFC 4/4] media: soc_camera: rcar_vin: Add NV16 scaling support Yoshihiro Kaneko
2016-02-29 13:27 ` [PATCH/RFC 0/4] media: soc_camera: rcar_vin: Add UDS and " Hans Verkuil
2016-03-02 17:26   ` Yoshihiro Kaneko
2016-03-02 21:45     ` Niklas Söderlund
2016-03-10 15:50       ` Yoshihiro Kaneko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.