Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/etnaviv: make THERMAL selectable

The etnaviv driver causes a link failure if it is built-in but THERMAL
is built as a module:

drivers/gpu/drm/etnaviv/etnaviv_gpu.o: In function `etnaviv_gpu_bind':
etnaviv_gpu.c:(.text+0x4c4): undefined reference to `thermal_of_cooling_device_register'
etnaviv_gpu.c:(.text+0x600): undefined reference to `thermal_cooling_device_unregister'
drivers/gpu/drm/etnaviv/etnaviv_gpu.o: In function `etnaviv_gpu_unbind':
etnaviv_gpu.c:(.text+0x2aac): undefined reference to `thermal_cooling_device_unregister'

Adding a Kconfig dependency on THERMAL || !THERMAL to avoid this causes
a dependency loop on x86_64:

drivers/gpu/drm/tve200/Kconfig:1:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/tve200/Kconfig:1: symbol DRM_TVE200 depends on CMA
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
mm/Kconfig:489: symbol CMA is selected by DRM_ETNAVIV
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/etnaviv/Kconfig:2: symbol DRM_ETNAVIV depends on THERMAL
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/thermal/Kconfig:5: symbol THERMAL is selected by ACPI_VIDEO
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/acpi/Kconfig:189: symbol ACPI_VIDEO is selected by BACKLIGHT_CLASS_DEVICE
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/backlight/Kconfig:158: symbol BACKLIGHT_CLASS_DEVICE is selected by DRM_PARADE_PS8622
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/bridge/Kconfig:62: symbol DRM_PARADE_PS8622 depends on DRM_BRIDGE
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/bridge/Kconfig:1: symbol DRM_BRIDGE is selected by DRM_TVE200

To work around this, add a new option DRM_ETNAVIV_THERMAL to optionally
enable thermal throttling support and make DRM_ETNAVIV select THERMAL
at the same time.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

authored by

Philipp Zabel and committed by
Lucas Stach
49b82c38 ff981595

+14 -3
+9
drivers/gpu/drm/etnaviv/Kconfig
··· 6 6 depends on MMU 7 7 select SHMEM 8 8 select SYNC_FILE 9 + select THERMAL if DRM_ETNAVIV_THERMAL 9 10 select TMPFS 10 11 select WANT_DEV_COREDUMP 11 12 select CMA if HAVE_DMA_CONTIGUOUS 12 13 select DMA_CMA if HAVE_DMA_CONTIGUOUS 13 14 help 14 15 DRM driver for Vivante GPUs. 16 + 17 + config DRM_ETNAVIV_THERMAL 18 + bool "enable ETNAVIV thermal throttling" 19 + depends on DRM_ETNAVIV 20 + default y 21 + help 22 + Compile in support for thermal throttling. 23 + Say Y unless you want to risk burning your SoC. 15 24 16 25 config DRM_ETNAVIV_REGISTER_LOGGING 17 26 bool "enable ETNAVIV register logging"
+5 -3
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
··· 1738 1738 struct etnaviv_gpu *gpu = dev_get_drvdata(dev); 1739 1739 int ret; 1740 1740 1741 - if (IS_ENABLED(CONFIG_THERMAL)) { 1741 + if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) { 1742 1742 gpu->cooling = thermal_of_cooling_device_register(dev->of_node, 1743 1743 (char *)dev_name(dev), gpu, &cooling_ops); 1744 1744 if (IS_ERR(gpu->cooling)) ··· 1751 1751 ret = etnaviv_gpu_clk_enable(gpu); 1752 1752 #endif 1753 1753 if (ret < 0) { 1754 - thermal_cooling_device_unregister(gpu->cooling); 1754 + if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) 1755 + thermal_cooling_device_unregister(gpu->cooling); 1755 1756 return ret; 1756 1757 } 1757 1758 ··· 1809 1808 1810 1809 gpu->drm = NULL; 1811 1810 1812 - thermal_cooling_device_unregister(gpu->cooling); 1811 + if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) 1812 + thermal_cooling_device_unregister(gpu->cooling); 1813 1813 gpu->cooling = NULL; 1814 1814 } 1815 1815