All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7
@ 2020-03-10 16:06 Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 01/10] media: imx: imx7_mipi_csis: Power off the source when stopping streaming Laurent Pinchart
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Hello,

This patch series contains miscellaneous fixes I developed while trying
to capture from a CSI-2 sensor on the i.MX7.

Patches 01/10, 02/10 and 05/10 are small fixes or enhancements, please
see individual commit messages. Patch 06/10 fixes a recent issue with
video field handling. Patches 03/10, 04/10 and 07/10 to 10/10 add
support for 10- and 12-bit greyscale formats (both on the i.MX7 CSI-2
receiver side and the CSI side), including the ability to clamp Y10 and
Y12 to Y8.

Steve, Philipp, Rui, once you get to review this series, will you submit
a pull request or should I do so ?

Laurent Pinchart (10):
  media: imx: imx7_mipi_csis: Power off the source when stopping
    streaming
  media: imx: imx7_mipi_csis: Print the RESOL_CH0 register
  media: imx: imx7_mipi_csis: Add greyscale formats support
  media: imx: imx7-mipi-csis: Filter on CSI-2 data type
  media: imx: imx7-media-csi: Remove unneeded register read
  media: imx: imx7-media-csi: Fix video field handling
  media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12
  media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8
  media: imx: imx7-media-csi: Add Y10 and Y12 formats support
  media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8

 drivers/staging/media/imx/imx-media-csi.c   |  3 ++-
 drivers/staging/media/imx/imx-media-utils.c | 19 ++++++++++++------
 drivers/staging/media/imx/imx7-media-csi.c  | 22 ++++++++++++++++++++-
 drivers/staging/media/imx/imx7-mipi-csis.c  | 16 ++++++++++++++-
 4 files changed, 51 insertions(+), 9 deletions(-)

-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 01/10] media: imx: imx7_mipi_csis: Power off the source when stopping streaming
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 02/10] media: imx: imx7_mipi_csis: Print the RESOL_CH0 register Laurent Pinchart
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

The .s_stream() implementation incorrectly powers on the source when
stopping the stream. Power it off instead.

Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
Changes since v1:

- Added Fixes: tag
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index 383abecb3bec..0053e8b0b88e 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -577,7 +577,7 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable)
 		state->flags |= ST_STREAMING;
 	} else {
 		v4l2_subdev_call(state->src_sd, video, s_stream, 0);
-		ret = v4l2_subdev_call(state->src_sd, core, s_power, 1);
+		ret = v4l2_subdev_call(state->src_sd, core, s_power, 0);
 		mipi_csis_stop_stream(state);
 		state->flags &= ~ST_STREAMING;
 		if (state->debug)
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 02/10] media: imx: imx7_mipi_csis: Print the RESOL_CH0 register
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 01/10] media: imx: imx7_mipi_csis: Power off the source when stopping streaming Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 03/10] media: imx: imx7_mipi_csis: Add greyscale formats support Laurent Pinchart
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Add the RESOL_CH0 register to the list of registers printed through the
debugfs debug infrastructure for the driver, as it can be useful to
verify proper configuration of the CSI-2 receiver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index 0053e8b0b88e..f96e32549381 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -301,6 +301,7 @@ static int mipi_csis_dump_regs(struct csi_state *state)
 		{ 0x20, "DPHYSTS" },
 		{ 0x10, "INTMSK" },
 		{ 0x40, "CONFIG_CH0" },
