diff mbox series

[5/6] ACPI: video: Remove register_backlight_delay module option and code

Message ID 20230403160329.707176-6-hdegoede@redhat.com
State Superseded
Headers show
Series ACPI: video: Fix missing acpi_video# devices on some systems | expand

Commit Message

Hans de Goede April 3, 2023, 4:03 p.m. UTC
Since commit 5aa9d943e9b6 ("ACPI: video: Don't enable fallback path for
creating ACPI backlight by default"), the delayed registerering of
acpi_video# backlight devices has been disabled by default.

The few bugreports where this option was used as a workaround were all
cases where the GPU driver did not call acpi_video_register_backlight()
and the workaround was to pass video.register_backlight_delay=1.

With the recent "ACPI: video: Make acpi_backlight=video work independent
from GPU driver" changes acpi_backlight=video can be used to achieve
the same result. So there is no need for the register_backlight_delay
option + code anymore.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpi_video.c                     | 38 -------------------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 --
 include/acpi/video.h                          |  2 -
 3 files changed, 44 deletions(-)

Comments

Mario Limonciello April 3, 2023, 4:38 p.m. UTC | #1
On 4/3/2023 11:03, Hans de Goede wrote:
> Since commit 5aa9d943e9b6 ("ACPI: video: Don't enable fallback path for
> creating ACPI backlight by default"), the delayed registerering of

registering

> acpi_video# backlight devices has been disabled by default.
> 
> The few bugreports where this option was used as a workaround were all
> cases where the GPU driver did not call acpi_video_register_backlight()
> and the workaround was to pass video.register_backlight_delay=1.
> 
> With the recent "ACPI: video: Make acpi_backlight=video work independent
> from GPU driver" changes acpi_backlight=video can be used to achieve
> the same result. So there is no need for the register_backlight_delay
> option + code anymore.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   drivers/acpi/acpi_video.c                     | 38 -------------------
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 --
>   include/acpi/video.h                          |  2 -
>   3 files changed, 44 deletions(-)
> 
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index c7a6d0b69dab..62f4364e4460 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -70,12 +70,6 @@ module_param(device_id_scheme, bool, 0444);
>   static int only_lcd = -1;
>   module_param(only_lcd, int, 0444);
>   
> -static int register_backlight_delay;
> -module_param(register_backlight_delay, int, 0444);
> -MODULE_PARM_DESC(register_backlight_delay,
> -	"Delay in seconds before doing fallback (non GPU driver triggered) "
> -	"backlight registration, set to 0 to disable.");
> -
>   static bool may_report_brightness_keys;
>   static int register_count;
>   static DEFINE_MUTEX(register_count_mutex);
> @@ -84,9 +78,6 @@ static LIST_HEAD(video_bus_head);
>   static int acpi_video_bus_add(struct acpi_device *device);
>   static void acpi_video_bus_remove(struct acpi_device *device);
>   static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
> -static void acpi_video_bus_register_backlight_work(struct work_struct *ignored);
> -static DECLARE_DELAYED_WORK(video_bus_register_backlight_work,
> -			    acpi_video_bus_register_backlight_work);
>   
>   /*
>    * Indices in the _BCL method response: the first two items are special,
> @@ -2096,11 +2087,6 @@ static void acpi_video_bus_remove(struct acpi_device *device)
>   	kfree(video);
>   }
>   
> -static void acpi_video_bus_register_backlight_work(struct work_struct *ignored)
> -{
> -	acpi_video_register_backlight();
> -}
> -
>   static int __init is_i740(struct pci_dev *dev)
>   {
>   	if (dev->device == 0x00D1)
> @@ -2183,17 +2169,6 @@ static bool should_check_lcd_flag(void)
>   	return false;
>   }
>   
> -/*
> - * At least one graphics driver has reported that no LCD is connected
> - * via the native interface. cancel the registration for fallback acpi_video0.
> - * If another driver still deems this necessary, it can explicitly register it.
> - */
> -void acpi_video_report_nolcd(void)
> -{
> -	cancel_delayed_work(&video_bus_register_backlight_work);
> -}
> -EXPORT_SYMBOL(acpi_video_report_nolcd);
> -
>   int acpi_video_register(void)
>   {
>   	int ret = 0;
> @@ -2222,18 +2197,6 @@ int acpi_video_register(void)
>   	 */
>   	register_count = 1;
>   
> -	/*
> -	 * acpi_video_bus_add() skips registering the userspace visible
> -	 * backlight_device. The intend is for this to be registered by the
> -	 * drm/kms driver calling acpi_video_register_backlight() *after* it is
> -	 * done setting up its own native backlight device. The delayed work
> -	 * ensures that acpi_video_register_backlight() always gets called
> -	 * eventually, in case there is no drm/kms driver or it is disabled.
> -	 */
> -	if (register_backlight_delay)
> -		schedule_delayed_work(&video_bus_register_backlight_work,
> -				      register_backlight_delay * HZ);
> -
>   leave:
>   	mutex_unlock(&register_count_mutex);
>   	return ret;
> @@ -2244,7 +2207,6 @@ void acpi_video_unregister(void)
>   {
>   	mutex_lock(&register_count_mutex);
>   	if (register_count) {
> -		cancel_delayed_work_sync(&video_bus_register_backlight_work);
>   		acpi_bus_unregister_driver(&acpi_video_bus);
>   		register_count = 0;
>   		may_report_brightness_keys = false;
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 7c96faa73426..d832f9ac43d4 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -4436,10 +4436,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>   		amdgpu_set_panel_orientation(&aconnector->base);
>   	}
>   
> -	/* If we didn't find a panel, notify the acpi video detection */
> -	if (dm->adev->flags & AMD_IS_APU && dm->num_of_edps == 0)
> -		acpi_video_report_nolcd();
> -
>   	/* Software is initialized. Now we can register interrupt handlers. */
>   	switch (adev->asic_type) {
>   #if defined(CONFIG_DRM_AMD_DC_SI)
> diff --git a/include/acpi/video.h b/include/acpi/video.h
> index ff5a8da5d883..4230392b5b0b 100644
> --- a/include/acpi/video.h
> +++ b/include/acpi/video.h
> @@ -53,7 +53,6 @@ enum acpi_backlight_type {
>   };
>   
>   #if IS_ENABLED(CONFIG_ACPI_VIDEO)
> -extern void acpi_video_report_nolcd(void);
>   extern int acpi_video_register(void);
>   extern void acpi_video_unregister(void);
>   extern void acpi_video_register_backlight(void);
> @@ -81,7 +80,6 @@ static inline bool acpi_video_backlight_use_native(void)
>   	return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;
>   }
>   #else
> -static inline void acpi_video_report_nolcd(void) { return; };
>   static inline int acpi_video_register(void) { return -ENODEV; }
>   static inline void acpi_video_unregister(void) { return; }
>   static inline void acpi_video_register_backlight(void) { return; }
diff mbox series

Patch

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index c7a6d0b69dab..62f4364e4460 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -70,12 +70,6 @@  module_param(device_id_scheme, bool, 0444);
 static int only_lcd = -1;
 module_param(only_lcd, int, 0444);
 
-static int register_backlight_delay;
-module_param(register_backlight_delay, int, 0444);
-MODULE_PARM_DESC(register_backlight_delay,
-	"Delay in seconds before doing fallback (non GPU driver triggered) "
-	"backlight registration, set to 0 to disable.");
-
 static bool may_report_brightness_keys;
 static int register_count;
 static DEFINE_MUTEX(register_count_mutex);
@@ -84,9 +78,6 @@  static LIST_HEAD(video_bus_head);
 static int acpi_video_bus_add(struct acpi_device *device);
 static void acpi_video_bus_remove(struct acpi_device *device);
 static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
-static void acpi_video_bus_register_backlight_work(struct work_struct *ignored);
-static DECLARE_DELAYED_WORK(video_bus_register_backlight_work,
-			    acpi_video_bus_register_backlight_work);
 
 /*
  * Indices in the _BCL method response: the first two items are special,
@@ -2096,11 +2087,6 @@  static void acpi_video_bus_remove(struct acpi_device *device)
 	kfree(video);
 }
 
-static void acpi_video_bus_register_backlight_work(struct work_struct *ignored)
-{
-	acpi_video_register_backlight();
-}
-
 static int __init is_i740(struct pci_dev *dev)
 {
 	if (dev->device == 0x00D1)
@@ -2183,17 +2169,6 @@  static bool should_check_lcd_flag(void)
 	return false;
 }
 
-/*
- * At least one graphics driver has reported that no LCD is connected
- * via the native interface. cancel the registration for fallback acpi_video0.
- * If another driver still deems this necessary, it can explicitly register it.
- */
-void acpi_video_report_nolcd(void)
-{
-	cancel_delayed_work(&video_bus_register_backlight_work);
-}
-EXPORT_SYMBOL(acpi_video_report_nolcd);
-
 int acpi_video_register(void)
 {
 	int ret = 0;
@@ -2222,18 +2197,6 @@  int acpi_video_register(void)
 	 */
 	register_count = 1;
 
-	/*
-	 * acpi_video_bus_add() skips registering the userspace visible
-	 * backlight_device. The intend is for this to be registered by the
-	 * drm/kms driver calling acpi_video_register_backlight() *after* it is
-	 * done setting up its own native backlight device. The delayed work
-	 * ensures that acpi_video_register_backlight() always gets called
-	 * eventually, in case there is no drm/kms driver or it is disabled.
-	 */
-	if (register_backlight_delay)
-		schedule_delayed_work(&video_bus_register_backlight_work,
-				      register_backlight_delay * HZ);
-
 leave:
 	mutex_unlock(&register_count_mutex);
 	return ret;
@@ -2244,7 +2207,6 @@  void acpi_video_unregister(void)
 {
 	mutex_lock(&register_count_mutex);
 	if (register_count) {
-		cancel_delayed_work_sync(&video_bus_register_backlight_work);
 		acpi_bus_unregister_driver(&acpi_video_bus);
 		register_count = 0;
 		may_report_brightness_keys = false;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 7c96faa73426..d832f9ac43d4 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4436,10 +4436,6 @@  static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 		amdgpu_set_panel_orientation(&aconnector->base);
 	}
 
-	/* If we didn't find a panel, notify the acpi video detection */
-	if (dm->adev->flags & AMD_IS_APU && dm->num_of_edps == 0)
-		acpi_video_report_nolcd();
-
 	/* Software is initialized. Now we can register interrupt handlers. */
 	switch (adev->asic_type) {
 #if defined(CONFIG_DRM_AMD_DC_SI)
diff --git a/include/acpi/video.h b/include/acpi/video.h
index ff5a8da5d883..4230392b5b0b 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -53,7 +53,6 @@  enum acpi_backlight_type {
 };
 
 #if IS_ENABLED(CONFIG_ACPI_VIDEO)
-extern void acpi_video_report_nolcd(void);
 extern int acpi_video_register(void);
 extern void acpi_video_unregister(void);
 extern void acpi_video_register_backlight(void);
@@ -81,7 +80,6 @@  static inline bool acpi_video_backlight_use_native(void)
 	return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;
 }
 #else
-static inline void acpi_video_report_nolcd(void) { return; };
 static inline int acpi_video_register(void) { return -ENODEV; }
 static inline void acpi_video_unregister(void) { return; }
 static inline void acpi_video_register_backlight(void) { return; }