Loading drivers/acpi/video.c +45 −10 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ static int acpi_video_device_lcd_get_level_current( unsigned long long *level); static int acpi_video_get_next_level(struct acpi_video_device *device, u32 level_current, u32 event); static void acpi_video_switch_brightness(struct acpi_video_device *device, static int acpi_video_switch_brightness(struct acpi_video_device *device, int event); static int acpi_video_device_get_state(struct acpi_video_device *device, unsigned long long *state); Loading @@ -308,7 +308,9 @@ static int acpi_video_get_brightness(struct backlight_device *bd) int i; struct acpi_video_device *vd = (struct acpi_video_device *)bl_get_data(bd); acpi_video_device_lcd_get_level_current(vd, &cur_level); if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) return -EINVAL; for (i = 2; i < vd->brightness->count; i++) { if (vd->brightness->levels[i] == cur_level) /* The first two entries are special - see page 575 Loading Loading @@ -373,7 +375,8 @@ static int video_get_cur_state(struct thermal_cooling_device *cdev, char *buf) unsigned long long level; int state; acpi_video_device_lcd_get_level_current(video, &level); if (acpi_video_device_lcd_get_level_current(video, &level)) return -EINVAL; for (state = 2; state < video->brightness->count; state++) if (level == video->brightness->levels[state]) return sprintf(buf, "%d\n", Loading Loading @@ -502,11 +505,29 @@ static int acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, unsigned long long *level) { if (device->cap._BQC) return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); acpi_status status = AE_OK; if (device->cap._BQC) { status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); if (ACPI_SUCCESS(status)) { device->brightness->curr = *level; return 0; } else { /* Fixme: * should we return an error or ignore this failure? * dev->brightness->curr is a cached value which stores * the correct current backlight level in most cases. * ACPI video backlight still works w/ buggy _BQC. * http://bugzilla.kernel.org/show_bug.cgi?id=12233 */ ACPI_WARNING((AE_INFO, "Evaluating _BQC failed")); device->cap._BQC = 0; } } *level = device->brightness->curr; return AE_OK; return 0; } static int Loading Loading @@ -1749,15 +1770,29 @@ acpi_video_get_next_level(struct acpi_video_device *device, } } static void static int acpi_video_switch_brightness(struct acpi_video_device *device, int event) { unsigned long long level_current, level_next; int result = -EINVAL; if (!device->brightness) return; acpi_video_device_lcd_get_level_current(device, &level_current); goto out; result = acpi_video_device_lcd_get_level_current(device, &level_current); if (result) goto out; level_next = acpi_video_get_next_level(device, level_current, event); acpi_video_device_lcd_set_level(device, level_next); out: if (result) printk(KERN_ERR PREFIX "Failed to switch the brightness\n"); return result; } static int Loading Loading
drivers/acpi/video.c +45 −10 Original line number Diff line number Diff line Loading @@ -294,7 +294,7 @@ static int acpi_video_device_lcd_get_level_current( unsigned long long *level); static int acpi_video_get_next_level(struct acpi_video_device *device, u32 level_current, u32 event); static void acpi_video_switch_brightness(struct acpi_video_device *device, static int acpi_video_switch_brightness(struct acpi_video_device *device, int event); static int acpi_video_device_get_state(struct acpi_video_device *device, unsigned long long *state); Loading @@ -308,7 +308,9 @@ static int acpi_video_get_brightness(struct backlight_device *bd) int i; struct acpi_video_device *vd = (struct acpi_video_device *)bl_get_data(bd); acpi_video_device_lcd_get_level_current(vd, &cur_level); if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) return -EINVAL; for (i = 2; i < vd->brightness->count; i++) { if (vd->brightness->levels[i] == cur_level) /* The first two entries are special - see page 575 Loading Loading @@ -373,7 +375,8 @@ static int video_get_cur_state(struct thermal_cooling_device *cdev, char *buf) unsigned long long level; int state; acpi_video_device_lcd_get_level_current(video, &level); if (acpi_video_device_lcd_get_level_current(video, &level)) return -EINVAL; for (state = 2; state < video->brightness->count; state++) if (level == video->brightness->levels[state]) return sprintf(buf, "%d\n", Loading Loading @@ -502,11 +505,29 @@ static int acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, unsigned long long *level) { if (device->cap._BQC) return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); acpi_status status = AE_OK; if (device->cap._BQC) { status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); if (ACPI_SUCCESS(status)) { device->brightness->curr = *level; return 0; } else { /* Fixme: * should we return an error or ignore this failure? * dev->brightness->curr is a cached value which stores * the correct current backlight level in most cases. * ACPI video backlight still works w/ buggy _BQC. * http://bugzilla.kernel.org/show_bug.cgi?id=12233 */ ACPI_WARNING((AE_INFO, "Evaluating _BQC failed")); device->cap._BQC = 0; } } *level = device->brightness->curr; return AE_OK; return 0; } static int Loading Loading @@ -1749,15 +1770,29 @@ acpi_video_get_next_level(struct acpi_video_device *device, } } static void static int acpi_video_switch_brightness(struct acpi_video_device *device, int event) { unsigned long long level_current, level_next; int result = -EINVAL; if (!device->brightness) return; acpi_video_device_lcd_get_level_current(device, &level_current); goto out; result = acpi_video_device_lcd_get_level_current(device, &level_current); if (result) goto out; level_next = acpi_video_get_next_level(device, level_current, event); acpi_video_device_lcd_set_level(device, level_next); out: if (result) printk(KERN_ERR PREFIX "Failed to switch the brightness\n"); return result; } static int Loading