Re: [PATCH v1 07/17] drm/mediatek: extract common functions from the mtk hdmi driver

From: AngeloGioacchino Del Regno
Date: Tue Sep 20 2022 - 06:25:56 EST


Il 19/09/22 18:56, Guillaume Ranquet ha scritto:
Create a common "framework" that can be used to add support for
different hdmi IPs within the mediatek range of products.

Signed-off-by: Guillaume Ranquet <granquet@xxxxxxxxxxxx>

diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile
index d4d193f60271..008ec69da67b 100644
--- a/drivers/gpu/drm/mediatek/Makefile
+++ b/drivers/gpu/drm/mediatek/Makefile
@@ -22,7 +22,8 @@ obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o
mediatek-drm-hdmi-objs := mtk_cec.o \
mtk_hdmi.o \

abcd ... mtk_hdmi_common.o goes here :-)

- mtk_hdmi_ddc.o
+ mtk_hdmi_ddc.o \
+ mtk_hdmi_common.o \
obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 5cd05d4fe1a9..837d36ec4d64 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -32,187 +32,18 @@
#include <drm/drm_probe_helper.h>
#include "mtk_cec.h"
-#include "mtk_hdmi.h"
#include "mtk_hdmi_regs.h"
+#include "mtk_hdmi_common.h"
#define NCTS_BYTES 7
-enum mtk_hdmi_clk_id {
- MTK_HDMI_CLK_HDMI_PIXEL,
- MTK_HDMI_CLK_HDMI_PLL,
- MTK_HDMI_CLK_AUD_BCLK,
- MTK_HDMI_CLK_AUD_SPDIF,
- MTK_HDMI_CLK_COUNT
+const char * const mtk_hdmi_clk_names_mt8183[MTK_MT8183_HDMI_CLK_COUNT] = {

Why MT8183? This can be either MT8167 or MT2701... or, IMO more appropriately, you
should name the IP version.
Example: MTK_HDMIV123_CLK_COUNT (I don't know what IP version would that be!).

+ [MTK_MT8183_HDMI_CLK_HDMI_PIXEL] = "pixel",
+ [MTK_MT8183_HDMI_CLK_HDMI_PLL] = "pll",
+ [MTK_MT8183_HDMI_CLK_AUD_BCLK] = "bclk",
+ [MTK_MT8183_HDMI_CLK_AUD_SPDIF] = "spdif",
};

Regards,
Angelo