Skip to content

Commit 8d0f798

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188
Add support for the newer HDMI-TX (Encoder) v2 and DDC v2 IPs found in MediaTek's MT8195, MT8188 SoC and their variants, and including support for display modes up to 4k60 and for HDMI Audio, as per the HDMI 2.0 spec. HDCP and CEC functionalities are also supported by this hardware, but are not included in this commit and that also poses a slight difference between the V2 and V1 controllers in how they handle Hotplug Detection (HPD). While the v1 controller was using the CEC controller to check HDMI cable connection and disconnection, in this driver the v2 one does not. This is due to the fact that on parts with v2 designs, like the MT8195 SoC, there is one CEC controller shared between the HDMI Transmitter (HDMI-TX) and Receiver (HDMI-RX): before eventually adding support to use the CEC HW to wake up the HDMI controllers it is necessary to have support for one TX, one RX *and* for both at the same time. Reviewed-by: CK Hu <ck.hu@mediatek.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20251023-mediatek-drm-hdmi-v2-v11-9-7873ec4a1edf@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> ddc_v2 ddc_v2
1 parent 3cbf911 commit 8d0f798

7 files changed

Lines changed: 2084 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,15 @@ config DRM_MEDIATEK_HDMI
4545
select DRM_MEDIATEK_HDMI_COMMON
4646
help
4747
DRM/KMS HDMI driver for Mediatek SoCs
48+
49+
config DRM_MEDIATEK_HDMI_V2
50+
tristate "DRM HDMI v2 IP support for MediaTek SoCs"
51+
depends on DRM_MEDIATEK
52+
select DRM_MEDIATEK_HDMI_COMMON
53+
help
54+
Say yes here to enable support for the HDMIv2 IP and related
55+
DDCv2 as found in the MediaTek MT8195, MT8188 SoCs and other
56+
variants.
57+
This driver can also be built as a module. If so, the HDMIv2
58+
module will be called "mtk_hdmi_v2", and the DDCv2 module
59+
will be called "mtk_hdmi_ddc_v2".

drivers/gpu/drm/mediatek/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ obj-$(CONFIG_DRM_MEDIATEK_HDMI_COMMON) += mtk_hdmi_common.o
2525
obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mtk_cec.o
2626
obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mtk_hdmi.o
2727
obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mtk_hdmi_ddc.o
28+
obj-$(CONFIG_DRM_MEDIATEK_HDMI_V2) += mtk_hdmi_v2.o
29+
obj-$(CONFIG_DRM_MEDIATEK_HDMI_V2) += mtk_hdmi_ddc_v2.o
2830

2931
obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk_dp.o

drivers/gpu/drm/mediatek/mtk_hdmi_common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
302302
if (ret)
303303
return dev_err_probe(dev, ret, "Failed to get clocks\n");
304304

305+
hdmi->irq = platform_get_irq(pdev, 0);
306+
if (!hdmi->irq)
307+
return hdmi->irq;
308+
305309
hdmi->regs = device_node_to_regmap(dev->of_node);
306310
if (IS_ERR(hdmi->regs))
307311
return PTR_ERR(hdmi->regs);

drivers/gpu/drm/mediatek/mtk_hdmi_common.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ struct hdmi_audio_param {
126126
struct hdmi_codec_params codec_params;
127127
};
128128

129+
enum hdmi_hpd_state {
130+
HDMI_PLUG_OUT = 0,
131+
HDMI_PLUG_IN_AND_SINK_POWER_ON,
132+
HDMI_PLUG_IN_ONLY,
133+
};
134+
129135
struct mtk_hdmi_ver_conf {
130136
const struct drm_bridge_funcs *bridge_funcs;
131137
const struct hdmi_codec_ops *codec_ops;
@@ -139,6 +145,7 @@ struct mtk_hdmi_conf {
139145
bool tz_disabled;
140146
bool cea_modes_only;
141147
unsigned long max_mode_clock;
148+
u32 reg_hdmi_tx_cfg;
142149
};
143150

144151
struct mtk_hdmi {
@@ -161,6 +168,8 @@ struct mtk_hdmi {
161168
bool audio_enable;
162169
bool powered;
163170
bool enabled;
171+
unsigned int irq;
172+
enum hdmi_hpd_state hpd;
164173
hdmi_codec_plugged_cb plugged_cb;
165174
struct device *codec_dev;
166175
struct mutex update_plugged_status_lock;

0 commit comments

Comments
 (0)