Linux ACPI
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Darren Hart <dvhart@infradead.org>
Cc: "Aaron Lu" <aaron.lu@intel.com>,
	"Ben Skeggs" <bskeggs@redhat.com>, "Lee Chun-Yi" <jlee@suse.com>,
	"Peter Feuerer" <peter@piie.net>,
	"Corentin Chary" <corentin.chary@gmail.com>,
	"Cezary Jackiewicz" <cezary.jackiewicz@gmail.com>,
	"Matthew Garrett" <mjg59@srcf.ucam.org>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Jonathan Woithe" <jwoithe@just42.net>,
	"Ike Panhc" <ike.pan@canonical.com>,
	"Anisse Astier" <anisse@astier.eu>,
	"Henrique de Moraes Holschuh" <ibm-acpi@hmh.eng.br>,
	"Azael Avalos" <coproscefalo@gmail.com>,
	linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	acpi4asus-user@lists.sourceforge.net,
	ibm-acpi-devel@lists.sourceforge.net,
	"Hans de Goede" <hdegoede@redhat.com>
Subject: [PATCH v3 07/35] acpi-video-detect: Move acpi_is_video_device() to acpi/scan.c
Date: Tue, 16 Jun 2015 16:27:45 +0200	[thread overview]
Message-ID: <1434464893-3529-8-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1434464893-3529-1-git-send-email-hdegoede@redhat.com>

This allows video_detect.c to be build as a module, this is a preparation
patch for the backlight interface selection logic cleanup.

Note this commit also causes acpi_is_video_device() to always be build
indepedent of CONFIG_ACPI_VIDEO, as there is no reason to make its
building depend on CONFIG_ACPI_VIDEO.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/scan.c         | 56 ++++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/video_detect.c | 60 ---------------------------------------------
 include/linux/acpi.h        |  8 ++----
 3 files changed, 58 insertions(+), 66 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c2c65dd..2649a06 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1936,6 +1936,62 @@ bool acpi_dock_match(acpi_handle handle)
 	return acpi_has_method(handle, "_DCK");
 }
 
+static acpi_status
+acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
+			  void **return_value)
+{
+	long *cap = context;
+
+	if (acpi_has_method(handle, "_BCM") &&
+	    acpi_has_method(handle, "_BCL")) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
+				  "support\n"));
+		*cap |= ACPI_VIDEO_BACKLIGHT;
+		if (!acpi_has_method(handle, "_BQC"))
+			printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
+				"cannot determine initial brightness\n");
+		/* We have backlight support, no need to scan further */
+		return AE_CTRL_TERMINATE;
+	}
+	return 0;
+}
+
+/* Returns true if the ACPI object is a video device which can be
+ * handled by video.ko.
+ * The device will get a Linux specific CID added in scan.c to
+ * identify the device as an ACPI graphics device
+ * Be aware that the graphics device may not be physically present
+ * Use acpi_video_get_capabilities() to detect general ACPI video
+ * capabilities of present cards
+ */
+long acpi_is_video_device(acpi_handle handle)
+{
+	long video_caps = 0;
+
+	/* Is this device able to support video switching ? */
+	if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
+		video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
+
+	/* Is this device able to retrieve a video ROM ? */
+	if (acpi_has_method(handle, "_ROM"))
+		video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
+
+	/* Is this device able to configure which video head to be POSTed ? */
+	if (acpi_has_method(handle, "_VPO") &&
+	    acpi_has_method(handle, "_GPD") &&
+	    acpi_has_method(handle, "_SPD"))
+		video_caps |= ACPI_VIDEO_DEVICE_POSTING;
+
+	/* Only check for backlight functionality if one of the above hit. */
+	if (video_caps)
+		acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
+				    ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
+				    &video_caps, NULL);
+
+	return video_caps;
+}
+EXPORT_SYMBOL(acpi_is_video_device);
+
 const char *acpi_device_hid(struct acpi_device *device)
 {
 	struct acpi_hardware_id *hid;
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index 3af18be..5076138 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -5,10 +5,6 @@
  *  May be copied or modified under the terms of the GNU General Public License
  *
  * video_detect.c:
- * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c
- * There a Linux specific (Spec does not provide a HID for video devices) is
- * assigned
- *
  * After PCI devices are glued with ACPI devices
  * acpi_get_pci_dev() can be called to identify ACPI graphics
  * devices for which a real graphics card is plugged in
@@ -47,62 +43,6 @@ static long acpi_video_support;
 static bool acpi_video_caps_checked;
 
 static acpi_status
-acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
-			  void **return_value)
-{
-	long *cap = context;
-
-	if (acpi_has_method(handle, "_BCM") &&
-	    acpi_has_method(handle, "_BCL")) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
-				  "support\n"));
-		*cap |= ACPI_VIDEO_BACKLIGHT;
-		if (!acpi_has_method(handle, "_BQC"))
-			printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
-				"cannot determine initial brightness\n");
-		/* We have backlight support, no need to scan further */
-		return AE_CTRL_TERMINATE;
-	}
-	return 0;
-}
-
-/* Returns true if the ACPI object is a video device which can be
- * handled by video.ko.
- * The device will get a Linux specific CID added in scan.c to
- * identify the device as an ACPI graphics device
- * Be aware that the graphics device may not be physically present
- * Use acpi_video_get_capabilities() to detect general ACPI video
- * capabilities of present cards
- */
-long acpi_is_video_device(acpi_handle handle)
-{
-	long video_caps = 0;
-
-	/* Is this device able to support video switching ? */
-	if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
-		video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
-
-	/* Is this device able to retrieve a video ROM ? */
-	if (acpi_has_method(handle, "_ROM"))
-		video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
-
-	/* Is this device able to configure which video head to be POSTed ? */
-	if (acpi_has_method(handle, "_VPO") &&
-	    acpi_has_method(handle, "_GPD") &&
-	    acpi_has_method(handle, "_SPD"))
-		video_caps |= ACPI_VIDEO_DEVICE_POSTING;
-
-	/* Only check for backlight functionality if one of the above hit. */
-	if (video_caps)
-		acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
-				    ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
-				    &video_caps, NULL);
-
-	return video_caps;
-}
-EXPORT_SYMBOL(acpi_is_video_device);
-
-static acpi_status
 find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
 	long *cap = context;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 49f8531..88228df 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -253,19 +253,15 @@ extern bool wmi_has_guid(const char *guid);
 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR		0x0400
 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO		0x0800
 
+extern long acpi_is_video_device(acpi_handle handle);
+
 #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
 
-extern long acpi_is_video_device(acpi_handle handle);
 extern void acpi_video_dmi_promote_vendor(void);
 extern int acpi_video_backlight_support(void);
 
 #else
 
-static inline long acpi_is_video_device(acpi_handle handle)
-{
-	return 0;
-}
-
 static inline void acpi_video_dmi_promote_vendor(void)
 {
 }
-- 
2.3.6

  parent reply	other threads:[~2015-06-16 14:27 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 14:27 [PATCH v3 00/35] acpi-video: Rewrite backlight interface selection logic Hans de Goede
2015-06-16 14:27 ` [PATCH v3 01/35] apple_gmux: Use acpi_video_unregister_backlight instead of acpi_video_unregister Hans de Goede
2015-06-16 14:27 ` [PATCH v3 02/35] asus-wmi: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 03/35] samsung-laptop: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 04/35] apple-gmux: Stop using acpi_video_dmi_demote_vendor() Hans de Goede
2015-06-16 14:27 ` [PATCH v3 05/35] acpi-video-detect: Remove the unused acpi_video_dmi_demote_vendor() function Hans de Goede
2015-06-16 14:27 ` [PATCH v3 06/35] acpi-video-detect: Make acpi_video_get_capabilities a private function Hans de Goede
2015-06-16 14:27 ` Hans de Goede [this message]
2015-06-16 14:27 ` [PATCH v3 08/35] acpi-video-detect: Move acpi_osi_is_win8 to osl.c Hans de Goede
2015-06-16 14:27 ` [PATCH v3 09/35] acpi-video-detect: video: Make video_detect code part of the video module Hans de Goede
2015-06-16 14:27 ` [PATCH v3 10/35] acpi-video-detect: Rewrite backlight interface selection logic Hans de Goede
2015-06-16 14:27 ` [PATCH v3 11/35] acpi-video-detect: Unregister acpi_video backlight when dmi quirks are added Hans de Goede
2015-06-16 14:27 ` [PATCH v3 12/35] drm: i915: Port to new backlight interface selection API Hans de Goede
2015-06-16 14:27 ` [PATCH v3 13/35] acpi-video: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 14/35] acpi-video: Move backlight notifier to video_detect.c Hans de Goede
2015-06-16 14:27 ` [PATCH v3 15/35] acpi-video: Move dmi_check_system from module_init to acpi_video_register Hans de Goede
2015-06-16 14:27 ` [PATCH v3 16/35] acpi-video: Fix acpi_video _register vs _unregister_backlight race Hans de Goede
2015-06-16 14:27 ` [PATCH v3 17/35] acer-wmi: Port to new backlight interface selection API Hans de Goede
2015-06-16 14:27 ` [PATCH v3 18/35] apple-gmux: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 19/35] asus-laptop: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 20/35] asus-wmi: " Hans de Goede
2015-06-16 14:27 ` [PATCH v3 21/35] compal-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 22/35] dell-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 23/35] dell-wmi: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 24/35] eeepc-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 25/35] fujitsu-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 26/35] ideapad-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 27/35] intel-oaktrail: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 28/35] msi-laptop: " Hans de Goede
2015-06-18  5:59   ` joeyli
2015-06-16 14:28 ` [PATCH v3 29/35] msi-wmi: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 30/35] samsung-laptop: " Hans de Goede
     [not found] ` <1434464893-3529-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-16 14:28   ` [PATCH v3 31/35] sony-laptop: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 32/35] thinkpad-acpi: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 33/35] toshiba-acpi: " Hans de Goede
2015-06-16 14:28 ` [PATCH v3 34/35] acpi-video-detect: Remove old API Hans de Goede
2015-06-16 14:28 ` [PATCH v3 35/35] acpi-video: Make acpi_video_unregister_backlight() private Hans de Goede

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=1434464893-3529-8-git-send-email-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=aaron.lu@intel.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=anisse@astier.eu \
    --cc=bskeggs@redhat.com \
    --cc=cezary.jackiewicz@gmail.com \
    --cc=coproscefalo@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=ike.pan@canonical.com \
    --cc=jlee@suse.com \
    --cc=jwoithe@just42.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pali.rohar@gmail.com \
    --cc=peter@piie.net \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.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