Commit cc8fe073 authored by Todor Tomov's avatar Todor Tomov Committed by Mauro Carvalho Chehab

media: camss: Add support for 10-bit grayscale formats

Add support for 10-bit packed V4L2_PIX_FMT_Y10P (on 8x16 and 8x96)
and unpacked V4L2_PIX_FMT_Y10 (on 8x96 only) pixel formats.
Signed-off-by: default avatarTodor Tomov <todor.tomov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent f476fb56
...@@ -193,7 +193,14 @@ static const struct csid_format csid_formats_8x16[] = { ...@@ -193,7 +193,14 @@ static const struct csid_format csid_formats_8x16[] = {
DECODE_FORMAT_UNCOMPRESSED_12_BIT, DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12, 12,
1, 1,
} },
{
MEDIA_BUS_FMT_Y10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
}; };
static const struct csid_format csid_formats_8x96[] = { static const struct csid_format csid_formats_8x96[] = {
...@@ -336,7 +343,14 @@ static const struct csid_format csid_formats_8x96[] = { ...@@ -336,7 +343,14 @@ static const struct csid_format csid_formats_8x96[] = {
DECODE_FORMAT_UNCOMPRESSED_14_BIT, DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14, 14,
1, 1,
} },
{
MEDIA_BUS_FMT_Y10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
}; };
static u32 csid_find_code(u32 *code, unsigned int n_code, static u32 csid_find_code(u32 *code, unsigned int n_code,
...@@ -379,6 +393,16 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code, ...@@ -379,6 +393,16 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code,
return csid_find_code(src_code, ARRAY_SIZE(src_code), return csid_find_code(src_code, ARRAY_SIZE(src_code),
index, src_req_code); index, src_req_code);
} }
case MEDIA_BUS_FMT_Y10_1X10:
{
u32 src_code[] = {
MEDIA_BUS_FMT_Y10_1X10,
MEDIA_BUS_FMT_Y10_2X8_PADHI_LE,
};
return csid_find_code(src_code, ARRAY_SIZE(src_code),
index, src_req_code);
}
default: default:
if (index > 0) if (index > 0)
return 0; return 0;
...@@ -689,15 +713,21 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable) ...@@ -689,15 +713,21 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable)
val |= CAMSS_CSID_CID_n_CFG_RDI_EN; val |= CAMSS_CSID_CID_n_CFG_RDI_EN;
val |= df << CAMSS_CSID_CID_n_CFG_DECODE_FORMAT_SHIFT; val |= df << CAMSS_CSID_CID_n_CFG_DECODE_FORMAT_SHIFT;
val |= CAMSS_CSID_CID_n_CFG_RDI_MODE_RAW_DUMP; val |= CAMSS_CSID_CID_n_CFG_RDI_MODE_RAW_DUMP;
if (csid->camss->version == CAMSS_8x96 &&
csid->fmt[MSM_CSID_PAD_SINK].code == if (csid->camss->version == CAMSS_8x96) {
MEDIA_BUS_FMT_SBGGR10_1X10 && u32 sink_code = csid->fmt[MSM_CSID_PAD_SINK].code;
csid->fmt[MSM_CSID_PAD_SRC].code == u32 src_code = csid->fmt[MSM_CSID_PAD_SRC].code;
MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) {
val |= CAMSS_CSID_CID_n_CFG_RDI_MODE_PLAIN_PACKING; if ((sink_code == MEDIA_BUS_FMT_SBGGR10_1X10 &&
val |= CAMSS_CSID_CID_n_CFG_PLAIN_FORMAT_16; src_code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) ||
val |= CAMSS_CSID_CID_n_CFG_PLAIN_ALIGNMENT_LSB; (sink_code == MEDIA_BUS_FMT_Y10_1X10 &&
src_code == MEDIA_BUS_FMT_Y10_2X8_PADHI_LE)) {
val |= CAMSS_CSID_CID_n_CFG_RDI_MODE_PLAIN_PACKING;
val |= CAMSS_CSID_CID_n_CFG_PLAIN_FORMAT_16;
val |= CAMSS_CSID_CID_n_CFG_PLAIN_ALIGNMENT_LSB;
}
} }
writel_relaxed(val, csid->base + writel_relaxed(val, csid->base +
CAMSS_CSID_CID_n_CFG(ver, cid)); CAMSS_CSID_CID_n_CFG(ver, cid));
......
...@@ -45,6 +45,7 @@ static const struct csiphy_format csiphy_formats_8x16[] = { ...@@ -45,6 +45,7 @@ static const struct csiphy_format csiphy_formats_8x16[] = {
{ MEDIA_BUS_FMT_SGBRG12_1X12, 12 }, { MEDIA_BUS_FMT_SGBRG12_1X12, 12 },
{ MEDIA_BUS_FMT_SGRBG12_1X12, 12 }, { MEDIA_BUS_FMT_SGRBG12_1X12, 12 },
{ MEDIA_BUS_FMT_SRGGB12_1X12, 12 }, { MEDIA_BUS_FMT_SRGGB12_1X12, 12 },
{ MEDIA_BUS_FMT_Y10_1X10, 10 },
}; };
static const struct csiphy_format csiphy_formats_8x96[] = { static const struct csiphy_format csiphy_formats_8x96[] = {
...@@ -68,6 +69,7 @@ static const struct csiphy_format csiphy_formats_8x96[] = { ...@@ -68,6 +69,7 @@ static const struct csiphy_format csiphy_formats_8x96[] = {
{ MEDIA_BUS_FMT_SGBRG14_1X14, 14 }, { MEDIA_BUS_FMT_SGBRG14_1X14, 14 },
{ MEDIA_BUS_FMT_SGRBG14_1X14, 14 }, { MEDIA_BUS_FMT_SGRBG14_1X14, 14 },
{ MEDIA_BUS_FMT_SRGGB14_1X14, 14 }, { MEDIA_BUS_FMT_SRGGB14_1X14, 14 },
{ MEDIA_BUS_FMT_Y10_1X10, 10 },
}; };
/* /*
......
...@@ -120,6 +120,7 @@ static const u32 ispif_formats_8x16[] = { ...@@ -120,6 +120,7 @@ static const u32 ispif_formats_8x16[] = {
MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGBRG12_1X12,
MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SGRBG12_1X12,
MEDIA_BUS_FMT_SRGGB12_1X12, MEDIA_BUS_FMT_SRGGB12_1X12,
MEDIA_BUS_FMT_Y10_1X10,
}; };
static const u32 ispif_formats_8x96[] = { static const u32 ispif_formats_8x96[] = {
...@@ -144,6 +145,8 @@ static const u32 ispif_formats_8x96[] = { ...@@ -144,6 +145,8 @@ static const u32 ispif_formats_8x96[] = {
MEDIA_BUS_FMT_SGBRG14_1X14, MEDIA_BUS_FMT_SGBRG14_1X14,
MEDIA_BUS_FMT_SGRBG14_1X14, MEDIA_BUS_FMT_SGRBG14_1X14,
MEDIA_BUS_FMT_SRGGB14_1X14, MEDIA_BUS_FMT_SRGGB14_1X14,
MEDIA_BUS_FMT_Y10_1X10,
MEDIA_BUS_FMT_Y10_2X8_PADHI_LE,
}; };
/* /*
...@@ -692,7 +695,8 @@ static void ispif_config_pack(struct ispif_device *ispif, u32 code, ...@@ -692,7 +695,8 @@ static void ispif_config_pack(struct ispif_device *ispif, u32 code,
{ {
u32 addr, val; u32 addr, val;
if (code != MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) if (code != MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE &&
code != MEDIA_BUS_FMT_Y10_2X8_PADHI_LE)
return; return;
switch (intf) { switch (intf) {
......
...@@ -67,6 +67,7 @@ static const struct vfe_format formats_rdi_8x16[] = { ...@@ -67,6 +67,7 @@ static const struct vfe_format formats_rdi_8x16[] = {
{ MEDIA_BUS_FMT_SGBRG12_1X12, 12 }, { MEDIA_BUS_FMT_SGBRG12_1X12, 12 },
{ MEDIA_BUS_FMT_SGRBG12_1X12, 12 }, { MEDIA_BUS_FMT_SGRBG12_1X12, 12 },
{ MEDIA_BUS_FMT_SRGGB12_1X12, 12 }, { MEDIA_BUS_FMT_SRGGB12_1X12, 12 },
{ MEDIA_BUS_FMT_Y10_1X10, 10 },
}; };
static const struct vfe_format formats_pix_8x16[] = { static const struct vfe_format formats_pix_8x16[] = {
...@@ -98,6 +99,8 @@ static const struct vfe_format formats_rdi_8x96[] = { ...@@ -98,6 +99,8 @@ static const struct vfe_format formats_rdi_8x96[] = {
{ MEDIA_BUS_FMT_SGBRG14_1X14, 14 }, { MEDIA_BUS_FMT_SGBRG14_1X14, 14 },
{ MEDIA_BUS_FMT_SGRBG14_1X14, 14 }, { MEDIA_BUS_FMT_SGRBG14_1X14, 14 },
{ MEDIA_BUS_FMT_SRGGB14_1X14, 14 }, { MEDIA_BUS_FMT_SRGGB14_1X14, 14 },
{ MEDIA_BUS_FMT_Y10_1X10, 10 },
{ MEDIA_BUS_FMT_Y10_2X8_PADHI_LE, 16 },
}; };
static const struct vfe_format formats_pix_8x96[] = { static const struct vfe_format formats_pix_8x96[] = {
......
...@@ -74,6 +74,8 @@ static const struct camss_format_info formats_rdi_8x16[] = { ...@@ -74,6 +74,8 @@ static const struct camss_format_info formats_rdi_8x16[] = {
{ { 1, 1 } }, { { 1, 1 } }, { 12 } }, { { 1, 1 } }, { { 1, 1 } }, { 12 } },
{ MEDIA_BUS_FMT_SRGGB12_1X12, V4L2_PIX_FMT_SRGGB12P, 1, { MEDIA_BUS_FMT_SRGGB12_1X12, V4L2_PIX_FMT_SRGGB12P, 1,
{ { 1, 1 } }, { { 1, 1 } }, { 12 } }, { { 1, 1 } }, { { 1, 1 } }, { 12 } },
{ MEDIA_BUS_FMT_Y10_1X10, V4L2_PIX_FMT_Y10P, 1,
{ { 1, 1 } }, { { 1, 1 } }, { 10 } },
}; };
static const struct camss_format_info formats_rdi_8x96[] = { static const struct camss_format_info formats_rdi_8x96[] = {
...@@ -119,6 +121,10 @@ static const struct camss_format_info formats_rdi_8x96[] = { ...@@ -119,6 +121,10 @@ static const struct camss_format_info formats_rdi_8x96[] = {
{ { 1, 1 } }, { { 1, 1 } }, { 14 } }, { { 1, 1 } }, { { 1, 1 } }, { 14 } },
{ MEDIA_BUS_FMT_SRGGB14_1X14, V4L2_PIX_FMT_SRGGB14P, 1, { MEDIA_BUS_FMT_SRGGB14_1X14, V4L2_PIX_FMT_SRGGB14P, 1,
{ { 1, 1 } }, { { 1, 1 } }, { 14 } }, { { 1, 1 } }, { { 1, 1 } }, { 14 } },
{ MEDIA_BUS_FMT_Y10_1X10, V4L2_PIX_FMT_Y10P, 1,
{ { 1, 1 } }, { { 1, 1 } }, { 10 } },
{ MEDIA_BUS_FMT_Y10_2X8_PADHI_LE, V4L2_PIX_FMT_Y10, 1,
{ { 1, 1 } }, { { 1, 1 } }, { 16 } },
}; };
static const struct camss_format_info formats_pix_8x16[] = { static const struct camss_format_info formats_pix_8x16[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment