Commit fae6f815 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Chun-Kuang Hu

drm/mediatek: dsi: Fix DSI RGB666 formats and definitions

The register bits definitions for RGB666 formats are wrong in multiple
ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666
format is selected with bit 1, while the Loosely Packed one is bit 2,
and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong
because the loosely packed format is 24 bits instead!

Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control()
do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets
loosely packed (24) on RGB666, the other sets packed (18), and the other
way around for RGB666_PACKED.

Fixing this entire stack of issues is done in one go:
 - Use the correct bit for the Loosely Packed RGB666 definition
 - Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666
 - Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set:
    - Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666
    - Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED

Fixes: 2e54c14e ("drm/mediatek: Add DSI sub driver")
Reviewed-by: default avatarAlexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: default avatarCK Hu <ck.hu@mediatek.com>
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-3-angelogioacchino.delregno@collabora.com/Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent 3b09cc77
...@@ -71,8 +71,8 @@ ...@@ -71,8 +71,8 @@
#define DSI_PS_WC GENMASK(13, 0) #define DSI_PS_WC GENMASK(13, 0)
#define DSI_PS_SEL GENMASK(17, 16) #define DSI_PS_SEL GENMASK(17, 16)
#define PACKED_PS_16BIT_RGB565 (0 << 16) #define PACKED_PS_16BIT_RGB565 (0 << 16)
#define LOOSELY_PS_18BIT_RGB666 (1 << 16) #define PACKED_PS_18BIT_RGB666 (1 << 16)
#define PACKED_PS_18BIT_RGB666 (2 << 16) #define LOOSELY_PS_24BIT_RGB666 (2 << 16)
#define PACKED_PS_24BIT_RGB888 (3 << 16) #define PACKED_PS_24BIT_RGB888 (3 << 16)
#define DSI_VSA_NL 0x20 #define DSI_VSA_NL 0x20
...@@ -370,10 +370,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) ...@@ -370,10 +370,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi)
ps_bpp_mode |= PACKED_PS_24BIT_RGB888; ps_bpp_mode |= PACKED_PS_24BIT_RGB888;
break; break;
case MIPI_DSI_FMT_RGB666: case MIPI_DSI_FMT_RGB666:
ps_bpp_mode |= PACKED_PS_18BIT_RGB666; ps_bpp_mode |= LOOSELY_PS_24BIT_RGB666;
break; break;
case MIPI_DSI_FMT_RGB666_PACKED: case MIPI_DSI_FMT_RGB666_PACKED:
ps_bpp_mode |= LOOSELY_PS_18BIT_RGB666; ps_bpp_mode |= PACKED_PS_18BIT_RGB666;
break; break;
case MIPI_DSI_FMT_RGB565: case MIPI_DSI_FMT_RGB565:
ps_bpp_mode |= PACKED_PS_16BIT_RGB565; ps_bpp_mode |= PACKED_PS_16BIT_RGB565;
...@@ -427,7 +427,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) ...@@ -427,7 +427,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi)
dsi_tmp_buf_bpp = 3; dsi_tmp_buf_bpp = 3;
break; break;
case MIPI_DSI_FMT_RGB666: case MIPI_DSI_FMT_RGB666:
tmp_reg = LOOSELY_PS_18BIT_RGB666; tmp_reg = LOOSELY_PS_24BIT_RGB666;
dsi_tmp_buf_bpp = 3; dsi_tmp_buf_bpp = 3;
break; break;
case MIPI_DSI_FMT_RGB666_PACKED: case MIPI_DSI_FMT_RGB666_PACKED:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment