AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Hans de Goede <hdegoede@redhat.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Alexander Deucher <Alexander.Deucher@amd.com>
Cc: linux-acpi@vger.kernel.org,
	Mario Limonciello <mario.limonciello@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: [PATCH 1/2] ACPI: video: Allow GPU drivers to report no panels
Date: Wed, 7 Dec 2022 13:31:33 -0600	[thread overview]
Message-ID: <20221207193134.763-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20221207193134.763-1-mario.limonciello@amd.com>

The current logic for the ACPI backlight detection will create
a backlight device if no native or vendor drivers have created
8 seconds after the system has booted if the ACPI tables
included backlight control methods.

If the GPU drivers have loaded, they may be able to report whether
any LCD panels were found.  Allow using this information to factor
in whether to make an acpi_video0 backlight device.

To avoid risks for regressions on complicated configurations with
muxes and multiple native drivers, only take into account drivers
that have reported this when the system is a desktop.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/acpi_video.c | 12 ++++++++++++
 include/acpi/video.h      |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 32953646caeb..e297f8877797 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -82,6 +82,7 @@ MODULE_PARM_DESC(register_backlight_delay,
 
 static bool may_report_brightness_keys;
 static int register_count;
+static bool native_reported_nolcd;
 static DEFINE_MUTEX(register_count_mutex);
 static DEFINE_MUTEX(video_list_lock);
 static LIST_HEAD(video_bus_head);
@@ -1811,6 +1812,9 @@ static bool acpi_video_should_register_backlight(struct acpi_video_device *dev)
 		return false;
 	}
 
+	if (native_reported_nolcd)
+		return false;
+
 	if (only_lcd)
 		return dev->flags.lcd;
 	return true;
@@ -2178,6 +2182,14 @@ static bool should_check_lcd_flag(void)
 	return false;
 }
 
+void acpi_video_report_nolcd(void)
+{
+	/* Only take into account native driver reporting on desktops */
+	if (dmi_is_desktop())
+		native_reported_nolcd = true;
+}
+EXPORT_SYMBOL(acpi_video_report_nolcd);
+
 int acpi_video_register(void)
 {
 	int ret = 0;
diff --git a/include/acpi/video.h b/include/acpi/video.h
index a275c35e5249..1fccb111c197 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -53,6 +53,7 @@ enum acpi_backlight_type {
 };
 
 #if IS_ENABLED(CONFIG_ACPI_VIDEO)
+extern void acpi_video_report_nolcd(void);
 extern int acpi_video_register(void);
 extern void acpi_video_unregister(void);
 extern void acpi_video_register_backlight(void);
-- 
2.34.1


  reply	other threads:[~2022-12-07 19:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 19:31 [PATCH 0/2] Avoid creating acpi_video0 on desktop APUs Mario Limonciello
2022-12-07 19:31 ` Mario Limonciello [this message]
2022-12-07 19:31 ` [PATCH 2/2] drm/amd/display: Report to ACPI video if no panels were found Mario Limonciello
2022-12-07 21:04 ` [PATCH 0/2] Avoid creating acpi_video0 on desktop APUs Hans de Goede
2022-12-07 21:21   ` Limonciello, Mario
2022-12-07 21:32     ` Hans de Goede
2022-12-07 23:41       ` Daniel Dadap

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=20221207193134.763-2-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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