+		{ 0x44, "RESOL_CH0" },
 		{ 0xC0, "DBG_CONFIG" },
 		{ 0x38, "DPHYSLAVE_L" },
 		{ 0x3C, "DPHYSLAVE_H" },
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 03/10] media: imx: imx7_mipi_csis: Add greyscale formats support
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 01/10] media: imx: imx7_mipi_csis: Power off the source when stopping streaming Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 02/10] media: imx: imx7_mipi_csis: Print the RESOL_CH0 register Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 04/10] media: imx: imx7-mipi-csis: Filter on CSI-2 data type Laurent Pinchart
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Add support for the 8-, 10- and 12-bit greyscale media bus formats, and
map them to the CSI-2 RAW8, RAW10 and RAW12 formats respectively.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index f96e32549381..2dd0b02e98b7 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -280,6 +280,18 @@ static const struct csis_pix_format mipi_csis_formats[] = {
 		.code = MEDIA_BUS_FMT_YUYV8_2X8,
 		.fmt_reg = MIPI_CSIS_ISPCFG_FMT_YCBCR422_8BIT,
 		.data_alignment = 16,
+	}, {
+		.code = MEDIA_BUS_FMT_Y8_1X8,
+		.fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW8,
+		.data_alignment = 8,
+	}, {
+		.code = MEDIA_BUS_FMT_Y10_1X10,
+		.fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW10,
+		.data_alignment = 16,
+	}, {
+		.code = MEDIA_BUS_FMT_Y12_1X12,
+		.fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW12,
+		.data_alignment = 16,
 	}
 };
 
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 04/10] media: imx: imx7-mipi-csis: Filter on CSI-2 data type
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (2 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 03/10] media: imx: imx7_mipi_csis: Add greyscale formats support Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 05/10] media: imx: imx7-media-csi: Remove unneeded register read Laurent Pinchart
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Enable filtering based on CSI-2 data type. Otherwise sources that send
multiple data types (such as sensors that send embedded data) will not
be properly supported. They will both result in additional non-image
lines being captured, and in the receiver being confused as it doesn't
resynchronise on vsync.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index 2dd0b02e98b7..de17a1d22873 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -430,6 +430,7 @@ static void mipi_csis_set_params(struct csi_state *state)
 	val = mipi_csis_read(state, MIPI_CSIS_CMN_CTRL);
 	val &= ~MIPI_CSIS_CMN_CTRL_LANE_NR_MASK;
 	val |= (lanes - 1) << MIPI_CSIS_CMN_CTRL_LANE_NR_OFFSET;
+	val |= MIPI_CSIS_CMN_CTRL_INTER_MODE;
 	mipi_csis_write(state, MIPI_CSIS_CMN_CTRL, val);
 
 	__mipi_csis_set_format(state);
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 05/10] media: imx: imx7-media-csi: Remove unneeded register read
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (3 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 04/10] media: imx: imx7-mipi-csis: Filter on CSI-2 data type Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 06/10] media: imx: imx7-media-csi: Fix video field handling Laurent Pinchart
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

The imx7_csi_dma_reflash() function starts by reading the unrelated
register CSI_CSICR18 to then overwrite the read value with a read from
register CSI_CSICR3. This is likely due to a bad copy&paste, and is not
needed. Remove the extraneous read from register CSI_CSICR18.

Fixes: 9e5fa4e1e5b5b ("media: imx7-media-csi: Use u32 for storing register reads")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
Changes since v1:

- Add Fixes: tag
---
 drivers/staging/media/imx/imx7-media-csi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index db30e2c70f2f..2f665e4b8c40 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -292,7 +292,7 @@ static void imx7_csi_hw_disable(struct imx7_csi *csi)
 
 static void imx7_csi_dma_reflash(struct imx7_csi *csi)
 {
-	u32 cr3 = imx7_csi_reg_read(csi, CSI_CSICR18);
+	u32 cr3;
 
 	cr3 = imx7_csi_reg_read(csi, CSI_CSICR3);
 	cr3 |= BIT_DMA_REFLASH_RFF;
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 06/10] media: imx: imx7-media-csi: Fix video field handling
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (4 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 05/10] media: imx: imx7-media-csi: Remove unneeded register read Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12 Laurent Pinchart
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Commit 4791bd7d6adc ("media: imx: Try colorimetry at both sink and
source pads") reworked the way that formats are set on the sink pad of
the CSI subdevice, and accidentally removed video field handling.
Restore it by defaulting to V4L2_FIELD_NONE if the field value isn't
supported, with the only two supported value being V4L2_FIELD_NONE and
V4L2_FIELD_INTERLACED.

Fixes: 4791bd7d6adc ("media: imx: Try colorimetry at both sink and source pads")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
Changes since v1:

- Fix commit message to mention V4L2_FIELD_INTERLACED instead of
  V4L2_FIELD_ALTERNATE
---
 drivers/staging/media/imx/imx7-media-csi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 2f665e4b8c40..706c47741a3c 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1009,6 +1009,7 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,
 		sdformat->format.width = in_fmt->width;
 		sdformat->format.height = in_fmt->height;
 		sdformat->format.code = in_fmt->code;
+		sdformat->format.field = in_fmt->field;
 		*cc = in_cc;
 
 		sdformat->format.colorspace = in_fmt->colorspace;
@@ -1023,6 +1024,9 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,
 							 false);
 			sdformat->format.code = (*cc)->codes[0];
 		}
