[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240527142311.3053-1-mario.limonciello@amd.com>
Date: Mon, 27 May 2024 09:23:11 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: <dri-devel@...ts.freedesktop.org>, <amd-gfx@...ts.freedesktop.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
<mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
<airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>
CC: <linux-kernel@...r.kernel.org>, Mario Limonciello
<mario.limonciello@....com>, Alex Deucher <alexander.deucher@....com>, "Chris
Bainbridge" <chris.bainbridge@...il.com>
Subject: [PATCH] drm/client: Detect when ACPI lid is closed during initialization
If the lid on a laptop is closed when eDP connectors are populated
then it remains enabled when the initial framebuffer configuration
is built.
When creating the initial framebuffer configuration detect the ACPI
lid status and if it's closed disable any eDP connectors.
Suggested-by: Alex Deucher <alexander.deucher@....com>
Reported-by: Chris Bainbridge <chris.bainbridge@...il.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3349
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
drivers/gpu/drm/drm_client_modeset.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 31af5cf37a09..b76438c31761 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -8,6 +8,7 @@
*/
#include "drm/drm_modeset_lock.h"
+#include <acpi/button.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
@@ -257,6 +258,27 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
enabled[i] = drm_connector_enabled(connectors[i], false);
}
+static void drm_client_match_edp_lid(struct drm_device *dev,
+ struct drm_connector **connectors,
+ unsigned int connector_count,
+ bool *enabled)
+{
+ int i;
+
+ for (i = 0; i < connector_count; i++) {
+ struct drm_connector *connector = connectors[i];
+
+ if (connector->connector_type != DRM_MODE_CONNECTOR_eDP || !enabled[i])
+ continue;
+
+ if (!acpi_lid_open()) {
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] lid is closed, disabling\n",
+ connector->base.id, connector->name);
+ enabled[i] = false;
+ }
+ }
+}
+
static bool drm_client_target_cloned(struct drm_device *dev,
struct drm_connector **connectors,
unsigned int connector_count,
@@ -844,6 +866,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
memset(crtcs, 0, connector_count * sizeof(*crtcs));
memset(offsets, 0, connector_count * sizeof(*offsets));
+ drm_client_match_edp_lid(dev, connectors, connector_count, enabled);
if (!drm_client_target_cloned(dev, connectors, connector_count, modes,
offsets, enabled, width, height) &&
!drm_client_target_preferred(dev, connectors, connector_count, modes,
--
2.43.0
Powered by blists - more mailing lists