2010-07-11 00:31:07

by Lee, Chun-Yi

[permalink] [raw]
Subject: [PATCH] Add intel drm blacklist to intel_opregion_present detect

There have some machines not support by i915 drm driver, e.g. MSI U110/U150,
there are use poulsbo chip and drm driver not support it because legal issue.
Those machines's acpi backlight control actually work fine and don't need apply
the intel opregion support.
So, add intel drm blacklist to intel_opregion_present, it can enable the acpi
brightness interface but not use intel opregion.

Signed-off-by: Lee, Chun-Yi <[email protected]>
---
drivers/acpi/video.c | 17 ++++++++++++++++-
include/linux/pci_ids.h | 1 +
2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 9865d46..25a70e0 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -88,6 +88,11 @@ static int acpi_video_bus_add(struct acpi_device *device);
static int acpi_video_bus_remove(struct acpi_device *device, int type);
static void acpi_video_bus_notify(struct acpi_device *device, u32 event);

+static const struct pci_device_id intel_drm_blacklist[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_VGA) },
+ { } /* Terminating entry */
+};
+
static const struct acpi_device_id video_device_ids[] = {
{ACPI_VIDEO_HID, 0},
{"", 0},
@@ -2531,8 +2536,11 @@ static int __init intel_opregion_present(void)
#if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
struct pci_dev *dev = NULL;
u32 address;
+ int i;
+ bool in_blacklist;

for_each_pci_dev(dev) {
+ in_blacklist = 0;
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
continue;
if (dev->vendor != PCI_VENDOR_ID_INTEL)
@@ -2540,7 +2548,14 @@ static int __init intel_opregion_present(void)
pci_read_config_dword(dev, 0xfc, &address);
if (!address)
continue;
- return 1;
+ for (i = 0; intel_drm_blacklist[i].device != 0; i++) {
+ if (dev->device == intel_drm_blacklist[i].device) {
+ in_blacklist = 1;
+ break;
+ }
+ }
+ if (!in_blacklist)
+ return 1;
}
#endif
return 0;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3bedcc1..78858b1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2669,6 +2669,7 @@
#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0
#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2
#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
+#define PCI_DEVICE_ID_INTEL_SCH_VGA 0x8108
#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
--
1.6.0.2


2010-07-12 15:12:21

by Joey Lee

[permalink] [raw]
Subject: Re: [PATCH] Add intel drm blacklist to intel_opregion_present detect

Hi Mattew,

於 一,2010-07-12 於 03:27 +0100,Matthew Garrett 提到:
> On Sun, Jul 11, 2010 at 08:12:57PM -0600, Joey Lee wrote:
>
> > He tested the drm blacklist patch can works fine on his computer, it's
> > also works on VESA mode because the acpi _BCM, _BQC direct change
> > brightness by opregion.
> >

Sorry, I write a wrong information, the MSI poulsbo netbook change
brightness by ec command in _BCM, _BQC, not opregion.

> > What can we do for this situtation? I mean if the BIOS have opregion
> > implementation but there have no opensource drm driver or native video
> > driver support opregion on Linux?
>
> The cleanest way would be to implement a stub backlight control driver
> for the chip - there should be enough information in the source of the
> poulsbo drm to do that.

M... Follow your suggestion, I am tracing the i915 drm driver and
Poulsbo drm driver from here:

http://sourceforge.net/mailarchive/message.php?msg_name=49C2ADA8.2090405%40shipmail.org

I am not sure fully understood your suggestion... Did you mean we can
extract some parts from Poulsbo drm driver and put it to a stub
backlight control driver for Poulsbo? Where can we put the stub driver?
Do we still put it in i915 drm?

On the other hand, the Poulsbo is a old and stop ship chip, do we still
want to add a special driver for it?

> The main problem with the blacklist approach is
> that there's no guarantee that all poulsbo systems will have a working
> acpi method, and I /think/ there's a couple more PCI IDs that ought to
> be covered in any case. On the other hand doing it properly does involve
> writing rather a lot more code, and the fact that Intel have shown
> absolutely no interest in making their hardware work means that the
> quick hack might be the most reasonable thing to do.
>

Thank's for your remind, I fully agreed cann't guarantee all poulsbo
systems have working acpi method. But, I am sure the MSI U110/U115 have
workable acpi backlight method.
Do you think it's good to put the special DMI detection in msi-laptop
driver to enable the the acpi backlight control by call
acpi_video_register in acpi video? But will cause msi-laptop driver
dependency to acpi video driver.

Need your kindly suggestion!


Thank's a lot!
Joey Lee

2010-07-12 15:19:48

by Matthew Garrett

[permalink] [raw]
Subject: Re: [PATCH] Add intel drm blacklist to intel_opregion_present detect

On Mon, Jul 12, 2010 at 09:12:13AM -0600, Joey Lee wrote:

> M... Follow your suggestion, I am tracing the i915 drm driver and
> Poulsbo drm driver from here:
>
> http://sourceforge.net/mailarchive/message.php?msg_name=49C2ADA8.2090405%40shipmail.org
>
> I am not sure fully understood your suggestion... Did you mean we can
> extract some parts from Poulsbo drm driver and put it to a stub
> backlight control driver for Poulsbo? Where can we put the stub driver?
> Do we still put it in i915 drm?

Pretty much, yeah. You'd need the interrupt handler and the backlight
control and pretty much nothing else. It should be a separate driver
under drivers/gpu and ideally the opregion code would be sufficiently
abstracted to work with it.

> On the other hand, the Poulsbo is a old and stop ship chip, do we still
> want to add a special driver for it?

Yeah, that's my concern. There's millions of things in the wild and
Intel continue to refuse to take responsibility for them, so it's not
clear to me that it's worth putting the effort into writing a "correct"
driver.

> Thank's for your remind, I fully agreed cann't guarantee all poulsbo
> systems have working acpi method. But, I am sure the MSI U110/U115 have
> workable acpi backlight method.
> Do you think it's good to put the special DMI detection in msi-laptop
> driver to enable the the acpi backlight control by call
> acpi_video_register in acpi video? But will cause msi-laptop driver
> dependency to acpi video driver.

Mm. Well, we *know* that opregion won't work on Poulsbo as is (even
Intel's driver doesn't implement it), so there's no way this patch can
make things any worse. On the other hand, if anyone ships an OS with
this hack *and* a native psb driver, I'm going to look sad for some
time.

