: ACPI: Weaken the dependency between ACPI video driver and I915
Subsystems (4)
PATCH 2/2 : ACPI: Weaken the dependency between ACPI video driver and I915
From: Zhao Yakui <[email protected]>
Now there exists the tight dependency between the ACPI video driver and i915 driver. If the I915 driver is compiled as built-in module and the acpi video is compiled as module, it will fail in the kernel compilation.
At the same time the acpi video driver must be loaded in order to load the I915 driver. It is very hack.
This patch is to weaken the dependency between the ACPI video driver and i915 driver. But it still can do what we expected.
a. the i915/acpi_video_register is defined in the video_detect.When the video is choosed, it will be complied as built-in functions. If the video is not choosed, it is defined as inline function.
b. i915_video_register is called by i915 driver. And i915 video flag is set. c. acpi_video_register/unregister is called by acpi video driver. The acpi video bus driver is hooked and the ACPI video flag is set.
d. When the both flag bits are set, the acpi video bus driver will be registered.
--- drivers/acpi/video.c | 39 ++++++++---------- drivers/acpi/video_detect.c | 74 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_opregion.c | 2 include/acpi/video.h | 11 ++++- 4 files changed, 101 insertions(+), 25 deletions(-)
drivers/acpi/video.c +18 -21
@@ -43,8 +43,8 @@#include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include <acpi/video.h> -#define ACPI_VIDEO_CLASS "video"#define ACPI_VIDEO_BUS_NAME "Video Bus"#define ACPI_VIDEO_DEVICE_NAME "Video Device"#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
@@ -2260,7 +2260,16 @@return 0 ; } -int acpi_video_register (void ) +/* +* This is kind of nasty. Hardware using Intel chipsets may require +* the video opregion code to be run first in order to initialise +* state before any ACPI video calls are made. To handle this we defer +* registration of the video class until the opregion code has run. +* If there is no opregion is supported, it will continue the original +* flowchart. Register the ACPI video bus driver. +*/ + +static int __init acpi_video_init (void ) {int result =0 ;
@@ -2268,34 +2277,22 @@if (!acpi_video_dir)return -ENODEV ; +if (intel_opregion_present ()) { +acpi_video_register (&acpi_video_bus); +return 0 ; + } result =acpi_bus_register_driver (&acpi_video_bus); +if (result <0 ) {remove_proc_entry (ACPI_VIDEO_CLASS , acpi_root_dir); -return -ENODEV ; } -return 0 ; -} -EXPORT_SYMBOL (acpi_video_register); - -/* -* This is kind of nasty. Hardware using Intel chipsets may require -* the video opregion code to be run first in order to initialise -* state before any ACPI video calls are made. To handle this we defer -* registration of the video class until the opregion code has run. -*/ - -static int __init acpi_video_init (void ) -{ -if (intel_opregion_present ()) -return 0 ; - -return acpi_video_register (); +return result; } static void __exit acpi_video_exit(void) { - +acpi_video_unregister (&acpi_video_bus);acpi_bus_unregister_driver (&acpi_video_bus);remove_proc_entry (ACPI_VIDEO_CLASS , acpi_root_dir);
drivers/acpi/video_detect.c +73 -1
93 lines not on this page · raw message
include/acpi/video.h +9 -2
@@ -1,10 +1,17 @@#ifndef __ACPI_VIDEO_H#define __ACPI_VIDEO_H +#define ACPI_VIDEO_CLASS "video"#if (definedCONFIG_ACPI_VIDEO || definedCONFIG_ACPI_VIDEO_MODULE ) -extern int acpi_video_register (void ); +extern int acpi_video_register (struct acpi_driver *driver); +extern int acpi_video_unregister (struct acpi_driver *driver); +extern int i915_video_register (void );#else -static inline int acpi_video_register (void ) {return 0 ; } +static inline int acpi_video_register (struct acpi_driver *driver) + {return 0 ; } +static inline int acpi_video_unregister (struct acpi_driver *driver) + {return 0 ; } +static inline int i915_video_register (void ) {return 0 ; }#endif #endif
drivers/gpu/drm/i915/i915_opregion.c +1 -1
@@ -373,7 +373,7 @@if (drm_core_check_feature (dev,DRIVER_MODESET )) {intel_didl_outputs (dev);if (!resume) -acpi_video_register (); +i915_video_register (); } }else {DRM_DEBUG ("Public ACPI methods not supported\n" );
Len Brown
reviewerI think that this one was determineed to be incorrect and thus i'm dropping it. let me know if i mis-read the thread.
thanks,
Len Brown, Intel Open Source Technology Center