All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org,
	Chris Bainbridge <chris.bainbridge@gmail.com>,
	hughsient@gmail.com
Subject: Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization
Date: Wed, 29 May 2024 17:14:47 +0300	[thread overview]
Message-ID: <Zlc4V1goFvU2antl@intel.com> (raw)
In-Reply-To: <20240528210319.1242-1-mario.limonciello@amd.com>

On Tue, May 28, 2024 at 04:03:19PM -0500, 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 <chris.bainbridge@gmail.com>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3349
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> 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 <acpi/button.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
>  #include <linux/slab.h>
> @@ -257,6 +258,34 @@ 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];
> +
> +		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 closed, disabling\n",
> +				    connector->base.id, connector->name);
> +			enabled[i] = false;
> +		}
> +	}
> +}

If you don't hook into some lid notify event how is one supposed to get
the display back to life after opening the lid?

> +
>  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_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

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2024-05-29 14:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 21:03 [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization Mario Limonciello
2024-05-29 13:33 ` Alex Deucher
2024-05-29 13:51   ` Jani Nikula
2024-05-29 13:55     ` Alex Deucher
2024-05-29 14:34       ` Mario Limonciello
2024-05-29 14:14 ` Ville Syrjälä [this message]
2024-05-29 14:45   ` Mario Limonciello
2024-05-29 15:39     ` Ville Syrjälä
2024-05-29 16:26       ` Mario Limonciello
2024-05-29 17:55       ` Dmitry Baryshkov
2024-05-30  4:41         ` Limonciello, Mario
2024-05-30  8:07           ` Dmitry Baryshkov
2024-05-30 20:44             ` Dmitry Torokhov
2024-05-29 14:22 ` ✓ Fi.CI.BAT: success for drm/client: Detect when ACPI lid is closed during initialization (rev2) Patchwork
2024-05-29 14:32 ` ✓ CI.Patch_applied: success for drm/client: Detect when ACPI lid is closed during initialization Patchwork
2024-05-29 14:33 ` ✓ CI.checkpatch: " Patchwork
2024-05-29 14:34 ` ✓ CI.KUnit: " Patchwork
2024-05-29 14:46 ` ✓ CI.Build: " Patchwork
2024-05-29 14:46 ` ✗ CI.Hooks: failure " Patchwork
2024-05-29 14:47 ` ✗ CI.checksparse: warning " Patchwork
2024-05-29 15:11 ` ✓ CI.BAT: success " Patchwork
2024-05-29 16:04 ` ✓ CI.FULL: " Patchwork
2024-05-30 14:13 ` ✗ Fi.CI.IGT: failure for drm/client: Detect when ACPI lid is closed during initialization (rev2) Patchwork
2024-06-04  2:02 ` [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization kernel test robot
2024-06-05 15:08   ` Chris Bainbridge
2024-06-06  7:21     ` Jani Nikula
2024-06-06 12:31       ` Ville Syrjälä

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=Zlc4V1goFvU2antl@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=chris.bainbridge@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hughsient@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.