Skip to content

Commit

Permalink
v4l2: xilinx: dprx: Add support for YUV 420 8bpc and 10bpc color format
Browse files Browse the repository at this point in the history
DisplayPort 1.4 source device may send Pixel Encoding/Colorimetry format
indication using a VSC (Video_Stream_Configuration) SDP payload. As per the
DP 1.4 specification section 2.2.4.3 for YCbCr420 colorimetry formats,
VSC SDP shall be used instead of MISC0/MISC1 fields for pixel
encoding/colorimetry format indication.

Signed-off-by: Rajesh Gugulothu <rajesh.gugulothu@amd.com>
Tested-by: Jaihind Biradar <jaihind.biradar@amd.com>
Reviewed-by: Vishal Sagar <vishal.sagar@amd.com>
  • Loading branch information
gugulot authored and michalsimek committed May 18, 2023
1 parent e734ea4 commit 42f7575
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions drivers/media/platform/xilinx/xilinx-dprxss.c
Expand Up @@ -200,17 +200,20 @@

#define XDPRX_MSA_MISC1_REG 0x52c
#define XDPRX_INTERLACE_MASK BIT(0)

#define XDPRX_DPCD_MSA_TIMING_IGNORE_MASK BIT(6)
#define XDPRX_MSA_MVID_REG 0x530
#define XDPRX_MSA_NVID_REG 0x534
#define XDPRX_INTR_ERRORCNT_MASK BIT(28)
#define XDPRX_INTR_LANESET_MASK BIT(30)

#define XDPRX_SDP_PAYLOAD_STREAM1 0x644
#define XDPRX_VSC_SDP_FMT_MASK GENMASK(7, 4)
#define XDPRX_VSC_SDP_BPC_MASK GENMASK(11, 8)
#define XDPRX_EXT_VRD_BWSET_REG 0x7f0

#define XDPRX_COLOR_FORMAT_RGB 0x0
#define XDPRX_COLOR_FORMAT_422 0x1
#define XDPRX_COLOR_FORMAT_444 0x2
#define XDPRX_COLOR_FORMAT_420 0x3
#define MHZ 1000000
#define XDPRX_MAX_LANE_COUNT 4

Expand Down Expand Up @@ -1021,10 +1024,26 @@ static int xdprxss_get_stream_properties(struct xdprxss_state *state)
xdprxss_write(state, XDPRX_PIXEL_WIDTH_REG, pixel_width);
read_val = xdprxss_read(state, XDPRX_DTG_REG);
xdprxss_write(state, XDPRX_DTG_REG, (read_val | 0x1));
fmt = FIELD_GET(XDPRX_MSA_FMT_MASK, rxmsa_misc);
state->bpc = FIELD_GET(XDPRX_MSA_BPC_MASK, rxmsa_misc);
read_val = FIELD_GET(XDPRX_DPCD_MSA_TIMING_IGNORE_MASK,
xdprxss_read(state, XDPRX_MSA_MISC1_REG));
if (read_val) {
dev_dbg(state->dev, "Read colorimetry info from SDP packet instead of MSA\n");
read_val = xdprxss_read(state, XDPRX_SDP_PAYLOAD_STREAM1);
/* Decoding Data byte 16 */
fmt = FIELD_GET(XDPRX_VSC_SDP_FMT_MASK, read_val);
state->bpc = FIELD_GET(XDPRX_VSC_SDP_BPC_MASK, read_val);
} else {
fmt = FIELD_GET(XDPRX_MSA_FMT_MASK, rxmsa_misc);
state->bpc = FIELD_GET(XDPRX_MSA_BPC_MASK, rxmsa_misc);
}

switch (fmt) {
case XDPRX_COLOR_FORMAT_420:
if (state->bpc == 10)
format->code = MEDIA_BUS_FMT_VYYUYY10_4X20;
else
format->code = MEDIA_BUS_FMT_VYYUYY8_1X24;
break;
case XDPRX_COLOR_FORMAT_422:
if (state->bpc == 10)
format->code = MEDIA_BUS_FMT_UYVY10_1X20;
Expand Down

0 comments on commit 42f7575

Please sign in to comment.