LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] i.MX6: Support 16-bit BT.1120 video input
@ 2021-10-06  6:13 Krzysztof Hałasa
  2021-10-08 11:31 ` Philipp Zabel
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Hałasa @ 2021-10-06  6:13 UTC (permalink / raw)
  To: Philipp Zabel, Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-kernel, linux-media, linux-staging,
	linux-arm-kernel

Confirmed to work with ADV7610 HDMI receiver.

Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index 658c173bebdf..2893b68f1f7a 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -261,10 +261,24 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code,
 		cfg->data_width = IPU_CSI_DATA_WIDTH_8;
 		break;
 	case MEDIA_BUS_FMT_UYVY8_1X16:
+		if (mbus_type == V4L2_MBUS_BT656) {
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_UYVY;
+			cfg->data_width = IPU_CSI_DATA_WIDTH_8;
+		} else {
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
+			cfg->data_width = IPU_CSI_DATA_WIDTH_16;
+		}
+		cfg->mipi_dt = MIPI_DT_YUV422;
+		break;
 	case MEDIA_BUS_FMT_YUYV8_1X16:
-		cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
+		if (mbus_type == V4L2_MBUS_BT656) {
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_YUYV;
+			cfg->data_width = IPU_CSI_DATA_WIDTH_8;
+		} else {
+			cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;
+			cfg->data_width = IPU_CSI_DATA_WIDTH_16;
+		}
 		cfg->mipi_dt = MIPI_DT_YUV422;
-		cfg->data_width = IPU_CSI_DATA_WIDTH_16;
 		break;
 	case MEDIA_BUS_FMT_SBGGR8_1X8:
 	case MEDIA_BUS_FMT_SGBRG8_1X8:
@@ -352,7 +366,7 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 			    const struct v4l2_mbus_config *mbus_cfg,
 			    const struct v4l2_mbus_framefmt *mbus_fmt)
 {
-	int ret;
+	int ret, is_bt1120;
 
 	memset(csicfg, 0, sizeof(*csicfg));
 
@@ -373,11 +387,18 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
 		break;
 	case V4L2_MBUS_BT656:
 		csicfg->ext_vsync = 0;
+		/* UYVY10_1X20 etc. should be supported as well */
+		is_bt1120 = mbus_fmt->code == MEDIA_BUS_FMT_UYVY8_1X16 ||
+			    mbus_fmt->code == MEDIA_BUS_FMT_YUYV8_1X16;
 		if (V4L2_FIELD_HAS_BOTH(mbus_fmt->field) ||
 		    mbus_fmt->field == V4L2_FIELD_ALTERNATE)
-			csicfg->clk_mode = IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
+			csicfg->clk_mode = is_bt1120 ?
+				IPU_CSI_CLK_MODE_CCIR1120_INTERLACED_SDR :
+				IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
 		else
-			csicfg->clk_mode = IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE;
+			csicfg->clk_mode = is_bt1120 ?
+				IPU_CSI_CLK_MODE_CCIR1120_PROGRESSIVE_SDR :
+				IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE;
 		break;
 	case V4L2_MBUS_CSI2_DPHY:
 		/*
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 45f9d797b9da..ba93512f8c71 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -139,6 +139,8 @@ static inline bool is_parallel_16bit_bus(struct v4l2_fwnode_endpoint *ep)
  * Check for conditions that require the IPU to handle the
  * data internally as generic data, aka passthrough mode:
  * - raw bayer media bus formats, or
+ * - BT.656 and BT.1120 (8/10-bit YUV422) data can always be processed
+ *   on-the-fly
  * - the CSI is receiving from a 16-bit parallel bus, or
  * - the CSI is receiving from an 8-bit parallel bus and the incoming
  *   media bus format is other than UYVY8_2X8/YUYV8_2X8.
@@ -147,6 +149,9 @@ static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep,
 					struct v4l2_mbus_framefmt *infmt,
 					const struct imx_media_pixfmt *incc)
 {
+	if (ep->bus_type == V4L2_MBUS_BT656) // including BT.1120
+		return 0;
+
 	return incc->bayer || is_parallel_16bit_bus(ep) ||
 		(is_parallel_bus(ep) &&
 		 infmt->code != MEDIA_BUS_FMT_UYVY8_2X8 &&

-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa

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

* Re: [PATCH v2] i.MX6: Support 16-bit BT.1120 video input
  2021-10-06  6:13 [PATCH v2] i.MX6: Support 16-bit BT.1120 video input Krzysztof Hałasa
@ 2021-10-08 11:31 ` Philipp Zabel
  2021-10-12  7:51   ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Philipp Zabel @ 2021-10-08 11:31 UTC (permalink / raw)
  To: Krzysztof Hałasa, Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-kernel, linux-media, linux-staging,
	linux-arm-kernel

