drm/sun4i: fix build failure with CONFIG_DRM_SUN8I_MIXER=m
authorArnd Bergmann <arnd@arndb.de>
Wed, 11 Jul 2018 14:43:10 +0000 (16:43 +0200)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Thu, 12 Jul 2018 07:35:19 +0000 (09:35 +0200)
Having DRM_SUN4I built-in but DRM_SUN8I_MIXER as a loadable module results in
a link error, as we try to access a symbol from the sun8i_tcon_top.ko module:

ERROR: "sun8i_tcon_top_of_table" [drivers/gpu/drm/sun4i/sun8i-drm-hdmi.ko] undefined!
ERROR: "sun8i_tcon_top_of_table" [drivers/gpu/drm/sun4i/sun4i-drm.ko] undefined!

This solves the problem by adding a silent symbol for the tcon_top module,
building it as a separate module in exactly the cases that we need it,
but in a way that it is reachable by the other modules.

Fixes: 57e23de02f48 ("drm/sun4i: DW HDMI: Expand algorithm for possible crtcs")
Fixes: ef0cf6441fbb ("drm/sun4i: Add support for traversing graph with TCON TOP")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180711144403.1022829-1-arnd@arndb.de
drivers/gpu/drm/sun4i/Kconfig
drivers/gpu/drm/sun4i/Makefile
drivers/gpu/drm/sun4i/sun4i_drv.c
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c

index 156a865c3e6d0bdf437ed0fc04a154dbd5d7dcac..c2c042287c19c26e899141e952bdf16d344c2904 100644 (file)
@@ -68,4 +68,11 @@ config DRM_SUN8I_MIXER
          graphics mixture and feed graphics to TCON, If M is
          selected the module will be called sun8i-mixer.
 
+config DRM_SUN8I_TCON_TOP
+       tristate
+       default DRM_SUN4I if DRM_SUN8I_MIXER!=n
+       help
+         TCON TOP is responsible for configuring display pipeline for
+         HTMI, TVE and LCD.
+
 endif
index 14f420f1d4ae94926fc78f41620bd042b142f228..b04ea0f3da75af6a1c119c52b5f4efcb7c861b19 100644 (file)
@@ -36,4 +36,5 @@ obj-$(CONFIG_DRM_SUN4I_BACKEND)       += sun4i-backend.o sun4i-frontend.o
 obj-$(CONFIG_DRM_SUN4I_HDMI)   += sun4i-drm-hdmi.o
 obj-$(CONFIG_DRM_SUN6I_DSI)    += sun6i-dsi.o
 obj-$(CONFIG_DRM_SUN8I_DW_HDMI)        += sun8i-drm-hdmi.o
-obj-$(CONFIG_DRM_SUN8I_MIXER)  += sun8i-mixer.o sun8i_tcon_top.o
+obj-$(CONFIG_DRM_SUN8I_MIXER)  += sun8i-mixer.o
+obj-$(CONFIG_DRM_SUN8I_TCON_TOP) += sun8i_tcon_top.o
index a15feb807393858f6a481001c44dba27ee6fc926..03ffbcc98dd0722fb804f6126b0e1390ef0779b4 100644 (file)
@@ -216,7 +216,8 @@ static bool sun4i_drv_node_is_tcon_with_ch0(struct device_node *node)
 
 static bool sun4i_drv_node_is_tcon_top(struct device_node *node)
 {
-       return !!of_match_node(sun8i_tcon_top_of_table, node);
+       return IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
+               !!of_match_node(sun8i_tcon_top_of_table, node);
 }
 
 static int compare_of(struct device *dev, void *data)
index 4cbe744e15a9a1270e8e801337f37d0b9494e68d..31875b636434a12337b597f6358fac37861c8303 100644 (file)
@@ -44,7 +44,8 @@ sun8i_dw_hdmi_mode_valid(struct drm_connector *connector,
 
 static bool sun8i_dw_hdmi_node_is_tcon_top(struct device_node *node)
 {
-       return !!of_match_node(sun8i_tcon_top_of_table, node);
+       return IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
+               !!of_match_node(sun8i_tcon_top_of_table, node);
 }
 
 static u32 sun8i_dw_hdmi_find_possible_crtcs(struct drm_device *drm,