All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support
@ 2018-05-03 16:29 Jan Luebbe
  2018-05-03 16:29 ` [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Jan Luebbe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jan Luebbe @ 2018-05-03 16:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Jan Luebbe

This series adds support to capture in RGB565 format on the parallel bus
by using the bayer (generic) mode instead.

It also contains a small cleanup patch to pass on error codes from
mbus_code_to_bus_cfg in fill_csi_bus_cfg and ipu_csi_init_interface by
Enrico Scholz.

Enrico Scholz (1):
  gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes

Jan Luebbe (1):
  gpu: ipu-v3: csi: support RGB565 on parallel bus

 drivers/gpu/ipu-v3/ipu-csi.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes
  2018-05-03 16:29 [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Jan Luebbe
@ 2018-05-03 16:29 ` Jan Luebbe
  2018-05-03 16:29 ` [PATCH 2/2] gpu: ipu-v3: csi: support RGB565 on parallel bus Jan Luebbe
  2018-05-18 16:07 ` [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Luebbe @ 2018-05-03 16:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Enrico Scholz, Jan Luebbe

From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

mbus_code_to_bus_cfg() can fail on unknown mbus codes; pass back the
error to the caller.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-csi.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index caa05b0702e1..39c3aabb6d17 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -318,13 +318,17 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
 /*
  * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
  */
-static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
+static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 				 struct v4l2_mbus_config *mbus_cfg,
 				 struct v4l2_mbus_framefmt *mbus_fmt)
 {
+	int rc;
+
 	memset(csicfg, 0, sizeof(*csicfg));
 
-	mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+	if (rc < 0)
+		return rc;
 
 	switch (mbus_cfg->type) {
 	case V4L2_MBUS_PARALLEL:
@@ -355,6 +359,8 @@ static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 		/* will never get here, keep compiler quiet */
 		break;
 	}
+
+	return 0;
 }
 
 int ipu_csi_init_interface(struct ipu_csi *csi,
@@ -364,8 +370,11 @@ int ipu_csi_init_interface(struct ipu_csi *csi,
 	struct ipu_csi_bus_config cfg;
 	unsigned long flags;
 	u32 width, height, data = 0;
+	int rc;
 
-	fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
+	rc = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
+	if (rc < 0)
+		return rc;
 
 	/* set default sensor frame width and height */
 	width = mbus_fmt->width;
@@ -586,11 +595,14 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
 	struct ipu_csi_bus_config cfg;
 	unsigned long flags;
 	u32 temp;
+	int rc;
 
 	if (vc > 3)
 		return -EINVAL;
 
-	mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+	if (rc < 0)
+		return rc;
 
 	spin_lock_irqsave(&csi->lock, flags);
 
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 2/2] gpu: ipu-v3: csi: support RGB565 on parallel bus
  2018-05-03 16:29 [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Jan Luebbe
  2018-05-03 16:29 ` [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Jan Luebbe
@ 2018-05-03 16:29 ` Jan Luebbe
  2018-05-18 16:07 ` [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Luebbe @ 2018-05-03 16:29 UTC (permalink / raw)
  To: dri-devel; +Cc: Jan Luebbe

The CSI_SENS_CONF_DATA_FMT_RGB565 configuration only works for MIPI
CSI-2 sources. On the parallel bus, we need to use bayer (generic) mode
instead. To handle this difference, we pass the mbus_type to
mbus_code_to_bus_cfg().

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-csi.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index 39c3aabb6d17..28a6b6243baa 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -224,14 +224,18 @@ static int ipu_csi_set_testgen_mclk(struct ipu_csi *csi, u32 pixel_clk,
  * Find the CSI data format and data width for the given V4L2 media
  * bus pixel format code.
  */
-static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
+static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code,
+				enum v4l2_mbus_type mbus_type)
 {
 	switch (mbus_code) {
 	case MEDIA_BUS_FMT_BGR565_2X8_BE:
 	case MEDIA_BUS_FMT_BGR565_2X8_LE:
 	case MEDIA_BUS_FMT_RGB565_2X8_BE:
 	case MEDIA_BUS_FMT_RGB565_2X8_LE:
-		cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565;
+		if (mbus_type == V4L2_MBUS_CSI2)
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565;
+		else
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
 		cfg->mipi_dt = MIPI_DT_RGB565;
 		cfg->data_width = IPU_CSI_DATA_WIDTH_8;
 		break;
@@ -326,7 +330,7 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 
 	memset(csicfg, 0, sizeof(*csicfg));
 
-	rc = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code, mbus_cfg->type);
 	if (rc < 0)
 		return rc;
 
@@ -600,7 +604,7 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
 	if (vc > 3)
 		return -EINVAL;
 
-	rc = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
+	rc = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code, V4L2_MBUS_CSI2);
 	if (rc < 0)
 		return rc;
 
-- 
2.17.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support
  2018-05-03 16:29 [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Jan Luebbe
  2018-05-03 16:29 ` [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Jan Luebbe
  2018-05-03 16:29 ` [PATCH 2/2] gpu: ipu-v3: csi: support RGB565 on parallel bus Jan Luebbe
@ 2018-05-18 16:07 ` Philipp Zabel
  2 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2018-05-18 16:07 UTC (permalink / raw)
  To: Jan Luebbe, dri-devel

On Thu, 2018-05-03 at 18:29 +0200, Jan Luebbe wrote:
> This series adds support to capture in RGB565 format on the parallel bus
> by using the bayer (generic) mode instead.
> 
> It also contains a small cleanup patch to pass on error codes from
> mbus_code_to_bus_cfg in fill_csi_bus_cfg and ipu_csi_init_interface by
> Enrico Scholz.
> 
> Enrico Scholz (1):
>   gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes
> 
> Jan Luebbe (1):
>   gpu: ipu-v3: csi: support RGB565 on parallel bus
> 
>  drivers/gpu/ipu-v3/ipu-csi.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)

I have applied both patches to imx-drm/next after renaming the "rc"
local variables to "ret" for consistency with the other ipu-v3 code.

regards
Philipp
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-05-18 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 16:29 [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Jan Luebbe
2018-05-03 16:29 ` [PATCH 1/2] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Jan Luebbe
2018-05-03 16:29 ` [PATCH 2/2] gpu: ipu-v3: csi: support RGB565 on parallel bus Jan Luebbe
2018-05-18 16:07 ` [PATCH 0/2] gpu: ipu-v3: csi: add RGB565 support Philipp Zabel

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.