On Wed, 2021-10-06 at 08:13 +0200, Krzysztof Hałasa wrote:
> Confirmed to work with ADV7610 HDMI receiver.
> 
> Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

* Re: [PATCH v2] i.MX6: Support 16-bit BT.1120 video input
  2021-10-08 11:31 ` Philipp Zabel
@ 2021-10-12  7:51   ` Hans Verkuil
  2021-10-12  8:12     ` Philipp Zabel
  2021-10-12 11:30     ` Krzysztof Hałasa
  0 siblings, 2 replies; 5+ messages in thread
From: Hans Verkuil @ 2021-10-12  7:51 UTC (permalink / raw)
  To: Philipp Zabel, Krzysztof Hałasa, Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-kernel, linux-media, linux-staging,
	linux-arm-kernel

Hi Philipp,

I can take this patch and merge it, right? Even though it mostly changes
drivers/gpu/ipu-v3/ipu-csi.c, it is still something for the media tree to pick
up, I think. Just checking to avoid this patch going in via two subsystems...

Regards,

	Hans

On 08/10/2021 13:31, Philipp Zabel wrote:
> On Wed, 2021-10-06 at 08:13 +0200, Krzysztof Hałasa wrote:
>> Confirmed to work with ADV7610 HDMI receiver.
>>
>> Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
> 
> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> regards
> Philipp
> 


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

* Re: [PATCH v2] i.MX6: Support 16-bit BT.1120 video input
  2021-10-12  7:51   ` Hans Verkuil
@ 2021-10-12  8:12     ` Philipp Zabel
  2021-10-12 11:30     ` Krzysztof Hałasa
  1 sibling, 0 replies; 5+ messages in thread
From: Philipp Zabel @ 2021-10-12  8:12 UTC (permalink / raw)
  To: Hans Verkuil, Krzysztof Hałasa, Steve Longerbeam
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-kernel, linux-media, linux-staging,
	linux-arm-kernel

Hi Hans,

On Tue, 2021-10-12 at 09:51 +0200, Hans Verkuil wrote:
> Hi Philipp,
> 
> I can take this patch and merge it, right? Even though it mostly changes
> drivers/gpu/ipu-v3/ipu-csi.c, it is still something for the media tree to pick
> up, I think. Just checking to avoid this patch going in via two subsystems...

Yes, thank you.

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

to merge via the media tree.

regards
Philipp

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

* Re: [PATCH v2] i.MX6: Support 16-bit BT.1120 video input
  2021-10-12  7:51   ` Hans Verkuil
  2021-10-12  8:12     ` Philipp Zabel
@ 2021-10-12 11:30     ` Krzysztof Hałasa
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Hałasa @ 2021-10-12 11:30 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Philipp Zabel, Steve Longerbeam, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-kernel, linux-media, linux-staging, linux-arm-kernel

Hi Hans,

Hans Verkuil <hverkuil@xs4all.nl> writes:

> I can take this patch and merge it, right? Even though it mostly changes
> drivers/gpu/ipu-v3/ipu-csi.c, it is still something for the media tree to pick
> up, I think. Just checking to avoid this patch going in via two subsystems...

Aah, sorry about that, didn't want to produce too much patch-noise.
-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa

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

end of thread, other threads:[~2021-10-12 11:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06  6:13 [PATCH v2] i.MX6: Support 16-bit BT.1120 video input Krzysztof Hałasa
2021-10-08 11:31 ` Philipp Zabel
2021-10-12  7:51   ` Hans Verkuil
2021-10-12  8:12     ` Philipp Zabel
2021-10-12 11:30     ` Krzysztof Hałasa

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).