diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 05dff631591c..b765790b32be 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -78,6 +78,13 @@ MODULE_LICENSE("GPL"); | |||
78 | static int brightness_switch_enabled = 1; | 78 | static int brightness_switch_enabled = 1; |
79 | module_param(brightness_switch_enabled, bool, 0644); | 79 | module_param(brightness_switch_enabled, bool, 0644); |
80 | 80 | ||
81 | /* | ||
82 | * By default, we don't allow duplicate ACPI video bus devices | ||
83 | * under the same VGA controller | ||
84 | */ | ||
85 | static int allow_duplicates; | ||
86 | module_param(allow_duplicates, bool, 0644); | ||
87 | |||
81 | static int register_count = 0; | 88 | static int register_count = 0; |
82 | static int acpi_video_bus_add(struct acpi_device *device); | 89 | static int acpi_video_bus_add(struct acpi_device *device); |
83 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 90 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
@@ -999,8 +1006,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
999 | sprintf(name, "acpi_video%d", count++); | 1006 | sprintf(name, "acpi_video%d", count++); |
1000 | device->backlight = backlight_device_register(name, | 1007 | device->backlight = backlight_device_register(name, |
1001 | NULL, device, &acpi_backlight_ops); | 1008 | NULL, device, &acpi_backlight_ops); |
1002 | device->backlight->props.max_brightness = device->brightness->count-3; | ||
1003 | kfree(name); | 1009 | kfree(name); |
1010 | if (IS_ERR(device->backlight)) | ||
1011 | return; | ||
1012 | device->backlight->props.max_brightness = device->brightness->count-3; | ||
1004 | 1013 | ||
1005 | result = sysfs_create_link(&device->backlight->dev.kobj, | 1014 | result = sysfs_create_link(&device->backlight->dev.kobj, |
1006 | &device->dev->dev.kobj, "device"); | 1015 | &device->dev->dev.kobj, "device"); |
@@ -1979,6 +1988,10 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1979 | unsigned long long level_current, level_next; | 1988 | unsigned long long level_current, level_next; |
1980 | int result = -EINVAL; | 1989 | int result = -EINVAL; |
1981 | 1990 | ||
1991 | /* no warning message if acpi_backlight=vendor is used */ | ||
1992 | if (!acpi_video_backlight_support()) | ||
1993 | return 0; | ||
1994 | |||
1982 | if (!device->brightness) | 1995 | if (!device->brightness) |
1983 | goto out; | 1996 | goto out; |
1984 | 1997 | ||
@@ -2233,11 +2246,47 @@ static int acpi_video_resume(struct acpi_device *device) | |||
2233 | return AE_OK; | 2246 | return AE_OK; |
2234 | } | 2247 | } |
2235 | 2248 | ||
2249 | static acpi_status | ||
2250 | acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | ||
2251 | void **return_value) | ||
2252 | { | ||
2253 | struct acpi_device *device = context; | ||
2254 | struct acpi_device *sibling; | ||
2255 | int result; | ||
2256 | |||
2257 | if (handle == device->handle) | ||
2258 | return AE_CTRL_TERMINATE; | ||
2259 | |||
2260 | result = acpi_bus_get_device(handle, &sibling); | ||
2261 | if (result) | ||
2262 | return AE_OK; | ||
2263 | |||
2264 | if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) | ||
2265 | return AE_ALREADY_EXISTS; | ||
2266 | |||
2267 | return AE_OK; | ||
2268 | } | ||
2269 | |||
2236 | static int acpi_video_bus_add(struct acpi_device *device) | 2270 | static int acpi_video_bus_add(struct acpi_device *device) |
2237 | { | 2271 | { |
2238 | struct acpi_video_bus *video; | 2272 | struct acpi_video_bus *video; |
2239 | struct input_dev *input; | 2273 | struct input_dev *input; |
2240 | int error; | 2274 | int error; |
2275 | acpi_status status; | ||
2276 | |||
2277 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
2278 | device->parent->handle, 1, | ||
2279 | acpi_video_bus_match, NULL, | ||
2280 | device, NULL); | ||
2281 | if (status == AE_ALREADY_EXISTS) { | ||
2282 | printk(KERN_WARNING FW_BUG | ||
2283 | "Duplicate ACPI video bus devices for the" | ||
2284 | " same VGA controller, please try module " | ||
2285 | "parameter \"video.allow_duplicates=1\"" | ||
2286 | "if the current driver doesn't work.\n"); | ||
2287 | if (!allow_duplicates) | ||
2288 | return -ENODEV; | ||
2289 | } | ||
2241 | 2290 | ||
2242 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 2291 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
2243 | if (!video) | 2292 | if (!video) |