提交 f838eb5b 编写于 作者: C Corentin Chary 提交者: Matthew Garrett

acpi: add a way to promote/demote vendor backlight drivers

Instead of adding a big blacklist in video_detect.c to set
ACPI_VIDEO_BACKLIGHT_DMI_VENDOR correctly, let external modules
promote or demote themselves when they know the generic video
module won't work.

Currently drivers where using acpi_video_unregister() directly
but:
- That didn't respect any acpi_backlight=[video|vendor] parameter
  provided by the user.
- Any later call to acpi_video_register() would still re-load the
  generic video module (and some gpu drivers are doing that).

This patch fix those two issues.
Signed-off-by: NCorentin Chary <corentin.chary@gmail.com>
Signed-off-by: NMatthew Garrett <mjg@redhat.com>
上级 1eb3fe1d
...@@ -182,8 +182,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle) ...@@ -182,8 +182,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
} }
EXPORT_SYMBOL(acpi_video_get_capabilities); EXPORT_SYMBOL(acpi_video_get_capabilities);
/* Returns true if video.ko can do backlight switching */ static void acpi_video_caps_check(void)
int acpi_video_backlight_support(void)
{ {
/* /*
* We must check whether the ACPI graphics device is physically plugged * We must check whether the ACPI graphics device is physically plugged
...@@ -191,6 +190,34 @@ int acpi_video_backlight_support(void) ...@@ -191,6 +190,34 @@ int acpi_video_backlight_support(void)
*/ */
if (!acpi_video_caps_checked) if (!acpi_video_caps_checked)
acpi_video_get_capabilities(NULL); acpi_video_get_capabilities(NULL);
}
/* Promote the vendor interface instead of the generic video module.
* This function allow DMI blacklists to be implemented by externals
* platform drivers instead of putting a big blacklist in video_detect.c
* After calling this function you will probably want to call
* acpi_video_unregister() to make sure the video module is not loaded
*/
void acpi_video_dmi_promote_vendor(void)
{
acpi_video_caps_check();
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
}
EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
/* To be called when a driver who previously promoted the vendor
* interface */
void acpi_video_dmi_demote_vendor(void)
{
acpi_video_caps_check();
acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
}
EXPORT_SYMBOL(acpi_video_dmi_demote_vendor);
/* Returns true if video.ko can do backlight switching */
int acpi_video_backlight_support(void)
{
acpi_video_caps_check();
/* First check for boot param -> highest prio */ /* First check for boot param -> highest prio */
if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR)
......
...@@ -190,6 +190,8 @@ extern bool wmi_has_guid(const char *guid); ...@@ -190,6 +190,8 @@ extern bool wmi_has_guid(const char *guid);
extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
extern long acpi_is_video_device(struct acpi_device *device); extern long acpi_is_video_device(struct acpi_device *device);
extern void acpi_video_dmi_promote_vendor(void);
extern void acpi_video_dmi_demote_vendor(void);
extern int acpi_video_backlight_support(void); extern int acpi_video_backlight_support(void);
extern int acpi_video_display_switch_support(void); extern int acpi_video_display_switch_support(void);
...@@ -205,6 +207,14 @@ static inline long acpi_is_video_device(struct acpi_device *device) ...@@ -205,6 +207,14 @@ static inline long acpi_is_video_device(struct acpi_device *device)
return 0; return 0;
} }
static inline void acpi_video_dmi_promote_vendor(void)
{
}
static inline void acpi_video_dmi_demote_vendor(void)
{
}
static inline int acpi_video_backlight_support(void) static inline int acpi_video_backlight_support(void)
{ {
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册