Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[pandora-kernel.git] / drivers / acpi / video.c
index a695aeb..0771b43 100644 (file)
@@ -40,7 +40,6 @@
 
 #define ACPI_VIDEO_COMPONENT           0x08000000
 #define ACPI_VIDEO_CLASS               "video"
-#define ACPI_VIDEO_DRIVER_NAME         "ACPI Video Driver"
 #define ACPI_VIDEO_BUS_NAME            "Video Bus"
 #define ACPI_VIDEO_DEVICE_NAME         "Video Device"
 #define ACPI_VIDEO_NOTIFY_SWITCH       0x80
 #define ACPI_VIDEO_DISPLAY_LCD 4
 
 #define _COMPONENT             ACPI_VIDEO_COMPONENT
-ACPI_MODULE_NAME("acpi_video")
+ACPI_MODULE_NAME("video");
 
-    MODULE_AUTHOR("Bruno Ducrot");
-MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME);
+MODULE_AUTHOR("Bruno Ducrot");
+MODULE_DESCRIPTION("ACPI Video Driver");
 MODULE_LICENSE("GPL");
 
 static int acpi_video_bus_add(struct acpi_device *device);
 static int acpi_video_bus_remove(struct acpi_device *device, int type);
-static int acpi_video_bus_match(struct acpi_device *device,
-                               struct acpi_driver *driver);
 
 static struct acpi_driver acpi_video_bus = {
-       .name = ACPI_VIDEO_DRIVER_NAME,
+       .name = "video",
        .class = ACPI_VIDEO_CLASS,
+       .ids = ACPI_VIDEO_HID,
        .ops = {
                .add = acpi_video_bus_add,
                .remove = acpi_video_bus_remove,
-               .match = acpi_video_bus_match,
                },
 };
 
@@ -172,7 +169,6 @@ struct acpi_video_device {
        struct acpi_device *dev;
        struct acpi_video_device_brightness *brightness;
        struct backlight_device *backlight;
-       struct backlight_properties *data;
 };
 
 /* bus */
@@ -289,13 +285,18 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
 
 static int acpi_video_set_brightness(struct backlight_device *bd)
 {
-       int request_level = bd->props->brightness;
+       int request_level = bd->props.brightness;
        struct acpi_video_device *vd =
                (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
        acpi_video_device_lcd_set_level(vd, request_level);
        return 0;
 }
 
+static struct backlight_ops acpi_backlight_ops = {
+       .get_brightness = acpi_video_get_brightness,
+       .update_status  = acpi_video_set_brightness,
+};
+
 /* --------------------------------------------------------------------------
                                Video Management
    -------------------------------------------------------------------------- */
@@ -611,31 +612,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
                unsigned long tmp;
                static int count = 0;
                char *name;
-               struct backlight_properties *acpi_video_data;
-
                name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
                if (!name)
                        return;
 
-               acpi_video_data = kzalloc(
-                       sizeof(struct backlight_properties),
-                       GFP_KERNEL);
-               if (!acpi_video_data){
-                       kfree(name);
-                       return;
-               }
-               acpi_video_data->owner = THIS_MODULE;
-               acpi_video_data->get_brightness =
-                       acpi_video_get_brightness;
-               acpi_video_data->update_status =
-                       acpi_video_set_brightness;
                sprintf(name, "acpi_video%d", count++);
-               device->data = acpi_video_data;
-               acpi_video_data->max_brightness = max_level;
                acpi_video_device_lcd_get_level_current(device, &tmp);
-               acpi_video_data->brightness = (int)tmp;
                device->backlight = backlight_device_register(name,
-                       NULL, device, acpi_video_data);
+                       NULL, device, &acpi_backlight_ops);
+               device->backlight->props.max_brightness = max_level;
+               device->backlight->props.brightness = (int)tmp;
+               backlight_update_status(device->backlight);
+
                kfree(name);
        }
        return;
@@ -1680,10 +1668,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
        status = acpi_remove_notify_handler(device->dev->handle,
                                            ACPI_DEVICE_NOTIFY,
                                            acpi_video_device_notify);
-       if (device->backlight){
-               backlight_device_unregister(device->backlight);
-               kfree(device->data);
-       }
+       backlight_device_unregister(device->backlight);
        return 0;
 }
 
@@ -1885,39 +1870,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
        return 0;
 }
 
-static int
-acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
-{
-       acpi_handle h_dummy1;
-       acpi_handle h_dummy2;
-       acpi_handle h_dummy3;
-
-
-       if (!device || !driver)
-               return -EINVAL;
-
-       /* Since there is no HID, CID for ACPI Video drivers, we have
-        * to check well known required nodes for each feature we support.
-        */
-
-       /* Does this device able to support video switching ? */
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
-           ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
-               return 0;
-
-       /* Does this device able to retrieve a video ROM ? */
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
-               return 0;
-
-       /* Does this device able to configure which video head to be POSTed ? */
-       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
-           ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
-           ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
-               return 0;
-
-       return -ENODEV;
-}
-
 static int __init acpi_video_init(void)
 {
        int result = 0;