--
Matthew Garrett | [email protected]

2010-07-13 08:13:46

by Joey Lee

[permalink] [raw]
Subject: Re: [PATCH] Add intel drm blacklist to intel_opregion_present detect

Hi Matthew,

First, thank's for your kindly suggestion.

於 一,2010-07-12 於 16:19 +0100,Matthew Garrett 提到:
>
> > On the other hand, the Poulsbo is a old and stop ship chip, do we still
> > want to add a special driver for it?
>
> Yeah, that's my concern. There's millions of things in the wild and
> Intel continue to refuse to take responsibility for them, so it's not
> clear to me that it's worth putting the effort into writing a "correct"
> driver.
>

Yes, fully agreed!

> > Thank's for your remind, I fully agreed cann't guarantee all poulsbo
> > systems have working acpi method. But, I am sure the MSI U110/U115 have
> > workable acpi backlight method.
> > Do you think it's good to put the special DMI detection in msi-laptop
> > driver to enable the the acpi backlight control by call
> > acpi_video_register in acpi video? But will cause msi-laptop driver
> > dependency to acpi video driver.
>
> Mm. Well, we *know* that opregion won't work on Poulsbo as is (even
> Intel's driver doesn't implement it), so there's no way this patch can
> make things any worse. On the other hand, if anyone ships an OS with
> this hack *and* a native psb driver, I'm going to look sad for some
> time.
>

Please then me add the MSI U110/U115 support in msi-laptop driver. I am
sure the acpi baclight method works fine on U110/U115 and I hope the
_REAL_ opensource kernel user will not have a invalid backlight control
function.

For the native psb driver, if have anyone want to ship it with newest
msi-laptop driver, then he must need take care anything in KMP, like:
disable msi-laptop or put it to modprobe blacklist.
Because the native psb driver doesn't not included in kernel mainline.

On the other hand, the Poulsbo already stop to chip, there will not have
many machine ship the native psb driver with newest msi-laptop.


Thank's a lot!
Joey Lee