linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge
@ 2019-06-17 13:43 Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 1/3] media: st-mipid02: add support of RGB565 Hugues Fruchet
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hugues Fruchet @ 2019-06-17 13:43 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Mickael Guene
  Cc: linux-media, linux-kernel, Hugues Fruchet, Benjamin Gaignard

Add support of RGB565, YUV and JPEG to MIPID02 bridge.

===========
= history =
===========
version 2:
  - Link frequency could not be computed from pixel rate for JPEG,
    remove JPEG case in bpp_from_code().

version 1:
  - Initial submission

Hugues Fruchet (3):
  media: st-mipid02: add support of RGB565
  media: st-mipid02: add support of YUYV8 and UYVY8
  media: st-mipid02: add support of JPEG

 drivers/media/i2c/st-mipid02.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

-- 
2.7.4


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

* [PATCH v2 1/3] media: st-mipid02: add support of RGB565
  2019-06-17 13:43 [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hugues Fruchet
@ 2019-06-17 13:43 ` Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 2/3] media: st-mipid02: add support of YUYV8 and UYVY8 Hugues Fruchet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hugues Fruchet @ 2019-06-17 13:43 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Mickael Guene
  Cc: linux-media, linux-kernel, Hugues Fruchet, Benjamin Gaignard

Add support of RGB565 pixel format.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 drivers/media/i2c/st-mipid02.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index 9369f38..76a9f52 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -61,7 +61,8 @@ static const u32 mipid02_supported_fmt_codes[] = {
 	MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10,
 	MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SGBRG12_1X12,
 	MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SRGGB12_1X12,
-	MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_BGR888_1X24
+	MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_BGR888_1X24,
+	MEDIA_BUS_FMT_RGB565_2X8_LE, MEDIA_BUS_FMT_RGB565_2X8_BE,
 };
 
 /* regulator supplies */
@@ -128,6 +129,8 @@ static int bpp_from_code(__u32 code)
 	case MEDIA_BUS_FMT_SRGGB12_1X12:
 		return 12;
 	case MEDIA_BUS_FMT_UYVY8_1X16:
+	case MEDIA_BUS_FMT_RGB565_2X8_LE:
+	case MEDIA_BUS_FMT_RGB565_2X8_BE:
 		return 16;
 	case MEDIA_BUS_FMT_BGR888_1X24:
 		return 24;
@@ -158,6 +161,9 @@ static u8 data_type_from_code(__u32 code)
 		return 0x1e;
 	case MEDIA_BUS_FMT_BGR888_1X24:
 		return 0x24;
+	case MEDIA_BUS_FMT_RGB565_2X8_LE:
+	case MEDIA_BUS_FMT_RGB565_2X8_BE:
+		return 0x22;
 	default:
 		return 0;
 	}
-- 
2.7.4


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

* [PATCH v2 2/3] media: st-mipid02: add support of YUYV8 and UYVY8
  2019-06-17 13:43 [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 1/3] media: st-mipid02: add support of RGB565 Hugues Fruchet
@ 2019-06-17 13:43 ` Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 3/3] media: st-mipid02: add support of JPEG Hugues Fruchet
  2019-06-20  8:49 ` [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hans Verkuil
  3 siblings, 0 replies; 5+ messages in thread
From: Hugues Fruchet @ 2019-06-17 13:43 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Mickael Guene
  Cc: linux-media, linux-kernel, Hugues Fruchet, Benjamin Gaignard

Add support of YUYV8 and UYVY8 pixel formats.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 drivers/media/i2c/st-mipid02.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index 76a9f52..35946ad 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -63,6 +63,7 @@ static const u32 mipid02_supported_fmt_codes[] = {
 	MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SRGGB12_1X12,
 	MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_BGR888_1X24,
 	MEDIA_BUS_FMT_RGB565_2X8_LE, MEDIA_BUS_FMT_RGB565_2X8_BE,
+	MEDIA_BUS_FMT_YUYV8_2X8, MEDIA_BUS_FMT_UYVY8_2X8,
 };
 
 /* regulator supplies */
@@ -129,6 +130,8 @@ static int bpp_from_code(__u32 code)
 	case MEDIA_BUS_FMT_SRGGB12_1X12:
 		return 12;
 	case MEDIA_BUS_FMT_UYVY8_1X16:
+	case MEDIA_BUS_FMT_YUYV8_2X8:
+	case MEDIA_BUS_FMT_UYVY8_2X8:
 	case MEDIA_BUS_FMT_RGB565_2X8_LE:
 	case MEDIA_BUS_FMT_RGB565_2X8_BE:
 		return 16;
@@ -158,6 +161,8 @@ static u8 data_type_from_code(__u32 code)
 	case MEDIA_BUS_FMT_SRGGB12_1X12:
 		return 0x2c;
 	case MEDIA_BUS_FMT_UYVY8_1X16:
+	case MEDIA_BUS_FMT_YUYV8_2X8:
+	case MEDIA_BUS_FMT_UYVY8_2X8:
 		return 0x1e;
 	case MEDIA_BUS_FMT_BGR888_1X24:
 		return 0x24;
-- 
2.7.4


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

* [PATCH v2 3/3] media: st-mipid02: add support of JPEG
  2019-06-17 13:43 [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 1/3] media: st-mipid02: add support of RGB565 Hugues Fruchet
  2019-06-17 13:43 ` [PATCH v2 2/3] media: st-mipid02: add support of YUYV8 and UYVY8 Hugues Fruchet
@ 2019-06-17 13:43 ` Hugues Fruchet
  2019-06-20  8:49 ` [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hans Verkuil
  3 siblings, 0 replies; 5+ messages in thread
From: Hugues Fruchet @ 2019-06-17 13:43 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus, Mickael Guene
  Cc: linux-media, linux-kernel, Hugues Fruchet, Benjamin Gaignard

Add support of JPEG pixel format.
This requires auto detection of data type from CSI-2 stream.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 drivers/media/i2c/st-mipid02.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index 35946ad..ff8a4d8 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -64,6 +64,7 @@ static const u32 mipid02_supported_fmt_codes[] = {
 	MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_BGR888_1X24,
 	MEDIA_BUS_FMT_RGB565_2X8_LE, MEDIA_BUS_FMT_RGB565_2X8_BE,
 	MEDIA_BUS_FMT_YUYV8_2X8, MEDIA_BUS_FMT_UYVY8_2X8,
+	MEDIA_BUS_FMT_JPEG_1X8
 };
 
 /* regulator supplies */
@@ -101,6 +102,7 @@ struct mipid02_dev {
 		u8 data_lane1_reg1;
 		u8 mode_reg1;
 		u8 mode_reg2;
+		u8 data_selection_ctrl;
 		u8 data_id_rreg;
 		u8 pix_width_ctrl;
 		u8 pix_width_ctrl_emb;
@@ -463,6 +465,7 @@ static int mipid02_configure_from_tx(struct mipid02_dev *bridge)
 {
 	struct v4l2_fwnode_endpoint *ep = &bridge->tx;
 
+	bridge->r.data_selection_ctrl = SELECTION_MANUAL_WIDTH;
 	bridge->r.pix_width_ctrl = ep->bus.parallel.bus_width;
 	bridge->r.pix_width_ctrl_emb = ep->bus.parallel.bus_width;
 	if (ep->bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
@@ -478,10 +481,15 @@ static int mipid02_configure_from_code(struct mipid02_dev *bridge)
 	u8 data_type;
 
 	bridge->r.data_id_rreg = 0;
-	data_type = data_type_from_code(bridge->fmt.code);
-	if (!data_type)
-		return -EINVAL;
-	bridge->r.data_id_rreg = data_type;
+
+	if (bridge->fmt.code != MEDIA_BUS_FMT_JPEG_1X8) {
+		bridge->r.data_selection_ctrl |= SELECTION_MANUAL_DATA;
+
+		data_type = data_type_from_code(bridge->fmt.code);
+		if (!data_type)
+			return -EINVAL;
+		bridge->r.data_id_rreg = data_type;
+	}
 
 	return 0;
 }
@@ -565,7 +573,7 @@ static int mipid02_stream_enable(struct mipid02_dev *bridge)
 	if (ret)
 		goto error;
 	ret = mipid02_write_reg(bridge, MIPID02_DATA_SELECTION_CTRL,
-		SELECTION_MANUAL_DATA | SELECTION_MANUAL_WIDTH);
+		bridge->r.data_selection_ctrl);
 	if (ret)
 		goto error;
 	ret = mipid02_write_reg(bridge, MIPID02_PIX_WIDTH_CTRL,
-- 
2.7.4


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

* Re: [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge
  2019-06-17 13:43 [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hugues Fruchet
                   ` (2 preceding siblings ...)
  2019-06-17 13:43 ` [PATCH v2 3/3] media: st-mipid02: add support of JPEG Hugues Fruchet
@ 2019-06-20  8:49 ` Hans Verkuil
  3 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2019-06-20  8:49 UTC (permalink / raw)
  To: Hugues Fruchet, Mauro Carvalho Chehab, Sakari Ailus, Mickael Guene
  Cc: linux-media, linux-kernel, Benjamin Gaignard

On 6/17/19 3:43 PM, Hugues Fruchet wrote:
> Add support of RGB565, YUV and JPEG to MIPID02 bridge.
> 
> ===========
> = history =
> ===========
> version 2:
>   - Link frequency could not be computed from pixel rate for JPEG,
>     remove JPEG case in bpp_from_code().
> 
> version 1:
>   - Initial submission
> 
> Hugues Fruchet (3):
>   media: st-mipid02: add support of RGB565
>   media: st-mipid02: add support of YUYV8 and UYVY8
>   media: st-mipid02: add support of JPEG
> 
>  drivers/media/i2c/st-mipid02.c | 31 +++++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 


For this series:

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

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

end of thread, other threads:[~2019-06-20  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 13:43 [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hugues Fruchet
2019-06-17 13:43 ` [PATCH v2 1/3] media: st-mipid02: add support of RGB565 Hugues Fruchet
2019-06-17 13:43 ` [PATCH v2 2/3] media: st-mipid02: add support of YUYV8 and UYVY8 Hugues Fruchet
2019-06-17 13:43 ` [PATCH v2 3/3] media: st-mipid02: add support of JPEG Hugues Fruchet
2019-06-20  8:49 ` [PATCH v2 0/3] Add support of RGB565, YUV and JPEG to MIPID02 bridge Hans Verkuil

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