Skip to content

Commit 6e1931e

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_dpi: Support AFIFO 1T1P output and conversion
On some SoCs, like MT8195 and MT8188, the DPI's FIFO controller (afifo) supports outputting either one or two pixels per round regardless of the input being 1T1P or 1T2P. Add a `output_1pixel` member to struct mtk_dpi_conf which, if set, will enable outputting one pixel per clock. In case the input is two pixel per clock (1T2P), the AFIFO HW will automatically (and internally) convert it to 1T1P. Reviewed-by: CK Hu <ck.hu@mediatek.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20250217154836.108895-9-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 713ee44 commit 6e1931e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ struct mtk_dpi_factor {
147147
* @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to be set in MMSYS.
148148
* @clocked_by_hdmi: HDMI IP outputs clock to dpi_pixel_clk input clock, needed
149149
* for DPI registers access.
150+
* @output_1pixel: Enable outputting one pixel per round; if the input is two pixel per
151+
* round, the DPI hardware will internally transform it to 1T1P.
150152
*/
151153
struct mtk_dpi_conf {
152154
const struct mtk_dpi_factor *dpi_factor;
@@ -168,6 +170,7 @@ struct mtk_dpi_conf {
168170
u32 pixels_per_iter;
169171
bool edge_cfg_in_mmsys;
170172
bool clocked_by_hdmi;
173+
bool output_1pixel;
171174
};
172175

173176
static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
@@ -653,7 +656,13 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
653656
if (dpi->conf->support_direct_pin) {
654657
mtk_dpi_config_yc_map(dpi, dpi->yc_map);
655658
mtk_dpi_config_2n_h_fre(dpi);
656-
mtk_dpi_dual_edge(dpi);
659+
660+
/* DPI can connect to either an external bridge or the internal HDMI encoder */
661+
if (dpi->conf->output_1pixel)
662+
mtk_dpi_mask(dpi, DPI_CON, DPI_OUTPUT_1T1P_EN, DPI_OUTPUT_1T1P_EN);
663+
else
664+
mtk_dpi_dual_edge(dpi);
665+
657666
mtk_dpi_config_disable_edge(dpi);
658667
}
659668
if (dpi->conf->input_2p_en_bit) {

drivers/gpu/drm/mediatek/mtk_dpi_regs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
#define FAKE_DE_LEVEN BIT(21)
4141
#define FAKE_DE_RODD BIT(22)
4242
#define FAKE_DE_REVEN BIT(23)
43+
44+
/* DPI_CON: DPI instances */
45+
#define DPI_OUTPUT_1T1P_EN BIT(24)
46+
/* DPI_CON: DPINTF instances */
4347
#define DPINTF_YUV422_EN BIT(24)
4448
#define DPINTF_CSC_ENABLE BIT(26)
4549
#define DPINTF_INPUT_2P_EN BIT(29)

0 commit comments

Comments
 (0)