Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp649334lqb; Wed, 29 May 2024 06:55:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpkJ4nmfY0BVBU6LPwSpGvnU6um6bt/bDLFpG9N9xATi0hl/DUyp3ZlObnT6oHjQ+XaATmM/QXKVjSPe9MpmMANQzOp1cErq7nZTEkjA== X-Google-Smtp-Source: AGHT+IGktuO0m3YcHT3T1soBgI6IP1c97bJa1coueVMBXWCFqS/NgTHwRyyA8xs2y8OEHN0HZSqJ X-Received: by 2002:a05:622a:150:b0:43a:f218:a63f with SMTP id d75a77b69052e-43fb0e8cda4mr147053761cf.66.1716990922530; Wed, 29 May 2024 06:55:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716990922; cv=pass; d=google.com; s=arc-20160816; b=VlO+eyjY0CIHSXXnwwuaCd1MAxtrIFlxZ8DN5Wgim/VT9+pRZNvtVDOVev7YImaKSb ZWfRzPJtIDZId0J2TfNmoDO7pP6hpicRF1TdJn8wMZAOiWcrZ+dY5sgoKrlfgcrsllU3 SH3stOB9fWw7GK3hBGQmFqQHx0qPyfnemJ3BPiBOEHWXQ8Q8XWIg/w6y9PUSAyzLmr+D rH/evWCJts9D1sFjMItdC26pfcdhjnjM2nQgGF8Gfsy0pTeCEDKuxGOMWBDE9qze9jkj pfqwVdc/XqOsnAZ7jJEakKeLMDiCNjhrD6oOXazLO1Yj5iJ5zeuqB5YkezTEqvz/XJE0 1HBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=sGlIeA8hMcr9Fm/VlCdK2KdthFpKjfRPf//jK9Gb9e8=; fh=OgvAzb0EygTF6cInd9jorYLjIRwvwRsQ6gNY9VHhlK4=; b=ubR+xCdovLEqqF56YAmPSCCsxckXNncVQCBawoCr4yNsPgnQJjcUD5xmfS1Vb/fyri meGoRgFMQchNnIdbWkcR99iyocuDpWILYnb7wfW+3kBDDdwEjt00YIdTfVaZFx20cBT5 Vel2dhnOewv/zPOdGlwtSV9Rmw5kYEVts4GqNVXIn35ZGwrZZrZyWLRQckAUNA5cxZ1v LAlP2JkOmkYc/NsfPssuXN4CE24OhnOJhXeqkg9wcQiVfP+JpFK3e/GUKVDfyxvHSGxO crN10lLdYc9CqD4ySwnuzPP/st/DOY1X/pFx6fLweooGQgiC1qkukRAxcrysbyJLaANf GiIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IHaHFGy9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-194213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194213-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb8105790si123149721cf.508.2024.05.29.06.55.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 06:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IHaHFGy9; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-194213-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194213-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 273BF1C2386D for ; Wed, 29 May 2024 13:55:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F6C21BF3B; Wed, 29 May 2024 13:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IHaHFGy9" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5249A1C290 for ; Wed, 29 May 2024 13:55:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990915; cv=none; b=cE8fa5OEpV+rcrytUdMTHXG5iuTgW2hTVJ9caSAPVVF+GBAWYYZW1lVwEulrFx5sS7wwi9QLcrt2U3FH0tSGHnyXh9mj4zSkmcTFe1xcGNgb3RXgMHXixrxGOuXxZJbHMevyUEjgJR4CMPyJlo18wSzDFT5RNyultwIt6x7zSmI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990915; c=relaxed/simple; bh=7pwxJwgIqNkEt9XQ+aY/jS7KUidtBt2N/WzmYBUYsp4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=o+FVcCkuvZfGeUP+o6pUbQ8K9FhUo4y9wdcZR7hyB3gZZTRZ9WU666DDZXQT7K2dOuittxmsqXZFOl1EI2iGFBFZXuCwKWJuaTkJZa6v8MYF3YGpAzzQkkpYrfjusmPV3bkMLAJMAoL0EUxgDdfSi/3X+AF3op+/Ksxrn+fn9x0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IHaHFGy9; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f44b5b9de6so16480285ad.3 for ; Wed, 29 May 2024 06:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716990913; x=1717595713; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sGlIeA8hMcr9Fm/VlCdK2KdthFpKjfRPf//jK9Gb9e8=; b=IHaHFGy9c5OqE4xNKb4XCL3vP4xhHCM7G6aGNkV/CWW3yi4C3fqzcoa3ZgSJblFI9a Y8yHj7j3AhxAhnTaATBvfgr1y7t3qr5yrtEiemuiylAUauUUiXW92wTF3JRmwMwMWrLt nF0tWLjnCjeT4HuwewA7hanV8zblX21LVEExt/eivxV804+VcLwh9roN0CZQ45eSNECv EEPhW0MK5Dn9GmeGioLVF4YJ2sUDzPC4d2ECqNty394999/8Tl1tU6x3wprT+a0mSL3J o1JnpPDo3XWRVXgDKJztNfGnYoXOmfgGxw4IYtNKbBi/VcmOGCkB0NNJE20oc+7+7L1j baLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716990913; x=1717595713; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sGlIeA8hMcr9Fm/VlCdK2KdthFpKjfRPf//jK9Gb9e8=; b=Muro07e4PZrt4LzQrm4a+NWOPgAExese5eRJTpBsD/0xVYiw/QflGgbXyUh/XsNkfT IgJ2KCgXQMPbgKYoKGOqtBG274FAO4QeZNC5JCNUhwHJNn77/Ox+fKBOe+/ITKoSoINZ 5O8uaX+Zg/oD2TZ6ruHTKGLWr31Igadbs/RlHdf6sfmGWmSzvwLkZrgsN7LI9C6rTktP 4bB6iktV0afRGGE6t+QpvZE8zh+xmMQEQIyqNRWhBdwQc/I9RVu1lHAtgA1mciBY/E1M 9CC7QwFLbUwd1dQiK2A9s4aCslM9u8uN+vMUrkGQ+g3WRHID2z/ssU+9pZbGQ9LDv4bH 80Ow== X-Forwarded-Encrypted: i=1; AJvYcCWUUuvz7DVQ4j/HxuOcVm/++saf5H9shO+tivxi/K29BGQ6cY4GNz+QuHnWxhmcO3IRMwDFl/O8tvXVPL1WFXJwF5cVz/jzAs2DmtSK X-Gm-Message-State: AOJu0YyM7vSeyJ6zN03MLLoOGda/HEzn6SLv4cMIoUyR3OdX2AmMRax7 QfNRwqh+EyJM/5Y9k87wUSVc++hNg78O8sRyQIUIw9kc9YadyhR5rqY+esf+c3VoJEqo2m6TDAz L1HbS2zLAatHm3usT128O8gpKZmg= X-Received: by 2002:a17:903:188:b0:1f4:ee68:3bc5 with SMTP id d9443c01a7336-1f4ee683c53mr18900995ad.57.1716990913482; Wed, 29 May 2024 06:55:13 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240528210319.1242-1-mario.limonciello@amd.com> <87r0dkiv4o.fsf@intel.com> In-Reply-To: <87r0dkiv4o.fsf@intel.com> From: Alex Deucher Date: Wed, 29 May 2024 09:55:01 -0400 Message-ID: Subject: Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization To: Jani Nikula Cc: Mario Limonciello , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, Chris Bainbridge , hughsient@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 29, 2024 at 9:51=E2=80=AFAM Jani Nikula wrote: > > On Wed, 29 May 2024, Alex Deucher wrote: > > On Tue, May 28, 2024 at 5:03=E2=80=AFPM Mario Limonciello > > wrote: > >> > >> 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. > >> > >> Reported-by: Chris Bainbridge > >> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3349 > >> Signed-off-by: Mario Limonciello > > > > Reviewed-by: Alex Deucher > > > > Do you have drm-misc access or do you need someone to apply this for yo= u? > > I've bounced this to intel-gfx and intel-xe lists to get CI testing. I'd > appreciate holding off on merging until we have results. Sure. Alex > > Thanks, > Jani. > > > > > Alex > > > >> --- > >> Cc: hughsient@gmail.com > >> v1->v2: > >> * Match LVDS as well > >> --- > >> drivers/gpu/drm/drm_client_modeset.c | 30 +++++++++++++++++++++++++++= + > >> 1 file changed, 30 insertions(+) > >> > >> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/dr= m_client_modeset.c > >> index 31af5cf37a09..0b0411086e76 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 > >> #include > >> #include > >> #include > >> @@ -257,6 +258,34 @@ static void drm_client_connectors_enabled(struct = drm_connector **connectors, > >> enabled[i] =3D drm_connector_enabled(connectors[i], fa= lse); > >> } > >> > >> +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 =3D 0; i < connector_count; i++) { > >> + struct drm_connector *connector =3D connectors[i]; > >> + > >> + switch (connector->connector_type) { > >> + case DRM_MODE_CONNECTOR_LVDS: > >> + case DRM_MODE_CONNECTOR_eDP: > >> + if (!enabled[i]) > >> + continue; > >> + break; > >> + default: > >> + continue; > >> + } > >> + > >> + if (!acpi_lid_open()) { > >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] lid is clo= sed, disabling\n", > >> + connector->base.id, connector->nam= e); > >> + enabled[i] =3D false; > >> + } > >> + } > >> +} > >> + > >> static bool drm_client_target_cloned(struct drm_device *dev, > >> struct drm_connector **connectors= , > >> unsigned int connector_count, > >> @@ -844,6 +873,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_co= unt, enabled); > >> if (!drm_client_target_cloned(dev, connectors, connect= or_count, modes, > >> offsets, enabled, width,= height) && > >> !drm_client_target_preferred(dev, connectors, conn= ector_count, modes, > >> -- > >> 2.43.0 > >> > > -- > Jani Nikula, Intel