diff options
author | Matthew Garrett <mjg@redhat.com> | 2011-03-22 19:30:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:00 -0400 |
commit | 9661e92c10a9775243c1ecb73373528ed8725a10 (patch) | |
tree | 6540081a58b66142f3c84f93f76313be7e38b02b /drivers | |
parent | 7eae3efa13c5d1c8e7d8dd0504ad524963b8add1 (diff) |
acpi: tie ACPI backlight devices to PCI devices if possible
Dual-GPU machines may provide more than one ACPI backlight interface. Tie
the backlight device to the GPU in order to allow userspace to identify
the correct interface.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/video.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a9eec8c95a1f..a18e497f1c3c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -782,6 +782,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
782 | 782 | ||
783 | if (acpi_video_backlight_support()) { | 783 | if (acpi_video_backlight_support()) { |
784 | struct backlight_properties props; | 784 | struct backlight_properties props; |
785 | struct pci_dev *pdev; | ||
786 | acpi_handle acpi_parent; | ||
787 | struct device *parent = NULL; | ||
785 | int result; | 788 | int result; |
786 | static int count = 0; | 789 | static int count = 0; |
787 | char *name; | 790 | char *name; |
@@ -794,10 +797,20 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
794 | return; | 797 | return; |
795 | count++; | 798 | count++; |
796 | 799 | ||
800 | acpi_get_parent(device->dev->handle, &acpi_parent); | ||
801 | |||
802 | pdev = acpi_get_pci_dev(acpi_parent); | ||
803 | if (pdev) { | ||
804 | parent = &pdev->dev; | ||
805 | pci_dev_put(pdev); | ||
806 | } | ||
807 | |||
797 | memset(&props, 0, sizeof(struct backlight_properties)); | 808 | memset(&props, 0, sizeof(struct backlight_properties)); |
798 | props.type = BACKLIGHT_FIRMWARE; | 809 | props.type = BACKLIGHT_FIRMWARE; |
799 | props.max_brightness = device->brightness->count - 3; | 810 | props.max_brightness = device->brightness->count - 3; |
800 | device->backlight = backlight_device_register(name, NULL, device, | 811 | device->backlight = backlight_device_register(name, |
812 | parent, | ||
813 | device, | ||
801 | &acpi_backlight_ops, | 814 | &acpi_backlight_ops, |
802 | &props); | 815 | &props); |
803 | kfree(name); | 816 | kfree(name); |