diff --git a/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-list.patch b/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-list.patch index c039e12eb7..5afb775c2a 100644 --- a/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-list.patch +++ b/projects/Rockchip/patches/linux/default/linux-0002-rockchip-from-list.patch @@ -270,7 +270,7 @@ Signed-off-by: Jonas Karlman 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 368f10405e13..238d70df6c80 100644 +index 4b70cbfc6d5d..5329f983db15 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1356,6 +1356,14 @@ void mmc_power_off(struct mmc_host *host) @@ -305,10 +305,10 @@ Signed-off-by: Alex Bee 1 file changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index 39db0b85b4da..d0410ae4def2 100644 +index 49ae15708a0b..60348d517efb 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -975,6 +975,20 @@ usb_host0_ohci: usb@ff5d0000 { +@@ -993,6 +993,20 @@ usb_host0_ohci: usb@ff5d0000 { status = "disabled"; }; @@ -346,10 +346,10 @@ Signed-off-by: Alex Bee 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index d0410ae4def2..cc46855aba46 100644 +index 60348d517efb..d7e44d174d7b 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -853,6 +853,8 @@ sdmmc: mmc@ff500000 { +@@ -871,6 +871,8 @@ sdmmc: mmc@ff500000 { clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; @@ -358,7 +358,7 @@ index d0410ae4def2..cc46855aba46 100644 status = "disabled"; }; -@@ -865,6 +867,8 @@ sdio: mmc@ff510000 { +@@ -883,6 +885,8 @@ sdio: mmc@ff510000 { clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; @@ -367,7 +367,7 @@ index d0410ae4def2..cc46855aba46 100644 status = "disabled"; }; -@@ -877,6 +881,8 @@ emmc: mmc@ff520000 { +@@ -895,6 +899,8 @@ emmc: mmc@ff520000 { clock-names = "biu", "ciu", "ciu-drive", "ciu-sample"; fifo-depth = <0x100>; max-frequency = <150000000>; diff --git a/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-list.patch b/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-list.patch index 8ae520924a..363d3ef7f3 100644 --- a/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-list.patch +++ b/projects/Rockchip/patches/linux/default/linux-0011-v4l2-from-list.patch @@ -1,133 +1,3 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 6 Jul 2020 21:54:33 +0000 -Subject: [PATCH] media: rkvdec: h264: Fix reference frame_num wrap for second - field - -When decoding the second field in a complementary field pair the second -field is sharing the same frame_num with the first field. - -Currently the frame_num for the first field is wrapped when it matches the -field being decoded, this cause issues to decode the second field in a -complementary field pair. - -Fix this by using inclusive comparison, less than or equal. - -Signed-off-by: Jonas Karlman -Reviewed-by: Ezequiel Garcia ---- - drivers/staging/media/rkvdec/rkvdec-h264.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 951e19231da2..3becb0186062 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-h264.c -+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -752,7 +752,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - continue; - - if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM || -- dpb[i].frame_num < dec_params->frame_num) { -+ dpb[i].frame_num <= dec_params->frame_num) { - p[i] = dpb[i].frame_num; - continue; - } - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 6 Jul 2020 21:54:34 +0000 -Subject: [PATCH] media: rkvdec: Ensure decoded resolution fit coded resolution - -Ensure decoded CAPTURE buffer resolution is larger or equal to the coded -OPTUPT buffer resolution. - -Signed-off-by: Jonas Karlman ---- - drivers/staging/media/rkvdec/rkvdec.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index ad2624c30843..efd316550807 100644 ---- a/drivers/staging/media/rkvdec/rkvdec.c -+++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -268,6 +268,8 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, - pix_mp->pixelformat = coded_desc->decoded_fmts[0]; - - /* Always apply the frmsize constraint of the coded end. */ -+ pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width); -+ pix_mp->height = max(pix_mp->height, ctx->coded_fmt.fmt.pix_mp.height); - v4l2_apply_frmsize_constraints(&pix_mp->width, - &pix_mp->height, - &coded_desc->frmsize); - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Mon, 6 Jul 2020 21:54:34 +0000 -Subject: [PATCH] media: rkvdec: h264: Validate and use pic width and height in - mbs - -The width and height in mbs is currently configured based on OUTPUT buffer -resolution, this works for frame pictures but can cause issues for field -pictures. - -When frame_mbs_only_flag is 0 the height in mbs should be height of -the field instead of height of frame. - -Validate pic_width_in_mbs_minus1 and pic_height_in_map_units_minus1 -against OUTPUT buffer resolution and use these values to configure HW. - -Signed-off-by: Jonas Karlman ---- - drivers/staging/media/rkvdec/rkvdec-h264.c | 4 ++-- - drivers/staging/media/rkvdec/rkvdec.c | 10 ++++++++++ - 2 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 3becb0186062..a379e43147fb 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-h264.c -+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -671,8 +671,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, - LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4); - WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO), - DELTA_PIC_ORDER_ALWAYS_ZERO_FLAG); -- WRITE_PPS(DIV_ROUND_UP(ctx->coded_fmt.fmt.pix_mp.width, 16), PIC_WIDTH_IN_MBS); -- WRITE_PPS(DIV_ROUND_UP(ctx->coded_fmt.fmt.pix_mp.height, 16), PIC_HEIGHT_IN_MBS); -+ WRITE_PPS(sps->pic_width_in_mbs_minus1 + 1, PIC_WIDTH_IN_MBS); -+ WRITE_PPS(sps->pic_height_in_map_units_minus1 + 1, PIC_HEIGHT_IN_MBS); - WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY), - FRAME_MBS_ONLY_FLAG); - WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD), -diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index efd316550807..c88e817cac0a 100644 ---- a/drivers/staging/media/rkvdec/rkvdec.c -+++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -29,8 +29,11 @@ - - static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - { -+ struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); -+ - if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) { - const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; -+ unsigned int width, height; - /* - * TODO: The hardware supports 10-bit and 4:2:2 profiles, - * but it's currently broken in the driver. -@@ -45,6 +48,13 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - if (sps->bit_depth_luma_minus8 != 0) - /* Only 8-bit is supported */ - return -EINVAL; -+ -+ width = (sps->pic_width_in_mbs_minus1 + 1) * 16; -+ height = (sps->pic_height_in_map_units_minus1 + 1) * 16; -+ -+ if (width > ctx->coded_fmt.fmt.pix_mp.width || -+ height > ctx->coded_fmt.fmt.pix_mp.height) -+ return -EINVAL; - } - return 0; - } - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jonas Karlman Date: Mon, 6 Jul 2020 21:54:35 +0000 @@ -298,10 +168,10 @@ index 287488016ff2..01f8a50586eb 100644 { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, { .format = V4L2_PIX_FMT_YUV411P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c -index 51289d4741dc..e6f2c65e24ca 100644 +index 21470de62d72..cb7496c084f6 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c -@@ -1299,6 +1299,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) +@@ -1306,6 +1306,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break; case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break; case V4L2_PIX_FMT_NV42: descr = "Y/CrCb 4:4:4"; break; @@ -311,10 +181,10 @@ index 51289d4741dc..e6f2c65e24ca 100644 case V4L2_PIX_FMT_NV12_16L16: descr = "Y/CbCr 4:2:0 (16x16 Linear)"; break; case V4L2_PIX_FMT_NV12_32L32: descr = "Y/CbCr 4:2:0 (32x32 Linear)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h -index df8b9c486ba1..9845ce720b4e 100644 +index 343b95107fce..3a5d6290a379 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h -@@ -602,6 +602,9 @@ struct v4l2_pix_format { +@@ -603,6 +603,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ @@ -342,10 +212,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 503ae683d0fd..88f5f4bb320b 100644 +index 2992fb87cf72..54fc3a6d0902 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -893,9 +893,9 @@ static void config_registers(struct rkvdec_ctx *ctx, +@@ -915,9 +915,9 @@ static void config_registers(struct rkvdec_ctx *ctx, dma_addr_t rlc_addr; dma_addr_t refer_addr; u32 rlc_len; @@ -358,7 +228,7 @@ index 503ae683d0fd..88f5f4bb320b 100644 u32 yuv_virstride = 0; u32 offset; dma_addr_t dst_addr; -@@ -906,8 +906,8 @@ static void config_registers(struct rkvdec_ctx *ctx, +@@ -928,8 +928,8 @@ static void config_registers(struct rkvdec_ctx *ctx, f = &ctx->decoded_fmt; dst_fmt = &f->fmt.pix_mp; @@ -387,7 +257,7 @@ Signed-off-by: Jonas Karlman 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index c88e817cac0a..d4ae792874bb 100644 +index 7bab7586918c..40cc791aef26 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -27,6 +27,17 @@ @@ -408,7 +278,7 @@ index c88e817cac0a..d4ae792874bb 100644 static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); -@@ -212,13 +223,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) +@@ -192,13 +203,9 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; @@ -425,7 +295,7 @@ index c88e817cac0a..d4ae792874bb 100644 } static int rkvdec_enum_framesizes(struct file *file, void *priv, -@@ -284,13 +291,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, +@@ -264,13 +271,7 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, &pix_mp->height, &coded_desc->frmsize); @@ -454,15 +324,15 @@ and 4:2:2 content. Signed-off-by: Jonas Karlman --- - drivers/staging/media/rkvdec/rkvdec.c | 59 ++++++++++++++++++++++++--- + drivers/staging/media/rkvdec/rkvdec.c | 67 +++++++++++++++++++++++---- drivers/staging/media/rkvdec/rkvdec.h | 2 + - 2 files changed, 55 insertions(+), 6 deletions(-) + 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index d4ae792874bb..3cbb1d26b972 100644 +index 40cc791aef26..e93e1cb0f829 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -38,6 +38,16 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, +@@ -38,19 +38,56 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, pix_mp->field = V4L2_FIELD_NONE; } @@ -479,21 +349,24 @@ index d4ae792874bb..3cbb1d26b972 100644 static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); -@@ -60,6 +70,10 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - /* Only 8-bit is supported */ - return -EINVAL; + const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; -+ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl)) -+ /* Only current valid format */ -+ return -EINVAL; +- if (desc->ops->try_ctrl) +- return desc->ops->try_ctrl(ctx, ctrl); ++ if (desc->ops->try_ctrl) { ++ int ret; ++ ret = desc->ops->try_ctrl(ctx, ctrl); ++ if (ret) ++ return ret; ++ } ++ ++ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl)) ++ /* Only current valid format */ ++ return -EINVAL; ++ ++ return 0; ++} + - width = (sps->pic_width_in_mbs_minus1 + 1) * 16; - height = (sps->pic_height_in_map_units_minus1 + 1) * 16; - -@@ -70,8 +84,27 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - return 0; - } - +static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); @@ -508,17 +381,17 @@ index d4ae792874bb..3cbb1d26b972 100644 + rkvdec_fill_decoded_pixfmt(ctx, pix_mp); + } + } -+ -+ return 0; -+} -+ + + return 0; + } + static const struct v4l2_ctrl_ops rkvdec_ctrl_ops = { .try_ctrl = rkvdec_try_ctrl, + .s_ctrl = rkvdec_s_ctrl, }; static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { -@@ -221,6 +254,7 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) +@@ -201,6 +238,7 @@ static void rkvdec_reset_decoded_fmt(struct rkvdec_ctx *ctx) { struct v4l2_format *f = &ctx->decoded_fmt; @@ -526,7 +399,7 @@ index d4ae792874bb..3cbb1d26b972 100644 rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; f->fmt.pix_mp.width = ctx->coded_fmt.fmt.pix_mp.width; -@@ -276,13 +310,17 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, +@@ -256,13 +294,17 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv, if (WARN_ON(!coded_desc)) return -EINVAL; @@ -550,7 +423,7 @@ index d4ae792874bb..3cbb1d26b972 100644 /* Always apply the frmsize constraint of the coded end. */ pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width); -@@ -346,6 +384,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv, +@@ -326,6 +368,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void *priv, return ret; ctx->decoded_fmt = *f; @@ -558,7 +431,7 @@ index d4ae792874bb..3cbb1d26b972 100644 return 0; } -@@ -446,6 +485,14 @@ static int rkvdec_enum_capture_fmt(struct file *file, void *priv, +@@ -429,6 +472,14 @@ static int rkvdec_enum_capture_fmt(struct file *file, void *priv, if (WARN_ON(!ctx->coded_fmt_desc)) return -EINVAL; @@ -574,7 +447,7 @@ index d4ae792874bb..3cbb1d26b972 100644 return -EINVAL; diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h -index 2f4ea1786b93..c26c472baa6f 100644 +index 633335ebb9c4..b9e219438bc9 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -66,6 +66,7 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf) @@ -585,7 +458,7 @@ index 2f4ea1786b93..c26c472baa6f 100644 int (*start)(struct rkvdec_ctx *ctx); void (*stop)(struct rkvdec_ctx *ctx); int (*run)(struct rkvdec_ctx *ctx); -@@ -99,6 +100,7 @@ struct rkvdec_ctx { +@@ -101,6 +102,7 @@ struct rkvdec_ctx { struct v4l2_fh fh; struct v4l2_format coded_fmt; struct v4l2_format decoded_fmt; @@ -609,15 +482,39 @@ for the provided SPS control. Signed-off-by: Jonas Karlman --- - drivers/staging/media/rkvdec/rkvdec-h264.c | 20 ++++++++++++++++++++ - drivers/staging/media/rkvdec/rkvdec.c | 19 +++++++++---------- - 2 files changed, 29 insertions(+), 10 deletions(-) + drivers/staging/media/rkvdec/rkvdec-h264.c | 33 ++++++++++++++++------ + drivers/staging/media/rkvdec/rkvdec.c | 19 +++++++++---- + 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 88f5f4bb320b..c9a551dbd9bc 100644 +index 54fc3a6d0902..af530b05a789 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -1021,6 +1021,25 @@ static int rkvdec_h264_adjust_fmt(struct rkvdec_ctx *ctx, +@@ -1044,19 +1044,14 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx, + { + unsigned int width, height; + +- /* +- * TODO: The hardware supports 10-bit and 4:2:2 profiles, +- * but it's currently broken in the driver. +- * Reject them for now, until it's fixed. +- */ +- if (sps->chroma_format_idc > 1) +- /* Only 4:0:0 and 4:2:0 are supported */ ++ if (sps->chroma_format_idc > 2) ++ /* Only 4:0:0, 4:2:0 and 4:2:2 are supported */ + return -EINVAL; + if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) + /* Luma and chroma bit depth mismatch */ + return -EINVAL; +- if (sps->bit_depth_luma_minus8 != 0) +- /* Only 8-bit is supported */ ++ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) ++ /* Only 8-bit and 10-bit is supported */ + return -EINVAL; + + width = (sps->pic_width_in_mbs_minus1 + 1) * 16; +@@ -1077,6 +1072,25 @@ static int rkvdec_h264_validate_sps(struct rkvdec_ctx *ctx, return 0; } @@ -643,7 +540,7 @@ index 88f5f4bb320b..c9a551dbd9bc 100644 static int rkvdec_h264_start(struct rkvdec_ctx *ctx) { struct rkvdec_dev *rkvdec = ctx->dev; -@@ -1124,6 +1143,7 @@ static int rkvdec_h264_run(struct rkvdec_ctx *ctx) +@@ -1198,6 +1212,7 @@ static int rkvdec_h264_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops = { .adjust_fmt = rkvdec_h264_adjust_fmt, @@ -652,7 +549,7 @@ index 88f5f4bb320b..c9a551dbd9bc 100644 .stop = rkvdec_h264_stop, .run = rkvdec_h264_run, diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 3cbb1d26b972..bd106b23f4a0 100644 +index e93e1cb0f829..4f5436c89e08 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -31,7 +31,7 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx, @@ -664,34 +561,12 @@ index 3cbb1d26b972..bd106b23f4a0 100644 pix_mp->plane_fmt[0].sizeimage += 128 * DIV_ROUND_UP(pix_mp->width, 16) * DIV_ROUND_UP(pix_mp->height, 16); -@@ -55,19 +55,15 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) { - const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps; - unsigned int width, height; -- /* -- * TODO: The hardware supports 10-bit and 4:2:2 profiles, -- * but it's currently broken in the driver. -- * Reject them for now, until it's fixed. -- */ -- if (sps->chroma_format_idc > 1) -- /* Only 4:0:0 and 4:2:0 are supported */ -+ -+ if (sps->chroma_format_idc > 2) -+ /* Only 4:0:0, 4:2:0 and 4:2:2 are supported */ - return -EINVAL; - if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) - /* Luma and chroma bit depth mismatch */ - return -EINVAL; -- if (sps->bit_depth_luma_minus8 != 0) -- /* Only 8-bit is supported */ -+ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) -+ /* Only 8-bit and 10-bit is supported */ - return -EINVAL; +@@ -136,8 +136,11 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = { + .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), + }; - if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl)) -@@ -155,6 +151,9 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = { - - static const u32 rkvdec_h264_vp9_decoded_fmts[] = { +-static const u32 rkvdec_h264_vp9_decoded_fmts[] = { ++static const u32 rkvdec_h264_decoded_fmts[] = { V4L2_PIX_FMT_NV12, + V4L2_PIX_FMT_NV15, + V4L2_PIX_FMT_NV16, @@ -699,3 +574,86 @@ index 3cbb1d26b972..bd106b23f4a0 100644 }; static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = { +@@ -160,6 +163,10 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = { + .num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs), + }; + ++static const u32 rkvdec_vp9_decoded_fmts[] = { ++ V4L2_PIX_FMT_NV12, ++}; ++ + static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, +@@ -173,8 +180,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + }, + .ctrls = &rkvdec_h264_ctrls, + .ops = &rkvdec_h264_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), +- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), ++ .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, + }, + { +@@ -189,8 +196,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + }, + .ctrls = &rkvdec_vp9_ctrls, + .ops = &rkvdec_vp9_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), +- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), ++ .decoded_fmts = rkvdec_vp9_decoded_fmts, + } + }; + + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 27 Mar 2022 14:18:07 +0200 +Subject: [PATCH] media: rkvdec-h264: Don't hardcode SPS/PPS parameters + +Some SPS/PPS parameters are currently hardcoded in the driver +even though so do exist in the uapi which is stable by now. + +Use them instead of hardcoding them. + +Signed-off-by: Alex Bee +--- + drivers/staging/media/rkvdec/rkvdec-h264.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c +index af530b05a789..f31b7c021d82 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-h264.c ++++ b/drivers/staging/media/rkvdec/rkvdec-h264.c +@@ -655,13 +655,14 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + + #define WRITE_PPS(value, field) set_ps_field(hw_ps->info, field, value) + /* write sps */ +- WRITE_PPS(0xf, SEQ_PARAMETER_SET_ID); +- WRITE_PPS(0xff, PROFILE_IDC); +- WRITE_PPS(1, CONSTRAINT_SET3_FLAG); ++ WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(sps->profile_idc, PROFILE_IDC); ++ WRITE_PPS((sps->constraint_set_flags & 1 << 3) ? 1 : 0, CONSTRAINT_SET3_FLAG); + WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC); + WRITE_PPS(sps->bit_depth_luma_minus8, BIT_DEPTH_LUMA); + WRITE_PPS(sps->bit_depth_chroma_minus8, BIT_DEPTH_CHROMA); +- WRITE_PPS(0, QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); ++ WRITE_PPS(!!(sps->flags & V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS), ++ QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG); + WRITE_PPS(sps->log2_max_frame_num_minus4, LOG2_MAX_FRAME_NUM_MINUS4); + WRITE_PPS(sps->max_num_ref_frames, MAX_NUM_REF_FRAMES); + WRITE_PPS(sps->pic_order_cnt_type, PIC_ORDER_CNT_TYPE); +@@ -688,8 +689,8 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + DIRECT_8X8_INFERENCE_FLAG); + + /* write pps */ +- WRITE_PPS(0xff, PIC_PARAMETER_SET_ID); +- WRITE_PPS(0x1f, PPS_SEQ_PARAMETER_SET_ID); ++ WRITE_PPS(pps->pic_parameter_set_id, PIC_PARAMETER_SET_ID); ++ WRITE_PPS(pps->seq_parameter_set_id, PPS_SEQ_PARAMETER_SET_ID); + WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE), + ENTROPY_CODING_MODE_FLAG); + WRITE_PPS(!!(pps->flags & V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT), diff --git a/projects/Rockchip/patches/linux/default/linux-0020-drm-from-list.patch b/projects/Rockchip/patches/linux/default/linux-0020-drm-from-list.patch index 7fb50ab8dc..4b796a94e7 100644 --- a/projects/Rockchip/patches/linux/default/linux-0020-drm-from-list.patch +++ b/projects/Rockchip/patches/linux/default/linux-0020-drm-from-list.patch @@ -24,7 +24,7 @@ Reviewed-by: Sandy Huang 2 files changed, 10 insertions(+) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c -index 25837b1d6639..f11080d63331 100644 +index 07741b678798..5ec38456dc5d 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -261,6 +261,14 @@ const struct drm_format_info *__drm_format_info(u32 format) @@ -43,7 +43,7 @@ index 25837b1d6639..f11080d63331 100644 .num_planes = 3, .char_per_block = { 2, 2, 2 }, .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 7f652c96845b..37824734633c 100644 +index f1972154a594..b972d0adfa2e 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -285,6 +285,8 @@ extern "C" { @@ -76,10 +76,10 @@ Reviewed-by: Sandy Huang 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index a25b98b7f5bd..91ded8a096ba 100644 +index 74562d40f639..9560f82ce880 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -262,6 +262,18 @@ static bool has_rb_swapped(uint32_t format) +@@ -274,6 +274,18 @@ static bool has_uv_swapped(uint32_t format) } } @@ -98,21 +98,23 @@ index a25b98b7f5bd..91ded8a096ba 100644 static enum vop_data_format vop_convert_format(uint32_t format) { switch (format) { -@@ -277,10 +289,13 @@ static enum vop_data_format vop_convert_format(uint32_t format) +@@ -289,12 +301,15 @@ static enum vop_data_format vop_convert_format(uint32_t format) case DRM_FORMAT_BGR565: return VOP_FMT_RGB565; case DRM_FORMAT_NV12: + case DRM_FORMAT_NV15: + case DRM_FORMAT_NV21: return VOP_FMT_YUV420SP; case DRM_FORMAT_NV16: + case DRM_FORMAT_NV20: + case DRM_FORMAT_NV61: return VOP_FMT_YUV422SP; case DRM_FORMAT_NV24: + case DRM_FORMAT_NV30: + case DRM_FORMAT_NV42: return VOP_FMT_YUV444SP; default: - DRM_ERROR("unsupported format[%08x]\n", format); -@@ -931,7 +946,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -948,7 +963,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane, dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start; dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff); @@ -126,7 +128,7 @@ index a25b98b7f5bd..91ded8a096ba 100644 offset += (src->y1 >> 16) * fb->pitches[0]; dma_addr = rk_obj->dma_addr + offset + fb->offsets[0]; -@@ -957,6 +977,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -974,6 +994,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, } VOP_WIN_SET(vop, win, format, format); @@ -134,7 +136,7 @@ index a25b98b7f5bd..91ded8a096ba 100644 VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4)); VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv); -@@ -973,7 +994,11 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -990,7 +1011,11 @@ static void vop_plane_atomic_update(struct drm_plane *plane, uv_obj = fb->obj[1]; rk_uv_obj = to_rockchip_obj(uv_obj); @@ -148,23 +150,23 @@ index a25b98b7f5bd..91ded8a096ba 100644 dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -index 857d97cdc67c..b7169010622a 100644 +index ba88addc1a75..567f226930b2 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -@@ -165,6 +165,7 @@ struct vop_win_phy { +@@ -179,6 +179,7 @@ struct vop_win_phy { struct vop_reg enable; struct vop_reg gate; struct vop_reg format; + struct vop_reg fmt_10; struct vop_reg rb_swap; + struct vop_reg uv_swap; struct vop_reg act_info; - struct vop_reg dsp_info; diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 1f7353f0684a..474cc8807ac9 100644 +index d03dd0402923..3b39b5a5f100 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -50,6 +50,23 @@ static const uint32_t formats_win_full[] = { - DRM_FORMAT_NV24, +@@ -53,6 +53,23 @@ static const uint32_t formats_win_full[] = { + DRM_FORMAT_NV42, }; +static const uint32_t formats_win_full_10[] = { @@ -187,7 +189,7 @@ index 1f7353f0684a..474cc8807ac9 100644 static const uint64_t format_modifiers_win_full[] = { DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID, -@@ -613,11 +630,12 @@ static const struct vop_scl_regs rk3288_win_full_scl = { +@@ -621,11 +638,12 @@ static const struct vop_scl_regs rk3288_win_full_scl = { static const struct vop_win_phy rk3288_win01_data = { .scl = &rk3288_win_full_scl, @@ -200,9 +202,9 @@ index 1f7353f0684a..474cc8807ac9 100644 .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), + .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4), .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), + .uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15), .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), - .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), -@@ -747,11 +765,12 @@ static const struct vop_intr rk3368_vop_intr = { +@@ -756,11 +774,12 @@ static const struct vop_intr rk3368_vop_intr = { static const struct vop_win_phy rk3368_win01_data = { .scl = &rk3288_win_full_scl, @@ -215,9 +217,9 @@ index 1f7353f0684a..474cc8807ac9 100644 .format = VOP_REG(RK3368_WIN0_CTRL0, 0x7, 1), + .fmt_10 = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 4), .rb_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 12), + .uv_swap = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 15), .x_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 21), - .y_mir_en = VOP_REG(RK3368_WIN0_CTRL0, 0x1, 22), -@@ -896,11 +915,12 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_big_win_yuv2yuv_data[] = { +@@ -906,11 +925,12 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_big_win_yuv2yuv_data[] = { static const struct vop_win_phy rk3399_win01_data = { .scl = &rk3288_win_full_scl, @@ -230,135 +232,5 @@ index 1f7353f0684a..474cc8807ac9 100644 .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), + .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4), .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), - .y_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 22), - .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Qinglang Miao -Date: Tue, 1 Dec 2020 20:54:57 +0800 -Subject: [PATCH] drm/rockchip: cdn-dp: fix reference leak when - pm_runtime_get_sync fails - -The PM reference count is not expected to be incremented on -return in cdn_dp_clk_enable. - -However, pm_runtime_get_sync will increment the PM reference -count even failed. Forgetting to putting operation will result -in a reference leak here. - -Replace it with pm_runtime_resume_and_get to keep usage -counter balanced. - -Fixes: efe0220fc2d2 ("drm/rockchip: cdn-dp: Fix error handling") -Reported-by: Hulk Robot -Signed-off-by: Qinglang Miao ---- - drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c -index 16497c31d9f9..e46963577854 100644 ---- a/drivers/gpu/drm/rockchip/cdn-dp-core.c -+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c -@@ -100,7 +100,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp) - goto err_core_clk; - } - -- ret = pm_runtime_get_sync(dp->dev); -+ ret = pm_runtime_resume_and_get(dp->dev); - if (ret < 0) { - DRM_DEV_ERROR(dp->dev, "cannot get pm runtime %d\n", ret); - goto err_pm_runtime_get; - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Qinglang Miao -Date: Tue, 1 Dec 2020 20:54:58 +0800 -Subject: [PATCH] drm/rockchip: vop: fix reference leak when - pm_runtime_get_sync fails - -The PM reference count is not expected to be incremented on -return in functions vop_enable and vop_enable. - -However, pm_runtime_get_sync will increment the PM reference -count even failed. Forgetting to putting operation will result -in a reference leak here. - -Replace it with pm_runtime_resume_and_get to keep usage -counter balanced. - -Fixes: 5e570373c015 ("drm/rockchip: vop: Enable pm domain before vop_initial") -Reported-by: Hulk Robot -Signed-off-by: Qinglang Miao ---- - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 91ded8a096ba..967f29625d7c 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -603,7 +603,7 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) - struct vop *vop = to_vop(crtc); - int ret, i; - -- ret = pm_runtime_get_sync(vop->dev); -+ ret = pm_runtime_resume_and_get(vop->dev); - if (ret < 0) { - DRM_DEV_ERROR(vop->dev, "failed to get pm runtime: %d\n", ret); - return ret; -@@ -1953,7 +1953,7 @@ static int vop_initial(struct vop *vop) - return PTR_ERR(vop->dclk); - } - -- ret = pm_runtime_get_sync(vop->dev); -+ ret = pm_runtime_resume_and_get(vop->dev); - if (ret < 0) { - DRM_DEV_ERROR(vop->dev, "failed to get pm runtime: %d\n", ret); - return ret; - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Qinglang Miao -Date: Tue, 1 Dec 2020 20:54:59 +0800 -Subject: [PATCH] drm/rockchip: lvds: fix reference leak when - pm_runtime_get_sync fails - -The PM reference count is not expected to be incremented on -return in functions rk3288_lvds_poweron and px30_lvds_poweron. - -However, pm_runtime_get_sync will increment the PM reference -count even failed. Forgetting to putting operation will result -in a reference leak here. - -Replace it with pm_runtime_resume_and_get to keep usage -counter balanced. - -Fixes: cca1705c3d89 ("drm/rockchip: lvds: Add PX30 support") -Reported-by: Hulk Robot -Signed-off-by: Qinglang Miao ---- - drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c -index be74c87a8be4..288462fd5d8e 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_lvds.c -+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c -@@ -146,7 +146,7 @@ static int rk3288_lvds_poweron(struct rockchip_lvds *lvds) - DRM_DEV_ERROR(lvds->dev, "failed to enable lvds pclk %d\n", ret); - return ret; - } -- ret = pm_runtime_get_sync(lvds->dev); -+ ret = pm_runtime_resume_and_get(lvds->dev); - if (ret < 0) { - DRM_DEV_ERROR(lvds->dev, "failed to get pm runtime: %d\n", ret); - clk_disable(lvds->pclk); -@@ -330,7 +330,7 @@ static int px30_lvds_poweron(struct rockchip_lvds *lvds) - { - int ret; - -- ret = pm_runtime_get_sync(lvds->dev); -+ ret = pm_runtime_resume_and_get(lvds->dev); - if (ret < 0) { - DRM_DEV_ERROR(lvds->dev, "failed to get pm runtime: %d\n", ret); - return ret; - + .uv_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 15), + .x_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 21), diff --git a/projects/Rockchip/patches/linux/default/linux-1000-drm-rockchip.patch b/projects/Rockchip/patches/linux/default/linux-1000-drm-rockchip.patch index bacd09c880..0e9ec6c13c 100644 --- a/projects/Rockchip/patches/linux/default/linux-1000-drm-rockchip.patch +++ b/projects/Rockchip/patches/linux/default/linux-1000-drm-rockchip.patch @@ -13,10 +13,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 967f29625d7c..08940fecaac3 100644 +index 9560f82ce880..c3fea637974f 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1575,7 +1575,11 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc) +@@ -1595,7 +1595,11 @@ static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc) { struct rockchip_crtc_state *rockchip_state; @@ -47,10 +47,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 54 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 08940fecaac3..084d060051da 100644 +index c3fea637974f..e736c735ec38 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1180,6 +1180,59 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc) +@@ -1200,6 +1200,59 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc) spin_unlock_irqrestore(&vop->irq_lock, flags); } @@ -110,7 +110,7 @@ index 08940fecaac3..084d060051da 100644 static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) -@@ -1558,6 +1611,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, +@@ -1578,6 +1631,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, } static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = { @@ -133,10 +133,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 084d060051da..5b28c707b44c 100644 +index e736c735ec38..2b765ec02a6e 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1218,6 +1218,9 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, +@@ -1238,6 +1238,9 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, if (!vop_crtc_is_tmds(crtc)) return MODE_OK; @@ -154,15 +154,16 @@ Subject: [PATCH] drm/rockchip: vop: define max output resolution supported Signed-off-by: Jonas Karlman --- - drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 6 ++++++ - drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 7 +++++++ - 2 files changed, 13 insertions(+) + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 6 ++++++ + drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 5 ----- + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 7 +++++++ + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -index b7169010622a..0b1984585082 100644 +index 567f226930b2..8db9ea4055f6 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -@@ -197,6 +197,11 @@ struct vop_win_data { +@@ -212,6 +212,11 @@ struct vop_win_data { enum drm_plane_type type; }; @@ -174,7 +175,7 @@ index b7169010622a..0b1984585082 100644 struct vop_data { uint32_t version; const struct vop_intr *intr; -@@ -209,6 +214,7 @@ struct vop_data { +@@ -224,6 +229,7 @@ struct vop_data { const struct vop_win_data *win; unsigned int win_size; unsigned int lut_size; @@ -182,11 +183,27 @@ index b7169010622a..0b1984585082 100644 #define VOP_FEATURE_OUTPUT_RGB10 BIT(0) #define VOP_FEATURE_INTERNAL_RGB BIT(1) +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +index c727093a06d6..f1234a151130 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +@@ -27,11 +27,6 @@ enum win_dly_mode { + VOP2_DLY_MODE_MAX, + }; + +-struct vop_rect { +- int width; +- int height; +-}; +- + enum vop2_scale_up_mode { + VOP2_SCALE_UP_NRST_NBOR, + VOP2_SCALE_UP_BIL, diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 474cc8807ac9..1d750cc492ec 100644 +index 3b39b5a5f100..0a9b64a62483 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -734,6 +734,7 @@ static const struct vop_intr rk3288_vop_intr = { +@@ -743,6 +743,7 @@ static const struct vop_intr rk3288_vop_intr = { static const struct vop_data rk3288_vop = { .version = VOP_VERSION(3, 1), .feature = VOP_FEATURE_OUTPUT_RGB10, @@ -194,7 +211,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3288_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -835,6 +836,7 @@ static const struct vop_misc rk3368_misc = { +@@ -845,6 +846,7 @@ static const struct vop_misc rk3368_misc = { static const struct vop_data rk3368_vop = { .version = VOP_VERSION(3, 2), @@ -202,7 +219,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3368_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -856,6 +858,7 @@ static const struct vop_intr rk3366_vop_intr = { +@@ -866,6 +868,7 @@ static const struct vop_intr rk3366_vop_intr = { static const struct vop_data rk3366_vop = { .version = VOP_VERSION(3, 4), @@ -210,7 +227,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3366_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -963,6 +966,7 @@ static const struct vop_afbc rk3399_vop_afbc = { +@@ -976,6 +979,7 @@ static const struct vop_afbc rk3399_vop_afbc = { static const struct vop_data rk3399_vop_big = { .version = VOP_VERSION(3, 5), .feature = VOP_FEATURE_OUTPUT_RGB10, @@ -218,7 +235,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3366_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -989,6 +993,7 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_lit_win_yuv2yuv_data[] = { +@@ -1002,6 +1006,7 @@ static const struct vop_win_yuv2yuv_data rk3399_vop_lit_win_yuv2yuv_data[] = { static const struct vop_data rk3399_vop_lit = { .version = VOP_VERSION(3, 6), @@ -226,7 +243,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3366_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -1009,6 +1014,7 @@ static const struct vop_win_data rk3228_vop_win_data[] = { +@@ -1022,6 +1027,7 @@ static const struct vop_win_data rk3228_vop_win_data[] = { static const struct vop_data rk3228_vop = { .version = VOP_VERSION(3, 7), .feature = VOP_FEATURE_OUTPUT_RGB10, @@ -234,7 +251,7 @@ index 474cc8807ac9..1d750cc492ec 100644 .intr = &rk3366_vop_intr, .common = &rk3288_common, .modeset = &rk3288_modeset, -@@ -1080,6 +1086,7 @@ static const struct vop_win_data rk3328_vop_win_data[] = { +@@ -1093,6 +1099,7 @@ static const struct vop_win_data rk3328_vop_win_data[] = { static const struct vop_data rk3328_vop = { .version = VOP_VERSION(3, 8), .feature = VOP_FEATURE_OUTPUT_RGB10, @@ -256,10 +273,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 5b28c707b44c..f906eb758b33 100644 +index 2b765ec02a6e..92caec48ccd8 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1212,6 +1212,7 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, +@@ -1232,6 +1232,7 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode) { struct vop *vop = to_vop(crtc); @@ -267,7 +284,7 @@ index 5b28c707b44c..f906eb758b33 100644 long rounded_rate; long lowest, highest; -@@ -1233,6 +1234,10 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, +@@ -1253,6 +1254,10 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc, if (rounded_rate > highest) return MODE_CLOCK_HIGH; @@ -278,7 +295,7 @@ index 5b28c707b44c..f906eb758b33 100644 return MODE_OK; } -@@ -1241,8 +1246,19 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, +@@ -1261,8 +1266,19 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, struct drm_display_mode *adjusted_mode) { struct vop *vop = to_vop(crtc); @@ -340,10 +357,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 830bdd5e9b7c..08c4ea2b6bf2 100644 +index c14f88893868..4411ca8fd7ed 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -181,7 +181,7 @@ static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { +@@ -193,7 +193,7 @@ static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { static const struct dw_hdmi_phy_config rockchip_phy_config[] = { /*pixelclk symbol term vlev*/ { 74250000, 0x8009, 0x0004, 0x0272}, @@ -367,10 +384,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 08c4ea2b6bf2..546970b36dd2 100644 +index 4411ca8fd7ed..bec381cde0bc 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -183,6 +183,7 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = { +@@ -195,6 +195,7 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = { { 74250000, 0x8009, 0x0004, 0x0272}, { 165000000, 0x802b, 0x0004, 0x0209}, { 297000000, 0x8039, 0x0005, 0x028d}, @@ -397,10 +414,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 546970b36dd2..3bbd90e2e40b 100644 +index bec381cde0bc..72c1d65c7b75 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -160,20 +160,8 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { +@@ -172,20 +172,8 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { /* pixelclk bpp8 bpp10 bpp12 */ { @@ -455,10 +472,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 69 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 3bbd90e2e40b..2cdaeb76ab9e 100644 +index 72c1d65c7b75..0370bb247fcb 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -79,80 +79,88 @@ struct rockchip_hdmi { +@@ -91,80 +91,88 @@ static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_encoder *encoder) static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { { @@ -628,10 +645,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 2cdaeb76ab9e..279d900e3e51 100644 +index 0370bb247fcb..55c0b8dddad5 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -221,19 +221,11 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, +@@ -242,19 +242,11 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, const struct drm_display_info *info, const struct drm_display_mode *mode) { @@ -667,10 +684,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 279d900e3e51..20c37b22b3eb 100644 +index 55c0b8dddad5..dadd2f6ef39a 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -225,7 +225,7 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, +@@ -246,7 +246,7 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, (info->max_tmds_clock && mode->clock > info->max_tmds_clock)) return MODE_CLOCK_HIGH; @@ -693,10 +710,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 20c37b22b3eb..f8001dd8dca7 100644 +index dadd2f6ef39a..62fbeaecbc92 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -306,6 +306,8 @@ static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, +@@ -327,6 +327,8 @@ static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, { struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; @@ -721,10 +738,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index f8001dd8dca7..8b957af7c61a 100644 +index 62fbeaecbc92..a4583fa1643e 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -396,9 +396,6 @@ static struct rockchip_hdmi_chip_data rk3228_chip_data = { +@@ -417,9 +417,6 @@ static struct rockchip_hdmi_chip_data rk3228_chip_data = { static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { .mode_valid = dw_hdmi_rockchip_mode_valid, @@ -734,7 +751,7 @@ index f8001dd8dca7..8b957af7c61a 100644 .phy_data = &rk3228_chip_data, .phy_ops = &rk3228_hdmi_phy_ops, .phy_name = "inno_dw_hdmi_phy2", -@@ -433,9 +430,6 @@ static struct rockchip_hdmi_chip_data rk3328_chip_data = { +@@ -454,9 +451,6 @@ static struct rockchip_hdmi_chip_data rk3328_chip_data = { static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { .mode_valid = dw_hdmi_rockchip_mode_valid, @@ -752,39 +769,28 @@ Subject: [PATCH] drm/rockchip: dw-hdmi: encoder error handling Signed-off-by: Jonas Karlman --- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 25 +++++++++++++++------ - 1 file changed, 18 insertions(+), 7 deletions(-) + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 8b957af7c61a..303c6e81ca4f 100644 +index a4583fa1643e..1bac3c741ee2 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -518,8 +518,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, +@@ -558,7 +558,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, if (IS_ERR(hdmi->phy)) { ret = PTR_ERR(hdmi->phy); if (ret != -EPROBE_DEFER) - DRM_DEV_ERROR(hdmi->dev, "failed to get phy\n"); -- return ret; + DRM_DEV_ERROR(hdmi->dev, "Failed to get phy: %d\n", ret); -+ goto err_disable_clk; - } - - ret = clk_prepare_enable(hdmi->vpll_clk); -@@ -524,8 +524,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, - - ret = clk_prepare_enable(hdmi->vpll_clk); - if (ret) { -- DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n", -- ret); -+ DRM_DEV_ERROR(hdmi->dev, "Failed to enable vpll: %d\n", ret); return ret; } -@@ -530,7 +530,11 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, +@@ -590,7 +590,12 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, } drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); - drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); ++ + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, "Failed to init encoder: %d\n", ret); @@ -793,27 +799,14 @@ index 8b957af7c61a..303c6e81ca4f 100644 platform_set_drvdata(pdev, hdmi); -@@ -542,10 +545,18 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, - */ - if (IS_ERR(hdmi->hdmi)) { - ret = PTR_ERR(hdmi->hdmi); -- drm_encoder_cleanup(encoder); -- clk_disable_unprepare(hdmi->vpll_clk); -+ if (ret != -EPROBE_DEFER) -+ DRM_DEV_ERROR(hdmi->dev, "Failed to init dw-hdmi bridge: %d\n", ret); -+ goto err_encoder_cleanup; - } +@@ -609,6 +614,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, -+ return 0; -+ -+err_encoder_cleanup: -+ drm_encoder_cleanup(encoder); + err_bind: + drm_encoder_cleanup(encoder); +err_disable_clk: -+ clk_disable_unprepare(hdmi->vpll_clk); -+ - return ret; - } - + clk_disable_unprepare(hdmi->ref_clk); + err_clk: + regulator_disable(hdmi->avdd_1v8); From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jonas Karlman @@ -850,10 +843,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 1d750cc492ec..91bdb85fdfd3 100644 +index 0a9b64a62483..6446f2158d30 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -731,7 +731,7 @@ static const struct vop_intr rk3288_vop_intr = { +@@ -740,7 +740,7 @@ static const struct vop_intr rk3288_vop_intr = { .clear = VOP_REG(RK3288_INTR_CTRL0, 0xf, 8), }; @@ -862,7 +855,7 @@ index 1d750cc492ec..91bdb85fdfd3 100644 .version = VOP_VERSION(3, 1), .feature = VOP_FEATURE_OUTPUT_RGB10, .max_output = { 3840, 2160 }, -@@ -744,6 +744,19 @@ static const struct vop_data rk3288_vop = { +@@ -753,6 +753,19 @@ static const struct vop_data rk3288_vop = { .lut_size = 1024, }; @@ -882,7 +875,7 @@ index 1d750cc492ec..91bdb85fdfd3 100644 static const int rk3368_vop_intrs[] = { FS_INTR, 0, 0, -@@ -1109,8 +1122,10 @@ static const struct of_device_id vop_driver_dt_match[] = { +@@ -1122,8 +1135,10 @@ static const struct of_device_id vop_driver_dt_match[] = { .data = &rk3066_vop }, { .compatible = "rockchip,rk3188-vop", .data = &rk3188_vop }, @@ -907,10 +900,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index aaaa61875701..7160118864df 100644 +index 487b0e03d4b4..c60eacab8a79 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -1016,7 +1016,7 @@ rga: rga@ff920000 { +@@ -1017,7 +1017,7 @@ rga: rga@ff920000 { }; vopb: vop@ff930000 { @@ -919,7 +912,7 @@ index aaaa61875701..7160118864df 100644 reg = <0x0 0xff930000 0x0 0x19c>, <0x0 0xff931000 0x0 0x1000>; interrupts = ; clocks = <&cru ACLK_VOP0>, <&cru DCLK_VOP0>, <&cru HCLK_VOP0>; -@@ -1065,7 +1065,7 @@ vopb_mmu: iommu@ff930300 { +@@ -1066,7 +1066,7 @@ vopb_mmu: iommu@ff930300 { }; vopl: vop@ff940000 { @@ -943,7 +936,7 @@ Signed-off-by: Jonas Karlman 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index f08d0fded61f..0af70d3839dd 100644 +index 3e1be9894ed1..170d291448df 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -137,7 +137,8 @@ struct dw_hdmi_phy_data { @@ -956,7 +949,7 @@ index f08d0fded61f..0af70d3839dd 100644 }; struct dw_hdmi { -@@ -1442,7 +1443,8 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) +@@ -1584,7 +1585,8 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) */ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, const struct dw_hdmi_plat_data *pdata, @@ -966,7 +959,7 @@ index f08d0fded61f..0af70d3839dd 100644 { const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg; const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr; -@@ -1517,9 +1519,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, +@@ -1659,9 +1661,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, /* Write to the PHY as configured by the platform */ if (pdata->configure_phy) @@ -993,10 +986,10 @@ index 18ed14911b98..9c75095a25c5 100644 const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params; diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 2a1f85f9a8a3..85be16b9cfbf 100644 +index f668e75fbabe..48fb72f9614f 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h -@@ -154,7 +154,8 @@ struct dw_hdmi_plat_data { +@@ -159,7 +159,8 @@ struct dw_hdmi_plat_data { const struct dw_hdmi_curr_ctrl *cur_ctr; const struct dw_hdmi_phy_config *phy_config; int (*configure_phy)(struct dw_hdmi *hdmi, void *data, @@ -1020,10 +1013,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 0af70d3839dd..48a343c9bcc3 100644 +index 170d291448df..507b7bf4c7fd 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1449,6 +1449,7 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, +@@ -1591,6 +1591,7 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg; const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr; const struct dw_hdmi_phy_config *phy_config = pdata->phy_config; @@ -1031,7 +1024,7 @@ index 0af70d3839dd..48a343c9bcc3 100644 /* TOFIX Will need 420 specific PHY configuration tables */ -@@ -1458,11 +1459,11 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, +@@ -1600,11 +1601,11 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, break; for (; curr_ctrl->mpixelclock != ~0UL; curr_ctrl++) @@ -1045,7 +1038,7 @@ index 0af70d3839dd..48a343c9bcc3 100644 break; if (mpll_config->mpixelclock == ~0UL || -@@ -1470,11 +1471,17 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, +@@ -1612,11 +1613,17 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, phy_config->mpixelclock == ~0UL) return -EINVAL; @@ -1079,10 +1072,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 48a343c9bcc3..90e683c65cbe 100644 +index 507b7bf4c7fd..2eb0f3cf1516 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1451,7 +1451,9 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, +@@ -1593,7 +1593,9 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi, const struct dw_hdmi_phy_config *phy_config = pdata->phy_config; int depth; @@ -1094,10 +1087,10 @@ index 48a343c9bcc3..90e683c65cbe 100644 /* PLL/MPLL Cfg - always match on final entry */ for (; mpll_config->mpixelclock != ~0UL; mpll_config++) diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h -index 85be16b9cfbf..bf45a37170ea 100644 +index 48fb72f9614f..02554d324b4b 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h -@@ -151,6 +151,7 @@ struct dw_hdmi_plat_data { +@@ -156,6 +156,7 @@ struct dw_hdmi_plat_data { /* Synopsys PHY support */ const struct dw_hdmi_mpll_config *mpll_cfg; @@ -1117,10 +1110,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 303c6e81ca4f..73fad678b6ee 100644 +index 1bac3c741ee2..1bf68ddc124c 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -221,8 +221,15 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, +@@ -242,8 +242,15 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, const struct drm_display_info *info, const struct drm_display_mode *mode) { @@ -1138,14 +1131,14 @@ index 303c6e81ca4f..73fad678b6ee 100644 return MODE_CLOCK_HIGH; return drm_mode_validate_size(mode, 3840, 2160); -@@ -495,6 +502,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, +@@ -531,6 +538,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + return -ENOMEM; hdmi->dev = &pdev->dev; - hdmi->chip_data = plat_data->phy_data; + plat_data->priv_data = plat_data; + hdmi->chip_data = plat_data->phy_data; plat_data->phy_data = hdmi; - encoder = &hdmi->encoder; - + encoder = &hdmi->encoder.encoder; From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jonas Karlman @@ -1158,10 +1151,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 41 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 73fad678b6ee..6471d601b98b 100644 +index 1bf68ddc124c..454c7bba0969 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -165,6 +165,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { +@@ -177,6 +177,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { } }; @@ -1208,7 +1201,7 @@ index 73fad678b6ee..6471d601b98b 100644 static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { /* pixelclk bpp8 bpp10 bpp12 */ { -@@ -453,6 +493,7 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = { +@@ -474,6 +514,7 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = { static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { .mode_valid = dw_hdmi_rockchip_mode_valid, .mpll_cfg = rockchip_mpll_cfg, @@ -1229,10 +1222,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 41 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 6471d601b98b..9af45fdfbd19 100644 +index 454c7bba0969..cb8b2135ddf0 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -205,6 +205,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg_420[] = { +@@ -217,6 +217,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg_420[] = { } }; @@ -1279,7 +1272,7 @@ index 6471d601b98b..9af45fdfbd19 100644 static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = { /* pixelclk bpp8 bpp10 bpp12 */ { -@@ -458,6 +498,7 @@ static struct rockchip_hdmi_chip_data rk3288_chip_data = { +@@ -479,6 +519,7 @@ static struct rockchip_hdmi_chip_data rk3288_chip_data = { static const struct dw_hdmi_plat_data rk3288_hdmi_drv_data = { .mode_valid = dw_hdmi_rockchip_mode_valid, .mpll_cfg = rockchip_mpll_cfg, @@ -1302,25 +1295,40 @@ atomic_get_input_bus_fmts and support for 8-bit RGB 4:4:4. Signed-off-by: Jonas Karlman --- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 110 ++++++++++++++------ - 1 file changed, 78 insertions(+), 32 deletions(-) + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 117 +++++++++++++------- + 1 file changed, 80 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 9af45fdfbd19..134c2db8d0fe 100644 +index cb8b2135ddf0..da4a829baded 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -68,6 +68,7 @@ struct rockchip_hdmi { +@@ -72,6 +72,7 @@ struct rockchip_hdmi_chip_data { + struct rockchip_hdmi { struct device *dev; struct regmap *regmap; - struct drm_encoder encoder; + struct drm_bridge bridge; + struct rockchip_encoder encoder; const struct rockchip_hdmi_chip_data *chip_data; - struct clk *vpll_clk; - struct clk *grf_clk; -@@ -315,30 +316,20 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, - return drm_mode_validate_size(mode, 3840, 2160); + struct clk *ref_clk; +@@ -82,11 +83,9 @@ struct rockchip_hdmi { + struct phy *phy; + }; + +-static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_encoder *encoder) ++static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_bridge *bridge) + { +- struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder); +- +- return container_of(rkencoder, struct rockchip_hdmi, encoder); ++ return container_of(bridge, struct rockchip_hdmi, bridge); } + static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { +@@ -335,31 +334,21 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, + + return drm_mode_validate_size(mode, 3840, 2160); + } +- -static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder) +static void +dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, @@ -1336,7 +1344,7 @@ index 9af45fdfbd19..134c2db8d0fe 100644 - struct drm_display_mode *adj_mode) -{ - return true; -+ clk_set_rate(hdmi->vpll_clk, adjusted_mode->clock * 1000); ++ clk_set_rate(hdmi->ref_clk, adjusted_mode->clock * 1000); } -static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder, @@ -1345,19 +1353,19 @@ index 9af45fdfbd19..134c2db8d0fe 100644 +static void dw_hdmi_rockchip_bridge_enable(struct drm_bridge *bridge) { - struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder); -- -- clk_set_rate(hdmi->vpll_clk, adj_mode->clock * 1000); ++ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); ++ struct drm_encoder *encoder = bridge->encoder; + +- clk_set_rate(hdmi->ref_clk, adj_mode->clock * 1000); -} - -static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) -{ - struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder); -+ struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); -+ struct drm_encoder *encoder = bridge->encoder; u32 val; int ret; -@@ -366,10 +357,21 @@ static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) +@@ -387,10 +376,21 @@ static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) ret ? "LIT" : "BIG"); } @@ -1382,7 +1390,7 @@ index 9af45fdfbd19..134c2db8d0fe 100644 { struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); -@@ -379,12 +381,38 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder, +@@ -400,12 +400,38 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder, return 0; } @@ -1427,7 +1435,7 @@ index 9af45fdfbd19..134c2db8d0fe 100644 }; static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, -@@ -565,6 +593,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, +@@ -602,6 +628,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, struct dw_hdmi_plat_data *plat_data; const struct of_device_id *match; struct drm_device *drm = data; @@ -1435,11 +1443,12 @@ index 9af45fdfbd19..134c2db8d0fe 100644 struct drm_encoder *encoder; struct rockchip_hdmi *hdmi; int ret; -@@ -618,19 +647,21 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, - goto err_disable_clk; +@@ -679,20 +706,21 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + RK3568_HDMI_SCLIN_MSK)); } - drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); +- ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); if (ret) { DRM_DEV_ERROR(hdmi->dev, "Failed to init encoder: %d\n", ret); @@ -1456,12 +1465,12 @@ index 9af45fdfbd19..134c2db8d0fe 100644 /* - * If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(), -+ * If dw_hdmi_probe() fails we'll never call dw_hdmi_remove(), ++ * If dw_hdmi_probe() fails we'll never call dw_hdmi_unbind(), * which would have called the encoder cleanup. Do it manually. */ if (IS_ERR(hdmi->hdmi)) { -@@ -640,8 +671,23 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, - goto err_encoder_cleanup; +@@ -700,8 +728,23 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, + goto err_bind; } + next_bridge = of_drm_find_bridge(pdev->dev.of_node); @@ -1481,18 +1490,18 @@ index 9af45fdfbd19..134c2db8d0fe 100644 +err_dw_hdmi_remove: + dw_hdmi_remove(hdmi->hdmi); - err_encoder_cleanup: + err_bind: drm_encoder_cleanup(encoder); err_disable_clk: -@@ -655,7 +701,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, +@@ -719,7 +762,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, { struct rockchip_hdmi *hdmi = dev_get_drvdata(dev); - dw_hdmi_unbind(hdmi->hdmi); + dw_hdmi_remove(hdmi->hdmi); - clk_disable_unprepare(hdmi->vpll_clk); - } + clk_disable_unprepare(hdmi->ref_clk); + regulator_disable(hdmi->avdd_1v8); From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jonas Karlman @@ -1505,10 +1514,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index f906eb758b33..ee6f7f653754 100644 +index 92caec48ccd8..3e2a0ce1a137 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1874,19 +1874,10 @@ static int vop_create_crtc(struct vop *vop) +@@ -1894,19 +1894,10 @@ static int vop_create_crtc(struct vop *vop) int ret; int i; @@ -1528,7 +1537,7 @@ index f906eb758b33..ee6f7f653754 100644 ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base, 0, &vop_plane_funcs, win_data->phy->data_formats, -@@ -1919,32 +1910,13 @@ static int vop_create_crtc(struct vop *vop) +@@ -1939,32 +1930,13 @@ static int vop_create_crtc(struct vop *vop) drm_crtc_enable_color_mgmt(crtc, 0, false, vop_data->lut_size); } @@ -1578,7 +1587,7 @@ Signed-off-by: Jonas Karlman 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c -index 3aa37e177667..a2b59faa9184 100644 +index 0d2cb4f3922b..e46965d16dd0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -132,6 +132,8 @@ void rockchip_drm_mode_config_init(struct drm_device *dev) @@ -1589,12 +1598,12 @@ index 3aa37e177667..a2b59faa9184 100644 + dev->mode_config.funcs = &rockchip_drm_mode_config_funcs; dev->mode_config.helper_private = &rockchip_mode_config_helpers; - } + diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index ee6f7f653754..350391e92c46 100644 +index 3e2a0ce1a137..3c1c415b039e 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1851,7 +1851,7 @@ static irqreturn_t vop_isr(int irq, void *data) +@@ -1871,7 +1871,7 @@ static irqreturn_t vop_isr(int irq, void *data) return ret; } @@ -1603,7 +1612,7 @@ index ee6f7f653754..350391e92c46 100644 const struct vop_win_data *win_data) { unsigned int flags = 0; -@@ -1861,6 +1861,8 @@ static void vop_plane_add_properties(struct drm_plane *plane, +@@ -1881,6 +1881,8 @@ static void vop_plane_add_properties(struct drm_plane *plane, if (flags) drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | flags); @@ -1612,7 +1621,7 @@ index ee6f7f653754..350391e92c46 100644 } static int vop_create_crtc(struct vop *vop) -@@ -1892,7 +1894,7 @@ static int vop_create_crtc(struct vop *vop) +@@ -1912,7 +1914,7 @@ static int vop_create_crtc(struct vop *vop) plane = &vop_win->base; drm_plane_helper_add(plane, &plane_helper_funcs); @@ -1633,10 +1642,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 350391e92c46..6f72c52db2d2 100644 +index 3c1c415b039e..1df221b7007d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -1851,8 +1851,23 @@ static irqreturn_t vop_isr(int irq, void *data) +@@ -1871,8 +1871,23 @@ static irqreturn_t vop_isr(int irq, void *data) return ret; } @@ -1661,7 +1670,7 @@ index 350391e92c46..6f72c52db2d2 100644 { unsigned int flags = 0; -@@ -1863,6 +1878,19 @@ static void vop_plane_add_properties(struct drm_plane *plane, int zpos, +@@ -1883,6 +1898,19 @@ static void vop_plane_add_properties(struct drm_plane *plane, int zpos, DRM_MODE_ROTATE_0 | flags); drm_plane_create_zpos_immutable_property(plane, zpos); @@ -1681,7 +1690,7 @@ index 350391e92c46..6f72c52db2d2 100644 } static int vop_create_crtc(struct vop *vop) -@@ -1894,7 +1922,7 @@ static int vop_create_crtc(struct vop *vop) +@@ -1914,7 +1942,7 @@ static int vop_create_crtc(struct vop *vop) plane = &vop_win->base; drm_plane_helper_add(plane, &plane_helper_funcs); @@ -1707,10 +1716,10 @@ Signed-off-by: Jonas Karlman 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 7160118864df..402492268dad 100644 +index c60eacab8a79..d1ae42757242 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -1025,6 +1025,8 @@ vopb: vop@ff930000 { +@@ -1026,6 +1026,8 @@ vopb: vop@ff930000 { resets = <&cru SRST_LCDC0_AXI>, <&cru SRST_LCDC0_AHB>, <&cru SRST_LCDC0_DCLK>; reset-names = "axi", "ahb", "dclk"; iommus = <&vopb_mmu>; @@ -1951,10 +1960,10 @@ Subject: [PATCH] HACK: dts: rockchip: do not use vopl for hdmi 2 files changed, 18 deletions(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 402492268dad..eb9d3bdf1d5e 100644 +index d1ae42757242..7b2cde230b87 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -1082,11 +1082,6 @@ vopl_out: port { +@@ -1083,11 +1083,6 @@ vopl_out: port { #address-cells = <1>; #size-cells = <0>; @@ -1966,7 +1975,7 @@ index 402492268dad..eb9d3bdf1d5e 100644 vopl_out_edp: endpoint@1 { reg = <1>; remote-endpoint = <&edp_in_vopl>; -@@ -1226,10 +1221,6 @@ hdmi_in_vopb: endpoint@0 { +@@ -1227,10 +1222,6 @@ hdmi_in_vopb: endpoint@0 { reg = <0>; remote-endpoint = <&vopb_out_hdmi>; }; @@ -1978,10 +1987,10 @@ index 402492268dad..eb9d3bdf1d5e 100644 }; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index d3cdf6f42a30..e21b93d57300 100644 +index fbd0346624e6..b0620c45820c 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1702,11 +1702,6 @@ vopl_out_edp: endpoint@1 { +@@ -1725,11 +1725,6 @@ vopl_out_edp: endpoint@1 { remote-endpoint = <&edp_in_vopl>; }; @@ -1993,7 +2002,7 @@ index d3cdf6f42a30..e21b93d57300 100644 vopl_out_mipi1: endpoint@3 { reg = <3>; remote-endpoint = <&mipi1_in_vopl>; -@@ -1900,10 +1895,6 @@ hdmi_in_vopb: endpoint@0 { +@@ -1923,10 +1918,6 @@ hdmi_in_vopb: endpoint@0 { reg = <0>; remote-endpoint = <&vopb_out_hdmi>; }; @@ -2016,10 +2025,10 @@ Subject: [PATCH] WIP: drm/bridge: dw-hdmi: limit mode and bus format to 1 file changed, 76 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 90e683c65cbe..419fd9124d7b 100644 +index 2eb0f3cf1516..3b0ce3f22d3e 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1860,6 +1860,21 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, +@@ -2002,6 +2002,21 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, HDMI_FC_PACKET_TX_EN_DRM_MASK, HDMI_FC_PACKET_TX_EN); } @@ -2041,7 +2050,7 @@ index 90e683c65cbe..419fd9124d7b 100644 static void hdmi_av_composer(struct dw_hdmi *hdmi, const struct drm_display_info *display, const struct drm_display_mode *mode) -@@ -1871,29 +1886,11 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, +@@ -2013,29 +2028,11 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, unsigned int vdisplay, hdisplay; vmode->mpixelclock = mode->clock * 1000; @@ -2074,7 +2083,7 @@ index 90e683c65cbe..419fd9124d7b 100644 dev_dbg(hdmi->dev, "final tmdsclock = %d\n", vmode->mtmdsclock); /* Set up HDMI_FC_INVIDCONF */ -@@ -2529,8 +2526,21 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) +@@ -2662,8 +2659,21 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) * - MEDIA_BUS_FMT_RGB888_1X24, */ @@ -2098,7 +2107,7 @@ index 90e683c65cbe..419fd9124d7b 100644 static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, -@@ -2542,8 +2552,6 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, +@@ -2675,8 +2685,6 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, struct drm_display_info *info = &conn->display_info; struct drm_display_mode *mode = &crtc_state->mode; u8 max_bpc = conn_state->max_requested_bpc; @@ -2107,7 +2116,7 @@ index 90e683c65cbe..419fd9124d7b 100644 u32 *output_fmts; unsigned int i = 0; -@@ -2566,29 +2574,33 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, +@@ -2700,29 +2708,33 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, * If the current mode enforces 4:2:0, force the output but format * to 4:2:0 and do not add the YUV422/444/RGB formats */ @@ -2149,7 +2158,7 @@ index 90e683c65cbe..419fd9124d7b 100644 } /* -@@ -2597,40 +2609,51 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, +@@ -2731,40 +2743,51 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge, */ if (max_bpc >= 16 && info->bpc == 16) { @@ -2212,7 +2221,7 @@ index 90e683c65cbe..419fd9124d7b 100644 *num_output_fmts = i; -@@ -2811,11 +2834,20 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, +@@ -2945,11 +2968,20 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, struct dw_hdmi *hdmi = bridge->driver_private; const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; enum drm_mode_status mode_status = MODE_OK; @@ -2240,23 +2249,24 @@ Date: Fri, 20 Dec 2019 08:12:42 +0000 Subject: [PATCH] WIP: drm/rockchip: dw_hdmi: add 10-bit rgb bus format --- - drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 41 +++++++++++++++++++++ - drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 + + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 42 +++++++++++++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + 2 files changed, 43 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 134c2db8d0fe..cba63dd5e8c8 100644 +index da4a829baded..66e463d58a0b 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -77,6 +77,7 @@ struct rockchip_hdmi { +@@ -83,6 +83,8 @@ struct rockchip_hdmi { + struct phy *phy; }; - #define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x) +#define to_crtc_state(x) container_of(x, struct drm_crtc_state, x) - - static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { - { -@@ -322,6 +323,11 @@ dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, ++ + static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_bridge *bridge) + { + return container_of(bridge, struct rockchip_hdmi, bridge); +@@ -340,6 +342,11 @@ dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *adjusted_mode) { struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); @@ -2266,23 +2276,12 @@ index 134c2db8d0fe..cba63dd5e8c8 100644 + if (hdmi->phy) + phy_set_bus_width(hdmi->phy, s->bus_width); - clk_set_rate(hdmi->vpll_clk, adjusted_mode->clock * 1000); + clk_set_rate(hdmi->ref_clk, adjusted_mode->clock * 1000); } -@@ -360,6 +366,7 @@ static void dw_hdmi_rockchip_bridge_enable(struct drm_bridge *bridge) - static bool is_rgb(u32 format) +@@ -380,6 +387,17 @@ static bool is_rgb(u32 format) { switch (format) { -+ case MEDIA_BUS_FMT_RGB101010_1X30: case MEDIA_BUS_FMT_RGB888_1X24: - return true; - default: -@@ -367,6 +374,16 @@ static bool is_rgb(u32 format) - } - } - -+static bool is_10bit(u32 format) -+{ -+ switch (format) { + case MEDIA_BUS_FMT_RGB101010_1X30: + return true; + default: @@ -2290,10 +2289,14 @@ index 134c2db8d0fe..cba63dd5e8c8 100644 + } +} + - static int - dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, - struct drm_bridge_state *bridge_state, -@@ -374,9 +391,24 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, ++static bool is_10bit(u32 format) ++{ ++ switch (format) { ++ case MEDIA_BUS_FMT_RGB101010_1X30: + return true; + default: + return false; +@@ -393,9 +411,24 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, struct drm_connector_state *conn_state) { struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); @@ -2318,7 +2321,7 @@ index 134c2db8d0fe..cba63dd5e8c8 100644 return 0; } -@@ -388,10 +420,19 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, +@@ -407,10 +440,19 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, u32 output_fmt, unsigned int *num_input_fmts) { @@ -2339,14 +2342,13 @@ index 134c2db8d0fe..cba63dd5e8c8 100644 return NULL; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h -index aa0909e8edf9..59716b037205 100644 +index 1641440837af..381e5ccab5f3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h -@@ -31,6 +31,8 @@ struct rockchip_crtc_state { - int output_bpc; - int output_flags; - bool enable_afbc; -+ u32 bus_format; +@@ -34,6 +34,7 @@ struct rockchip_crtc_state { + u32 bus_format; + u32 bus_flags; + int color_space; + int bus_width; }; #define to_rockchip_crtc_state(s) \ @@ -2363,10 +2365,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 419fd9124d7b..21b4e5873630 100644 +index 3b0ce3f22d3e..cd806742c010 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1647,6 +1647,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, +@@ -1789,6 +1789,7 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, const struct drm_connector *connector, const struct drm_display_mode *mode) { @@ -2374,7 +2376,7 @@ index 419fd9124d7b..21b4e5873630 100644 struct hdmi_avi_infoframe frame; u8 val; -@@ -1704,6 +1705,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, +@@ -1846,6 +1847,8 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; } @@ -2383,7 +2385,7 @@ index 419fd9124d7b..21b4e5873630 100644 /* * The Designware IP uses a different byte format from standard * AVI info frames, though generally the bits are in the correct -@@ -2417,7 +2420,8 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, +@@ -2550,7 +2553,8 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, if (!crtc) return 0; @@ -2393,7 +2395,7 @@ index 419fd9124d7b..21b4e5873630 100644 crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) return PTR_ERR(crtc_state); -@@ -2485,6 +2489,8 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) +@@ -2618,6 +2622,8 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) drm_connector_attach_max_bpc_property(connector, 8, 16); @@ -2416,10 +2418,10 @@ Subject: [PATCH] WIP: drm/rockchip: add yuv444 support 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index cba63dd5e8c8..6429892ac4df 100644 +index 66e463d58a0b..4fad844a18af 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -62,6 +62,7 @@ struct rockchip_hdmi_chip_data { +@@ -67,6 +67,7 @@ struct rockchip_hdmi_chip_data { int lcdsel_grf_reg; u32 lcdsel_big; u32 lcdsel_lit; @@ -2427,7 +2429,7 @@ index cba63dd5e8c8..6429892ac4df 100644 }; struct rockchip_hdmi { -@@ -374,10 +375,22 @@ static bool is_rgb(u32 format) +@@ -394,10 +395,22 @@ static bool is_rgb(u32 format) } } @@ -2450,7 +2452,7 @@ index cba63dd5e8c8..6429892ac4df 100644 return true; default: return false; -@@ -394,12 +407,22 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, +@@ -414,12 +427,22 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, struct drm_atomic_state *state = bridge_state->base.state; struct drm_crtc_state *old_crtc_state; struct rockchip_crtc_state *old_state; @@ -2473,7 +2475,7 @@ index cba63dd5e8c8..6429892ac4df 100644 s->bus_width = is_10bit(format) ? 10 : 8; old_crtc_state = drm_atomic_get_old_crtc_state(state, conn_state->crtc); -@@ -433,7 +456,10 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, +@@ -453,7 +476,10 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, if (!has_10bit && is_10bit(output_fmt)) return NULL; @@ -2485,7 +2487,7 @@ index cba63dd5e8c8..6429892ac4df 100644 return NULL; input_fmt = kzalloc(sizeof(*input_fmt), GFP_KERNEL); -@@ -583,6 +609,7 @@ static const struct dw_hdmi_phy_ops rk3328_hdmi_phy_ops = { +@@ -603,6 +629,7 @@ static const struct dw_hdmi_phy_ops rk3328_hdmi_phy_ops = { static struct rockchip_hdmi_chip_data rk3328_chip_data = { .lcdsel_grf_reg = -1, @@ -2494,10 +2496,10 @@ index cba63dd5e8c8..6429892ac4df 100644 static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 6f72c52db2d2..68251bb45459 100644 +index 1df221b7007d..ac3802c3be21 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -326,6 +326,17 @@ static int vop_convert_afbc_format(uint32_t format) +@@ -341,6 +341,17 @@ static int vop_convert_afbc_format(uint32_t format) return -EINVAL; } @@ -2515,7 +2517,7 @@ index 6f72c52db2d2..68251bb45459 100644 static uint16_t scl_vop_cal_scale(enum scale_mode mode, uint32_t src, uint32_t dst, bool is_horizontal, int vsu_mode, int *vskiplines) -@@ -1392,6 +1403,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -1412,6 +1423,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, u16 vact_end = vact_st + vdisplay; uint32_t pin_pol, val; int dither_bpc = s->output_bpc ? s->output_bpc : 10; @@ -2523,7 +2525,7 @@ index 6f72c52db2d2..68251bb45459 100644 int ret; if (old_state && old_state->self_refresh_active) { -@@ -1465,6 +1477,8 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -1485,6 +1497,8 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) s->output_mode = ROCKCHIP_OUT_MODE_P888; @@ -2532,7 +2534,7 @@ index 6f72c52db2d2..68251bb45459 100644 if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && dither_bpc <= 8) VOP_REG_SET(vop, common, pre_dither_down, 1); else -@@ -1480,6 +1494,21 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -1500,6 +1514,21 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, VOP_REG_SET(vop, common, out_mode, s->output_mode); @@ -2555,10 +2557,10 @@ index 6f72c52db2d2..68251bb45459 100644 val = hact_st << 16; val |= hact_end; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -index 0b1984585082..72dd670bf2a7 100644 +index 8db9ea4055f6..e9f256bd8d5a 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -@@ -103,10 +103,16 @@ struct vop_common { +@@ -117,10 +117,16 @@ struct vop_common { struct vop_reg mmu_en; struct vop_reg out_mode; struct vop_reg standby; @@ -2576,10 +2578,10 @@ index 0b1984585082..72dd670bf2a7 100644 struct vop_intr { diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 91bdb85fdfd3..6abf72b6a751 100644 +index 6446f2158d30..7c4c3e299760 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -696,6 +696,11 @@ static const struct vop_common rk3288_common = { +@@ -705,6 +705,11 @@ static const struct vop_common rk3288_common = { .dsp_blank = VOP_REG(RK3288_DSP_CTRL0, 0x3, 18), .out_mode = VOP_REG(RK3288_DSP_CTRL0, 0xf, 0), .cfg_done = VOP_REG_SYNC(RK3288_REG_CFG_DONE, 0x1, 0), @@ -2591,7 +2593,7 @@ index 91bdb85fdfd3..6abf72b6a751 100644 }; /* -@@ -1063,6 +1068,10 @@ static const struct vop_output rk3328_output = { +@@ -1076,6 +1081,10 @@ static const struct vop_output rk3328_output = { static const struct vop_misc rk3328_misc = { .global_regdone_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 11), @@ -2602,7 +2604,7 @@ index 91bdb85fdfd3..6abf72b6a751 100644 }; static const struct vop_common rk3328_common = { -@@ -1075,6 +1084,11 @@ static const struct vop_common rk3328_common = { +@@ -1088,6 +1097,11 @@ static const struct vop_common rk3328_common = { .dsp_blank = VOP_REG(RK3328_DSP_CTRL0, 0x3, 18), .out_mode = VOP_REG(RK3328_DSP_CTRL0, 0xf, 0), .cfg_done = VOP_REG_SYNC(RK3328_REG_CFG_DONE, 0x1, 0), @@ -2628,10 +2630,10 @@ Subject: [PATCH] WIP: drm/rockchip: add yuv420 support 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 6429892ac4df..257770ea2dc7 100644 +index 4fad844a18af..d57e953ce585 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -386,9 +386,21 @@ static bool is_yuv444(u32 format) +@@ -406,9 +406,21 @@ static bool is_yuv444(u32 format) } } @@ -2653,7 +2655,7 @@ index 6429892ac4df..257770ea2dc7 100644 case MEDIA_BUS_FMT_RGB101010_1X30: case MEDIA_BUS_FMT_YUV10_1X30: return true; -@@ -425,6 +437,11 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, +@@ -445,6 +457,11 @@ dw_hdmi_rockchip_bridge_atomic_check(struct drm_bridge *bridge, s->bus_width = is_10bit(format) ? 10 : 8; @@ -2665,7 +2667,7 @@ index 6429892ac4df..257770ea2dc7 100644 old_crtc_state = drm_atomic_get_old_crtc_state(state, conn_state->crtc); if (old_crtc_state && !crtc_state->mode_changed) { old_state = to_rockchip_crtc_state(old_crtc_state); -@@ -445,6 +462,7 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, +@@ -465,6 +482,7 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, { struct rockchip_hdmi *hdmi = to_rockchip_hdmi(bridge); struct drm_encoder *encoder = bridge->encoder; @@ -2673,7 +2675,7 @@ index 6429892ac4df..257770ea2dc7 100644 u32 *input_fmt; bool has_10bit = true; -@@ -459,6 +477,9 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, +@@ -479,6 +497,9 @@ static u32 *dw_hdmi_rockchip_get_input_bus_fmts(struct drm_bridge *bridge, if (is_yuv444(output_fmt)) { if (!hdmi->chip_data->ycbcr_444_allowed) return NULL; @@ -2683,7 +2685,7 @@ index 6429892ac4df..257770ea2dc7 100644 } else if (!is_rgb(output_fmt)) return NULL; -@@ -619,6 +640,7 @@ static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { +@@ -639,6 +660,7 @@ static const struct dw_hdmi_plat_data rk3328_hdmi_drv_data = { .phy_name = "inno_dw_hdmi_phy2", .phy_force_vendor = true, .use_drm_infoframe = true, @@ -2692,10 +2694,10 @@ index 6429892ac4df..257770ea2dc7 100644 static struct rockchip_hdmi_chip_data rk3399_chip_data = { diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 68251bb45459..fb0ceda19fa4 100644 +index ac3802c3be21..04a135730b12 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -327,6 +327,19 @@ static int vop_convert_afbc_format(uint32_t format) +@@ -342,6 +342,19 @@ static int vop_convert_afbc_format(uint32_t format) } static bool is_yuv_output(uint32_t bus_format) @@ -2711,20 +2713,20 @@ index 68251bb45459..fb0ceda19fa4 100644 + } +} + -+static bool has_uv_swapped(uint32_t bus_format) ++static bool bus_fmt_has_uv_swapped(uint32_t bus_format) { switch (bus_format) { case MEDIA_BUS_FMT_YUV8_1X24: -@@ -1477,7 +1490,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -1497,7 +1510,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) s->output_mode = ROCKCHIP_OUT_MODE_P888; - VOP_REG_SET(vop, common, dsp_data_swap, yuv_output ? 2 : 0); -+ VOP_REG_SET(vop, common, dsp_data_swap, has_uv_swapped(s->bus_format) ? 2 : 0); ++ VOP_REG_SET(vop, common, dsp_data_swap, bus_fmt_has_uv_swapped(s->bus_format) ? 2 : 0); if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && dither_bpc <= 8) VOP_REG_SET(vop, common, pre_dither_down, 1); -@@ -1494,6 +1507,9 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -1514,6 +1527,9 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc, VOP_REG_SET(vop, common, out_mode, s->output_mode); @@ -2735,10 +2737,10 @@ index 68251bb45459..fb0ceda19fa4 100644 VOP_REG_SET(vop, common, dsp_out_yuv, yuv_output); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -index 72dd670bf2a7..a997578e174a 100644 +index e9f256bd8d5a..c5c8d3887081 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h -@@ -105,6 +105,7 @@ struct vop_common { +@@ -119,6 +119,7 @@ struct vop_common { struct vop_reg standby; struct vop_reg overlay_mode; @@ -2746,7 +2748,7 @@ index 72dd670bf2a7..a997578e174a 100644 struct vop_reg dsp_data_swap; struct vop_reg dsp_out_yuv; struct vop_reg dsp_background; -@@ -269,11 +270,12 @@ struct vop_data { +@@ -284,11 +285,12 @@ struct vop_data { /* * display output interface supported by rockchip lcdc */ @@ -2764,10 +2766,10 @@ index 72dd670bf2a7..a997578e174a 100644 /* output flags */ #define ROCKCHIP_OUTPUT_DSI_DUAL BIT(0) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index 6abf72b6a751..bcdfa9de3d62 100644 +index 7c4c3e299760..1aecdcf63da9 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -698,6 +698,7 @@ static const struct vop_common rk3288_common = { +@@ -707,6 +707,7 @@ static const struct vop_common rk3288_common = { .cfg_done = VOP_REG_SYNC(RK3288_REG_CFG_DONE, 0x1, 0), .overlay_mode = VOP_REG(RK3288_SYS_CTRL, 0x1, 16), @@ -2775,7 +2777,7 @@ index 6abf72b6a751..bcdfa9de3d62 100644 .dsp_data_swap = VOP_REG(RK3288_DSP_CTRL0, 0x1f, 12), .dsp_out_yuv = VOP_REG(RK3288_POST_SCL_CTRL, 0x1, 2), .dsp_background = VOP_REG(RK3288_DSP_BG, 0xffffffff, 0), -@@ -1086,6 +1087,7 @@ static const struct vop_common rk3328_common = { +@@ -1099,6 +1100,7 @@ static const struct vop_common rk3328_common = { .cfg_done = VOP_REG_SYNC(RK3328_REG_CFG_DONE, 0x1, 0), .overlay_mode = VOP_REG(RK3328_SYS_CTRL, 0x1, 16), @@ -2795,10 +2797,10 @@ Subject: [PATCH] drm/rockchip: enable ycbcr_420_allowed and ycbcr_444_allowed 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 257770ea2dc7..78b77b31436a 100644 +index d57e953ce585..42457f7d9bc9 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -595,6 +595,7 @@ static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops = { +@@ -615,6 +615,7 @@ static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops = { static struct rockchip_hdmi_chip_data rk3228_chip_data = { .lcdsel_grf_reg = -1, @@ -2806,7 +2808,7 @@ index 257770ea2dc7..78b77b31436a 100644 }; static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { -@@ -603,6 +604,7 @@ static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { +@@ -623,6 +624,7 @@ static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { .phy_ops = &rk3228_hdmi_phy_ops, .phy_name = "inno_dw_hdmi_phy2", .phy_force_vendor = true, @@ -2830,10 +2832,10 @@ Signed-off-by: Alex Bee 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 78b77b31436a..976dd3c9c26f 100644 +index 42457f7d9bc9..90cc3b33e2a0 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -305,16 +305,30 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, +@@ -325,16 +325,30 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, const struct drm_display_mode *mode) { struct dw_hdmi_plat_data *pdata = (struct dw_hdmi_plat_data *)data; @@ -2865,7 +2867,7 @@ index 78b77b31436a..976dd3c9c26f 100644 + return drm_mode_validate_size(mode, 3840, 2160); } - + static void From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee @@ -2878,10 +2880,10 @@ Subject: [PATCH] !fixup drm/rockchip: rk3368's vop does not support 10-bit 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index bcdfa9de3d62..d70c61d64155 100644 +index 1aecdcf63da9..870e388c2345 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -785,8 +785,8 @@ static const struct vop_intr rk3368_vop_intr = { +@@ -794,8 +794,8 @@ static const struct vop_intr rk3368_vop_intr = { static const struct vop_win_phy rk3368_win01_data = { .scl = &rk3288_win_full_scl, @@ -2904,10 +2906,10 @@ Signed-off-by: Alex Bee 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -index d70c61d64155..5b79d7911ad7 100644 +index 870e388c2345..4ba8f79582db 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c -@@ -1103,12 +1103,36 @@ static const struct vop_intr rk3328_vop_intr = { +@@ -1116,12 +1116,36 @@ static const struct vop_intr rk3328_vop_intr = { .clear = VOP_REG_MASK_SYNC(RK3328_INTR_CLEAR0, 0xffff, 0), }; @@ -2958,10 +2960,10 @@ Subject: [PATCH] rockchip: vop: force skip lines if image too big 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index fb0ceda19fa4..0513649886e1 100644 +index 04a135730b12..96a301501584 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -941,6 +941,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -958,6 +958,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, int format; int is_yuv = fb->format->is_yuv; int i; @@ -2969,7 +2971,7 @@ index fb0ceda19fa4..0513649886e1 100644 /* * can't update plane when vop is disabled. -@@ -959,8 +960,14 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -976,8 +977,14 @@ static void vop_plane_atomic_update(struct drm_plane *plane, obj = fb->obj[0]; rk_obj = to_rockchip_obj(obj); @@ -2985,7 +2987,7 @@ index fb0ceda19fa4..0513649886e1 100644 act_info = (actual_h - 1) << 16 | ((actual_w - 1) & 0xffff); dsp_info = (drm_rect_height(dest) - 1) << 16; -@@ -1002,7 +1009,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -1019,7 +1026,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, VOP_WIN_SET(vop, win, format, format); VOP_WIN_SET(vop, win, fmt_10, is_fmt_10(fb->format->format)); @@ -2994,7 +2996,7 @@ index fb0ceda19fa4..0513649886e1 100644 VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, y2r_en, is_yuv); VOP_WIN_SET(vop, win, y_mir_en, -@@ -1026,7 +1033,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, +@@ -1043,7 +1050,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, offset += (src->y1 >> 16) * fb->pitches[1] / vsub; dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; @@ -3018,10 +3020,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index cc46855aba46..908cacb91c6a 100644 +index d7e44d174d7b..5519347232f6 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -793,8 +793,8 @@ cru: clock-controller@ff440000 { +@@ -811,8 +811,8 @@ cru: clock-controller@ff440000 { <0>, <24000000>, <24000000>, <24000000>, <15000000>, <15000000>, @@ -3089,7 +3091,7 @@ Signed-off-by: Alex Bee 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index 21b4e5873630..e694655845e9 100644 +index cd806742c010..772cc629c35d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -81,15 +81,15 @@ static const u16 csc_coeff_rgb_out_eitu709[3][4] = { @@ -3449,10 +3451,10 @@ Signed-off-by: Algea Cao 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index e694655845e9..fb3ed58d0e77 100644 +index 772cc629c35d..428e057dd415 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -1061,7 +1061,7 @@ static void hdmi_video_csc(struct dw_hdmi *hdmi) +@@ -1178,7 +1178,7 @@ static void hdmi_video_csc(struct dw_hdmi *hdmi) if (is_color_space_interpolation(hdmi)) interpolation = HDMI_CSC_CFG_INTMODE_CHROMA_INT_FORMULA1; else if (is_color_space_decimation(hdmi)) @@ -3479,23 +3481,23 @@ Signed-off-by: Alex Bee 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -index 976dd3c9c26f..a5929367ddbe 100644 +index 90cc3b33e2a0..3c0796c5743d 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c -@@ -329,7 +329,7 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, +@@ -349,7 +349,7 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, return MODE_CLOCK_HIGH; } - return drm_mode_validate_size(mode, 3840, 2160); + return MODE_OK; } - static void + dw_hdmi_rockchip_bridge_mode_set(struct drm_bridge *bridge, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -index 0513649886e1..ab2935df35c5 100644 +index 96a301501584..a89f96ab3974 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c -@@ -402,8 +402,8 @@ static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win, +@@ -417,8 +417,8 @@ static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win, if (info->is_yuv) is_yuv = true; @@ -3566,10 +3568,10 @@ Signed-off-by: Jonas Karlman 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c -index cd9cb354dc2c..b9a3d7af4a0b 100644 +index 8bf91b5a7d0e..ad8a2e5a31ac 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c -@@ -1614,8 +1614,15 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) +@@ -1671,8 +1671,15 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) if (IS_ERR_OR_NULL(adap)) return; @@ -3587,10 +3589,10 @@ index cd9cb354dc2c..b9a3d7af4a0b 100644 } EXPORT_SYMBOL_GPL(cec_s_phys_addr); diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c -index 551689d371a7..e3e038021e29 100644 +index af358e901b5f..bece8c56e5af 100644 --- a/drivers/media/cec/core/cec-core.c +++ b/drivers/media/cec/core/cec-core.c -@@ -28,6 +28,10 @@ static bool debug_phys_addr; +@@ -40,6 +40,10 @@ static bool debug_phys_addr; module_param(debug_phys_addr, bool, 0644); MODULE_PARM_DESC(debug_phys_addr, "add CEC_CAP_PHYS_ADDR if set"); @@ -3601,7 +3603,7 @@ index 551689d371a7..e3e038021e29 100644 static dev_t cec_dev_t; /* Active devices */ -@@ -174,6 +178,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap) +@@ -188,6 +192,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap) mutex_unlock(&devnode->lock); @@ -3610,7 +3612,7 @@ index 551689d371a7..e3e038021e29 100644 mutex_lock(&adap->lock); __cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false); __cec_s_log_addrs(adap, NULL, false); -@@ -232,6 +238,17 @@ static const struct file_operations cec_error_inj_fops = { +@@ -246,6 +252,17 @@ static const struct file_operations cec_error_inj_fops = { }; #endif @@ -3628,7 +3630,7 @@ index 551689d371a7..e3e038021e29 100644 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, void *priv, const char *name, u32 caps, u8 available_las) -@@ -269,6 +286,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, +@@ -283,6 +300,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, INIT_LIST_HEAD(&adap->transmit_queue); INIT_LIST_HEAD(&adap->wait_queue); init_waitqueue_head(&adap->kthread_waitq); @@ -3637,10 +3639,10 @@ index 551689d371a7..e3e038021e29 100644 /* adap->devnode initialization */ INIT_LIST_HEAD(&adap->devnode.fhs); diff --git a/drivers/media/cec/core/cec-priv.h b/drivers/media/cec/core/cec-priv.h -index 9bbd05053d42..d479dbd50528 100644 +index b78df931aa74..ebbea63ea9de 100644 --- a/drivers/media/cec/core/cec-priv.h +++ b/drivers/media/cec/core/cec-priv.h -@@ -27,6 +27,7 @@ static inline bool msg_is_raw(const struct cec_msg *msg) +@@ -37,6 +37,7 @@ static inline bool msg_is_raw(const struct cec_msg *msg) /* cec-core.c */ extern int cec_debug; @@ -3649,10 +3651,10 @@ index 9bbd05053d42..d479dbd50528 100644 void cec_put_device(struct cec_devnode *devnode); diff --git a/include/media/cec.h b/include/media/cec.h -index 208c9613c07e..6cea463b37bd 100644 +index abee41ae02d0..544eedb5d671 100644 --- a/include/media/cec.h +++ b/include/media/cec.h -@@ -217,6 +217,8 @@ struct cec_adapter { +@@ -236,6 +236,8 @@ struct cec_adapter { struct task_struct *kthread; wait_queue_head_t kthread_waitq; @@ -3681,10 +3683,10 @@ Signed-off-by: Alex Bee 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -index fb3ed58d0e77..29ed45025745 100644 +index 428e057dd415..9f13f2aa87d1 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c -@@ -3038,18 +3038,11 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) +@@ -3172,18 +3172,11 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) * ask the source to re-read the EDID. */ if (intr_stat & @@ -3704,7 +3706,7 @@ index fb3ed58d0e77..29ed45025745 100644 if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD ? connector_status_connected -@@ -3063,6 +3056,14 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) +@@ -3197,6 +3190,14 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) drm_helper_hpd_irq_event(hdmi->bridge.dev); drm_bridge_hpd_notify(&hdmi->bridge, status); } diff --git a/projects/Rockchip/patches/linux/default/linux-1001-v4l2-rockchip.patch b/projects/Rockchip/patches/linux/default/linux-1001-v4l2-rockchip.patch index 858d62224e..ecc91ff0dc 100644 --- a/projects/Rockchip/patches/linux/default/linux-1001-v4l2-rockchip.patch +++ b/projects/Rockchip/patches/linux/default/linux-1001-v4l2-rockchip.patch @@ -10,10 +10,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index bd106b23f4a0..5d1d50e4fd57 100644 +index 4f5436c89e08..06c23512e1a7 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -1021,7 +1021,8 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) +@@ -1016,7 +1016,8 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) state = (status & RKVDEC_RDY_STA) ? VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; @@ -23,7 +23,7 @@ index bd106b23f4a0..5d1d50e4fd57 100644 if (cancel_delayed_work(&rkvdec->watchdog_work)) { struct rkvdec_ctx *ctx; -@@ -1042,7 +1043,8 @@ static void rkvdec_watchdog_func(struct work_struct *work) +@@ -1037,7 +1038,8 @@ static void rkvdec_watchdog_func(struct work_struct *work) ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); if (ctx) { dev_err(rkvdec->dev, "Frame processing timed out!\n"); @@ -46,10 +46,10 @@ Signed-off-by: Jonas Karlman 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 5d1d50e4fd57..18f36e8546d9 100644 +index 06c23512e1a7..630ef09ab70b 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -1138,9 +1138,9 @@ static int rkvdec_remove(struct platform_device *pdev) +@@ -1127,9 +1127,9 @@ static int rkvdec_remove(struct platform_device *pdev) { struct rkvdec_dev *rkvdec = platform_get_drvdata(pdev); @@ -62,417 +62,6 @@ index 5d1d50e4fd57..18f36e8546d9 100644 } -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 23 May 2020 11:23:04 +0000 -Subject: [PATCH] WIP: media: rkvdec: h264: return early when no reference - pictures - -NOTE: also change from a switch statement to access reflists from a pointer array, -should simplify once we add support for field reference list - -Signed-off-by: Jonas Karlman ---- - drivers/staging/media/rkvdec/rkvdec-h264.c | 18 +++++------------- - 1 file changed, 5 insertions(+), 13 deletions(-) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index c9a551dbd9bc..6ce11b736363 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-h264.c -+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -734,6 +734,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - const struct v4l2_ctrl_h264_sps *sps = run->sps; - struct rkvdec_h264_priv_tbl *priv_tbl = h264_ctx->priv_tbl.cpu; - u32 max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4); -+ u8 *reflists[3] = { h264_ctx->reflists.p, h264_ctx->reflists.b0, h264_ctx->reflists.b1 }; - - u32 *hw_rps = priv_tbl->rps; - u32 i, j; -@@ -741,6 +742,9 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - - memset(hw_rps, 0, sizeof(priv_tbl->rps)); - -+ if (!h264_ctx->reflists.num_valid) -+ return; -+ - /* - * Assign an invalid pic_num if DPB entry at that position is inactive. - * If we assign 0 in that position hardware will treat that as a real -@@ -763,19 +767,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { - for (i = 0; i < h264_ctx->reflists.num_valid; i++) { - bool dpb_valid = run->ref_buf_idx[i] >= 0; -- u8 idx = 0; -- -- switch (j) { -- case 0: -- idx = h264_ctx->reflists.p[i]; -- break; -- case 1: -- idx = h264_ctx->reflists.b0[i]; -- break; -- case 2: -- idx = h264_ctx->reflists.b1[i]; -- break; -- } -+ u8 idx = reflists[j][i]; - - if (idx >= ARRAY_SIZE(dec_params->dpb)) - continue; - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sat, 23 May 2020 14:42:27 +0000 -Subject: [PATCH] WIP: media: rkvdec: h264: add field decoding support - -Signed-off-by: Jonas Karlman ---- - drivers/staging/media/rkvdec/rkvdec-h264.c | 79 ++++++++++++++++++---- - 1 file changed, 64 insertions(+), 15 deletions(-) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 6ce11b736363..9c3f08c94800 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-h264.c -+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -737,7 +737,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - u8 *reflists[3] = { h264_ctx->reflists.p, h264_ctx->reflists.b0, h264_ctx->reflists.b1 }; - - u32 *hw_rps = priv_tbl->rps; -- u32 i, j; -+ u32 i, j, k; - u16 *p = (u16 *)hw_rps; - - memset(hw_rps, 0, sizeof(priv_tbl->rps)); -@@ -764,16 +764,69 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - p[i] = dpb[i].frame_num - max_frame_num; - } - -- for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { -- for (i = 0; i < h264_ctx->reflists.num_valid; i++) { -- bool dpb_valid = run->ref_buf_idx[i] >= 0; -- u8 idx = reflists[j][i]; -+ if (!(dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) { -+ for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { -+ for (i = 0; i < h264_ctx->reflists.num_valid; i++) { -+ bool dpb_valid = run->ref_buf_idx[i] >= 0; -+ u8 idx = reflists[j][i]; - -- if (idx >= ARRAY_SIZE(dec_params->dpb)) -- continue; -+ if (idx >= ARRAY_SIZE(dec_params->dpb)) -+ continue; - -- set_ps_field(hw_rps, DPB_INFO(i, j), -- idx | dpb_valid << 4); -+ set_ps_field(hw_rps, DPB_INFO(i, j), -+ idx | dpb_valid << 4); -+ } -+ } -+ return; -+ } -+ -+ for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { -+ enum v4l2_h264_field_reference a_parity = -+ (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) -+ ? V4L2_H264_BOTTOM_FIELD_REF : V4L2_H264_TOP_FIELD_REF; -+ enum v4l2_h264_field_reference b_parity = -+ (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) -+ ? V4L2_H264_TOP_FIELD_REF : V4L2_H264_BOTTOM_FIELD_REF; -+ u32 flags = V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM; -+ i = 0; -+ -+ for (k = 0; k < 2; k++) { -+ u8 a = 0; -+ u8 b = 0; -+ u32 long_term = k ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0; -+ -+ while (a < h264_ctx->reflists.num_valid || b < h264_ctx->reflists.num_valid) { -+ for (; a < h264_ctx->reflists.num_valid; a++) { -+ u8 idx = reflists[j][a]; -+ if (idx >= ARRAY_SIZE(dec_params->dpb)) -+ continue; -+ if ((dpb[idx].reference & a_parity) == a_parity && -+ (dpb[idx].flags & flags) == long_term) { -+ set_ps_field(hw_rps, DPB_INFO(i, j), -+ idx | (1 << 4)); -+ set_ps_field(hw_rps, BOTTOM_FLAG(i, j), -+ a_parity == V4L2_H264_BOTTOM_FIELD_REF); -+ i++; -+ a++; -+ break; -+ } -+ } -+ for (; b < h264_ctx->reflists.num_valid; b++) { -+ u8 idx = reflists[j][b]; -+ if (idx >= ARRAY_SIZE(dec_params->dpb)) -+ continue; -+ if ((dpb[idx].reference & b_parity) == b_parity && -+ (dpb[idx].flags & flags) == long_term) { -+ set_ps_field(hw_rps, DPB_INFO(i, j), -+ idx | (1 << 4)); -+ set_ps_field(hw_rps, BOTTOM_FLAG(i, j), -+ b_parity == V4L2_H264_BOTTOM_FIELD_REF); -+ i++; -+ b++; -+ break; -+ } -+ } -+ } - } - } - } -@@ -968,10 +1021,6 @@ static void config_registers(struct rkvdec_ctx *ctx, - rkvdec->regs + RKVDEC_REG_H264_BASE_REFER15); - } - -- /* -- * Since support frame mode only -- * top_field_order_cnt is the same as bottom_field_order_cnt -- */ - reg = RKVDEC_CUR_POC(dec_params->top_field_order_cnt); - writel_relaxed(reg, rkvdec->regs + RKVDEC_REG_CUR_POC0); - - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Tue, 29 Oct 2019 01:26:02 +0000 -Subject: [PATCH] RFC: media: hantro: Fix H264 decoding of field encoded - content - -This still need code cleanup and formatting - -Signed-off-by: Jonas Karlman ---- - drivers/staging/media/hantro/hantro_h264.c | 91 ++++++++++++++++------ - 1 file changed, 69 insertions(+), 22 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c -index 0b4d2491be3b..7b56a68c176c 100644 ---- a/drivers/staging/media/hantro/hantro_h264.c -+++ b/drivers/staging/media/hantro/hantro_h264.c -@@ -227,30 +227,67 @@ static void prepare_table(struct hantro_ctx *ctx) - { - const struct hantro_h264_dec_ctrls *ctrls = &ctx->h264_dec.ctrls; - const struct v4l2_ctrl_h264_decode_params *dec_param = ctrls->decode; -+ const struct v4l2_ctrl_h264_sps *sps = ctrls->sps; - struct hantro_h264_dec_priv_tbl *tbl = ctx->h264_dec.priv.cpu; - const struct v4l2_h264_dpb_entry *dpb = ctx->h264_dec.dpb; - u32 dpb_longterm = 0; - u32 dpb_valid = 0; - int i; - -- for (i = 0; i < HANTRO_H264_DPB_SIZE; ++i) { -- tbl->poc[i * 2] = dpb[i].top_field_order_cnt; -- tbl->poc[i * 2 + 1] = dpb[i].bottom_field_order_cnt; -+ /* -+ * Set up bit maps of valid and long term DPBs. -+ * NOTE: The bits are reversed, i.e. MSb is DPB 0. -+ */ -+ if ((dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) || (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD)) { -+ for (i = 0; i < HANTRO_H264_DPB_SIZE * 2; ++i) { -+ // check for correct reference use -+ enum v4l2_h264_field_reference parity = (i & 0x1) ? -+ V4L2_H264_BOTTOM_FIELD_REF : V4L2_H264_TOP_FIELD_REF; -+ if (dpb[i / 2].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE && -+ dpb[i / 2].reference & parity) -+ dpb_valid |= BIT(HANTRO_H264_DPB_SIZE * 2 - 1 - i); -+ -+ if (dpb[i / 2].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) -+ dpb_longterm |= BIT(HANTRO_H264_DPB_SIZE * 2 - 1 - i); -+ } - -- /* -- * Set up bit maps of valid and long term DPBs. -- * NOTE: The bits are reversed, i.e. MSb is DPB 0. -- */ -- if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) -- dpb_valid |= BIT(HANTRO_H264_DPB_SIZE - 1 - i); -- if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) -- dpb_longterm |= BIT(HANTRO_H264_DPB_SIZE - 1 - i); -+ ctx->h264_dec.dpb_valid = dpb_valid; -+ ctx->h264_dec.dpb_longterm = dpb_longterm; -+ } else { -+ for (i = 0; i < HANTRO_H264_DPB_SIZE; ++i) { -+ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) -+ dpb_valid |= BIT(HANTRO_H264_DPB_SIZE - 1 - i); -+ -+ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) -+ dpb_longterm |= BIT(HANTRO_H264_DPB_SIZE - 1 - i); -+ } -+ -+ ctx->h264_dec.dpb_valid = dpb_valid << 16; -+ ctx->h264_dec.dpb_longterm = dpb_longterm << 16; - } -- ctx->h264_dec.dpb_valid = dpb_valid << 16; -- ctx->h264_dec.dpb_longterm = dpb_longterm << 16; - -- tbl->poc[32] = dec_param->top_field_order_cnt; -- tbl->poc[33] = dec_param->bottom_field_order_cnt; -+ for (i = 0; i < HANTRO_H264_DPB_SIZE; ++i) { -+ if (dpb[i].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) { -+ tbl->poc[i * 2] = dpb[i].top_field_order_cnt; -+ tbl->poc[i * 2 + 1] = dpb[i].bottom_field_order_cnt; -+ } else { -+ tbl->poc[i * 2] = 0; -+ tbl->poc[i * 2 + 1] = 0; -+ } -+ } -+ -+ if ((dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) || !(sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD)) { -+ if ((dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC)) -+ tbl->poc[32] = (dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) ? -+ dec_param->bottom_field_order_cnt : -+ dec_param->top_field_order_cnt; -+ else -+ tbl->poc[32] = min(dec_param->top_field_order_cnt, dec_param->bottom_field_order_cnt); -+ tbl->poc[33] = 0; -+ } else { -+ tbl->poc[32] = dec_param->top_field_order_cnt; -+ tbl->poc[33] = dec_param->bottom_field_order_cnt; -+ }; - - assemble_scaling_list(ctx); - } -@@ -258,8 +295,7 @@ static void prepare_table(struct hantro_ctx *ctx) - static bool dpb_entry_match(const struct v4l2_h264_dpb_entry *a, - const struct v4l2_h264_dpb_entry *b) - { -- return a->top_field_order_cnt == b->top_field_order_cnt && -- a->bottom_field_order_cnt == b->bottom_field_order_cnt; -+ return a->reference_ts == b->reference_ts; - } - - static void update_dpb(struct hantro_ctx *ctx) -@@ -273,13 +309,13 @@ static void update_dpb(struct hantro_ctx *ctx) - - /* Disable all entries by default. */ - for (i = 0; i < ARRAY_SIZE(ctx->h264_dec.dpb); i++) -- ctx->h264_dec.dpb[i].flags &= ~V4L2_H264_DPB_ENTRY_FLAG_ACTIVE; -+ ctx->h264_dec.dpb[i].flags = 0; - - /* Try to match new DPB entries with existing ones by their POCs. */ - for (i = 0; i < ARRAY_SIZE(dec_param->dpb); i++) { - const struct v4l2_h264_dpb_entry *ndpb = &dec_param->dpb[i]; - -- if (!(ndpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE)) -+ if (!(ndpb->flags & V4L2_H264_DPB_ENTRY_FLAG_VALID)) - continue; - - /* -@@ -290,8 +326,7 @@ static void update_dpb(struct hantro_ctx *ctx) - struct v4l2_h264_dpb_entry *cdpb; - - cdpb = &ctx->h264_dec.dpb[j]; -- if (cdpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE || -- !dpb_entry_match(cdpb, ndpb)) -+ if (!dpb_entry_match(cdpb, ndpb)) - continue; - - *cdpb = *ndpb; -@@ -327,7 +362,10 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, - unsigned int dpb_idx) - { - struct v4l2_h264_dpb_entry *dpb = ctx->h264_dec.dpb; -+ const struct v4l2_ctrl_h264_decode_params *dec_param = ctx->h264_dec.ctrls.decode; - dma_addr_t dma_addr = 0; -+ s32 cur_poc; -+ u32 flags; - - if (dpb[dpb_idx].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE) - dma_addr = hantro_get_ref(ctx, dpb[dpb_idx].reference_ts); -@@ -345,7 +383,16 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx, - dma_addr = hantro_get_dec_buf_addr(ctx, buf); - } - -- return dma_addr; -+ cur_poc = dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD ? -+ dec_param->bottom_field_order_cnt : -+ dec_param->top_field_order_cnt; -+ flags = dpb[dpb_idx].flags & V4L2_H264_DPB_ENTRY_FLAG_FIELD ? 0x2 : 0; -+ flags |= abs(dpb[dpb_idx].top_field_order_cnt - cur_poc) < -+ abs(dpb[dpb_idx].bottom_field_order_cnt - cur_poc) ? -+ 0x1 : 0; -+ -+ return dma_addr | flags; -+ - } - - u16 hantro_h264_get_ref_nbr(struct hantro_ctx *ctx, unsigned int dpb_idx) - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Wed, 14 Oct 2020 13:27:12 +0200 -Subject: [PATCH] media: hantro: adapt to match 5.11 H.264 uapi changes - -Signed-off-by: Alex Bee ---- - drivers/staging/media/hantro/hantro_h264.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c -index 7b56a68c176c..befa69d5c855 100644 ---- a/drivers/staging/media/hantro/hantro_h264.c -+++ b/drivers/staging/media/hantro/hantro_h264.c -@@ -241,10 +241,10 @@ static void prepare_table(struct hantro_ctx *ctx) - if ((dec_param->flags & V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC) || (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD)) { - for (i = 0; i < HANTRO_H264_DPB_SIZE * 2; ++i) { - // check for correct reference use -- enum v4l2_h264_field_reference parity = (i & 0x1) ? -+ u8 parity = (i & 0x1) ? - V4L2_H264_BOTTOM_FIELD_REF : V4L2_H264_TOP_FIELD_REF; - if (dpb[i / 2].flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE && -- dpb[i / 2].reference & parity) -+ dpb[i / 2].fields & parity) - dpb_valid |= BIT(HANTRO_H264_DPB_SIZE * 2 - 1 - i); - - if (dpb[i / 2].flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM) - -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Wed, 14 Oct 2020 13:42:01 +0200 -Subject: [PATCH] media: rkvdec: adapt to match 5.11 H.264 uapi changes - -Signed-off-by: Alex Bee ---- - drivers/staging/media/rkvdec/rkvdec-h264.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c -index 9c3f08c94800..7238117b6cf4 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-h264.c -+++ b/drivers/staging/media/rkvdec/rkvdec-h264.c -@@ -783,10 +783,10 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - } - - for (j = 0; j < RKVDEC_NUM_REFLIST; j++) { -- enum v4l2_h264_field_reference a_parity = -+ u8 a_parity = - (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) - ? V4L2_H264_BOTTOM_FIELD_REF : V4L2_H264_TOP_FIELD_REF; -- enum v4l2_h264_field_reference b_parity = -+ u8 b_parity = - (dec_params->flags & V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD) - ? V4L2_H264_TOP_FIELD_REF : V4L2_H264_BOTTOM_FIELD_REF; - u32 flags = V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM; -@@ -802,7 +802,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - u8 idx = reflists[j][a]; - if (idx >= ARRAY_SIZE(dec_params->dpb)) - continue; -- if ((dpb[idx].reference & a_parity) == a_parity && -+ if ((dpb[idx].fields & a_parity) == a_parity && - (dpb[idx].flags & flags) == long_term) { - set_ps_field(hw_rps, DPB_INFO(i, j), - idx | (1 << 4)); -@@ -817,7 +817,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - u8 idx = reflists[j][b]; - if (idx >= ARRAY_SIZE(dec_params->dpb)) - continue; -- if ((dpb[idx].reference & b_parity) == b_parity && -+ if ((dpb[idx].fields & b_parity) == b_parity && - (dpb[idx].flags & flags) == long_term) { - set_ps_field(hw_rps, DPB_INFO(i, j), - idx | (1 << 4)); - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Randy Li Date: Sun, 6 Jan 2019 01:48:37 +0800 @@ -489,16 +78,15 @@ Signed-off-by: Randy Li --- drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++ include/linux/rockchip_pmu.h | 15 +++++++++++++++ - include/soc/rockchip/pm_domains.h | 18 ++++++++++++++++++ - 3 files changed, 56 insertions(+) + include/soc/rockchip/pm_domains.h | 6 ++++++ + 3 files changed, 44 insertions(+) create mode 100644 include/linux/rockchip_pmu.h - create mode 100644 include/soc/rockchip/pm_domains.h diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c -index 0868b7d406fb..fddb4022c376 100644 +index 89795abac951..ffb5d62c9d52 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c -@@ -204,6 +204,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, +@@ -309,6 +309,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, return 0; } @@ -550,29 +138,29 @@ index 000000000000..720b3314e71a + +#endif /* _LINUX_ROCKCHIP_PM_H */ diff --git a/include/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h -new file mode 100644 -index 000000000000..690db6118636 ---- /dev/null +index 7dbd941fc937..c5a59dd71754 100644 +--- a/include/soc/rockchip/pm_domains.h +++ b/include/soc/rockchip/pm_domains.h -@@ -0,0 +1,18 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H -+#define __SOC_ROCKCHIP_PM_DOMAINS_H -+ -+#include -+ -+struct device; -+ -+#ifdef CONFIG_ROCKCHIP_PM_DOMAINS +@@ -10,6 +10,7 @@ + + int rockchip_pmu_block(void); + void rockchip_pmu_unblock(void); +int rockchip_pmu_idle_request(struct device *dev, bool idle); -+#else + + #else /* CONFIG_ROCKCHIP_PM_DOMAINS */ + +@@ -20,6 +21,11 @@ static inline int rockchip_pmu_block(void) + + static inline void rockchip_pmu_unblock(void) { } + +static inline int rockchip_pmu_idle_request(struct device *dev, bool idle) +{ + return -ENOTSUPP; +} -+#endif + -+#endif + #endif /* CONFIG_ROCKCHIP_PM_DOMAINS */ + + #endif /* __SOC_ROCKCHIP_PM_DOMAINS_H__ */ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee @@ -587,10 +175,10 @@ Subject: [PATCH] WIP: media: rkvdec: implement reset controls 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml -index 089f11d21b25..3f4772c8d095 100644 +index 3bcfb8e12333..dd6958df1de8 100644 --- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml +++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml -@@ -51,6 +51,18 @@ properties: +@@ -53,6 +53,18 @@ properties: iommus: maxItems: 1 @@ -609,7 +197,7 @@ index 089f11d21b25..3f4772c8d095 100644 required: - compatible - reg -@@ -58,6 +70,8 @@ required: +@@ -60,6 +72,8 @@ required: - clocks - clock-names - power-domains @@ -618,7 +206,7 @@ index 089f11d21b25..3f4772c8d095 100644 additionalProperties: false -@@ -76,6 +90,11 @@ examples: +@@ -78,6 +92,11 @@ examples: clock-names = "axi", "ahb", "cabac", "core"; power-domains = <&power RK3399_PD_VDU>; iommus = <&vdec_mmu>; @@ -647,7 +235,7 @@ index 15b9bee92016..3acc914888f6 100644 #define RKVDEC_REG_SYSCTRL 0x008 #define RKVDEC_IN_ENDIAN BIT(0) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 18f36e8546d9..8d2495bee04d 100644 +index 630ef09ab70b..b6d5b26a93c2 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -10,12 +10,15 @@ @@ -666,7 +254,7 @@ index 18f36e8546d9..8d2495bee04d 100644 #include #include #include -@@ -722,6 +725,11 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx, +@@ -717,6 +720,11 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx, pm_runtime_mark_last_busy(rkvdec->dev); pm_runtime_put_autosuspend(rkvdec->dev); @@ -678,7 +266,7 @@ index 18f36e8546d9..8d2495bee04d 100644 rkvdec_job_finish_no_pm(ctx, result); } -@@ -759,6 +767,33 @@ static void rkvdec_device_run(void *priv) +@@ -754,6 +762,33 @@ static void rkvdec_device_run(void *priv) if (WARN_ON(!desc)) return; @@ -712,7 +300,7 @@ index 18f36e8546d9..8d2495bee04d 100644 ret = pm_runtime_resume_and_get(rkvdec->dev); if (ret < 0) { -@@ -1026,6 +1061,11 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) +@@ -1021,6 +1056,11 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) if (cancel_delayed_work(&rkvdec->watchdog_work)) { struct rkvdec_ctx *ctx; @@ -724,7 +312,7 @@ index 18f36e8546d9..8d2495bee04d 100644 ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); rkvdec_job_finish(ctx, state); } -@@ -1043,6 +1083,7 @@ static void rkvdec_watchdog_func(struct work_struct *work) +@@ -1038,6 +1078,7 @@ static void rkvdec_watchdog_func(struct work_struct *work) ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); if (ctx) { dev_err(rkvdec->dev, "Frame processing timed out!\n"); @@ -732,7 +320,7 @@ index 18f36e8546d9..8d2495bee04d 100644 writel(RKVDEC_CONFIG_DEC_CLK_GATE_E | RKVDEC_IRQ_DIS, rkvdec->regs + RKVDEC_REG_INTERRUPT); writel(0, rkvdec->regs + RKVDEC_REG_SYSCTRL); -@@ -1118,6 +1159,18 @@ static int rkvdec_probe(struct platform_device *pdev) +@@ -1107,6 +1148,18 @@ static int rkvdec_probe(struct platform_device *pdev) return ret; } @@ -752,7 +340,7 @@ index 18f36e8546d9..8d2495bee04d 100644 pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_enable(&pdev->dev); diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h -index c26c472baa6f..f360f2ef799f 100644 +index b9e219438bc9..f02f79c405f0 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -11,10 +11,11 @@ @@ -781,7 +369,7 @@ index c26c472baa6f..f360f2ef799f 100644 struct rkvdec_ctx; struct rkvdec_ctrl_desc { -@@ -94,6 +101,8 @@ struct rkvdec_dev { +@@ -96,6 +103,8 @@ struct rkvdec_dev { void __iomem *regs; struct mutex vdev_lock; /* serializes ioctls */ struct delayed_work watchdog_work; @@ -801,10 +389,10 @@ Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3399 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index e21b93d57300..638224b6ff70 100644 +index b0620c45820c..e797271ef6b4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1053,7 +1053,10 @@ power-domain@RK3399_PD_VCODEC { +@@ -1062,7 +1062,10 @@ power-domain@RK3399_PD_VCODEC { power-domain@RK3399_PD_VDU { reg = ; clocks = <&cru ACLK_VDU>, @@ -816,7 +404,7 @@ index e21b93d57300..638224b6ff70 100644 pm_qos = <&qos_video_m1_r>, <&qos_video_m1_w>; #power-domain-cells = <0>; -@@ -1326,6 +1329,11 @@ vdec: video-codec@ff660000 { +@@ -1345,6 +1348,11 @@ vdec: video-codec@ff660000 { clock-names = "axi", "ahb", "cabac", "core"; iommus = <&vdec_mmu>; power-domains = <&power RK3399_PD_VDU>; @@ -840,10 +428,10 @@ Signed-off-by: Alex Bee 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index 638224b6ff70..533a031c7e24 100644 +index e797271ef6b4..748eb7368e6a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1322,7 +1322,7 @@ vpu_mmu: iommu@ff650800 { +@@ -1341,7 +1341,7 @@ vpu_mmu: iommu@ff650800 { vdec: video-codec@ff660000 { compatible = "rockchip,rk3399-vdec"; @@ -853,82 +441,6 @@ index 638224b6ff70..533a031c7e24 100644 clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>, <&cru SCLK_VDU_CA>, <&cru SCLK_VDU_CORE>; -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Wed, 19 Aug 2020 21:12:54 +0200 -Subject: [PATCH] arm64: dts: rockchip: add rkvdec node for RK3328 - -Signed-off-by: Alex Bee ---- - .../bindings/media/rockchip,vdec.yaml | 3 +++ - arch/arm64/boot/dts/rockchip/rk3328.dtsi | 25 ++++++++++++++++++- - 2 files changed, 27 insertions(+), 1 deletion(-) - -diff --git a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml -index 3f4772c8d095..21a78372dae6 100644 ---- a/Documentation/devicetree/bindings/media/rockchip,vdec.yaml -+++ b/Documentation/devicetree/bindings/media/rockchip,vdec.yaml -@@ -20,6 +20,9 @@ properties: - - items: - - const: rockchip,rk3228-vdec - - const: rockchip,rk3399-vdec -+ - items: -+ - const: rockchip,rk3328-vdec -+ - const: rockchip,rk3399-vdec - - reg: - maxItems: 1 -diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index 908cacb91c6a..d8a812a7d23b 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -306,6 +306,10 @@ power-domain@RK3328_PD_HEVC { - }; - power-domain@RK3328_PD_VIDEO { - reg = ; -+ clocks = <&cru ACLK_RKVDEC>, -+ <&cru HCLK_RKVDEC>, -+ <&cru SCLK_VDEC_CABAC>, -+ <&cru SCLK_VDEC_CORE>; - #power-domain-cells = <0>; - }; - power-domain@RK3328_PD_VPU { -@@ -660,6 +664,25 @@ vpu_mmu: iommu@ff350800 { - power-domains = <&power RK3328_PD_VPU>; - }; - -+ rkvdec: video-codec@ff360000 { -+ compatible = "rockchip,rk3328-vdec", "rockchip,rk3399-vdec"; -+ reg = <0x0 0xff360000 0x0 0x480>; -+ interrupts = ; -+ assigned-clocks = <&cru ACLK_RKVDEC>, <&cru SCLK_VDEC_CABAC>, -+ <&cru SCLK_VDEC_CORE>; -+ assigned-clock-rates = <400000000>, <400000000>, <300000000>; -+ clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>, -+ <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>; -+ clock-names = "axi", "ahb", "cabac", "core"; -+ iommus = <&rkvdec_mmu>; -+ power-domains = <&power RK3328_PD_VIDEO>; -+ resets = <&cru SRST_VDEC_H>, <&cru SRST_VDEC_A>, -+ <&cru SRST_VDEC_CORE>, <&cru SRST_VDEC_CABAC>, -+ <&cru SRST_VDEC_NIU_A>, <&cru SRST_VDEC_NIU_H>; -+ reset-names = "video_h", "video_a", "video_core", "video_cabac", -+ "niu_a", "niu_h"; -+ }; -+ - rkvdec_mmu: iommu@ff360480 { - compatible = "rockchip,iommu"; - reg = <0x0 0xff360480 0x0 0x40>, <0x0 0xff3604c0 0x0 0x40>; -@@ -667,7 +690,7 @@ rkvdec_mmu: iommu@ff360480 { - clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>; - clock-names = "aclk", "iface"; - #iommu-cells = <0>; -- status = "disabled"; -+ power-domains = <&power RK3328_PD_VIDEO>; - }; - - vop: vop@ff370000 { - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sat, 21 Aug 2021 16:12:36 +0200 @@ -942,7 +454,7 @@ Signed-off-by: Alex Bee 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c -index f372f767d4ff..f0014823a093 100644 +index fc96501f3bc8..f31550c21172 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -15,7 +15,8 @@ @@ -977,7 +489,7 @@ index f372f767d4ff..f0014823a093 100644 static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; -@@ -512,7 +520,7 @@ const struct hantro_variant rk3288_vpu_variant = { +@@ -507,7 +515,7 @@ const struct hantro_variant rk3288_vpu_variant = { .codec_ops = rk3288_vpu_codec_ops, .irqs = rockchip_vpu1_irqs, .num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs), @@ -989,56 +501,126 @@ index f372f767d4ff..f0014823a093 100644 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee -Date: Sun, 16 Jan 2022 18:38:23 +0100 -Subject: [PATCH] media: rkvdec: split vp9/h264 decoded_fmts +Date: Sun, 3 Apr 2022 13:45:57 +0200 +Subject: [PATCH] media: hantro: rockchip: Enable H.264 codec for RK3399 + +--- + drivers/staging/media/hantro/rockchip_vpu_hw.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c +index f31550c21172..304d7b359295 100644 +--- a/drivers/staging/media/hantro/rockchip_vpu_hw.c ++++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c +@@ -544,7 +544,7 @@ const struct hantro_variant rk3399_vpu_variant = { + .dec_fmts = rk3399_vpu_dec_fmts, + .num_dec_fmts = ARRAY_SIZE(rk3399_vpu_dec_fmts), + .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER | +- HANTRO_VP8_DECODER, ++ HANTRO_VP8_DECODER | HANTRO_H264_DECODER, + .codec_ops = rk3399_vpu_codec_ops, + .irqs = rockchip_vpu2_irqs, + .num_irqs = ARRAY_SIZE(rockchip_vpu2_irqs), + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 4 Jul 2021 15:19:44 +0200 +Subject: [PATCH] media: rkvdec: disable QoS for VP9 (corruptions on RK3328 + otherwise) Signed-off-by: Alex Bee --- - drivers/staging/media/rkvdec/rkvdec.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) + drivers/staging/media/rkvdec/rkvdec-regs.h | 2 ++ + drivers/staging/media/rkvdec/rkvdec-vp9.c | 8 ++++++++ + 2 files changed, 10 insertions(+) -diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 19b31bef0bb3..63385d92880e 100644 ---- a/drivers/staging/media/rkvdec/rkvdec.c -+++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -152,13 +152,17 @@ static const struct rkvdec_ctrls rkvdec_h264_ctrls = { - .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), - }; +diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h +index 3acc914888f6..265f5234f4eb 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-regs.h ++++ b/drivers/staging/media/rkvdec/rkvdec-regs.h +@@ -222,6 +222,8 @@ + #define RKVDEC_REG_H264_ERR_E 0x134 + #define RKVDEC_H264_ERR_EN_HIGHBITS(x) ((x) & 0x3fffffff) --static const u32 rkvdec_h264_vp9_decoded_fmts[] = { -+static const u32 rkvdec_h264_decoded_fmts[] = { - V4L2_PIX_FMT_NV12, - V4L2_PIX_FMT_NV15, - V4L2_PIX_FMT_NV16, - V4L2_PIX_FMT_NV20, - }; - -+static const u32 rkvdec_vp9_decoded_fmts[] = { -+ V4L2_PIX_FMT_NV12, -+}; ++#define RKVDEC_QOS_CTRL 0x18C + - static const struct rkvdec_ctrl_desc rkvdec_vp9_ctrl_descs[] = { - { - .cfg.id = V4L2_CID_STATELESS_VP9_FRAME, -@@ -192,8 +196,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { - }, - .ctrls = &rkvdec_h264_ctrls, - .ops = &rkvdec_h264_fmt_ops, -- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), -- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, -+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), -+ .decoded_fmts = rkvdec_h264_decoded_fmts, - }, - { - .fourcc = V4L2_PIX_FMT_VP9_FRAME, -@@ -207,8 +211,8 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { - }, - .ctrls = &rkvdec_vp9_ctrls, - .ops = &rkvdec_vp9_fmt_ops, -- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_vp9_decoded_fmts), -- .decoded_fmts = rkvdec_h264_vp9_decoded_fmts, -+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), -+ .decoded_fmts = rkvdec_vp9_decoded_fmts, - } - }; + #define RKVDEC_REG_PREF_LUMA_CACHE_COMMAND 0x410 + #define RKVDEC_REG_PREF_CHR_CACHE_COMMAND 0x450 +diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c +index 311a12656072..ea270262bbed 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-vp9.c ++++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c +@@ -802,6 +802,7 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) + struct rkvdec_dev *rkvdec = ctx->dev; + struct rkvdec_vp9_run run = { }; + int ret; ++ u32 reg; + + ret = rkvdec_vp9_run_preamble(ctx, &run); + if (ret) { +@@ -823,6 +824,13 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) + writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); + + writel(0xe, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); ++ ++ /* disable QOS for RK3328 - no effect on other SoCs */ ++ reg = readl(rkvdec->regs + RKVDEC_QOS_CTRL); ++ reg |= 0xFFFF; ++ reg &= (~BIT(12)); ++ writel(reg, rkvdec->regs + RKVDEC_QOS_CTRL); ++ + /* Start decoding! */ + writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E | + RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Thu, 16 Jun 2022 13:15:09 +0200 +Subject: [PATCH] arm64: dts: use correct PLL for vdec core + +vdec core should use codec pll for proper operation, by default +it uses general pll (GPLL) - as all other clocks would +--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 748eb7368e6a..658ec3b00445 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -1346,6 +1346,8 @@ vdec: video-codec@ff660000 { + clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>, + <&cru SCLK_VDU_CA>, <&cru SCLK_VDU_CORE>; + clock-names = "axi", "ahb", "cabac", "core"; ++ assigned-clocks = <&cru ACLK_VDU>; ++ assigned-clock-parents = <&cru PLL_CPLL>; + iommus = <&vdec_mmu>; + power-domains = <&power RK3399_PD_VDU>; + resets = <&cru SRST_H_VDU>, <&cru SRST_A_VDU>, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Thu, 16 Jun 2022 13:18:22 +0200 +Subject: [PATCH] WIP: arm64: dts: add resets to vdec for RK3328 + +--- + arch/arm64/boot/dts/rockchip/rk3328.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 5519347232f6..431c4ec198be 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -674,6 +674,11 @@ vdec: video-codec@ff360000 { + assigned-clocks = <&cru ACLK_RKVDEC>, <&cru SCLK_VDEC_CABAC>, + <&cru SCLK_VDEC_CORE>; + assigned-clock-rates = <400000000>, <400000000>, <300000000>; ++ resets = <&cru SRST_VDEC_H>, <&cru SRST_VDEC_A>, ++ <&cru SRST_VDEC_CORE>, <&cru SRST_VDEC_CABAC>, ++ <&cru SRST_VDEC_NIU_A>, <&cru SRST_VDEC_NIU_H>; ++ reset-names = "video_h", "video_a", "video_core", "video_cabac", ++ "niu_a", "niu_h"; + iommus = <&vdec_mmu>; + power-domains = <&power RK3328_PD_VIDEO>; + }; diff --git a/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch b/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch index 7b4796b7c5..3e70d40a68 100644 --- a/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch +++ b/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch @@ -1,55 +1,3 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Sun, 4 Jul 2021 15:19:44 +0200 -Subject: [PATCH] media: rkvdec: disable QoS for VP9 (corruptions on RK3328 - otherwise) - -Signed-off-by: Alex Bee ---- - drivers/staging/media/rkvdec/rkvdec-regs.h | 2 ++ - drivers/staging/media/rkvdec/rkvdec-vp9.c | 8 ++++++++ - 2 files changed, 10 insertions(+) - -diff --git a/drivers/staging/media/rkvdec/rkvdec-regs.h b/drivers/staging/media/rkvdec/rkvdec-regs.h -index 3acc914888f6..265f5234f4eb 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-regs.h -+++ b/drivers/staging/media/rkvdec/rkvdec-regs.h -@@ -222,6 +222,8 @@ - #define RKVDEC_REG_H264_ERR_E 0x134 - #define RKVDEC_H264_ERR_EN_HIGHBITS(x) ((x) & 0x3fffffff) - -+#define RKVDEC_QOS_CTRL 0x18C -+ - #define RKVDEC_REG_PREF_LUMA_CACHE_COMMAND 0x410 - #define RKVDEC_REG_PREF_CHR_CACHE_COMMAND 0x450 - -diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c -index 311a12656072..ea270262bbed 100644 ---- a/drivers/staging/media/rkvdec/rkvdec-vp9.c -+++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c -@@ -802,6 +802,7 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) - struct rkvdec_dev *rkvdec = ctx->dev; - struct rkvdec_vp9_run run = { }; - int ret; -+ u32 reg; - - ret = rkvdec_vp9_run_preamble(ctx, &run); - if (ret) { -@@ -823,6 +824,13 @@ static int rkvdec_vp9_run(struct rkvdec_ctx *ctx) - writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); - - writel(0xe, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); -+ -+ /* disable QOS for RK3328 - no effect on other SoCs */ -+ reg = readl(rkvdec->regs + RKVDEC_QOS_CTRL); -+ reg |= 0xFFFF; -+ reg &= (~BIT(12)); -+ writel(reg, rkvdec->regs + RKVDEC_QOS_CTRL); -+ - /* Start decoding! */ - writel(RKVDEC_INTERRUPT_DEC_E | RKVDEC_CONFIG_DEC_CLK_GATE_E | - RKVDEC_TIMEOUT_E | RKVDEC_BUF_EMPTY_E, - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Wed, 2 Sep 2020 19:52:02 +0200 @@ -67,7 +15,7 @@ Signed-off-by: Alex Bee 1 file changed, 35 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index d8a812a7d23b..e4c6a33b4b7e 100644 +index 431c4ec198be..e4977669b16a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi @@ -300,6 +300,11 @@ power: power-controller { @@ -202,10 +150,10 @@ index 9c1e38c54eae..ee332fc9cf1f 100644 simple-audio-card,codec { diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index 533a031c7e24..c4894053b3f6 100644 +index 658ec3b00445..925d320dea86 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1867,7 +1867,7 @@ hdmi_sound: hdmi-sound { +@@ -1892,7 +1892,7 @@ hdmi_sound: hdmi-sound { compatible = "simple-audio-card"; simple-audio-card,format = "i2s"; simple-audio-card,mclk-fs = <256>; @@ -226,10 +174,10 @@ Signed-off-by: Alex Bee 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c -index 4dcdec6487bb..6549651b9978 100644 +index eb0c2d041f13..9256eadb8a3e 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c -@@ -1051,7 +1051,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, +@@ -1053,7 +1053,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, ret = obj->funcs->mmap(obj, vma); if (ret) goto err_drm_gem_object_put; @@ -249,7 +197,7 @@ Subject: [PATCH] ASoC: hdmi-codec: fix channel allocation 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c -index b61f980cabdc..3ad50ae8c93d 100644 +index b773466619b2..e53950e85631 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -194,78 +194,69 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = { @@ -384,34 +332,6 @@ index b61f980cabdc..3ad50ae8c93d 100644 struct hdmi_codec_priv { -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Sun, 2 May 2021 20:44:21 +0200 -Subject: [PATCH] arm64: dts: rockchip: Fix gmac delays for rockpro64 board - -Values are measured by RK's delayline tool in vendor kernel - -Signed-off-by: Alex Bee ---- - arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -index 83db4ca67334..06d2a1e3e340 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi -@@ -289,8 +289,8 @@ &gmac { - snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; - snps,reset-active-low; - snps,reset-delays-us = <0 10000 50000>; -- tx_delay = <0x28>; -- rx_delay = <0x11>; -+ tx_delay = <0x23>; -+ rx_delay = <0x1e>; - status = "okay"; - }; - - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sat, 27 Feb 2021 17:52:02 +0100 @@ -423,7 +343,7 @@ Signed-off-by: Alex Bee 1 file changed, 23 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts -index de2d3e88e27f..68b74ed080f3 100644 +index 40bf808642b9..27a1799027c2 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts @@ -57,6 +57,24 @@ ir-receiver { @@ -451,7 +371,7 @@ index de2d3e88e27f..68b74ed080f3 100644 }; &analog_sound { -@@ -324,6 +342,11 @@ &sdmmc { +@@ -325,6 +343,11 @@ &sdmmc { status = "okay"; }; @@ -540,7 +460,7 @@ Subject: [PATCH] HACK: arm64: dts: enable FE phy for Beelink A1 also 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts -index 68b74ed080f3..6736b5dc53e4 100644 +index 27a1799027c2..7de9dfa71d89 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts @@ -147,6 +147,14 @@ rtl8211f: ethernet-phy@0 { @@ -633,10 +553,10 @@ Signed-off-by: Alex Bee 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index c4894053b3f6..b39a3390bd7d 100644 +index 925d320dea86..037732441f92 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1453,7 +1453,7 @@ cru: clock-controller@ff760000 { +@@ -1478,7 +1478,7 @@ cru: clock-controller@ff760000 { <1000000000>, <150000000>, <75000000>, <37500000>, @@ -657,10 +577,10 @@ Signed-off-by: Alex Bee 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts -index 6736b5dc53e4..9000fae2a5ee 100644 +index 7de9dfa71d89..e857e5a727f4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-a1.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-a1.dts -@@ -388,6 +388,11 @@ &usb_host0_ehci { +@@ -389,6 +389,11 @@ &usb_host0_ehci { status = "okay"; }; @@ -673,31 +593,6 @@ index 6736b5dc53e4..9000fae2a5ee 100644 status = "okay"; }; -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bee -Date: Sat, 21 Aug 2021 14:03:25 +0200 -Subject: [PATCH] HACK: media: hantro: rockchip: disable H264 for RK3328 - -Signed-off-by: Alex Bee ---- - drivers/staging/media/hantro/rockchip_vpu_hw.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c -index f0014823a093..db4b9fe26256 100644 ---- a/drivers/staging/media/hantro/rockchip_vpu_hw.c -+++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c -@@ -531,8 +531,7 @@ const struct hantro_variant rk3328_vpu_variant = { - .dec_offset = 0x400, - .dec_fmts = rk3399_vpu_dec_fmts, - .num_dec_fmts = ARRAY_SIZE(rk3399_vpu_dec_fmts), -- .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER | -- HANTRO_H264_DECODER, -+ .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER, - .codec_ops = rk3399_vpu_codec_ops, - .irqs = rockchip_vdpu2_irqs, - .num_irqs = ARRAY_SIZE(rockchip_vdpu2_irqs), - From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sat, 30 Oct 2021 12:19:19 +0200 @@ -714,7 +609,7 @@ Signed-off-by: Alex Bee 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c -index feb04f127b55..f7631f2e34c5 100644 +index f50b47ac11a8..d9b3c8c29e6f 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -34,9 +34,9 @@ static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset) @@ -730,7 +625,7 @@ index feb04f127b55..f7631f2e34c5 100644 { struct dw_hdmi_i2s_audio_data *audio = data; struct dw_hdmi *hdmi = audio->hdmi; -@@ -171,7 +171,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data, +@@ -178,7 +178,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data, } static const struct hdmi_codec_ops dw_hdmi_i2s_ops = { diff --git a/projects/Rockchip/patches/linux/default/linux-2000-v4l2-wip-rkvdec-hevc.patch b/projects/Rockchip/patches/linux/default/linux-2000-v4l2-wip-rkvdec-hevc.patch index 78efb47a18..1d31e882bd 100644 --- a/projects/Rockchip/patches/linux/default/linux-2000-v4l2-wip-rkvdec-hevc.patch +++ b/projects/Rockchip/patches/linux/default/linux-2000-v4l2-wip-rkvdec-hevc.patch @@ -11,7 +11,7 @@ Signed-off-by: Jonas Karlman 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h -index ef63bc205756..a808894e8c76 100644 +index 01ccda48d8c5..a536dab3f8a7 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -58,6 +58,8 @@ enum v4l2_mpeg_video_hevc_start_code { @@ -49,7 +49,7 @@ index ef63bc205756..a808894e8c76 100644 __u64 flags; }; -@@ -202,7 +207,10 @@ struct v4l2_ctrl_hevc_slice_params { +@@ -200,7 +205,10 @@ struct v4l2_ctrl_hevc_slice_params { __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; @@ -72,7 +72,7 @@ Subject: [PATCH] HACK: media: uapi: hevc: tiles and num_slices 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h -index a808894e8c76..f1b8756521b9 100644 +index a536dab3f8a7..c8618dc68fc7 100644 --- a/include/media/hevc-ctrls.h +++ b/include/media/hevc-ctrls.h @@ -83,7 +83,8 @@ struct v4l2_ctrl_hevc_sps { @@ -85,7 +85,7 @@ index a808894e8c76..f1b8756521b9 100644 __u64 flags; }; -@@ -210,7 +211,9 @@ struct v4l2_ctrl_hevc_slice_params { +@@ -208,7 +209,9 @@ struct v4l2_ctrl_hevc_slice_params { __u16 short_term_ref_pic_set_size; __u16 long_term_ref_pic_set_size; @@ -2338,13 +2338,13 @@ index 000000000000..c3cceba837c2 + memset(hw_ps, 0, sizeof(*hw_ps)); + + for (i = 0; i <= sl_params->num_ref_idx_l0_active_minus1; i++) { -+ WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR), + REF_PIC_LONG_TERM_L0(i)); + WRITE_RPS(sl_params->ref_idx_l0[i], REF_PIC_IDX_L0(i)); + } + + for (i = 0; i <= sl_params->num_ref_idx_l1_active_minus1; i++) { -+ WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR), + REF_PIC_LONG_TERM_L1(i)); + WRITE_RPS(sl_params->ref_idx_l1[i], REF_PIC_IDX_L1(i)); + } @@ -2665,10 +2665,10 @@ index 265f5234f4eb..4319ee3ccbbc 100644 #define RKVDEC_MODE_VP9 2 #define RKVDEC_RPS_MODE BIT(24) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 63385d92880e..7340972faead 100644 +index b6d5b26a93c2..7e8674e7d501 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -147,6 +147,58 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { +@@ -134,6 +134,58 @@ static const struct rkvdec_ctrl_desc rkvdec_h264_ctrl_descs[] = { }, }; @@ -2727,9 +2727,9 @@ index 63385d92880e..7340972faead 100644 static const struct rkvdec_ctrls rkvdec_h264_ctrls = { .ctrls = rkvdec_h264_ctrl_descs, .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), -@@ -199,6 +251,21 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { - .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), +@@ -187,6 +239,21 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, }, + { + .fourcc = V4L2_PIX_FMT_HEVC_SLICE, @@ -2750,10 +2750,10 @@ index 63385d92880e..7340972faead 100644 .fourcc = V4L2_PIX_FMT_VP9_FRAME, .frmsize = { diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h -index f360f2ef799f..53719e825c70 100644 +index f02f79c405f0..d6222a2588be 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h -@@ -131,6 +131,7 @@ void rkvdec_run_preamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run); +@@ -133,6 +133,7 @@ void rkvdec_run_preamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run); void rkvdec_run_postamble(struct rkvdec_ctx *ctx, struct rkvdec_run *run); extern const struct rkvdec_coded_fmt_ops rkvdec_h264_fmt_ops; @@ -2874,10 +2874,10 @@ index c3cceba837c2..5c341b5fa534 100644 V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS); run->slices_params = ctrl ? ctrl->p_cur.p : NULL; diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 7340972faead..722d9912b332 100644 +index 7e8674e7d501..0f877acfba27 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -163,6 +163,9 @@ static const struct rkvdec_ctrl_desc rkvdec_hevc_ctrl_descs[] = { +@@ -150,6 +150,9 @@ static const struct rkvdec_ctrl_desc rkvdec_hevc_ctrl_descs[] = { { .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX, }, @@ -2894,18 +2894,54 @@ Date: Sat, 1 Aug 2020 12:24:58 +0000 Subject: [PATCH] WIP: media: rkvdec: add HEVC format validation --- - drivers/staging/media/rkvdec/rkvdec-hevc.c | 11 +++++++++++ - drivers/staging/media/rkvdec/rkvdec.c | 23 +++++++++++++++++++++- - 2 files changed, 33 insertions(+), 1 deletion(-) + drivers/staging/media/rkvdec/rkvdec-hevc.c | 55 +++++++++++++++++++++- + drivers/staging/media/rkvdec/rkvdec.c | 3 +- + 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c -index 5c341b5fa534..8ea2ad9f4f3a 100644 +index 5c341b5fa534..ac06039140bc 100644 --- a/drivers/staging/media/rkvdec/rkvdec-hevc.c +++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c -@@ -2418,6 +2418,16 @@ static int rkvdec_hevc_adjust_fmt(struct rkvdec_ctx *ctx, +@@ -2208,13 +2208,13 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + memset(hw_ps, 0, sizeof(*hw_ps)); + + for (i = 0; i <= sl_params->num_ref_idx_l0_active_minus1; i++) { +- WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR), ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), + REF_PIC_LONG_TERM_L0(i)); + WRITE_RPS(sl_params->ref_idx_l0[i], REF_PIC_IDX_L0(i)); + } + + for (i = 0; i <= sl_params->num_ref_idx_l1_active_minus1; i++) { +- WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR), ++ WRITE_RPS(!!(dpb[sl_params->ref_idx_l1[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), + REF_PIC_LONG_TERM_L1(i)); + WRITE_RPS(sl_params->ref_idx_l1[i], REF_PIC_IDX_L1(i)); + } +@@ -2418,17 +2418,58 @@ static int rkvdec_hevc_adjust_fmt(struct rkvdec_ctx *ctx, return 0; } ++static int rkvdec_hevc_validate_sps(struct rkvdec_ctx *ctx, ++ const struct v4l2_ctrl_hevc_sps *sps) ++{ ++ if (sps->chroma_format_idc > 1) ++ /* Only 4:0:0 and 4:2:0 are supported */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) ++ /* Luma and chroma bit depth mismatch */ ++ return -EINVAL; ++ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) ++ /* Only 8-bit and 10-bit is supported */ ++ return -EINVAL; ++ ++ if (sps->pic_width_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.width || ++ sps->pic_height_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.height) ++ return -EINVAL; ++ ++ return 0; ++} ++ +static u32 rkvdec_hevc_valid_fmt(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) +{ + const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; @@ -2919,46 +2955,53 @@ index 5c341b5fa534..8ea2ad9f4f3a 100644 static int rkvdec_hevc_start(struct rkvdec_ctx *ctx) { struct rkvdec_dev *rkvdec = ctx->dev; -@@ -2521,6 +2531,7 @@ static int rkvdec_hevc_run(struct rkvdec_ctx *ctx) + struct rkvdec_hevc_priv_tbl *priv_tbl; + struct rkvdec_hevc_ctx *hevc_ctx; ++ struct v4l2_ctrl *ctrl; + int ret; ++ ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, ++ V4L2_CID_MPEG_VIDEO_HEVC_SPS); ++ if (!ctrl) ++ return -EINVAL; ++ ++ ret = rkvdec_hevc_validate_sps(ctx, ctrl->p_new.p_hevc_sps); ++ if (ret) ++ return ret; ++ + hevc_ctx = kzalloc(sizeof(*hevc_ctx), GFP_KERNEL); + if (!hevc_ctx) + return -ENOMEM; + ++ + priv_tbl = dma_alloc_coherent(rkvdec->dev, sizeof(*priv_tbl), + &hevc_ctx->priv_tbl.dma, GFP_KERNEL); + if (!priv_tbl) { +@@ -2519,9 +2560,19 @@ static int rkvdec_hevc_run(struct rkvdec_ctx *ctx) + return 0; + } + ++static int rkvdec_hevc_try_ctrl(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl) ++{ ++ if (ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_SPS) ++ return rkvdec_hevc_validate_sps(ctx, ctrl->p_new.p_hevc_sps); ++ ++ return 0; ++} ++ const struct rkvdec_coded_fmt_ops rkvdec_hevc_fmt_ops = { .adjust_fmt = rkvdec_hevc_adjust_fmt, -+ .valid_fmt = rkvdec_hevc_valid_fmt, .start = rkvdec_hevc_start, .stop = rkvdec_hevc_stop, .run = rkvdec_hevc_run, ++ .try_ctrl = rkvdec_hevc_try_ctrl, ++ .valid_fmt = rkvdec_hevc_valid_fmt, + }; diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 722d9912b332..62e728777cd4 100644 +index 0f877acfba27..9f6a619499ab 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -79,6 +79,26 @@ static int rkvdec_try_ctrl(struct v4l2_ctrl *ctrl) - if (width > ctx->coded_fmt.fmt.pix_mp.width || - height > ctx->coded_fmt.fmt.pix_mp.height) - return -EINVAL; -+ } else if (ctrl->id == V4L2_CID_MPEG_VIDEO_HEVC_SPS) { -+ const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; -+ -+ if (sps->chroma_format_idc > 1) -+ /* Only 4:0:0 and 4:2:0 are supported */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) -+ /* Luma and chroma bit depth mismatch */ -+ return -EINVAL; -+ if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2) -+ /* Only 8-bit and 10-bit is supported */ -+ return -EINVAL; -+ -+ if (ctx->valid_fmt && ctx->valid_fmt != rkvdec_valid_fmt(ctx, ctrl)) -+ /* Only current valid format */ -+ return -EINVAL; -+ -+ if (sps->pic_width_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.width || -+ sps->pic_height_in_luma_samples > ctx->coded_fmt.fmt.pix_mp.height) -+ return -EINVAL; - } - return 0; - } -@@ -87,7 +107,7 @@ static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) +@@ -74,7 +74,7 @@ static int rkvdec_s_ctrl(struct v4l2_ctrl *ctrl) { struct rkvdec_ctx *ctx = container_of(ctrl->handler, struct rkvdec_ctx, ctrl_hdl); @@ -2967,7 +3010,7 @@ index 722d9912b332..62e728777cd4 100644 ctx->valid_fmt = rkvdec_valid_fmt(ctx, ctrl); if (ctx->valid_fmt) { struct v4l2_pix_format_mplane *pix_mp; -@@ -156,6 +176,7 @@ static const struct rkvdec_ctrl_desc rkvdec_hevc_ctrl_descs[] = { +@@ -143,6 +143,7 @@ static const struct rkvdec_ctrl_desc rkvdec_hevc_ctrl_descs[] = { }, { .cfg.id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, @@ -2988,7 +3031,7 @@ Signed-off-by: Alex Bee 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c -index 8ea2ad9f4f3a..58ae8a1a4ff3 100644 +index ac06039140bc..99bfb937facc 100644 --- a/drivers/staging/media/rkvdec/rkvdec-hevc.c +++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c @@ -2165,9 +2165,9 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, @@ -3015,7 +3058,7 @@ Signed-off-by: Alex Bee 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c -index 58ae8a1a4ff3..55bf61a84165 100644 +index 99bfb937facc..b5bb4c083dbc 100644 --- a/drivers/staging/media/rkvdec/rkvdec-hevc.c +++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c @@ -2196,8 +2196,8 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, @@ -3053,11 +3096,11 @@ Subject: [PATCH] WIP: media: rkvdec: hevc: implement lowdelay Signed-off-by: Alex Bee --- - drivers/staging/media/rkvdec/rkvdec-hevc.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) + drivers/staging/media/rkvdec/rkvdec-hevc.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c -index 55bf61a84165..db33f9d357cf 100644 +index b5bb4c083dbc..8467084165df 100644 --- a/drivers/staging/media/rkvdec/rkvdec-hevc.c +++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c @@ -2187,6 +2187,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, @@ -3076,13 +3119,14 @@ index 55bf61a84165..db33f9d357cf 100644 hw_ps = &priv_tbl->rps[j]; memset(hw_ps, 0, sizeof(*hw_ps)); -@@ -2211,18 +2213,23 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, - WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), +@@ -2211,18 +2213,24 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx, + WRITE_RPS(!!(dpb[sl_params->ref_idx_l0[i]].flags & V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE), REF_PIC_LONG_TERM_L0(i)); WRITE_RPS(sl_params->ref_idx_l0[i], REF_PIC_IDX_L0(i)); + + if (dpb[sl_params->ref_idx_l0[i]].pic_order_cnt[0] > sl_params->slice_pic_order_cnt) + lowdelay = 0; ++ } for (i = 0; i <= sl_params->num_ref_idx_l1_active_minus1; i++) { @@ -3120,12 +3164,12 @@ the better soultion than duplicatiing code for every newly added IP. Signed-off-by: Alex Bee --- - drivers/staging/media/rkvdec/rkvdec.c | 104 ++++++++++++++++++-------- + drivers/staging/media/rkvdec/rkvdec.c | 105 ++++++++++++++++++-------- drivers/staging/media/rkvdec/rkvdec.h | 10 +++ - 2 files changed, 84 insertions(+), 30 deletions(-) + 2 files changed, 85 insertions(+), 30 deletions(-) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index 62e728777cd4..a5552ccc9460 100644 +index 9f6a619499ab..2d1a388e20fe 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c @@ -14,6 +14,7 @@ @@ -3136,53 +3180,53 @@ index 62e728777cd4..a5552ccc9460 100644 #include #include #include -@@ -260,21 +261,6 @@ static const struct rkvdec_ctrls rkvdec_vp9_ctrls = { +@@ -227,6 +228,22 @@ static const u32 rkvdec_vp9_decoded_fmts[] = { }; static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { -- { -- .fourcc = V4L2_PIX_FMT_H264_SLICE, -- .frmsize = { -- .min_width = 48, -- .max_width = 4096, -- .step_width = 16, -- .min_height = 48, -- .max_height = 2304, -- .step_height = 16, -- }, -- .ctrls = &rkvdec_h264_ctrls, -- .ops = &rkvdec_h264_fmt_ops, -- .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), -- .decoded_fmts = rkvdec_h264_decoded_fmts, -- }, - { - .fourcc = V4L2_PIX_FMT_HEVC_SLICE, - .frmsize = { -@@ -289,6 +275,23 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { - .ops = &rkvdec_hevc_fmt_ops, - .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), - .decoded_fmts = rkvdec_hevc_decoded_fmts, -+ .capability = RKVDEC_CAPABILITY_HEVC, -+ }, + { -+ .fourcc = V4L2_PIX_FMT_H264_SLICE, ++ .fourcc = V4L2_PIX_FMT_HEVC_SLICE, + .frmsize = { -+ .min_width = 48, ++ .min_width = 64, + .max_width = 4096, -+ .step_width = 16, -+ .min_height = 48, ++ .step_width = 64, ++ .min_height = 64, + .max_height = 2304, + .step_height = 16, + }, -+ .ctrls = &rkvdec_h264_ctrls, -+ .ops = &rkvdec_h264_fmt_ops, -+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), -+ .decoded_fmts = rkvdec_h264_decoded_fmts, ++ .ctrls = &rkvdec_hevc_ctrls, ++ .ops = &rkvdec_hevc_fmt_ops, ++ .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), ++ .decoded_fmts = rkvdec_hevc_decoded_fmts, ++ .capability = RKVDEC_CAPABILITY_HEVC, ++ }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .frmsize = { +@@ -242,21 +259,7 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { + .num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts), + .decoded_fmts = rkvdec_h264_decoded_fmts, + .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, +- }, +- { +- .fourcc = V4L2_PIX_FMT_HEVC_SLICE, +- .frmsize = { +- .min_width = 64, +- .max_width = 4096, +- .step_width = 64, +- .min_height = 64, +- .max_height = 2304, +- .step_height = 16, +- }, +- .ctrls = &rkvdec_hevc_ctrls, +- .ops = &rkvdec_hevc_fmt_ops, +- .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts), +- .decoded_fmts = rkvdec_hevc_decoded_fmts, + .capability = RKVDEC_CAPABILITY_H264, }, { .fourcc = V4L2_PIX_FMT_VP9_FRAME, -@@ -304,16 +307,31 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { +@@ -272,16 +275,31 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { .ops = &rkvdec_vp9_fmt_ops, .num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts), .decoded_fmts = rkvdec_vp9_decoded_fmts, @@ -3217,7 +3261,7 @@ index 62e728777cd4..a5552ccc9460 100644 return &rkvdec_coded_fmts[i]; } -@@ -336,7 +354,7 @@ static void rkvdec_reset_coded_fmt(struct rkvdec_ctx *ctx) +@@ -304,7 +322,7 @@ static void rkvdec_reset_coded_fmt(struct rkvdec_ctx *ctx) { struct v4l2_format *f = &ctx->coded_fmt; @@ -3226,7 +3270,7 @@ index 62e728777cd4..a5552ccc9460 100644 rkvdec_reset_fmt(ctx, f, ctx->coded_fmt_desc->fourcc); f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; -@@ -363,11 +381,13 @@ static int rkvdec_enum_framesizes(struct file *file, void *priv, +@@ -331,11 +349,13 @@ static int rkvdec_enum_framesizes(struct file *file, void *priv, struct v4l2_frmsizeenum *fsize) { const struct rkvdec_coded_fmt_desc *fmt; @@ -3241,7 +3285,7 @@ index 62e728777cd4..a5552ccc9460 100644 if (!fmt) return -EINVAL; -@@ -438,10 +458,11 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv, +@@ -406,10 +426,11 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv, struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); const struct rkvdec_coded_fmt_desc *desc; @@ -3256,7 +3300,7 @@ index 62e728777cd4..a5552ccc9460 100644 } v4l2_apply_frmsize_constraints(&pix_mp->width, -@@ -519,7 +540,8 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv, +@@ -487,7 +508,8 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv, if (ret) return ret; @@ -3266,7 +3310,7 @@ index 62e728777cd4..a5552ccc9460 100644 if (!desc) return -EINVAL; ctx->coded_fmt_desc = desc; -@@ -567,7 +589,10 @@ static int rkvdec_g_capture_fmt(struct file *file, void *priv, +@@ -538,7 +560,10 @@ static int rkvdec_g_capture_fmt(struct file *file, void *priv, static int rkvdec_enum_output_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { @@ -3278,7 +3322,7 @@ index 62e728777cd4..a5552ccc9460 100644 return -EINVAL; f->pixelformat = rkvdec_coded_fmts[f->index].fourcc; -@@ -975,14 +1000,17 @@ static int rkvdec_init_ctrls(struct rkvdec_ctx *ctx) +@@ -946,14 +971,17 @@ static int rkvdec_init_ctrls(struct rkvdec_ctx *ctx) int ret; for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) @@ -3300,7 +3344,7 @@ index 62e728777cd4..a5552ccc9460 100644 } ret = v4l2_ctrl_handler_setup(&ctx->ctrl_hdl); -@@ -1186,8 +1214,17 @@ static void rkvdec_watchdog_func(struct work_struct *work) +@@ -1157,8 +1185,17 @@ static void rkvdec_watchdog_func(struct work_struct *work) } } @@ -3319,7 +3363,7 @@ index 62e728777cd4..a5552ccc9460 100644 { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, of_rkvdec_match); -@@ -1199,6 +1236,7 @@ static const char * const rkvdec_clk_names[] = { +@@ -1170,6 +1207,7 @@ static const char * const rkvdec_clk_names[] = { static int rkvdec_probe(struct platform_device *pdev) { struct rkvdec_dev *rkvdec; @@ -3327,7 +3371,7 @@ index 62e728777cd4..a5552ccc9460 100644 unsigned int i; int ret, irq; -@@ -1224,6 +1262,12 @@ static int rkvdec_probe(struct platform_device *pdev) +@@ -1195,6 +1233,13 @@ static int rkvdec_probe(struct platform_device *pdev) if (ret) return ret; @@ -3336,12 +3380,13 @@ index 62e728777cd4..a5552ccc9460 100644 + return -EINVAL; + + rkvdec->capabilities = variant->capabilities; ++ + rkvdec->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(rkvdec->regs)) return PTR_ERR(rkvdec->regs); diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h -index 53719e825c70..d2096ec351e1 100644 +index d6222a2588be..ad8e83884121 100644 --- a/drivers/staging/media/rkvdec/rkvdec.h +++ b/drivers/staging/media/rkvdec/rkvdec.h @@ -29,6 +29,10 @@ @@ -3366,15 +3411,15 @@ index 53719e825c70..d2096ec351e1 100644 struct rkvdec_coded_fmt_ops { int (*adjust_fmt)(struct rkvdec_ctx *ctx, struct v4l2_format *f); -@@ -89,6 +97,7 @@ struct rkvdec_coded_fmt_desc { - const struct rkvdec_coded_fmt_ops *ops; +@@ -91,6 +99,7 @@ struct rkvdec_coded_fmt_desc { unsigned int num_decoded_fmts; const u32 *decoded_fmts; + u32 subsystem_flags; + unsigned int capability; }; struct rkvdec_dev { -@@ -103,6 +112,7 @@ struct rkvdec_dev { +@@ -105,6 +114,7 @@ struct rkvdec_dev { struct delayed_work watchdog_work; struct reset_control *rstc; u8 reset_mask; @@ -3397,10 +3442,10 @@ Signed-off-by: Alex Bee 1 file changed, 8 insertions(+) diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c -index a5552ccc9460..5fc6d30fd7c4 100644 +index 2d1a388e20fe..c2de6fcb6419 100644 --- a/drivers/staging/media/rkvdec/rkvdec.c +++ b/drivers/staging/media/rkvdec/rkvdec.c -@@ -1220,11 +1220,19 @@ static const struct rkvdec_variant rk3399_rkvdec_variant = { +@@ -1191,11 +1191,19 @@ static const struct rkvdec_variant rk3399_rkvdec_variant = { RKVDEC_CAPABILITY_VP9 }; @@ -3432,10 +3477,10 @@ Signed-off-by: Alex Bee 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index eb9d3bdf1d5e..2c1f0a7e0603 100644 +index 7b2cde230b87..59fba3ac6aae 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -1247,6 +1247,25 @@ vpu_mmu: iommu@ff9a0800 { +@@ -1248,6 +1248,25 @@ vpu_mmu: iommu@ff9a0800 { power-domains = <&power RK3288_PD_VIDEO>; }; @@ -3461,7 +3506,7 @@ index eb9d3bdf1d5e..2c1f0a7e0603 100644 hevc_mmu: iommu@ff9c0440 { compatible = "rockchip,iommu"; reg = <0x0 0xff9c0440 0x0 0x40>, <0x0 0xff9c0480 0x0 0x40>; -@@ -1254,7 +1273,7 @@ hevc_mmu: iommu@ff9c0440 { +@@ -1255,7 +1274,7 @@ hevc_mmu: iommu@ff9c0440 { clocks = <&cru ACLK_HEVC>, <&cru HCLK_HEVC>; clock-names = "aclk", "iface"; #iommu-cells = <0>; @@ -3470,3 +3515,27 @@ index eb9d3bdf1d5e..2c1f0a7e0603 100644 }; gpu: gpu@ffa30000 { + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sun, 3 Apr 2022 14:39:14 +0200 +Subject: [PATCH] WIP: media: rkvdec: hevc: Use chroma_format_idc from + v4l2_ctrl_hevc_sps + +--- + drivers/staging/media/rkvdec/rkvdec-hevc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/media/rkvdec/rkvdec-hevc.c b/drivers/staging/media/rkvdec/rkvdec-hevc.c +index 8467084165df..a7dc8262f6d7 100644 +--- a/drivers/staging/media/rkvdec/rkvdec-hevc.c ++++ b/drivers/staging/media/rkvdec/rkvdec-hevc.c +@@ -2048,7 +2048,7 @@ static void assemble_hw_pps(struct rkvdec_ctx *ctx, + /* write sps */ + WRITE_PPS(sps->video_parameter_set_id, VIDEO_PARAMETER_SET_ID); + WRITE_PPS(sps->seq_parameter_set_id, SEQ_PARAMETER_SET_ID); +- WRITE_PPS(1, CHROMA_FORMAT_IDC); ++ WRITE_PPS(sps->chroma_format_idc, CHROMA_FORMAT_IDC); + WRITE_PPS(sps->pic_width_in_luma_samples, PIC_WIDTH_IN_LUMA_SAMPLES); + WRITE_PPS(sps->pic_height_in_luma_samples, PIC_HEIGHT_IN_LUMA_SAMPLES); + WRITE_PPS(sps->bit_depth_luma_minus8 + 8, BIT_DEPTH_LUMA); diff --git a/projects/Rockchip/patches/linux/default/linux-2001-v4l2-wip-iep-driver.patch b/projects/Rockchip/patches/linux/default/linux-2001-v4l2-wip-iep-driver.patch index 1fbe8f3bdb..6ed5f6332d 100644 --- a/projects/Rockchip/patches/linux/default/linux-2001-v4l2-wip-iep-driver.patch +++ b/projects/Rockchip/patches/linux/default/linux-2001-v4l2-wip-iep-driver.patch @@ -96,23 +96,46 @@ Subject: [PATCH] media: rockchip: Add Rockchip IEP driver Signed-off-by: Alex Bee --- - drivers/media/platform/Makefile | 1 + + drivers/media/platform/rockchip/Kconfig | 1 + + drivers/media/platform/rockchip/Makefile | 1 + + drivers/media/platform/rockchip/iep/Kconfig | 16 + drivers/media/platform/rockchip/iep/Makefile | 5 + .../media/platform/rockchip/iep/iep-regs.h | 291 +++++ - .../media/platform/rockchip/iep/Kconfig | 16 + drivers/media/platform/rockchip/iep/iep.c | 1089 +++++++++++++++++ drivers/media/platform/rockchip/iep/iep.h | 112 ++ - 6 files changed, 1512 insertions(+) + 7 files changed, 1515 insertions(+) + create mode 100644 drivers/media/platform/rockchip/iep/Kconfig create mode 100644 drivers/media/platform/rockchip/iep/Makefile create mode 100644 drivers/media/platform/rockchip/iep/iep-regs.h create mode 100644 drivers/media/platform/rockchip/iep/iep.c create mode 100644 drivers/media/platform/rockchip/iep/iep.h -diff --git /dev/null b/drivers/media/platform/rockchip/iep/Kconfig -index cf4adc64c953..79b850a71449 100644 +diff --git a/drivers/media/platform/rockchip/Kconfig b/drivers/media/platform/rockchip/Kconfig +index b41d3960c1b4..9ff362805ded 100644 +--- a/drivers/media/platform/rockchip/Kconfig ++++ b/drivers/media/platform/rockchip/Kconfig +@@ -2,5 +2,6 @@ + + comment "Rockchip media platform drivers" + ++source "drivers/media/platform/rockchip/iep/Kconfig" + source "drivers/media/platform/rockchip/rga/Kconfig" + source "drivers/media/platform/rockchip/rkisp1/Kconfig" +diff --git a/drivers/media/platform/rockchip/Makefile b/drivers/media/platform/rockchip/Makefile +index 4f782b876ac9..c075ecc2fa14 100644 +--- a/drivers/media/platform/rockchip/Makefile ++++ b/drivers/media/platform/rockchip/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only ++obj-y += iep/ + obj-y += rga/ + obj-y += rkisp1/ +diff --git a/drivers/media/platform/rockchip/iep/Kconfig b/drivers/media/platform/rockchip/iep/Kconfig +new file mode 100644 +index 000000000000..d95155a95133 --- /dev/null +++ b/drivers/media/platform/rockchip/iep/Kconfig -@@ -0,0 +1,16 @@ config VIDEO_RENESAS_VSP1 +@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_ROCKCHIP_IEP @@ -129,25 +152,6 @@ index cf4adc64c953..79b850a71449 100644 + images. The driver currently implements YUV deinterlacing only. + To compile this driver as a module, choose M here: the module + will be called rockchip-iep -diff --git a/drivers/media/platform/rockchip/Kconfig b/drivers/media/platform/rockchip/Kconfig ---- a/drivers/media/platform/rockchip/Kconfig 2022-04-24 04:43:48.781195873 +0000 -+++ b/drivers/media/platform/rockchip/Kconfig 2022-04-24 04:39:04.394777975 +0000 -@@ -2,5 +2,6 @@ - - comment "Rockchip media platform drivers" - -+source "drivers/media/platform/rockchip/iep/Kconfig" - source "drivers/media/platform/rockchip/rga/Kconfig" - source "drivers/media/platform/rockchip/rkisp1/Kconfig" -diff --git a/drivers/media/platform/rockchip/Makefile b/drivers/media/platform/rockchip/Makefile -index a148553babfc..08fcccdbbb49 100644 ---- a/drivers/media/platform/rockchip/Makefile -+++ b/drivers/media/platform/rockchip/Makefile -@@ -1,3 +1,4 @@ - # SPDX-License-Identifier: GPL-2.0-only -+obj-y += iep/ - obj-y += rga/ - obj-y += rkisp1/ diff --git a/drivers/media/platform/rockchip/iep/Makefile b/drivers/media/platform/rockchip/iep/Makefile new file mode 100644 index 000000000000..5c89b3277469 @@ -1683,7 +1687,7 @@ Signed-off-by: Alex Bee 1 file changed, 22 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index e4c6a33b4b7e..54a3d0022363 100644 +index e4977669b16a..6c0cbc9cea61 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi @@ -760,6 +760,28 @@ vop_mmu: iommu@ff373f00 { @@ -1727,10 +1731,10 @@ Signed-off-by: Alex Bee 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index b39a3390bd7d..f9769857d147 100644 +index 037732441f92..d90c90406a49 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -1346,14 +1346,25 @@ vdec_mmu: iommu@ff660480 { +@@ -1367,14 +1367,25 @@ vdec_mmu: iommu@ff660480 { #iommu-cells = <0>; }; @@ -1769,11 +1773,11 @@ Signed-off-by: Alex Bee 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi -index 2c1f0a7e0603..afcc4d9ec746 100644 +index 59fba3ac6aae..06545f423de2 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -983,14 +983,25 @@ crypto: cypto-controller@ff8a0000 { - status = "okay"; +@@ -984,14 +984,25 @@ crypto: crypto@ff8a0000 { + reset-names = "crypto-rst"; }; + iep: iep@ff90000 {