aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video_detect.c
diff options
context:
space:
mode:
authorCorentin Chary <corentin.chary@gmail.com>2012-06-13 03:32:01 -0400
committerMatthew Garrett <mjg@redhat.com>2012-07-28 00:11:48 -0400
commitf838eb5bd257e8a666aa8c451058fa198df7e299 (patch)
tree4a0ce12abef63c20367256b24f1bdf183f284238 /drivers/acpi/video_detect.c
parent1eb3fe1d3b6b9bf6045eb12f0c3ac12569169870 (diff)
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: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/acpi/video_detect.c')
-rw-r--r--drivers/acpi/video_detect.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 45d8097ef4cf..942fa2a998f7 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -182,8 +182,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
182} 182}
183EXPORT_SYMBOL(acpi_video_get_capabilities); 183EXPORT_SYMBOL(acpi_video_get_capabilities);
184 184
185/* Returns true if video.ko can do backlight switching */ 185static void acpi_video_caps_check(void)
186int acpi_video_backlight_support(void)
187{ 186{
188 /* 187 /*
189 * We must check whether the ACPI graphics device is physically plugged 188 * We must check whether the ACPI graphics device is physically plugged
@@ -191,6 +190,34 @@ int acpi_video_backlight_support(void)
191 */ 190 */
192 if (!acpi_video_caps_checked) 191 if (!acpi_video_caps_checked)
193 acpi_video_get_capabilities(NULL); 192 acpi_video_get_capabilities(NULL);
193}
194
195/* Promote the vendor interface instead of the generic video module.
196 * This function allow DMI blacklists to be implemented by externals
197 * platform drivers instead of putting a big blacklist in video_detect.c
198 * After calling this function you will probably want to call
199 * acpi_video_unregister() to make sure the video module is not loaded
200 */
201void acpi_video_dmi_promote_vendor(void)
202{
203 acpi_video_caps_check();
204 acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
205}
206EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
207
208/* To be called when a driver who previously promoted the vendor
209 * interface */
210void acpi_video_dmi_demote_vendor(void)
211{
212 acpi_video_caps_check();
213 acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
214}
215EXPORT_SYMBOL(acpi_video_dmi_demote_vendor);
216
217/* Returns true if video.ko can do backlight switching */
218int acpi_video_backlight_support(void)
219{
220 acpi_video_caps_check();
194 221
195 /* First check for boot param -> highest prio */ 222 /* First check for boot param -> highest prio */
196 if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) 223 if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR)