linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: rpurdie@rpsys.net, akpm@linux-foundation.org,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, linux-acpi@vger.kernel.org,
	lenb@kernel.org, Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 5/5] ACPI: Tie ACPI backlight devices to PCI devices if possible
Date: Fri, 19 Nov 2010 10:53:56 -0500	[thread overview]
Message-ID: <1290182036-30484-5-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1290182036-30484-1-git-send-email-mjg@redhat.com>

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>
---
 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 38165a8..0403647 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -843,6 +843,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
 
 	if (acpi_video_backlight_support()) {
 		struct backlight_properties props;
+		struct pci_dev *pdev;
+		acpi_handle acpi_parent;
+		struct device *parent = NULL;
 		int result;
 		static int count = 0;
 		char *name;
@@ -855,10 +858,20 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
 			return;
 		count++;
 
+		acpi_get_parent(device->dev->handle, &acpi_parent);
+
+		pdev = acpi_get_pci_dev(acpi_parent);
+		if (pdev) {
+			parent = &pdev->dev;
+			pci_dev_put(pdev);
+		}
+
 		memset(&props, 0, sizeof(struct backlight_properties));
 		props.type = BACKLIGHT_FIRMWARE;
 		props.max_brightness = device->brightness->count - 3;
-		device->backlight = backlight_device_register(name, NULL, device,
+		device->backlight = backlight_device_register(name,
+							      parent,
+							      device,
 							      &acpi_backlight_ops,
 							      &props);
 		kfree(name);
-- 
1.7.3.2


  parent reply	other threads:[~2010-11-19 15:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19 15:53 [PATCH 1/5] Backlight: Add backlight type Matthew Garrett
2010-11-19 15:53 ` [PATCH 2/5] i915: Add native backlight control Matthew Garrett
2010-11-19 15:53 ` [PATCH 3/5] radeon: Expose backlight class device for legacy LVDS encoder Matthew Garrett
2010-11-19 15:53 ` [PATCH 4/5] nouveau: Change the backlight parent device to the connector, not the PCI dev Matthew Garrett
2010-11-19 15:53 ` Matthew Garrett [this message]
2010-11-19 20:05 ` [PATCH 1/5] Backlight: Add backlight type Andrew Morton
2010-11-19 20:25   ` Matthew Garrett
2010-11-19 20:35     ` Andrew Morton
2010-11-22 10:17     ` Richard Purdie
2010-11-22 12:30       ` Matthew Garrett
2010-11-22 13:35         ` Richard Purdie
2010-11-22 13:40           ` Matthew Garrett
  -- strict thread matches above, loose matches on Subject: below --
2011-01-14 19:24 Matthew Garrett
2011-01-14 19:24 ` [PATCH 5/5] ACPI: Tie ACPI backlight devices to PCI devices if possible Matthew Garrett
2011-02-06 20:35   ` Rafael J. Wysocki
2011-02-06 20:56     ` Matthew Garrett
2011-02-06 22:41       ` Rafael J. Wysocki
2011-02-06 22:53         ` Matthew Garrett
2011-02-06 23:01           ` Rafael J. Wysocki
2011-02-06 23:05             ` Matthew Garrett
2011-02-06 23:34               ` Rafael J. Wysocki
2011-02-07 21:32                 ` Bjorn Helgaas
2011-02-07 21:34                   ` Matthew Garrett
2011-02-07 22:04                     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290182036-30484-5-git-send-email-mjg@redhat.com \
    --to=mjg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).