Provide workarounds to use DRM/KMS with broken graphics hardware
Subsystems (4)
v2 cover Provide workarounds to use DRM/KMS with broken graphics hardware
This is V2 of a patchset to use DRM/KMS with broken graphics hardware.
As a major change from V1, generic EDID data are now built-in into the drm_kms_helper module as proposed by Alan. To help people building their own EDID data and to understand how the binary EDID blobs in drivers/gpu/drm/drm_edid_load.c have been created, the entire material went into the Documentation tree as suggested by Valdis. Finally, David showed a much better way to explicitly disable and enable a particular connector, so patch 02/03 could go.
The two remaining patches
- introduce a mechanism to define or load EDID data instead of letting the controller probe for it,
- add a parameter to the i915 module to invert the sense of the backlight brightness variable for broken controllers that require this.
-Carsten.
PATCH v2 1/2 drivers-gpu-drm-allow-to-load-edid-firmware.patch
Broken monitors and/or broken graphic boards may send erroneous or no EDID data. This also applies to broken KVM devices that are unable to correctly forward the EDID data of the connected monitor but invent their own fantasy data.
This patch allows to specify an EDID data set to be used instead of probing the monitor for it. It contains built-in data sets of frequently used screen resolutions. In addition, a particular EDID data set may be provided in the /lib/firmware directory and loaded via the firmware interface. The name is passed to the kernel as module parameter of the drm_kms_helper module either when loaded
options drm_kms_helper edid_firmware=edid/1280x1024.bin
or as kernel commandline parameter
drm_kms_helper.edid_firmware=edid/1280x1024.bin
The built-in data sets are
Resolution Name
--------------------------------
1024x768 edid/1024x768.bin 1280x1024 edid/1280x1024.bin 1680x1050 edid/1680x1050.bin 1920x1080 edid/1920x1080.bin
They are ignored, if a file with the same name is available in the /lib/firmware directory.
The built-in EDID data sets are based on standard timings that may not apply to a particular monitor and even crash it. Ideally, EDID data of the connected monitor should be used. They may be obtained through the drm/cardX/cardX-<connector>/edid entry in the /sys/devices PCI directory of a correctly working graphics adapter.
It is also possible to specify the name of an EDID data set on-the-fly via the /sys/module interface, e.g.
echo edid/myedid.bin >/sys/module/drm_kms_helper/parameters/edid_firmware The new screen mode is considered when the related kernel function is called for the first time after the change. Such calls are made when the X server is started or when the display settings dialog is opened in an already running X server.
--- Documentation/EDID/1024x768.S | 44 ++++++ Documentation/EDID/1280x1024.S | 44 ++++++ Documentation/EDID/1680x1050.S | 44 ++++++ Documentation/EDID/1920x1080.S | 44 ++++++ Documentation/EDID/HOWTO.txt | 39 +++++ Documentation/EDID/Makefile | 25 +++ Documentation/EDID/edid.S | 261 ++++++++++++++++++++++++++++++++++++ Documentation/EDID/hex | 1 Documentation/kernel-parameters.txt | 10 + drivers/gpu/drm/Kconfig | 11 + drivers/gpu/drm/Makefile | 3 drivers/gpu/drm/drm_crtc_helper.c | 8 - drivers/gpu/drm/drm_edid.c | 4 drivers/gpu/drm/drm_edid_load.c | 241 +++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 1 include/drm/drm_edid.h | 1 16 files changed, 778 insertions(+), 3 deletions(-)
Documentation/EDID/1024x768.S new file +44 -0
@@ -0,0 +1,44 @@ +/* + 1024x768.S: EDID data set for standard 1024x768 60 Hz monitor + + Copyright (C) 2011 Carsten Emde <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +/* EDID */ +#define VERSION 1 +#define REVISION 3 + +/* Display */ +#define CLOCK 65000 /* kHz */ +#define XPIX 1024 +#define YPIX 768 +#define XY_RATIO XY_RATIO_4_3 +#define XBLANK 320 +#define YBLANK 38 +#define XOFFSET 8 +#define XPULSE 144 +#define YOFFSET (63+3) +#define YPULSE (63+6) +#define DPI 72 +#define VFREQ 60 /* Hz */ +#define TIMING_NAME "Linux XGA" +#define ESTABLISHED_TIMINGS_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */ +#define HSYNC_POL 0 +#define VSYNC_POL 0 +#define CRC 0x55 + +#include "edid.S"
Documentation/EDID/1280x1024.S new file +44 -0
44 lines not on this page · raw message
Documentation/EDID/1680x1050.S new file +44 -0
44 lines not on this page · raw message
Documentation/EDID/1920x1080.S new file +44 -0
44 lines not on this page · raw message
Documentation/EDID/HOWTO.txt new file +39 -0
@@ -0,0 +1,39 @@ +In the good old days when graphics parameters were configured explicitly +in a file called xorg.conf, even broken hardware could be managed. + +Today, with the advent of Kernel Mode Setting, a graphics board is +either correctly working because all components follow the standards - +or the computer is unusable, because the screen remains dark after +booting or it displays the wrong area. Cases when this happens are: +- The graphics board does not recognize the monitor. +- The graphics board is unable to detect any EDID data. +- The graphics board incorrectly forwards EDID data to the driver. +- The monitor sends no or bogus EDID data. +- A KVM sends its own EDID data instead of querying the connected monitor. +Adding the kernel parameter "nomodeset" helps in most cases, but causes +restrictions later on. + +As a remedy for such situations, the kernel configuration item +CONFIG_DRM_LOAD_EDID_FIRMWARE was introduced. It allows to provide an +individually prepared or corrected EDID data set in the /lib/firmware +directory from where it is loaded via the firmware interface. The code +(see drivers/gpu/drm/drm_edid_load.c) contains built-in data sets for +commonly used screen resolutions (1024x768, 1280x1024, 1680x1050, +1920x1080) as binary blobs, but the kernel source tree does not contain +code to create these data. In order to elucidate the origin of the +built-in binary EDID blobs and to facilitate the creation of individual +data for a specific misbehaving monitor, commented sources and a +Makefile environment are given here. + +To create binary EDID and C source code files from the existing data +material, simply type "make". + +If you want to create your own EDID file, copy the file 1024x768.S and +replace the settings with your own data. The CRC value in the last line + #define CRC 0x55 +is a bit tricky. After a first version of the binary data set is +created, it must be be checked with the "edid-decode" utility which will +most probably complain about a wrong CRC. Fortunately, the utility also +displays the correct CRC which must then be inserted into the source +file. After the make procedure is repeated, the EDID data set is ready +to be used.
Documentation/EDID/Makefile new file +25 -0
@@ -0,0 +1,25 @@ + +SOURCES := $(wildcard [0-9]*x[0-9]*.S) + +BIN := $(patsubst %.S, %.bin, $(SOURCES)) + +IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES)) + +CODE := $(patsubst %.S, %.c, $(SOURCES)) + +all: $(BIN) $(IHEX) $(CODE) + +clean: + @rm -f *.o *.bin.ihex *.bin *.c + +%.o: %.S + @cc -c $^ + +%.bin: %.o + @objcopy -Obinary $^ $@ + +%.bin.ihex: %.o + @objcopy -Oihex $^ $@ + +%.c: %.bin + @echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@
Documentation/EDID/edid.S new file +261 -0
261 lines not on this page · raw message
Documentation/EDID/hex new file +1 -0
@@ -0,0 +1 @@ +"\t" 8/1 "0x%02x, " "\n"
Documentation/kernel-parameters.txt +10 -0
@@ -713,6 +713,16 @@ bytes respectively. Such letter suffixes The filter can be disabled or changed to another driver later using sysfs. + drm_kms_helper.edid_firmware=<file> + Broken monitors, graphic adapters and KVMs may + send no or broken EDID data sets. This parameter + allows to specify an EDID data set in the + /lib/firmware directory that is used instead. + Generic built-in EDID data sets are used, if one of + edid/1024x768.bin, edid/1280x1024.bin, + edid/1680x1050.bin, or edid/1920x1080.bin is given + and no file with the same name exists. + dscc4.setup= [NET] earlycon= [KNL] Output early console device and options.
drivers/gpu/drm/Kconfig +11 -0
@@ -27,6 +27,17 @@ config DRM_KMS_HELPER help FB and CRTC helpers for KMS drivers. +config DRM_LOAD_EDID_FIRMWARE + bool "Allow to specify an EDID data set instead of probing for it" + depends on DRM_KMS_HELPER + help + Say Y here, if you want to use EDID data to be loaded from the + /lib/firmware directory or one of the provided built-in + data sets. This may be necessary, if the graphics adapter or + monitor are unable to provide appropriate EDID data. Since this + feature is provided as a workaround for broken hardware, the + default case is N. + config DRM_TTM tristate depends on DRM
drivers/gpu/drm/Makefile +3 -0
@@ -17,6 +17,9 @@ drm-y := drm_auth.o drm_buffer.o d drm-$(CONFIG_COMPAT) += drm_ioc32.o drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_i2c_helper.o +ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE +drm_kms_helper-y += drm_edid_load.o +endif obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
drivers/gpu/drm/drm_crtc_helper.c +7 -1
@@ -37,6 +37,7 @@#include "drm_fourcc.h" #include "drm_crtc_helper.h" #include "drm_fb_helper.h" +#include "drm_edid.h" static bool drm_kms_helper_poll = true;module_param_named (poll, drm_kms_helper_poll, bool,0600 );
@@ -118,7 +119,12 @@ int drm_helper_probe_single_connector_mo goto prune; } - count = (*connector_funcs->get_modes)(connector); +#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE + count =load_edid_firmware (connector); + if (count == 0) +#endif + count = (*connector_funcs->get_modes)(connector); +if (count ==0 && connector->status == connector_status_connected) count =drm_add_modes_noedid (connector,1024 ,768 );if (count ==0 )
drivers/gpu/drm/drm_edid.c +2 -2
@@ -149,8 +149,7 @@ EXPORT_SYMBOL(drm_edid_header_is_valid);* Sanity check the EDID block (base or extension). Return 0 if the block * doesn't check out, or 1 if it's valid. */ -static bool -drm_edid_block_valid (u8 *raw_edid) +bool drm_edid_block_valid (u8 *raw_edid) {int i;u8 csum =0 ;
@@ -203,6 +202,7 @@ bad: }return 0 ; } +EXPORT_SYMBOL (drm_edid_block_valid);/** * drm_edid_is_valid - sanity check EDID data
drivers/gpu/drm/drm_edid_load.c new file +241 -0
241 lines not on this page · raw message
include/drm/drm_crtc.h +1 -0
@@ -995,6 +995,7 @@ extern int drm_add_modes_noedid(struct d int hdisplay, int vdisplay);extern int drm_edid_header_is_valid (const u8 *raw_edid); +extern bool drm_edid_block_valid (u8 *raw_edid);extern bool drm_edid_is_valid (struct edid *edid);struct drm_display_mode *drm_mode_find_dmt (struct drm_device *dev,int hsize,int vsize,int fresh);
include/drm/drm_edid.h +1 -0
@@ -238,5 +238,6 @@ int drm_av_sync_delay(struct drm_connect struct drm_display_mode *mode);struct drm_connector *drm_select_eld (struct drm_encoder *encoder,struct drm_display_mode *mode); +int load_edid_firmware (struct drm_connector *connector);#endif /* __DRM_EDID_H__ */
Re: [V2 PATCH 1/2] drivers-gpu-drm-allow-to-load-edid-firmware.patch
Dear Carsten,
Am Donnerstag, den 15.03.2012, 00:35 +0100 schrieb Carsten Emde:
Quoted 2 lines
Einfaches Textdokument-Anlage (drivers-gpu-drm-allow-to-load-edid-firmware.patch)
somehow your message was send as an attachment. Could you configure your mailer (quilt) that it is send inline?
Quoted 60 lines
Broken monitors and/or broken graphic boards may send erroneous or no EDID data. This also applies to broken KVM devices that are unable to correctly forward the EDID data of the connected monitor but invent their own fantasy data.
This patch allows to specify an EDID data set to be used instead of probing the monitor for it. It contains built-in data sets of frequently used screen resolutions. In addition, a particular EDID data set may be provided in the
/lib/firmwaredirectory and loaded via the firmware interface. The name is passed to the kernel as module parameter of thedrm_kms_helpermodule either when loaded
optionsdrm_kms_helperedid_firmware=edid/1280x1024.bin
or as kernel commandline parameter
drm_kms_helper.edid_firmware=edid/1280x1024.binThe built-in data sets are
Resolution Name
--------------------------------1024x768 edid/1024x768.bin 1280x1024 edid/1280x1024.bin 1680x1050 edid/1680x1050.bin 1920x1080 edid/1920x1080.binThey are ignored, if a file with the same name is available in the
/lib/firmwaredirectory.The built-in EDID data sets are based on standard timings that may not apply to a particular monitor and even crash it. Ideally, EDID data of the connected monitor should be used. They may be obtained through the drm/cardX/cardX-<connector>/edid entry in the
/sys/devicesPCI directory of a correctly working graphics adapter.It is also possible to specify the name of an EDID data set on-the-fly via the
/sys/moduleinterface, e.g.
echo edid/myedid.bin >/sys/module/drm_kms_helper/parameters/edid_firmware The new screen mode is considered when the related kernel function is called for the first time after the change. Such calls are made when the X server is started or when the display settings dialog is opened in an already running X server.Signed-off-by Carsten Emde <[email protected]>--- Documentation/EDID/1024x768.S | 44 ++++++ Documentation/EDID/1280x1024.S | 44 ++++++ Documentation/EDID/1680x1050.S | 44 ++++++ Documentation/EDID/1920x1080.S | 44 ++++++ Documentation/EDID/HOWTO.txt | 39 +++++ Documentation/EDID/Makefile | 25 +++ Documentation/EDID/edid.S | 261 ++++++++++++++++++++++++++++++++++++ Documentation/EDID/hex | 1 Documentation/kernel-parameters.txt | 10 + drivers/gpu/drm/Kconfig | 11 + drivers/gpu/drm/Makefile | 3 drivers/gpu/drm/drm_crtc_helper.c | 8 - drivers/gpu/drm/drm_edid.c | 4 drivers/gpu/drm/drm_edid_load.c | 241 +++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 1 include/drm/drm_edid.h | 1 16 files changed, 778 insertions(+), 3 deletions(-)
[…]
Quoted 7 lines
Index:
linux-3.3-rc6/Documentation/kernel-parameters.txt
===================================================================Documentation/kernel-parameters.txt +0
-0@@ -713,6 +713,16 @@ bytes respectively. Such letter suffixes The filter can be disabled or changed to another driver later using sysfs.
Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes · line 724
Quoted 10 lines
Documentation/kernel-parameters.txt +9
-0+ drm_kms_helper.edid_firmware=<file> + Broken monitors, graphic adapters and KVMs may + send no or broken EDID data sets. This parameter + allows to specify an EDID data set in the + /lib/firmware directory that is used instead. + Generic built-in EDID data sets are used, if one of + edid/1024x768.bin, edid/1280x1024.bin, + edid/1680x1050.bin, or edid/1920x1080.bin is given + and no file with the same name exists.
Maybe a hint to look into Documentation/EDID could be added?
Quoted 12 lines
Documentation/kernel-parameters.txt +1
-0+ dscc4.setup= [NET] earlycon= [KNL] Output early console device and options.Index: linux-3.3-rc6/drivers/gpu/drm/Kconfig
===================================================================drivers/gpu/drm/Kconfig +0
-0@@ -27,6 +27,17 @@ config DRM_KMS_HELPER help FB and CRTC helpers for KMS drivers.
drivers/gpu/drm/Kconfig config DRM_KMS_HELPER · line 39
Quoted 10 lines
drivers/gpu/drm/Kconfig +10
-0+config DRM_LOAD_EDID_FIRMWARE + bool "Allow to specify an EDID data set instead of probing for it" + depends on DRM_KMS_HELPER + help + Say Y here, if you want to use EDID data to be loaded from the + /lib/firmware directory or one of the provided built-in + data sets. This may be necessary, if the graphics adapter or + monitor are unable to provide appropriate EDID data. Since this + feature is provided as a workaround for broken hardware, the + default case is N.
Dito.
drivers/gpu/drm/Kconfig config DRM_KMS_HELPER · line 43
Quoted 4 lines
drivers/gpu/drm/Kconfig +1
-0+ config DRM_TTM tristate depends on DRM
[…]
Thanks,
Paul
Re: [V2 PATCH 1/2] drivers-gpu-drm-allow-to-load-edid-firmware.patch
Quoted 9 lines · Paul Menzel
Dear Carsten,
Am Donnerstag, den 15.03.2012, 00:35 +0100 schrieb Carsten Emde:
Quoted 2 lines
Einfaches Textdokument-Anlage (drivers-gpu-drm-allow-to-load-edid-firmware.patch)
somehow your message was send as an attachment. Could you configure your mailer (quilt) that it is send inline?
quilt sends the patches inline. From Carstens original mail:
Content-Disposition: inline; filename=drivers-gpu-drm-allow-to-load-edid-firmware.patch
Could you use a sane mail client or teach Devolution to stop being silly?
Thanks,
tglx
Using quilt to send patches (was: [V2 PATCH 1/2] drivers-gpu-drm-allow-to-load-edid-firmware.patch)
Am Donnerstag, den 15.03.2012, 11:08 +0100 schrieb Thomas Gleixner:
Quoted 9 lines · Paul Menzel
Quoted 7 lines
Am Donnerstag, den 15.03.2012, 00:35 +0100 schrieb Carsten Emde:
Quoted 2 lines
Einfaches Textdokument-Anlage (drivers-gpu-drm-allow-to-load-edid-firmware.patch)
somehow your message was send as an attachment. Could you configure your mailer (quilt) that it is send inline?
Quoted 6 lines
quilt sends the patches inline. From Carstens original mail:
Content-Disposition: inline; filename=drivers-gpu-drm-allow-to-load-edid-firmware.patch
Could you use a sane mail client or teach Devolution to stop being silly?
Actually Evolution displayed the message inline. Only when replying the attachment message was added to the top.
Still that leaves the ugly subject line in my opinion, where quilt only seems to use the file name.
Thanks,
Paul
Re: Using quilt to send patches (was: [V2 PATCH 1/2] drivers-gpu-drm-allow-to-load-edid-firmware.patch)
Am Sonntag, den 18.03.2012, 11:54 +0100 schrieb Paul Menzel:
Quoted 12 lines
Am Donnerstag, den 15.03.2012, 11:08 +0100 schrieb Thomas Gleixner:
Quoted 11 lines · Paul Menzel
Quoted 7 lines
Am Donnerstag, den 15.03.2012, 00:35 +0100 schrieb Carsten Emde:
Quoted 2 lines
Einfaches Textdokument-Anlage (drivers-gpu-drm-allow-to-load-edid-firmware.patch)
somehow your message was send as an attachment. Could you configure your mailer (quilt) that it is send inline?
quilt sends the patches inline. From Carstens original mail:
Quoted 7 lines
Quoted 4 lines
Content-Disposition: inline; filename=drivers-gpu-drm-allow-to-load-edid-firmware.patch
Could you use a sane mail client or teach Devolution to stop being silly?
Actually Evolution displayed the message inline. Only when replying the attachment message was added to the top.
I reported this to GNOME’s Bugzilla as #672129 [1].
Quoted 2 lines
Still that leaves the ugly subject line in my opinion, where quilt only seems to use the file name.
Thanks,
Paul
PATCH v2 2/2 drivers-gpu-drm-i915-invert-backlight-brightness
In reply to Carsten EmdeFollowing the documentation of the Legacy Backlight Brightness (LBB) Register in the configuration space of some Intel PCI graphics adapters, setting the LBB register with the value 0x0 causes the backlight to be turned off, and 0xFF causes the backlight to be set to 100% intensity
(http://download.intel.com/embedded/processors/Whitepaper/324567.pdf).
At least one of our test systems, however, turns the backlight off at 0xFF and sets it to maximum intensity at 0. In consequence, the screen of this systems becomes dark at an early boot stage which makes it unusable. The same inversion applies to the BLC_PWM_CTL I915 register. This problem was introduced in kernel version 2.6.38 when the PCI device of this system was first supported by the i915 KMS module.
This patch adds a module parameter to invert the backlight brightness value before writing and after reading which makes the affected notebook usable again.
--- Documentation/kernel-parameters.txt | 9 +++++++++ drivers/gpu/drm/i915/intel_panel.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+)
Documentation/kernel-parameters.txt +9 -0
@@ -966,6 +966,15 @@ bytes respectively. Such letter suffixes i810= [HW,DRM] + i915.invert_brightness + [DRM] Invert the sense of the variable that is used to + set the brightness of the panel backlight. Normally a + value of 0 indicates backlight switched off, and the + maximum value sets the backlight to maximum brightness. + If this parameter is specified, a value of 0 sets the + backlight to maximum brightness, and the maximum value + switches the backlight off. + i8k.ignore_dmi [HW] Continue probing hardware even if DMI data indicates that the driver is running on unsupported hardware.
drivers/gpu/drm/i915/intel_panel.c +14 -0
@@ -28,6 +28,7 @@* Chris Wilson <[email protected]> */ +#include <linux/moduleparam.h> #include "intel_drv.h" #define PCI_LBPC 0xf4/* legacy/combination backlight modes */
@@ -191,6 +192,10 @@ u32 intel_panel_get_max_backlight(structreturn max; } +static bool brightness_inverted; +MODULE_PARM_DESC (brightness_inverted,"Backlight brightness value is inverted " +"(0 = max brightness, max value = dark)" ); +module_param_named (brightness_inverted, brightness_inverted, bool,0600 );u32 intel_panel_get_backlight (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -212,6 +217,10 @@ u32 intel_panel_get_backlight(struct drm }DRM_DEBUG_DRIVER ("get backlight PWM = %d\n" , val); +if (brightness_inverted) { +u32 max =intel_panel_get_max_backlight (dev); + val = max - val; + }return val; }
@@ -229,6 +238,11 @@ static void intel_panel_actually_set_bacDRM_DEBUG_DRIVER ("set backlight PWM = %d\n" , level); +if (brightness_inverted) { +u32 max =intel_panel_get_max_backlight (dev); + level = max - level; + } +if (HAS_PCH_SPLIT (dev))return intel_pch_panel_set_backlight (dev, level);
Re: [V2 PATCH 2/2] drivers-gpu-drm-i915-invert-backlight-brightness
<#part sign=pgpmime>
Quoted 3 lines · Carsten Emde
This patch adds a module parameter to invert the backlight brightness value before writing and after reading which makes the affected notebook usable again.
You should add a quirk for this and set things up so that your machine automatically gets the right value; when we find more machines that do this, we can add them so that more people will get a system that 'just works'.
Signature · 1 line
[email protected]
Re: [V2 PATCH 2/2] drivers-gpu-drm-i915-invert-backlight-brightness
Am Mittwoch, den 14.03.2012, 19:42 -0700 schrieb Keith Packard:
Quoted 1 line
<#part sign=pgpmime>
Notmuch sometimes seems to add that line. Is that a bug?
Quoted 10 lines · Carsten Emde
Quoted 4 lines
This patch adds a module parameter to invert the backlight brightness value before writing and after reading which makes the affected notebook usable again.
You should add a quirk for this and set things up so that your machine automatically gets the right value; when we find more machines that do this, we can add them so that more people will get a system that 'just works'.
Keith, do you mean adding the quirk additionally in a separate patch? Having that module option would ease testing the workaround without needing to build a custom Linux kernel with a quirk added.
Thanks,
Paul
Re: [V2 PATCH 2/2] drivers-gpu-drm-i915-invert-backlight-brightness
In reply to Carsten EmdeAm Donnerstag, den 15.03.2012, 00:35 +0100 schrieb Carsten Emde:
Quoted 2 lines
Einfaches Textdokument-Anlage (drivers-gpu-drm-i915-invert-backlight-brightness.patch)
quilt also does not adapt the subject line of the message correctly to the one of the patch.
Quoted 56 lines
Following the documentation of the Legacy Backlight Brightness (LBB) Register in the configuration space of some Intel PCI graphics adapters, setting the LBB register with the value
0x0causes the backlight to be turned off, and0xFFcauses the backlight to be set to 100% intensity
(http://download.intel.com/embedded/processors/Whitepaper/324567.pdf).
At least one of our test systems, however, turns the backlight off at0xFFand sets it to maximum intensity at 0. In consequence, the screen of this systems becomes dark at an early boot stage which makes it unusable. The same inversion applies to theBLC_PWM_CTLI915 register. This problem was introduced in kernel version 2.6.38 when the PCI device of this system was first supported by the i915 KMS module.This patch adds a module parameter to invert the backlight brightness value before writing and after reading which makes the affected notebook usable again.
Signed-off-by Carsten Emde <[email protected]>--- Documentation/kernel-parameters.txt | 9 +++++++++ drivers/gpu/drm/i915/intel_panel.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+)Index:
linux-3.3-rc6/Documentation/kernel-parameters.txt
===================================================================Documentation/kernel-parameters.txt +9
-0@@ -966,6 +966,15 @@ bytes respectively. Such letter suffixes i810= [HW,DRM] + i915.invert_brightness + [DRM] Invert the sense of the variable that is used to + set the brightness of the panel backlight. Normally a + value of 0 indicates backlight switched off, and the + maximum value sets the backlight to maximum brightness. + If this parameter is specified, a value of 0 sets the + backlight to maximum brightness, and the maximum value + switches the backlight off. + i8k.ignore_dmi [HW] Continue probing hardware even if DMI data indicates that the driver is running on unsupported hardware.Index:
linux-3.3-rc6/drivers/gpu/drm/i915/intel_panel.c
===================================================================drivers/gpu/drm/i915/intel_panel.c +1
-0@@ -28,6 +28,7 @@* Chris Wilson <[email protected]> */ +#include <linux/moduleparam.h> #include "intel_drv.h" #define PCI_LBPC 0xf4/* legacy/combination backlight modes */
drivers/gpu/drm/i915/intel_panel.c u32 intel_panel_get_max_backlight(struct · line 197
Quoted 6 lines
drivers/gpu/drm/i915/intel_panel.c +3
-0@@ -191,6 +192,10 @@ u32 intel_panel_get_max_backlight(structreturn max; } +static bool brightness_inverted; +MODULE_PARM_DESC (brightness_inverted,"Backlight brightness value is inverted " +"(0 = max brightness, max value = dark)" );
Could you elaborate somewhere for example by giving an example what dark means? As a normal user it is not clear to me.
Quoted 16 lines
drivers/gpu/drm/i915/intel_panel.c +5
-0+module_param_named (brightness_inverted, brightness_inverted, bool,0600 );u32 intel_panel_get_backlight (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -212,6 +217,10 @@ u32 intel_panel_get_backlight(struct drm }DRM_DEBUG_DRIVER ("get backlight PWM = %d\n" , val); +if (brightness_inverted) { +u32 max =intel_panel_get_max_backlight (dev); + val = max - val; + }return val; }
drivers/gpu/drm/i915/intel_panel.c static void intel_panel_actually_set_bac · line 247
Quoted 10 lines
drivers/gpu/drm/i915/intel_panel.c +5
-0@@ -229,6 +238,11 @@ static void intel_panel_actually_set_bacDRM_DEBUG_DRIVER ("set backlight PWM = %d\n" , level); +if (brightness_inverted) { +u32 max =intel_panel_get_max_backlight (dev); + level = max - level; + } +if (HAS_PCH_SPLIT (dev))return intel_pch_panel_set_backlight (dev, level);
Thanks,
Paul