+
+		if (sdformat->format.field != V4L2_FIELD_INTERLACED)
+			sdformat->format.field = V4L2_FIELD_NONE;
 		break;
 	default:
 		return -EINVAL;
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (5 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 06/10] media: imx: imx7-media-csi: Fix video field handling Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-12  0:21   ` Steve Longerbeam
  2020-03-10 16:06 ` [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

The driver doesn't really support V4L2_PIX_FMT_Y16, as there's no 16-bit
greyscale media bus code defined by the kernel. It (ab)uses the format
to capture 10-bit and 12-bit greyscale formats. Fix it to properly
support MEDIA_BUS_FMT_Y10_1X10 and MEDIA_BUS_FMT_Y12_1X12 instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
 drivers/staging/media/imx/imx-media-csi.c   |  3 ++-
 drivers/staging/media/imx/imx-media-utils.c | 13 ++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index b60ed4f22f6d..f4abac93c0e4 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -457,7 +457,8 @@ static int csi_idmac_setup_channel(struct csi_priv *priv)
 	case V4L2_PIX_FMT_SGBRG16:
 	case V4L2_PIX_FMT_SGRBG16:
 	case V4L2_PIX_FMT_SRGGB16:
-	case V4L2_PIX_FMT_Y16:
+	case V4L2_PIX_FMT_Y10:
+	case V4L2_PIX_FMT_Y12:
 		burst_size = 8;
 		passthrough_bits = 16;
 		break;
diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 0788a1874557..bc20fcc88267 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -166,11 +166,14 @@ static const struct imx_media_pixfmt rgb_formats[] = {
 		.bpp    = 8,
 		.bayer  = true,
 	}, {
-		.fourcc = V4L2_PIX_FMT_Y16,
-		.codes = {
-			MEDIA_BUS_FMT_Y10_1X10,
-			MEDIA_BUS_FMT_Y12_1X12,
-		},
+		.fourcc = V4L2_PIX_FMT_Y10,
+		.codes = {MEDIA_BUS_FMT_Y10_1X10},
+		.cs     = IPUV3_COLORSPACE_RGB,
+		.bpp    = 16,
+		.bayer  = true,
+	}, {
+		.fourcc = V4L2_PIX_FMT_Y12,
+		.codes = {MEDIA_BUS_FMT_Y12_1X12},
 		.cs     = IPUV3_COLORSPACE_RGB,
 		.bpp    = 16,
 		.bayer  = true,
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (6 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12 Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-12  0:22   ` Steve Longerbeam
  2020-03-10 16:06 ` [PATCH v2 09/10] media: imx: imx7-media-csi: Add Y10 and Y12 formats support Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
  9 siblings, 1 reply; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

10-bit and 12-bit greyscale input data to the CSI can be written as
8-bit data to memory. Support this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx-media-utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index bc20fcc88267..fae981698c49 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -161,7 +161,11 @@ static const struct imx_media_pixfmt rgb_formats[] = {
 		.bayer  = true,
 	}, {
 		.fourcc = V4L2_PIX_FMT_GREY,
-		.codes = {MEDIA_BUS_FMT_Y8_1X8},
+		.codes = {
+			MEDIA_BUS_FMT_Y8_1X8,
+			MEDIA_BUS_FMT_Y10_1X10,
+			MEDIA_BUS_FMT_Y12_1X12,
+		},
 		.cs     = IPUV3_COLORSPACE_RGB,
 		.bpp    = 8,
 		.bayer  = true,
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 09/10] media: imx: imx7-media-csi: Add Y10 and Y12 formats support
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (7 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-10 16:06 ` [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
  9 siblings, 0 replies; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

Support capturing the 10- and 12-bit greyscale formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index 706c47741a3c..e85202255168 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -804,6 +804,14 @@ static int imx7_csi_configure(struct imx7_csi *csi)
 	case V4L2_PIX_FMT_YUYV:
 		cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B;
 		break;
+	case V4L2_PIX_FMT_Y10:
+		cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
+		cr1 |= BIT_PIXEL_BIT;
+		break;
+	case V4L2_PIX_FMT_Y12:
+		cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
+		cr1 |= BIT_PIXEL_BIT;
+		break;
 	case V4L2_PIX_FMT_SBGGR8:
 		cr18 |= BIT_MIPI_DATA_FORMAT_RAW8;
 		break;
-- 
Regards,

Laurent Pinchart


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

* [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8
  2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
                   ` (8 preceding siblings ...)
  2020-03-10 16:06 ` [PATCH v2 09/10] media: imx: imx7-media-csi: Add Y10 and Y12 formats support Laurent Pinchart
@ 2020-03-10 16:06 ` Laurent Pinchart
  2020-03-11 14:29   ` Rui Miguel Silva
  9 siblings, 1 reply; 14+ messages in thread
From: Laurent Pinchart @ 2020-03-10 16:06 UTC (permalink / raw)
  To: linux-media; +Cc: Steve Longerbeam, Philipp Zabel, Rui Miguel Silva

10-bit and 12-bit greyscale input data to the CSI can be written as
8-bit data to memory. Support this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index e85202255168..3225082ce58d 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -804,6 +804,14 @@ static int imx7_csi_configure(struct imx7_csi *csi)
 	case V4L2_PIX_FMT_YUYV:
 		cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B;
 		break;
+	case V4L2_PIX_FMT_GREY:
+		if (in_code == MEDIA_BUS_FMT_Y8_1X8)
+			cr18 |= BIT_MIPI_DATA_FORMAT_RAW8;
+		else if (in_code == MEDIA_BUS_FMT_Y10_1X10)
+			cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
+		else
+			cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
+		break;
 	case V4L2_PIX_FMT_Y10:
 		cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
 		cr1 |= BIT_PIXEL_BIT;
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8
  2020-03-10 16:06 ` [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
@ 2020-03-11 14:29   ` Rui Miguel Silva
  0 siblings, 0 replies; 14+ messages in thread
From: Rui Miguel Silva @ 2020-03-11 14:29 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, Steve Longerbeam, Philipp Zabel

Hi Laurent,
Thanks for this, I think this is the only one I did not acked.

On Tue, Mar 10, 2020 at 06:06:33PM +0200, Laurent Pinchart wrote:
> 10-bit and 12-bit greyscale input data to the CSI can be written as
> 8-bit data to memory. Support this.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>

------
Cheers,
     Rui
> ---
>  drivers/staging/media/imx/imx7-media-csi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
> index e85202255168..3225082ce58d 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -804,6 +804,14 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>  	case V4L2_PIX_FMT_YUYV:
>  		cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B;
>  		break;
> +	case V4L2_PIX_FMT_GREY:
> +		if (in_code == MEDIA_BUS_FMT_Y8_1X8)
> +			cr18 |= BIT_MIPI_DATA_FORMAT_RAW8;
> +		else if (in_code == MEDIA_BUS_FMT_Y10_1X10)
> +			cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
> +		else
> +			cr18 |= BIT_MIPI_DATA_FORMAT_RAW12;
> +		break;
>  	case V4L2_PIX_FMT_Y10:
>  		cr18 |= BIT_MIPI_DATA_FORMAT_RAW10;
>  		cr1 |= BIT_PIXEL_BIT;
> -- 
> Regards,
> 
> Laurent Pinchart
> 

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

* Re: [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12
  2020-03-10 16:06 ` [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12 Laurent Pinchart
@ 2020-03-12  0:21   ` Steve Longerbeam
  0 siblings, 0 replies; 14+ messages in thread
From: Steve Longerbeam @ 2020-03-12  0:21 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: Philipp Zabel, Rui Miguel Silva



On 3/10/20 9:06 AM, Laurent Pinchart wrote:
> The driver doesn't really support V4L2_PIX_FMT_Y16, as there's no 16-bit
> greyscale media bus code defined by the kernel. It (ab)uses the format
> to capture 10-bit and 12-bit greyscale formats. Fix it to properly
> support MEDIA_BUS_FMT_Y10_1X10 and MEDIA_BUS_FMT_Y12_1X12 instead.

I thought this might need a Fixes: e30681bc19bf ("media: imx: add 16-bit 
grayscale support"), but on closer look, V4L2_PIX_FMT_Y10 and 
V4L2_PIX_FMT_Y12 were not added until after. In any case,

Acked-by: Steve Longerbeam <slongerbeam@gmail.com>

>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
> ---
>   drivers/staging/media/imx/imx-media-csi.c   |  3 ++-
>   drivers/staging/media/imx/imx-media-utils.c | 13 ++++++++-----
>   2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index b60ed4f22f6d..f4abac93c0e4 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -457,7 +457,8 @@ static int csi_idmac_setup_channel(struct csi_priv *priv)
>   	case V4L2_PIX_FMT_SGBRG16:
>   	case V4L2_PIX_FMT_SGRBG16:
>   	case V4L2_PIX_FMT_SRGGB16:
> -	case V4L2_PIX_FMT_Y16:
> +	case V4L2_PIX_FMT_Y10:
> +	case V4L2_PIX_FMT_Y12:
>   		burst_size = 8;
>   		passthrough_bits = 16;
>   		break;
> diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
> index 0788a1874557..bc20fcc88267 100644
> --- a/drivers/staging/media/imx/imx-media-utils.c
> +++ b/drivers/staging/media/imx/imx-media-utils.c
> @@ -166,11 +166,14 @@ static const struct imx_media_pixfmt rgb_formats[] = {
>   		.bpp    = 8,
>   		.bayer  = true,
>   	}, {
> -		.fourcc = V4L2_PIX_FMT_Y16,
> -		.codes = {
> -			MEDIA_BUS_FMT_Y10_1X10,
> -			MEDIA_BUS_FMT_Y12_1X12,
> -		},
> +		.fourcc = V4L2_PIX_FMT_Y10,
> +		.codes = {MEDIA_BUS_FMT_Y10_1X10},
> +		.cs     = IPUV3_COLORSPACE_RGB,
> +		.bpp    = 16,
> +		.bayer  = true,
> +	}, {
> +		.fourcc = V4L2_PIX_FMT_Y12,
> +		.codes = {MEDIA_BUS_FMT_Y12_1X12},
>   		.cs     = IPUV3_COLORSPACE_RGB,
>   		.bpp    = 16,
>   		.bayer  = true,


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

* Re: [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8
  2020-03-10 16:06 ` [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
@ 2020-03-12  0:22   ` Steve Longerbeam
  0 siblings, 0 replies; 14+ messages in thread
From: Steve Longerbeam @ 2020-03-12  0:22 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: Philipp Zabel, Rui Miguel Silva



On 3/10/20 9:06 AM, Laurent Pinchart wrote:
> 10-bit and 12-bit greyscale input data to the CSI can be written as
> 8-bit data to memory. Support this.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Acked-by: Steve Longerbeam <slongerbeam@gmail.com>

> ---
>   drivers/staging/media/imx/imx-media-utils.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
> index bc20fcc88267..fae981698c49 100644
> --- a/drivers/staging/media/imx/imx-media-utils.c
> +++ b/drivers/staging/media/imx/imx-media-utils.c
> @@ -161,7 +161,11 @@ static const struct imx_media_pixfmt rgb_formats[] = {
>   		.bayer  = true,
>   	}, {
>   		.fourcc = V4L2_PIX_FMT_GREY,
> -		.codes = {MEDIA_BUS_FMT_Y8_1X8},
> +		.codes = {
> +			MEDIA_BUS_FMT_Y8_1X8,
> +			MEDIA_BUS_FMT_Y10_1X10,
> +			MEDIA_BUS_FMT_Y12_1X12,
> +		},
>   		.cs     = IPUV3_COLORSPACE_RGB,
>   		.bpp    = 8,
>   		.bayer  = true,


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

end of thread, other threads:[~2020-03-12  0:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 16:06 [PATCH v2 00/10] media: imx: Miscellaneous fixes for i.MX7 Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 01/10] media: imx: imx7_mipi_csis: Power off the source when stopping streaming Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 02/10] media: imx: imx7_mipi_csis: Print the RESOL_CH0 register Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 03/10] media: imx: imx7_mipi_csis: Add greyscale formats support Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 04/10] media: imx: imx7-mipi-csis: Filter on CSI-2 data type Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 05/10] media: imx: imx7-media-csi: Remove unneeded register read Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 06/10] media: imx: imx7-media-csi: Fix video field handling Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 07/10] media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12 Laurent Pinchart
2020-03-12  0:21   ` Steve Longerbeam
2020-03-10 16:06 ` [PATCH v2 08/10] media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
2020-03-12  0:22   ` Steve Longerbeam
2020-03-10 16:06 ` [PATCH v2 09/10] media: imx: imx7-media-csi: Add Y10 and Y12 formats support Laurent Pinchart
2020-03-10 16:06 ` [PATCH v2 10/10] media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8 Laurent Pinchart
2020-03-11 14:29   ` Rui Miguel Silva

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.