Skip to content

Commit 713ee44

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_dpi: Add support for DPI input clock from HDMI
On some SoCs, like MT8195 and MT8188, the DPI instance that is reserved to the HDMI Transmitter uses a different clock topology. In this case, the DPI is clocked by the HDMI IP, and this outputs its clock to the MM input of dpi_pixel_clk, which is essential to enable register access to the DPI IP. Add a `clocked_by_hdmi` member to struct mtk_dpi_conf, and check it to avoid enabling the DPI clocks in the mediatek-drm internal .start() callback (and avoid disabing in the .stop() component callback): this will make sure that the clock configuration sequence is respected during display pipeline setup by following the bridge ops between DPI and HDMI, where the HDMI driver is expected to enable the clocks in the bridge's pre_enable(), and DPI in the enable() cb. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent c90876a commit 713ee44

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ struct mtk_dpi_factor {
145145
* If present, implies that the feature must be enabled.
146146
* @pixels_per_iter: Quantity of transferred pixels per iteration.
147147
* @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to be set in MMSYS.
148+
* @clocked_by_hdmi: HDMI IP outputs clock to dpi_pixel_clk input clock, needed
149+
* for DPI registers access.
148150
*/
149151
struct mtk_dpi_conf {
150152
const struct mtk_dpi_factor *dpi_factor;
@@ -165,6 +167,7 @@ struct mtk_dpi_conf {
165167
u32 input_2p_en_bit;
166168
u32 pixels_per_iter;
167169
bool edge_cfg_in_mmsys;
170+
bool clocked_by_hdmi;
168171
};
169172

170173
static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
@@ -585,7 +588,9 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
585588
struct videomode vm = { 0 };
586589

587590
drm_display_mode_to_videomode(mode, &vm);
588-
mtk_dpi_set_pixel_clk(dpi, &vm, mode->clock);
591+
592+
if (!dpi->conf->clocked_by_hdmi)
593+
mtk_dpi_set_pixel_clk(dpi, &vm, mode->clock);
589594

590595
dpi_pol.ck_pol = MTK_DPI_POLARITY_FALLING;
591596
dpi_pol.de_pol = MTK_DPI_POLARITY_RISING;
@@ -920,14 +925,16 @@ void mtk_dpi_start(struct device *dev)
920925
{
921926
struct mtk_dpi *dpi = dev_get_drvdata(dev);
922927

923-
mtk_dpi_power_on(dpi);
928+
if (!dpi->conf->clocked_by_hdmi)
929+
mtk_dpi_power_on(dpi);
924930
}
925931

926932
void mtk_dpi_stop(struct device *dev)
927933
{
928934
struct mtk_dpi *dpi = dev_get_drvdata(dev);
929935

930-
mtk_dpi_power_off(dpi);
936+
if (!dpi->conf->clocked_by_hdmi)
937+
mtk_dpi_power_off(dpi);
931938
}
932939

933940
unsigned int mtk_dpi_encoder_index(struct device *dev)

0 commit comments

Comments
 (0)