[PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

Mario Limonciello
2024-02-14T21:58:31Z

Many DRM drivers (ab)use `select ACPI_VIDEO` and to avoid problems
will then select all the dependencies for ACPI_VIDEO. This creates
a soft dependency, but makes it very hard to use ACPI_VIDEO in DRM
core. Switch everything else over to use `depends on ACPI_VIDEO`
instead.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/gpu/drm/amd/amdgpu/Kconfig | 9 +--------
drivers/gpu/drm/gma500/Kconfig | 7 +------
drivers/gpu/drm/i915/Kconfig | 9 +--------
drivers/gpu/drm/nouveau/Kconfig | 9 +--------
drivers/gpu/drm/radeon/Kconfig | 9 +--------
drivers/gpu/drm/xe/Kconfig | 8 +-------
drivers/platform/loongarch/Kconfig | 2 +-
drivers/staging/olpc_dcon/Kconfig | 2 +-
drivers/video/fbdev/core/Kconfig | 2 +-
9 files changed, 9 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 22d88f8ef527..49c3b6eeef76 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -4,6 +4,7 @@ config DRM_AMDGPU
tristate "AMD GPU"
depends on DRM && PCI && MMU
depends on !UML
+ depends on ACPI_VIDEO || !ACPI
select FW_LOADER
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HDMI_HELPER
@@ -17,18 +18,10 @@ config DRM_AMDGPU
select HWMON
select I2C
select I2C_ALGOBIT
- select BACKLIGHT_CLASS_DEVICE
select INTERVAL_TREE
select DRM_BUDDY
select DRM_SUBALLOC_HELPER
select DRM_EXEC
- # amdgpu depends on ACPI_VIDEO when ACPI is enabled, for select to work
- # ACPI_VIDEO's dependencies must also be selected.
- select INPUT if ACPI
- select ACPI_VIDEO if ACPI
- # On x86 ACPI_VIDEO also needs ACPI_WMI
- select X86_PLATFORM_DEVICES if ACPI && X86
- select ACPI_WMI if ACPI && X86
help
Choose this option if you have a recent AMD Radeon graphics card.

diff --git a/drivers/gpu/drm/gma500/Kconfig b/drivers/gpu/drm/gma500/Kconfig
index efb4a2dd2f80..a974cdde4b9c 100644
--- a/drivers/gpu/drm/gma500/Kconfig
+++ b/drivers/gpu/drm/gma500/Kconfig
@@ -2,16 +2,11 @@
config DRM_GMA500
tristate "Intel GMA500/600/3600/3650 KMS Framebuffer"
depends on DRM && PCI && X86 && MMU
+ depends on ACPI_VIDEO || !ACPI
select DRM_KMS_HELPER
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
select I2C
select I2C_ALGOBIT
- # GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915
- select ACPI_VIDEO if ACPI
- select BACKLIGHT_CLASS_DEVICE if ACPI
- select INPUT if ACPI
- select X86_PLATFORM_DEVICES if ACPI
- select ACPI_WMI if ACPI
help
Say yes for an experimental 2D KMS framebuffer driver for the
Intel GMA500 (Poulsbo), Intel GMA600 (Moorestown/Oak Trail) and
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index b5d6e3352071..e99405c18c22 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -4,6 +4,7 @@ config DRM_I915
depends on DRM
depends on X86 && PCI
depends on !PREEMPT_RT
+ depends on ACPI_VIDEO || !ACPI
select INTEL_GTT if X86
select INTERVAL_TREE
# we need shmfs for the swappable backing store, and in particular
@@ -22,14 +23,6 @@ config DRM_I915
select I2C
select I2C_ALGOBIT
select IRQ_WORK
- # i915 depends on ACPI_VIDEO when ACPI is enabled
- # but for select to work, need to select ACPI_VIDEO's dependencies, ick
- select BACKLIGHT_CLASS_DEVICE if ACPI
- select INPUT if ACPI
- select X86_PLATFORM_DEVICES if ACPI
- select ACPI_WMI if ACPI
- select ACPI_VIDEO if ACPI
- select ACPI_BUTTON if ACPI
select SYNC_FILE
select IOSF_MBI if X86
select CRC32
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index 1e6aaf95ff7c..a3768484cbf5 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -2,6 +2,7 @@
config DRM_NOUVEAU
tristate "Nouveau (NVIDIA) cards"
depends on DRM && PCI && MMU
+ depends on ACPI_VIDEO || !ACPI
select IOMMU_API
select FW_LOADER
select DRM_DISPLAY_DP_HELPER
@@ -15,16 +16,8 @@ config DRM_NOUVEAU
select DRM_SCHED
select I2C
select I2C_ALGOBIT
- select BACKLIGHT_CLASS_DEVICE if DRM_NOUVEAU_BACKLIGHT
- select X86_PLATFORM_DEVICES if ACPI && X86
- select ACPI_WMI if ACPI && X86
- select MXM_WMI if ACPI && X86
select POWER_SUPPLY
- # Similar to i915, we need to select ACPI_VIDEO and it's dependencies
- select BACKLIGHT_CLASS_DEVICE if ACPI && X86
- select INPUT if ACPI && X86
select THERMAL if ACPI && X86
- select ACPI_VIDEO if ACPI && X86
select SND_HDA_COMPONENT if SND_HDA_CORE
help
Choose this option for open-source NVIDIA support.
diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig
index f98356be0af2..05d134bb1cb2 100644
--- a/drivers/gpu/drm/radeon/Kconfig
+++ b/drivers/gpu/drm/radeon/Kconfig
@@ -4,6 +4,7 @@ config DRM_RADEON
tristate "ATI Radeon"
depends on DRM && PCI && MMU
depends on AGP || !AGP
+ depends on ACPI_VIDEO || !ACPI
select FW_LOADER
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HELPER
@@ -15,17 +16,9 @@ config DRM_RADEON
select SND_HDA_COMPONENT if SND_HDA_CORE
select POWER_SUPPLY
select HWMON
- select BACKLIGHT_CLASS_DEVICE
select INTERVAL_TREE
select I2C
select I2C_ALGOBIT
- # radeon depends on ACPI_VIDEO when ACPI is enabled, for select to work
- # ACPI_VIDEO's dependencies must also be selected.
- select INPUT if ACPI
- select ACPI_VIDEO if ACPI
- # On x86 ACPI_VIDEO also needs ACPI_WMI
- select X86_PLATFORM_DEVICES if ACPI && X86
- select ACPI_WMI if ACPI && X86
help
Choose this option if you have an ATI Radeon graphics card. There
are both PCI and AGP versions. You don't need to choose this to
diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index e36ae1f0d885..8a20f5a4d516 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -2,6 +2,7 @@
config DRM_XE
tristate "Intel Xe Graphics"
depends on DRM && PCI && MMU && (m || (y && KUNIT=y)) && 64BIT
+ depends on ACPI_VIDEO || !ACPI
select INTERVAL_TREE
# we need shmfs for the swappable backing store, and in particular
# the shmem_readpage() which depends upon tmpfs
@@ -19,13 +20,6 @@ config DRM_XE
select DRM_MIPI_DSI
select RELAY
select IRQ_WORK
- # xe depends on ACPI_VIDEO when ACPI is enabled
- # but for select to work, need to select ACPI_VIDEO's dependencies, ick
- select BACKLIGHT_CLASS_DEVICE if ACPI
- select INPUT if ACPI
- select ACPI_VIDEO if X86 && ACPI
- select ACPI_BUTTON if ACPI
- select ACPI_WMI if X86 && ACPI
select SYNC_FILE
select IOSF_MBI
select CRC32
diff --git a/drivers/platform/loongarch/Kconfig b/drivers/platform/loongarch/Kconfig
index 5633e4d73991..2c55bc98c727 100644
--- a/drivers/platform/loongarch/Kconfig
+++ b/drivers/platform/loongarch/Kconfig
@@ -22,7 +22,7 @@ config LOONGSON_LAPTOP
depends on BACKLIGHT_CLASS_DEVICE
depends on INPUT
depends on MACH_LOONGSON64
- select ACPI_VIDEO
+ depends on ACPI_VIDEO
select INPUT_SPARSEKMAP
default y
help
diff --git a/drivers/staging/olpc_dcon/Kconfig b/drivers/staging/olpc_dcon/Kconfig
index d0ba34cc32f7..e1fe1f2b767a 100644
--- a/drivers/staging/olpc_dcon/Kconfig
+++ b/drivers/staging/olpc_dcon/Kconfig
@@ -4,7 +4,7 @@ config FB_OLPC_DCON
depends on OLPC && FB && BROKEN
depends on I2C
depends on GPIO_CS5535 && ACPI
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE
help
In order to support very low power operation, the XO laptop uses a
secondary Display CONtroller, or DCON. This secondary controller
diff --git a/drivers/video/fbdev/core/Kconfig b/drivers/video/fbdev/core/Kconfig
index db09fe87fcd4..d5c9249cdb5d 100644
--- a/drivers/video/fbdev/core/Kconfig
+++ b/drivers/video/fbdev/core/Kconfig
@@ -179,7 +179,7 @@ config FB_SYSMEM_HELPERS_DEFERRED
config FB_BACKLIGHT
tristate
depends on FB
- select BACKLIGHT_CLASS_DEVICE
+ depends on BACKLIGHT_CLASS_DEVICE

config FB_MODE_HELPERS
bool "Enable Video Mode Handling Helpers"
--
2.34.1