From b021dd5871ef570c9bc894eb59440d24a55b4543 Mon Sep 17 00:00:00 2001 From: Binyuan Lan Date: Sat, 19 Oct 2024 09:34:58 +0800 Subject: [PATCH 1/5] ASoC: rk817: fix no sound when capture by tinycap or arecord Because I2STX_CKE has been set to disable in rk817_codec_shutdown, then I2STX_CKE_EN should be set when recording. Change-Id: If1201ad12e33dca21eb443bd32750a73c1fa9f67 Signed-off-by: Binyuan Lan --- sound/soc/codecs/rk817_codec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c index a60960a2c91c..fc5f1665fd06 100644 --- a/sound/soc/codecs/rk817_codec.c +++ b/sound/soc/codecs/rk817_codec.c @@ -1239,12 +1239,15 @@ static int rk817_digital_mute_adc(struct snd_soc_dai *dai, int mute, int stream) { struct snd_soc_component *component = dai->component; - if (mute) + if (mute) { snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, I2STX_EN_MASK, I2STX_DIS); - else + } else { snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, I2STX_EN_MASK, I2STX_EN); + snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, + I2STX_CKE_EN, I2STX_CKE_EN); + } return 0; } From c65d2fce11f7b36f075ba63a92b3c3fc4591f281 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Tue, 22 Oct 2024 11:49:53 +0800 Subject: [PATCH 2/5] drm/rockchip: vop2: add reset vp->win_mask vp->mask must initialize correctly, otherwise after suspend and resume, the software state[vp->mask] maybe different with hardware state and lead to close win error or timeout. Signed-off-by: Sandy Huang Change-Id: Icc605878b6ac74b24dde44f7933bc761ccdcd526 --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 9c2f8697cb2b..2031c8c5e70b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -4154,6 +4154,10 @@ static void vop3_layer_map_initial(struct vop2 *vop2, uint32_t current_vp_id) { uint16_t vp_id; struct drm_plane *plane = NULL; + int i = 0; + + for (i = 0; i < vop2->data->nr_vps; i++) + vop2->vps[i].win_mask = 0; drm_for_each_plane(plane, vop2->drm_dev) { struct vop2_win *win = to_vop2_win(plane); From 22ff58327e6e7186430663237cc2ce63bd8b98aa Mon Sep 17 00:00:00 2001 From: Cai YiWei Date: Tue, 22 Oct 2024 09:09:24 +0800 Subject: [PATCH 3/5] media: rockchip: isp: fix isp39 no output Change-Id: Ifd64690705d21cd70f3bd1dd0a81bc18ee2eb796 Signed-off-by: Cai YiWei --- drivers/media/platform/rockchip/isp/hw.c | 3 +++ drivers/media/platform/rockchip/isp/regs_v3x.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/drivers/media/platform/rockchip/isp/hw.c b/drivers/media/platform/rockchip/isp/hw.c index 37f946a64de4..afc9dbdfce41 100644 --- a/drivers/media/platform/rockchip/isp/hw.c +++ b/drivers/media/platform/rockchip/isp/hw.c @@ -1068,6 +1068,9 @@ static void isp_config_clk(struct rkisp_hw_dev *dev, int on) if ((dev->isp_ver == ISP_V20 || dev->isp_ver == ISP_V30) && on) val |= CLK_CTRL_ISP_3A | CLK_CTRL_ISP_RAW; + /* fix mi and scale on-off no output for isp39 */ + if (dev->isp_ver == ISP_V39 && on) + val |= ISP3X_CLK_RSZM | ISP3X_CLK_RSZS; if (dev->isp_ver == ISP_V32) rv1106_sdmmc_get_lock(); writel(val, dev->base_addr + CTRL_VI_ISP_CLK_CTRL); diff --git a/drivers/media/platform/rockchip/isp/regs_v3x.h b/drivers/media/platform/rockchip/isp/regs_v3x.h index 3ad0ae284b7c..ebd4a2202fac 100644 --- a/drivers/media/platform/rockchip/isp/regs_v3x.h +++ b/drivers/media/platform/rockchip/isp/regs_v3x.h @@ -2390,6 +2390,10 @@ /* VI_ICCL */ #define ISP32_BRSZ_CLK_ENABLE BIT(13) +/* VI_ISP_CLK_CTRL */ +#define ISP3X_CLK_RSZM BIT(26) +#define ISP3X_CLK_RSZS BIT(29) + /* SWS_CFG */ #define ISP32L_ISP2ENC_CNT_MUX BIT(0) #define ISP3X_SW_ACK_FRM_PRO_DIS BIT(3) From 46b9b70ded96429fd63a91d256bb3766060ceed7 Mon Sep 17 00:00:00 2001 From: Mingwei Yan Date: Tue, 22 Oct 2024 17:39:59 +0800 Subject: [PATCH 4/5] media: rockchip: vpss: online support tile write Signed-off-by: Mingwei Yan Change-Id: Iab4ca3d82315222543c5f98b5adb8847ed872b3b --- drivers/media/platform/rockchip/vpss/stream.c | 182 +++++++++++++++++- 1 file changed, 173 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/rockchip/vpss/stream.c b/drivers/media/platform/rockchip/vpss/stream.c index 2ebdbf3c7d09..1e6552889b96 100644 --- a/drivers/media/platform/rockchip/vpss/stream.c +++ b/drivers/media/platform/rockchip/vpss/stream.c @@ -25,7 +25,7 @@ static int rkvpss_stream_crop(struct rkvpss_stream *stream, bool on, bool sync); static int rkvpss_stream_scale(struct rkvpss_stream *stream, bool on, bool sync); static void rkvpss_stream_mf(struct rkvpss_stream *stream); -static const struct capture_fmt scl_fmts[] = { +static const struct capture_fmt scl0_fmts[] = { { .fourcc = V4L2_PIX_FMT_NV16, .fmt_type = FMT_YUV, @@ -89,6 +89,24 @@ static const struct capture_fmt scl_fmts[] = { .swap = 0, .wr_fmt = RKVPSS_MI_CHN_WR_422P, .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + }, { + .fourcc = V4L2_PIX_FMT_TILE420, + .fmt_type = FMT_YUV, + .bpp = { 24 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = 0, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV420, + }, { + .fourcc = V4L2_PIX_FMT_TILE422, + .fmt_type = FMT_YUV, + .bpp = { 32 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = 0, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, } }; @@ -210,12 +228,98 @@ static const struct capture_fmt scl1_fmts[] = { .swap = 0, .wr_fmt = RKVPSS_MI_CHN_WR_422P, .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + }, { + .fourcc = V4L2_PIX_FMT_TILE420, + .fmt_type = FMT_YUV, + .bpp = { 24 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = 0, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV420, + }, { + .fourcc = V4L2_PIX_FMT_TILE422, + .fmt_type = FMT_YUV, + .bpp = { 32 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = 0, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, } }; +static const struct capture_fmt scl2_3_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV16, + .fmt_type = FMT_YUV, + .bpp = { 8, 16 }, + .cplanes = 2, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_42XSP, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + }, { + .fourcc = V4L2_PIX_FMT_NV12, + .fmt_type = FMT_YUV, + .bpp = { 8, 16 }, + .cplanes = 2, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_42XSP, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV420, + }, { + .fourcc = V4L2_PIX_FMT_GREY, + .fmt_type = FMT_YUV, + .bpp = { 8 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_42XSP, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV400, + }, { + .fourcc = V4L2_PIX_FMT_UYVY, + .fmt_type = FMT_YUV, + .bpp = { 16 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_422P, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + }, { + .fourcc = V4L2_PIX_FMT_NV61, + .fmt_type = FMT_YUV, + .bpp = { 8, 16 }, + .cplanes = 2, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_42XSP, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + }, { + .fourcc = V4L2_PIX_FMT_NV21, + .fmt_type = FMT_YUV, + .bpp = { 8, 16 }, + .cplanes = 2, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_42XSP, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV420, + }, { + .fourcc = V4L2_PIX_FMT_VYUY, + .fmt_type = FMT_YUV, + .bpp = { 16 }, + .cplanes = 1, + .mplanes = 1, + .swap = 0, + .wr_fmt = RKVPSS_MI_CHN_WR_422P, + .output_fmt = RKVPSS_MI_CHN_WR_OUTPUT_YUV422, + } +}; + + static struct stream_config scl0_config = { - .fmts = scl_fmts, - .fmt_size = ARRAY_SIZE(scl_fmts), + .fmts = scl0_fmts, + .fmt_size = ARRAY_SIZE(scl0_fmts), .frame_end_id = RKVPSS_MI_CHN0_FRM_END, .crop = { .ctrl = RKVPSS_CROP1_CTRL, @@ -319,8 +423,8 @@ static struct stream_config scl1_config = { }; static struct stream_config scl2_config = { - .fmts = scl_fmts, - .fmt_size = ARRAY_SIZE(scl_fmts), + .fmts = scl2_3_fmts, + .fmt_size = ARRAY_SIZE(scl2_3_fmts), .frame_end_id = RKVPSS_MI_CHN2_FRM_END, .crop = { .ctrl = RKVPSS_CROP1_CTRL, @@ -389,8 +493,8 @@ static struct stream_config scl2_config = { }; static struct stream_config scl3_config = { - .fmts = scl_fmts, - .fmt_size = ARRAY_SIZE(scl_fmts), + .fmts = scl2_3_fmts, + .fmt_size = ARRAY_SIZE(scl2_3_fmts), .frame_end_id = RKVPSS_MI_CHN3_FRM_END, .crop = { .ctrl = RKVPSS_CROP1_CTRL, @@ -689,6 +793,15 @@ static void scl_config_mi(struct rkvpss_stream *stream) mask = RKVPSS_MI_WR_UV_SWAP; val = RKVPSS_MI_WR_UV_SWAP; rkvpss_hw_set_bits(dev->hw_dev, RKVPSS_MI_WR_CTRL, mask, val); + break; + case V4L2_PIX_FMT_TILE420: + case V4L2_PIX_FMT_TILE422: + mask = RKVPSS_MI_WR_TILE_SEL(3); + val = RKVPSS_MI_WR_TILE_SEL(stream->id + 1); + rkvpss_hw_set_bits(dev->hw_dev, RKVPSS_MI_WR_CTRL, mask, val); + break; + default: + break; } stream->is_mf_upd = true; @@ -1775,6 +1888,28 @@ static int rkvpss_set_fmt(struct rkvpss_stream *stream, return -EINVAL; } + /* Tile4x4 writing of Channel0 and Channel1 only supports either one.*/ + if (fmt->fourcc == V4L2_PIX_FMT_TILE420 || fmt->fourcc == V4L2_PIX_FMT_TILE422) { + if (stream->id == 0) { + if (dev->stream_vdev.stream[1].streaming && + (dev->stream_vdev.stream[1].out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE420 || + dev->stream_vdev.stream[1].out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE422)) { + v4l2_err(&dev->v4l2_dev, + "Tile4x4 writing of Ch0 and Cl1 only supports either one\n"); + return -EINVAL; + } + } + if (stream->id == 1) { + if (dev->stream_vdev.stream[0].streaming && + (dev->stream_vdev.stream[0].out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE420 || + dev->stream_vdev.stream[0].out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE422)) { + v4l2_err(&dev->v4l2_dev, + "Tile4x4 writing of Ch0 and Cl1 only supports either one\n"); + return -EINVAL; + } + } + } + pixm->num_planes = fmt->mplanes; pixm->field = V4L2_FIELD_NONE; if (!pixm->quantization) @@ -1790,10 +1925,20 @@ static int rkvpss_set_fmt(struct rkvpss_stream *stream, h = pixm->height; width = i ? w / xsubs : w; height = i ? h / ysubs : h; - bytesperline = width * DIV_ROUND_UP(fmt->bpp[i], 8); + + if (fmt->fourcc == V4L2_PIX_FMT_TILE420 || fmt->fourcc == V4L2_PIX_FMT_TILE422) + bytesperline = ALIGN(((width / 4) * fmt->bpp[i]), 16); + else + bytesperline = width * DIV_ROUND_UP(fmt->bpp[i], 8); + if (i != 0 || plane_fmt->bytesperline < bytesperline) plane_fmt->bytesperline = bytesperline; - plane_fmt->sizeimage = plane_fmt->bytesperline * height; + + if (fmt->fourcc == V4L2_PIX_FMT_TILE420 || fmt->fourcc == V4L2_PIX_FMT_TILE422) + plane_fmt->sizeimage = plane_fmt->bytesperline * (height / 4); + else + plane_fmt->sizeimage = plane_fmt->bytesperline * height; + imagsize += plane_fmt->sizeimage; } if (fmt->mplanes == 1) @@ -1886,6 +2031,21 @@ static int rkvpss_enum_fmt_vid_mplane(struct file *file, void *priv, fmt = &stream->config->fmts[f->index]; f->pixelformat = fmt->fourcc; + switch (f->pixelformat) { + case V4L2_PIX_FMT_TILE420: + strscpy(f->description, + "Rockchip yuv420 tile", + sizeof(f->description)); + break; + case V4L2_PIX_FMT_TILE422: + strscpy(f->description, + "Rockchip yuv422 tile", + sizeof(f->description)); + break; + default: + break; + } + return 0; } @@ -1998,6 +2158,10 @@ static void rkvpss_stream_mf(struct rkvpss_stream *stream) rkvpss_unite_set_bits(dev, RKVPSS_VPSS_CTRL, mask, val); } mask = RKVPSS_MI_CHN_V_FLIP(stream->id); + /* Tile4x4 writing can't flip*/ + if (stream->out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE420 || + stream->out_cap_fmt.fourcc == V4L2_PIX_FMT_TILE422) + stream->flip_en = false; val = stream->flip_en ? mask : 0; rkvpss_unite_set_bits(dev, RKVPSS_MI_WR_VFLIP_CTRL, mask, val); } From e3772da5fa567cc139cb8215f83887383aac58ad Mon Sep 17 00:00:00 2001 From: Yao Xiao Date: Fri, 23 Dec 2022 09:10:44 +0800 Subject: [PATCH 5/5] ARM: dts: rockchip: rk3126c-evb-ddr3-v10-linux: fixed ldo5 regulator err Change-Id: I8aa5bf17c80fe5ba78c8ef1767c0f947ea9b6080 Signed-off-by: Yao Xiao --- arch/arm/boot/dts/rk3126c-evb-ddr3-v10-linux.dts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/rk3126c-evb-ddr3-v10-linux.dts b/arch/arm/boot/dts/rk3126c-evb-ddr3-v10-linux.dts index 3b1970d17eec..14436291bd51 100644 --- a/arch/arm/boot/dts/rk3126c-evb-ddr3-v10-linux.dts +++ b/arch/arm/boot/dts/rk3126c-evb-ddr3-v10-linux.dts @@ -128,6 +128,13 @@ #clock-cells = <0>; }; + /* This node is useless for RK3126C EVB without bluetooth. + * It's just for compatibility with SDK script checks. + */ + wireless-bluetooth { + status = "disabled"; + }; + wireless-wlan { compatible = "wlan-platdata"; power_ctrl_by_pmu; @@ -719,7 +726,6 @@ regulator-name= "ldo5"; regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3000000>; - regulator-boot-on; regulator-state-mem { regulator-off-in-suspend; };