Index: xserver-xorg-video-intel-2.17.0/src/intel_display.c =================================================================== --- xserver-xorg-video-intel-2.17.0.orig/src/intel_display.c 2012-01-15 15:38:03.000000000 +0200 +++ xserver-xorg-video-intel-2.17.0/src/intel_display.c 2012-01-15 15:56:32.000000000 +0200 @@ -118,7 +118,8 @@ #define BACKLIGHT_CLASS "/sys/class/backlight" /* - * List of available kernel interfaces in priority order + * List of available kernel interfaces in priority order. + * May be overridden by a model-specific workaround. */ static const char *backlight_interfaces[] = { "asus-laptop", @@ -240,28 +241,55 @@ return max; } +static Bool +intel_output_backlight_probe(xf86OutputPtr output, const char *iface) +{ + struct intel_output *intel_output = output->driver_private; + char path[BACKLIGHT_PATH_LEN]; + struct stat buf; + + sprintf(path, "%s/%s", BACKLIGHT_CLASS, iface); + if (!stat(path, &buf)) { + intel_output->backlight_iface = iface; + intel_output->backlight_max = intel_output_backlight_get_max(output); + if (intel_output->backlight_max > 0) { + intel_output->backlight_active_level = intel_output_backlight_get(output); + xf86DrvMsg(output->scrn->scrnIndex, X_INFO, + "found backlight control interface %s\n", path); + return TRUE; + } + } + + return FALSE; +} + static void intel_output_backlight_init(xf86OutputPtr output) { struct intel_output *intel_output = output->driver_private; + intel_screen_private *intel = intel_get_screen_private(output->scrn); int i; - for (i = 0; backlight_interfaces[i] != NULL; i++) { - char path[BACKLIGHT_PATH_LEN]; - struct stat buf; + /* Debian bug 651741: With Linux 3.1.0 on Sony VAIO VPCYA1V9E, + * both acpi_video0 and intel_backlight exist and can be + * adjusted, but only intel_backlight affects the display. + */ + if (VENDOR_ID(intel->PciInfo) == 0x8086 /* Intel */ + && DEVICE_ID(intel->PciInfo) == PCI_CHIP_IRONLAKE_M_G + && CHIP_REVISION(intel->PciInfo) == 0x02 + && SUBVENDOR_ID(intel->PciInfo) == 0x104d /* Sony */ + && SUBSYS_ID(intel->PciInfo) == 0x907c) { + xf86DrvMsg(output->scrn->scrnIndex, X_INFO, + "will prefer intel_backlight on this Sony VAIO model\n"); + if (intel_output_backlight_probe(output, "intel_backlight")) + return; + } - sprintf(path, "%s/%s", BACKLIGHT_CLASS, backlight_interfaces[i]); - if (!stat(path, &buf)) { - intel_output->backlight_iface = backlight_interfaces[i]; - intel_output->backlight_max = intel_output_backlight_get_max(output); - if (intel_output->backlight_max > 0) { - intel_output->backlight_active_level = intel_output_backlight_get(output); - xf86DrvMsg(output->scrn->scrnIndex, X_INFO, - "found backlight control interface %s\n", path); - return; - } - } + for (i = 0; backlight_interfaces[i] != NULL; i++) { + if (intel_output_backlight_probe(output, backlight_interfaces[i])) + return; } + intel_output->backlight_iface = NULL; }