summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/camera.c
diff options
context:
space:
mode:
authorJacopo Mondi2016-07-15 11:03:41 +0200
committerGreg Kroah-Hartman2016-07-17 03:31:21 +0200
commit6cc270483c550f1d3f7098bb7fb0de20537947a2 (patch)
treeb5e2eb435f4653d8ae2ef859308db6c8e799fc64 /drivers/staging/greybus/camera.c
parentgreybus: audio_topology: Fix compile warning (diff)
downloadkernel-qcow2-linux-6cc270483c550f1d3f7098bb7fb0de20537947a2.tar.gz
kernel-qcow2-linux-6cc270483c550f1d3f7098bb7fb0de20537947a2.tar.xz
kernel-qcow2-linux-6cc270483c550f1d3f7098bb7fb0de20537947a2.zip
greybus: camera: Add bpp to Greybus Format description
Add the bytes per pixel value to the structure describing a Greybus Protocol Image Format. The bpp information will be used to compute the length in bytes of a line of pixel data Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org> Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/camera.c')
-rw-r--r--drivers/staging/greybus/camera.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index bdceb77200c6..7835ed78570a 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -74,76 +74,93 @@ struct gb_camera_stream_config {
unsigned int max_size;
};
-struct gb_camera_fmt_map {
+struct gb_camera_fmt_info {
enum v4l2_mbus_pixelcode mbus_code;
unsigned int gb_format;
+ unsigned int bpp;
};
/* GB format to media code map */
-static const struct gb_camera_fmt_map mbus_to_gbus_format[] = {
+static const struct gb_camera_fmt_info gb_fmt_info[] = {
{
.mbus_code = V4L2_MBUS_FMT_UYVY8_1X16,
.gb_format = 0x01,
+ .bpp = 16,
},
{
.mbus_code = V4L2_MBUS_FMT_NV12_1x8,
.gb_format = 0x12,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_NV21_1x8,
.gb_format = 0x13,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_YU12_1x8,
.gb_format = 0x16,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_YV12_1x8,
.gb_format = 0x17,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_JPEG_1X8,
.gb_format = 0x40,
+ .bpp = 0,
},
{
.mbus_code = V4L2_MBUS_FMT_ARA_METADATA_1X8,
.gb_format = 0x41,
+ .bpp = 0,
},
{
.mbus_code = V4L2_MBUS_FMT_ARA_DEBUG_DATA_1X8,
.gb_format = 0x42,
+ .bpp = 0,
},
{
.mbus_code = V4L2_MBUS_FMT_SBGGR10_1X10,
.gb_format = 0x80,
+ .bpp = 10,
},
{
.mbus_code = V4L2_MBUS_FMT_SGBRG10_1X10,
.gb_format = 0x81,
+ .bpp = 10,
},
{
.mbus_code = V4L2_MBUS_FMT_SGRBG10_1X10,
.gb_format = 0x82,
+ .bpp = 10,
},
{
.mbus_code = V4L2_MBUS_FMT_SRGGB10_1X10,
.gb_format = 0x83,
+ .bpp = 10,
},
{
.mbus_code = V4L2_MBUS_FMT_SBGGR12_1X12,
.gb_format = 0x84,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_SGBRG12_1X12,
.gb_format = 0x85,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_SGRBG12_1X12,
.gb_format = 0x86,
+ .bpp = 12,
},
{
.mbus_code = V4L2_MBUS_FMT_SRGGB12_1X12,
.gb_format = 0x87,
+ .bpp = 12,
},
};
@@ -615,22 +632,22 @@ static unsigned int gb_camera_mbus_to_gb(enum v4l2_mbus_pixelcode mbus_code)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(mbus_to_gbus_format); i++) {
- if (mbus_to_gbus_format[i].mbus_code == mbus_code)
- return mbus_to_gbus_format[i].gb_format;
+ for (i = 0; i < ARRAY_SIZE(gb_fmt_info); i++) {
+ if (gb_fmt_info[i].mbus_code == mbus_code)
+ return gb_fmt_info[i].gb_format;
}
- return mbus_to_gbus_format[0].gb_format;
+ return gb_fmt_info[0].gb_format;
}
static enum v4l2_mbus_pixelcode gb_camera_gb_to_mbus(u16 gb_fmt)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(mbus_to_gbus_format); i++) {
- if (mbus_to_gbus_format[i].gb_format == gb_fmt)
- return mbus_to_gbus_format[i].mbus_code;
+ for (i = 0; i < ARRAY_SIZE(gb_fmt_info); i++) {
+ if (gb_fmt_info[i].gb_format == gb_fmt)
+ return gb_fmt_info[i].mbus_code;
}
- return mbus_to_gbus_format[0].mbus_code;
+ return gb_fmt_info[0].mbus_code;
}
static ssize_t gb_camera_op_capabilities(void *priv, char *data, size_t len)