From 613e5c0710d3e4dd4c906221bcbe0b96ea1052b2 Mon Sep 17 00:00:00 2001 From: Guochun Huang Date: Wed, 16 Aug 2023 01:37:54 +0000 Subject: [PATCH] drm/rockchip: dsi2: havle dsc pps pic_width in dual channel dsi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit two dsc encoder slices which is equal to pic_width / slice_width will also halve whith pic_width <-HxV-> <------------- H/2 x V --------------> <-H x V-> ┌───────┐ ┌───────┐ ┌───────────┐ │ DSC0 ├───►│dsi0 tx├──►│lcd dsi0 rx│\ ┌───────┐ ┌─────┐ /└───────┘ └───────┘ └───────────┘ \│ │ │ │/ /│lcd DSC│ │ VP │\ ┌───────┐ ┌───────┐ ┌───────────┐/ │ │ └─────┘ \│ DSC1 ├───►│dsi1 tx├──►│lcd dsi1 rx│ └───────┘ └───────┘ └───────┘ └───────────┘ Change-Id: I65e65f969f9b1e81bee1a7343b386f577255a2f5 Signed-off-by: Guochun Huang --- drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c index b7a24e102d75..46ace54ebab8 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c @@ -1214,6 +1214,9 @@ static int dw_mipi_dsi2_get_dsc_params_from_sink(struct dw_mipi_dsi2 *dsi2, dsi2->slave->dsc_enable = dsi2->dsc_enable; } + if (!dsi2->dsc_enable) + return 0; + of_property_read_u32(np, "slice-width", &dsi2->slice_width); of_property_read_u32(np, "slice-height", &dsi2->slice_height); of_property_read_u8(np, "version-major", &dsi2->version_major); @@ -1249,8 +1252,21 @@ static int dw_mipi_dsi2_get_dsc_params_from_sink(struct dw_mipi_dsi2 *dsi2, len -= header->payload_length; } + if (!pps) { + dev_err(dsi2->dev, "not found dsc pps definition\n"); + return -EINVAL; + } + dsi2->pps = pps; + if (dsi2->slave) { + u16 pic_width = be16_to_cpu(pps->pic_width) / 2; + + dsi2->pps->pic_width = cpu_to_be16(pic_width); + dev_info(dsi2->dev, "dsc pic_width change from %d to %d\n", + pic_width * 2, pic_width); + } + return 0; }