diff options
Diffstat (limited to 'drivers/media/common/v4l2-tpg/v4l2-tpg-core.c')
-rw-r--r-- | drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index abd4c788dffd..fa483b95bc5a 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -202,6 +202,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: tpg->interleaved = true; tpg->vdownsampling[1] = 1; tpg->hdownsampling[1] = 1; @@ -235,6 +239,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) case V4L2_PIX_FMT_Y12: case V4L2_PIX_FMT_Y16: case V4L2_PIX_FMT_Y16_BE: + case V4L2_PIX_FMT_Z16: tpg->color_enc = TGP_COLOR_ENC_LUMA; break; case V4L2_PIX_FMT_YUV444: @@ -351,6 +356,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) case V4L2_PIX_FMT_Y12: case V4L2_PIX_FMT_Y16: case V4L2_PIX_FMT_Y16_BE: + case V4L2_PIX_FMT_Z16: tpg->twopixelsize[0] = 2 * 2; break; case V4L2_PIX_FMT_RGB24: @@ -392,6 +398,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SBGGR12: + case V4L2_PIX_FMT_SRGGB16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SBGGR16: tpg->twopixelsize[0] = 4; tpg->twopixelsize[1] = 4; break; @@ -1062,6 +1072,7 @@ static void gen_twopix(struct tpg_data *tpg, buf[0][offset+1] = r_y_h >> 4; break; case V4L2_PIX_FMT_Y16: + case V4L2_PIX_FMT_Z16: /* * Ideally both bytes should be set to r_y_h, but then you won't * be able to detect endian problems. So keep it 0 except for @@ -1355,6 +1366,22 @@ static void gen_twopix(struct tpg_data *tpg, buf[0][offset] |= (buf[0][offset] >> 4) & 0xf; buf[1][offset] |= (buf[1][offset] >> 4) & 0xf; break; + case V4L2_PIX_FMT_SBGGR16: + buf[0][offset] = buf[0][offset + 1] = odd ? g_u_s : b_v; + buf[1][offset] = buf[1][offset + 1] = odd ? r_y_h : g_u_s; + break; + case V4L2_PIX_FMT_SGBRG16: + buf[0][offset] = buf[0][offset + 1] = odd ? b_v : g_u_s; + buf[1][offset] = buf[1][offset + 1] = odd ? g_u_s : r_y_h; + break; + case V4L2_PIX_FMT_SGRBG16: + buf[0][offset] = buf[0][offset + 1] = odd ? r_y_h : g_u_s; + buf[1][offset] = buf[1][offset + 1] = odd ? g_u_s : b_v; + break; + case V4L2_PIX_FMT_SRGGB16: + buf[0][offset] = buf[0][offset + 1] = odd ? g_u_s : r_y_h; + buf[1][offset] = buf[1][offset + 1] = odd ? b_v : g_u_s; + break; } } @@ -1373,6 +1400,10 @@ unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: return buf_line & 1; default: return 0; @@ -1770,7 +1801,7 @@ typedef struct { u16 __; u8 _; } __packed x24; pos[7] = (chr & (0x01 << 0) ? fg : bg); \ } \ \ - pos += (tpg->hflip ? -8 : 8) / hdiv; \ + pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \ } \ } \ } while (0) @@ -2038,8 +2069,12 @@ void tpg_log_status(struct tpg_data *tpg) tpg->compose.left, tpg->compose.top); pr_info("tpg colorspace: %d\n", tpg->colorspace); pr_info("tpg transfer function: %d/%d\n", tpg->xfer_func, tpg->real_xfer_func); - pr_info("tpg Y'CbCr encoding: %d/%d\n", tpg->ycbcr_enc, tpg->real_ycbcr_enc); - pr_info("tpg HSV encoding: %d/%d\n", tpg->hsv_enc, tpg->real_hsv_enc); + if (tpg->color_enc == TGP_COLOR_ENC_HSV) + pr_info("tpg HSV encoding: %d/%d\n", + tpg->hsv_enc, tpg->real_hsv_enc); + else if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) + pr_info("tpg Y'CbCr encoding: %d/%d\n", + tpg->ycbcr_enc, tpg->real_ycbcr_enc); pr_info("tpg quantization: %d/%d\n", tpg->quantization, tpg->real_quantization); pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range); } |