]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: sun6i: Add support for JPEG media bus format
authorChen-Yu Tsai <wens@csie.org>
Sun, 3 Feb 2019 16:03:58 +0000 (11:03 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 18 Feb 2019 20:27:08 +0000 (15:27 -0500)
The CSI controller can take raw data from the data bus and output it
directly to capture buffers. This can be used to support the JPEG media
bus format.

While the controller can report minimum and maximum bytes per line, it
has no way to report how many lines were captured in the last frame.
Thus, even when the on-bus data is framed correctly, we have no way to
accertain the actual amount of data captured, unless we scan the buffer
for JPEG EOI markers, or sequential zeros. For now we leave bytesused
alone, and leave it up to userspace applications to parse the data.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h
drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c

index ff739466f189a33097973db38b55dff3229d070c..4c79eb64a7a702c2b2d48dcb12f025de45b3f45e 100644 (file)
@@ -150,6 +150,9 @@ bool sun6i_csi_is_format_supported(struct sun6i_csi *csi,
        case V4L2_PIX_FMT_RGB565X:
                return (mbus_code == MEDIA_BUS_FMT_RGB565_2X8_BE);
 
+       case V4L2_PIX_FMT_JPEG:
+               return (mbus_code == MEDIA_BUS_FMT_JPEG_1X8);
+
        default:
                dev_dbg(sdev->dev, "Unsupported pixformat: 0x%x\n", pixformat);
                break;
@@ -289,6 +292,9 @@ static enum csi_output_fmt get_csi_output_format(struct sun6i_csi_dev *sdev,
        case V4L2_PIX_FMT_RGB565X:
                return buf_interlaced ? CSI_FRAME_RGB565 : CSI_FIELD_RGB565;
 
+       case V4L2_PIX_FMT_JPEG:
+               return buf_interlaced ? CSI_FRAME_RAW_8 : CSI_FIELD_RAW_8;
+
        default:
                dev_warn(sdev->dev, "Unsupported pixformat: 0x%x\n", pixformat);
                break;
index 585cd96694171fd61f65c5e338004ebdb2fe00d5..f30a210e9caa361a1247e33c25ab3bb76a9f1a10 100644 (file)
@@ -94,6 +94,7 @@ static inline int sun6i_csi_get_bpp(unsigned int pixformat)
        case V4L2_PIX_FMT_SGBRG8:
        case V4L2_PIX_FMT_SGRBG8:
        case V4L2_PIX_FMT_SRGGB8:
+       case V4L2_PIX_FMT_JPEG:
                return 8;
        case V4L2_PIX_FMT_SBGGR10:
        case V4L2_PIX_FMT_SGBRG10:
index bff6fe8328035d6460af861a776779f4f37d3aed..1fd16861f11145a24a65264bf377dbb97333ce23 100644 (file)
@@ -58,6 +58,7 @@ static const u32 supported_pixformats[] = {
        V4L2_PIX_FMT_YUV422P,
        V4L2_PIX_FMT_RGB565,
        V4L2_PIX_FMT_RGB565X,
+       V4L2_PIX_FMT_JPEG,
 };
 
 static bool is_pixformat_valid(unsigned int pixformat)