Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp660455lqb; Wed, 29 May 2024 07:07:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXMlaATL185EDrAT97JK3LVzoYBrpVACPe1pRwhoNR6H/GXQxG71BUOZBih6k9FwstPE+Q1iVJX73bPpI+2Z3wrZNthl3VGXc9xbntLw== X-Google-Smtp-Source: AGHT+IE9G9XpS0S53kyMhWuOov8aPek80B5+hQ8OAOnpYjX237Eo9Imr5MPMLcx4GFephrctvMk1 X-Received: by 2002:a05:6a20:f3a0:b0:1b2:12ed:d02f with SMTP id adf61e73a8af0-1b259acf6d1mr2745772637.29.1716991661541; Wed, 29 May 2024 07:07:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716991661; cv=pass; d=google.com; s=arc-20160816; b=Zx9NJWzqdeeLrCSJ5Y4hLTy12OT2VGtCx3i2W11PgoaOyWnjltXPJjplsiZ4E2uArz S+RIfsNuGg3KSKf1G0ULFuIM0bZKiFwzHTTxAVgZZ5FK3odopak+VF2rXYU5DPo7up+p vwuE2unhbqd5UHe6T8piDTTcq32uNU0BYEwOcx7DR07RwsuQIcIIx9EYU0ac1ApEapd+ X0UxrIcXDeEMk3/Wr8v1hpd4cYgvYMyLnTZs+vUYIMMnjcBgeqehgUpB0uAg6ow5t605 PvBYBjWbH7Gag28umbITYY/IiLZV3EFxOkS60nOEmXBDDJva+wuEDGHX1CZPw61R0xgu yn5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=uEPH6n1+L2HHI9AVPEDzrRUMt6BJxwffzwCaBkqM+s8=; fh=yJxMroJbZ8x/oQSgYjY2D5s18lqk0kH9nekCpGhRk6I=; b=LXCyKCTj7fv7jatr95yOmS3lHcSXgrAYw1KhpKGBRXWQFyrtZKgWcCyjrlAmtVIrOo uVyhAURAB9T7nXSN8G1z8nHsfIrixGlOaPjw0HaX6Sg/k3+9LnT5WAQqQByRRdXTYnZA +BWpIkTwNjdtCCZYg2ORIlunm7ugsSjy3f0pQYVGZCJjxD2xUqG+XplesZr10f7fCfDj jaII+YoSPTRIBEuQstxzmWgPpXvYcZINt737nNP6HwfV/5Wty4zNxziRj6G5xoRfOv+Z cmupLKxX7mA1zKjFPwXY5JXLOOqEeNw+jFFz0Tn0AzBGiEECU/i/R89kZO7lIXM/R508 IBXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BYLSbycw; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-194206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-696ca462158si6951665a12.506.2024.05.29.07.07.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:07:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BYLSbycw; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-194206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 27001B26FF7 for ; Wed, 29 May 2024 13:51:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F1C81B947; Wed, 29 May 2024 13:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BYLSbycw" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD5851CA8D for ; Wed, 29 May 2024 13:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990693; cv=none; b=LbI57MERxMg38ROIUpBkv6q+D2yivTCDHwxGZbLigW733jOGKUWqVq466hEqPRg2Q420OnlxnHregy6QidC5tzkFR2+o85PBM1lRV1LDjKVzQfBlTbiLMk0DNwCNBegnoBLIbWvM7bDUnGSvR+iD6b82J4nuXHBcJEkgKnZFTtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990693; c=relaxed/simple; bh=4qG4dad29dPTvZyqQLXRikddg2y7NmdD+VTC9hKpIPE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=TcfqV2Tvh2ccf8TtzNGY/sRcFIecSm01LHWH8LzsdobOt6dlzmouTbj7IGdBG2zvMM9aJmqJOJieseGPIevlGjuUCXC5u7CwW9160xmICMQxBx91PJYq/nJMePzrEa77+T3nDymwJYYZlgA/0EqPfZkNh2+W3+HlXWsK02ggYa4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BYLSbycw; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716990692; x=1748526692; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=4qG4dad29dPTvZyqQLXRikddg2y7NmdD+VTC9hKpIPE=; b=BYLSbycwjVncgClmsRzXsnhBInZ9R/CQlc4+YDZIZp6b9Jarw3RrCiwj Ayn25G+v4Jobl2bGMxkjAKAnJTN3P9Sq1u276Mf37n8IE6eKwfRqDdoey F38I+lLLxDBUluOBk6jaxjy9uSelSwQsFekkrzTv1TA634ZLRJTS7W+Ne K4nlRfBgjYPsO8GAgSi6fKNy+S2sa+cookUT3JZ8W+EGDvGJTUkaYFqdI +k4JcXUzDT2+83KodN8xhnYCanT1JqSZIdZDrT7zEmBDV00WMAhdJOWHs Uk8tY5uNhKjl4yTQir2E8JdZhVCrX0hip9EF1jx0CAN7D6GmQRC3ObuM6 A==; X-CSE-ConnectionGUID: q/mM9txnTUmMc2ca8jVhKA== X-CSE-MsgGUID: T6nw3AB7Szyum471s5FFqQ== X-IronPort-AV: E=McAfee;i="6600,9927,11087"; a="13558545" X-IronPort-AV: E=Sophos;i="6.08,198,1712646000"; d="scan'208";a="13558545" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2024 06:51:31 -0700 X-CSE-ConnectionGUID: aFSTnD87RZ2C1kyGZFNVww== X-CSE-MsgGUID: QENQtQuSRL+hs1haaaXu0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,198,1712646000"; d="scan'208";a="35390243" Received: from ncintean-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.86]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2024 06:51:26 -0700 From: Jani Nikula To: Alex Deucher , Mario Limonciello Cc: 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 Subject: Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20240528210319.1242-1-mario.limonciello@amd.com> Date: Wed, 29 May 2024 16:51:35 +0300 Message-ID: <87r0dkiv4o.fsf@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 you? 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. 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/drm_= 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 dr= m_connector **connectors, >> enabled[i] =3D drm_connector_enabled(connectors[i], fals= e); >> } >> >> +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 close= d, disabling\n", >> + connector->base.id, connector->name); >> + 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_coun= t, enabled); >> if (!drm_client_target_cloned(dev, connectors, connector= _count, modes, >> offsets, enabled, width, h= eight) && >> !drm_client_target_preferred(dev, connectors, connec= tor_count, modes, >> -- >> 2.43.0 >> --=20 Jani Nikula, Intel