Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp77035lqm; Mon, 10 Jun 2024 13:13:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpAbDKos4FvYuVB9uSHxEVErxIr33xaYuEeCB/oPkg6jGj3fpJK1ZICNpQ1Y/qCFHVWm1MK+uw3udvQ3dsnuF9hJqhysuJRKhkZ4INmA== X-Google-Smtp-Source: AGHT+IHU+Ki6+w1WV3S3VyMWAWtwCXCBEYe/jl/eNjUzbVzUhCnQ/Ab3E98AJziOlbB1ki1ZJNh7 X-Received: by 2002:a05:6359:5f90:b0:19f:5612:cf4c with SMTP id e5c5f4694b2df-19f5612d38cmr313109455d.1.1718050404014; Mon, 10 Jun 2024 13:13:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718050403; cv=pass; d=google.com; s=arc-20160816; b=d9dhpIDAYab8gR8pCC2MirVr9L9hBApCFMqiMwllTApRTIwH0KAy9OsTtg4qHBclR7 DxGxo/CiWxq0HcMdCrEGjx+p/JYWMdfMqh4ZmUTNBCVkiq/HuIY9X+c5vFa9JE5FyMmF yV0CHPI9OZlnFybqnfYk/6z46/iKhjfXHO+6cp3ja4kG0/UblKmqQzwSdnV4OGG9fqYN 3ZM3DaNtcnLLrV1eK2LcX1dyVvwCNzrCqH1M89DsGyYV8Qm1SxYTP4YZAixpvSJXw0vL FrUFLq/oDV54iAl0AaUK5cWkPVrCu85XL5A7YRLGC2t3M+aX0gbN8wjdwhaOSVC2f1mw w0bA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DBoieIs2AO2IQlJcxTsiqqYCy7jvXGf+Mjpq4ywpNIA=; fh=ufbA/CHkB06i2hyyQYOlVQgeV65uR3tiia254m++A0Q=; b=ib8MDk8WOK+z9xgtGd5gHRdVSPoWRh1Wupt61BFOjZD1Id0NTLPkI/a86Knc+ytqBK jqFZnIuu3wlEpO3+lwdZOB9XH9uehvzH0ESJ/hGL6kM3YuRY64N6tVvr7GyOkQda/Et2 2b8r+BZbBSk1GW92TcAUz5P+3c6n3hNiWwqEbx7hW3Gq/CVLjYRFrZ9pGja2901tf5Eh kobdP87fjhbvpVcWJVlSr4nfd4YuI3bp5WCLkU+BdiWL86MtDFf1RvtY06yoZ3oN9PZF DvOpAsufTbOD+P8GBRkwjMyHAjX1eRiXO0/xB4doDrpKk54C9+gbKtywR4DXjo/Ownrc oJ6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=EjkK7y3U; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-208840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de20832325si4599800a12.82.2024.06.10.13.13.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 13:13:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=EjkK7y3U; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-208840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 702A62866CC for ; Mon, 10 Jun 2024 20:13:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CA8B14F9EC; Mon, 10 Jun 2024 20:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="EjkK7y3U" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 9BADE14F9E0 for ; Mon, 10 Jun 2024 20:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718050366; cv=none; b=TVMVqFS1CUb2Xv904n34LbKIF/IjTD5di3cXxwk6IgEt3yL5qxZ17PdA5Oz5v/pRWMxf2uEKsboK6ljMVNRIKS8LHe3i8EsNtI0PRdjpjfPsdgGkbCWx8QTiY7pN4CiHNuWEcPiW4RT1SZsrtpfddjYxFcJm0zvLA97AJucs9DY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718050366; c=relaxed/simple; bh=I1Hh+qcmMRJfWvLmvO7pofMH2jbsnSVY2A5MKQ0zG1I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b9gSFKhRWOA62uCbr75I2Vo6Uy43EySiX2InLU3b/NOPiXfVPDHAuJk1/a3H9d7Y+P0CfAHxoH7lTq30IDnpYiUuVpyORBP9/6q0GJpGORFWx7C14mw3qVs/ryn+FG/evbTcRI2+kzNV5GbdsL5gCfGNQtzT3EhMCYq7Utbp0X0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=EjkK7y3U; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1718050361; bh=I1Hh+qcmMRJfWvLmvO7pofMH2jbsnSVY2A5MKQ0zG1I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EjkK7y3Ucn6Lpi55NnrvHM8MdR0uWWIlbro80NYBZk5JxC9SvzqzlBbkF9M+2uQt2 HMRAs3jULLMxi/pHiyO9VVP+fZoblbIxPDf+d9yD1EHTtKdJztAXoikLznzRI07trF vwryK5coz1arzS1vWzarler8/rPYUb7OIVw1SsYM= Date: Mon, 10 Jun 2024 22:12:40 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Mario Limonciello Cc: Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , David Airlie , Daniel Vetter , Kieran Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dustin Howett , Matt Hartley Subject: Re: [PATCH] drm/amd: force min_input_signal to 0 on Framework AMD 13/16 Message-ID: <0759ed40-efef-4230-86fc-cdf6702843e6@t-8ch.de> References: <20240610-amdgpu-min-backlight-quirk-v1-1-8459895a5b2a@weissschuh.net> <74f3c189-f3d3-4dca-9357-d4bc8f98da08@amd.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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <74f3c189-f3d3-4dca-9357-d4bc8f98da08@amd.com> On 2024-06-10 14:58:02+0000, Mario Limonciello wrote: > +Kieran > > On 6/10/2024 14:26, Thomas Weißschuh wrote: > > The value of "min_input_signal" returned from ATIF on a Framework AMD 13 > > is "12". This leads to a fairly bright minimum display backlight. > > > > Introduce a quirk to override "min_input_signal" to "0" which leads to a > > much lower minimum brightness, which is still readable even in daylight. > > > > Tested on a Framework AMD 13 BIOS 3.05 and Framework AMD 16. > > > > Link: https://community.frame.work/t/25711/9 > > Link: https://community.frame.work/t/47036 > > Signed-off-by: Thomas Weißschuh > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 35 ++++++++++++++++++++++++++++++++ > > 1 file changed, 35 insertions(+) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c > > index 7099ff9cf8c5..b481889f7491 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c > > @@ -25,6 +25,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -130,6 +131,35 @@ static struct amdgpu_acpi_priv { > > struct amdgpu_atcs atcs; > > } amdgpu_acpi_priv; > > +struct amdgpu_acpi_quirks { > > + bool ignore_min_input_signal; > > +}; > > + > > +static const struct dmi_system_id amdgpu_acpi_quirk_table[] = { > > + { > > + /* the Framework Laptop 13 (AMD Ryzen) and 16 (AMD Ryzen) */ > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Framework"), > > + DMI_MATCH(DMI_PRODUCT_NAME, "AMD Ryzen"), > > + DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"), > > + }, > > Two problems I see: > > 1) This really "should" be fixed in the BIOS. I added Kieran to the thread > for comments if that's viable. Agreed! > 2) IMO this is going to match too liberally across all potential Framework > models. If they introduce a refreshed motherboard for either product then > the quirk would apply to both products when we don't know that such a > deficiency would exist. Also agreed. In addition to be really specific this should also match by display type (via EDID?). So far this was only tested with the matte panel. (I forgot to mention that, sorry) > You can reference drivers/platform/x86/amd/pmc/pmc-quirks.c for what we used > for a quirk that was matching against a single product and single BIOS. Will do for the next revision, but let's gather some feedback first. > But FWIW if that issue isn't fixed in the next BIOS I think we'll end up > needing to tear out the BIOS string match and match just the platform. I'm wondering what the longterm strategy will have to be. Given that there are different kinds of displays, and new ones will be released, each new display type will require an update to the firmware. When there are no firmware updates for a device anymore, but new, compatible displays are released, then the kernel will need the quirks again. > > + .driver_data = &(struct amdgpu_acpi_quirks) { > > + .ignore_min_input_signal = true, > > + }, > > + }, > > + {} > > +}; > > + > > +static const struct amdgpu_acpi_quirks *amdgpu_acpi_get_quirks(void) > > +{ > > + const struct dmi_system_id *dmi_id; > > + > > + dmi_id = dmi_first_match(amdgpu_acpi_quirk_table); > > + if (!dmi_id) > > + return NULL; > > + return dmi_id->driver_data; > > +} > > + > > /* Call the ATIF method > > */ > > /** > > @@ -1388,6 +1418,7 @@ bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) > > */ > > void amdgpu_acpi_detect(void) > > { > > + const struct amdgpu_acpi_quirks *quirks = amdgpu_acpi_get_quirks(); > > struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif; > > struct amdgpu_atcs *atcs = &amdgpu_acpi_priv.atcs; > > struct pci_dev *pdev = NULL; > > @@ -1429,6 +1460,10 @@ void amdgpu_acpi_detect(void) > > ret); > > atif->backlight_caps.caps_valid = false; > > } > > + if (quirks && quirks->ignore_min_input_signal) { > > + DRM_INFO("amdgpu_acpi quirk: min_input_signal=0\n"); > > + atif->backlight_caps.min_input_signal = 0; > > + } > > } else { > > atif->backlight_caps.caps_valid = false; > > } > > > > --- > > base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670 > > change-id: 20240610-amdgpu-min-backlight-quirk-8402fd8e736a > > > > Best regards, >