diff options
Diffstat (limited to 'drivers/acpi/video_detect.c')
-rw-r--r-- | drivers/acpi/video_detect.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 45d8097ef4cf..b728880ef10e 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -132,6 +132,33 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
132 | return AE_OK; | 132 | return AE_OK; |
133 | } | 133 | } |
134 | 134 | ||
135 | /* Force to use vendor driver when the ACPI device is known to be | ||
136 | * buggy */ | ||
137 | static int video_detect_force_vendor(const struct dmi_system_id *d) | ||
138 | { | ||
139 | acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static struct dmi_system_id video_detect_dmi_table[] = { | ||
144 | /* On Samsung X360, the BIOS will set a flag (VDRV) if generic | ||
145 | * ACPI backlight device is used. This flag will definitively break | ||
146 | * the backlight interface (even the vendor interface) untill next | ||
147 | * reboot. It's why we should prevent video.ko from being used here | ||
148 | * and we can't rely on a later call to acpi_video_unregister(). | ||
149 | */ | ||
150 | { | ||
151 | .callback = video_detect_force_vendor, | ||
152 | .ident = "X360", | ||
153 | .matches = { | ||
154 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
155 | DMI_MATCH(DMI_PRODUCT_NAME, "X360"), | ||
156 | DMI_MATCH(DMI_BOARD_NAME, "X360"), | ||
157 | }, | ||
158 | }, | ||
159 | { }, | ||
160 | }; | ||
161 | |||
135 | /* | 162 | /* |
136 | * Returns the video capabilities of a specific ACPI graphics device | 163 | * Returns the video capabilities of a specific ACPI graphics device |
137 | * | 164 | * |
@@ -164,6 +191,8 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle) | |||
164 | * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | 191 | * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; |
165 | *} | 192 | *} |
166 | */ | 193 | */ |
194 | |||
195 | dmi_check_system(video_detect_dmi_table); | ||
167 | } else { | 196 | } else { |
168 | status = acpi_bus_get_device(graphics_handle, &tmp_dev); | 197 | status = acpi_bus_get_device(graphics_handle, &tmp_dev); |
169 | if (ACPI_FAILURE(status)) { | 198 | if (ACPI_FAILURE(status)) { |
@@ -182,8 +211,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle) | |||
182 | } | 211 | } |
183 | EXPORT_SYMBOL(acpi_video_get_capabilities); | 212 | EXPORT_SYMBOL(acpi_video_get_capabilities); |
184 | 213 | ||
185 | /* Returns true if video.ko can do backlight switching */ | 214 | static void acpi_video_caps_check(void) |
186 | int acpi_video_backlight_support(void) | ||
187 | { | 215 | { |
188 | /* | 216 | /* |
189 | * We must check whether the ACPI graphics device is physically plugged | 217 | * We must check whether the ACPI graphics device is physically plugged |
@@ -191,6 +219,34 @@ int acpi_video_backlight_support(void) | |||
191 | */ | 219 | */ |
192 | if (!acpi_video_caps_checked) | 220 | if (!acpi_video_caps_checked) |
193 | acpi_video_get_capabilities(NULL); | 221 | acpi_video_get_capabilities(NULL); |
222 | } | ||
223 | |||
224 | /* Promote the vendor interface instead of the generic video module. | ||
225 | * This function allow DMI blacklists to be implemented by externals | ||
226 | * platform drivers instead of putting a big blacklist in video_detect.c | ||
227 | * After calling this function you will probably want to call | ||
228 | * acpi_video_unregister() to make sure the video module is not loaded | ||
229 | */ | ||
230 | void acpi_video_dmi_promote_vendor(void) | ||
231 | { | ||
232 | acpi_video_caps_check(); | ||
233 | acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | ||
234 | } | ||
235 | EXPORT_SYMBOL(acpi_video_dmi_promote_vendor); | ||
236 | |||
237 | /* To be called when a driver who previously promoted the vendor | ||
238 | * interface */ | ||
239 | void acpi_video_dmi_demote_vendor(void) | ||
240 | { | ||
241 | acpi_video_caps_check(); | ||
242 | acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | ||
243 | } | ||
244 | EXPORT_SYMBOL(acpi_video_dmi_demote_vendor); | ||
245 | |||
246 | /* Returns true if video.ko can do backlight switching */ | ||
247 | int acpi_video_backlight_support(void) | ||
248 | { | ||
249 | acpi_video_caps_check(); | ||
194 | 250 | ||
195 | /* First check for boot param -> highest prio */ | 251 | /* First check for boot param -> highest prio */ |
196 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) | 252 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) |