From patchwork Wed Jun 28 02:42:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1800846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=JfWJ0pm7; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QrQqm4dHjz20bN for ; Wed, 28 Jun 2023 12:43:15 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qEL96-0004Vf-On; Wed, 28 Jun 2023 02:43:04 +0000 Received: from mail-qt1-f171.google.com ([209.85.160.171]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qEL94-0004VM-DO for kernel-team@lists.ubuntu.com; Wed, 28 Jun 2023 02:43:02 +0000 Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-3fddb0bd9e2so56526681cf.0 for ; Tue, 27 Jun 2023 19:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687920181; x=1690512181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=UMRnUyHNXoT2r3r83bmpEMRBgtIwY/iL/DyXxmUEHl4=; b=JfWJ0pm7rR3yzc0MxTJW34qnlwbmPfQ2XRah+pdqzW0B8T/kFS0KhrDa+UH4HlnbmS o+q/oOZTuvakZCXbjHYWaLAuh8M3rcK3hOTr/OawsuKsM3HhqrGGj5U7RU/1ntgLNy9c HcsbpPkg787SLWOhjW30UjKjsu5XUGKURTtJDg61UPRnXSVg4f8nDIkoel1qceKH9DOv WU9gOXvk9KO2ikKTNNcZXzWr+gkiUWxng1q75cVpJzT/i+8Ax/OBbbcblWrSdMs6q9ss o/0EfH0wBcbK77QZ9SgnVeqpkwrJKXU/cZ8kj7RYZTaKgG9loMjt6GIwjHhhvHJeBEPw j/ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687920181; x=1690512181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UMRnUyHNXoT2r3r83bmpEMRBgtIwY/iL/DyXxmUEHl4=; b=F7Q4sUUVrza1VDM4Jt+WeTiQGsr8U6vsE+te3iPlOvQYeUFSwViheaHD2FMctjW+Si tnI1K4ScUd/zkSnUSEAmNPZzHroaIPBbE4jr0V02Hydv/Ew6re/7Zx53nQL8mXrnibtj Vz2e7E+vBtH18hnlL+nurOBPruq0IXvbNKPbh7mZmSBi7qxme8gzckjRsBTJd/ocpAkA NirgcMGu2we8l8DvNgwFHfPrzJBM1HdnSSS4ZgpQ2KBOrqO69yCg10VKnEwxXRgaL5qZ SkJjNEqQuIgZPvzLHWHTWktSGE1oHv59yZ6y5mGrdhC1tTsDMKvX85ST1gFMr53299dO faxw== X-Gm-Message-State: AC+VfDzBmU5rhcY/NCiFnLMawA5BfaEMhKK85nPtaOK580C3WANE+IKT DwJGehZCq7HnemAuSwqhKyIXQ+QAdZA= X-Google-Smtp-Source: ACHHUZ7CmPK6Nn6VcbAQpTpPkUT45eP9etzONBJinwj7BpFw630RPXTqhEkOJyPfzKJjGB65HDy/qQ== X-Received: by 2002:a05:622a:110a:b0:3fd:ecdc:1e1e with SMTP id e10-20020a05622a110a00b003fdecdc1e1emr32080440qty.22.1687920180711; Tue, 27 Jun 2023 19:43:00 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id t15-20020a63534f000000b0050fa6546a45sm6442377pgl.6.2023.06.27.19.43.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 19:43:00 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][L][M] ACPI: video: Stop trying to use vendor backlight control on laptops from after ~2012 Date: Wed, 28 Jun 2023 10:42:56 +0800 Message-Id: <20230628024256.365495-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230628024256.365495-1-acelan.kao@canonical.com> References: <20230628024256.365495-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.160.171; envelope-from=acelan@gmail.com; helo=mail-qt1-f171.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Hans de Goede BugLink: https://bugs.launchpad.net/bugs/2023638 There have been 2 separate reports now about a non working "dell_backlight" device getting registered under /sys/class/backlight 1 report for a Raptor Lake based Dell and 1 report for a Meteor Lake (development) platform. On hw from the last 10 years dell-laptop will not register "dell_backlight" because acpi_video_get_backlight_type() will return acpi_backlight_video there if called before the GPU/kms driver loads. So it does not matter if the GPU driver's native backlight is registered after dell-laptop loads. But it seems that on the latest generation laptops the ACPI tables no longer contain acpi_video backlight control support which causes acpi_video_get_backlight_type() to return acpi_backlight_vendor causing "dell_backlight" to get registered if the dell-laptop module is loaded before the GPU/kms driver. Vendor specific backlight control like the "dell_backlight" device is only necessary on quite old hw (from before acpi_video backlight control was introduced). Work around "dell_backlight" registering on very new hw (where acpi_video backlight control seems to be no more) by making acpi_video_get_backlight_type() return acpi_backlight_none instead of acpi_backlight_vendor as final fallback when the ACPI tables have support for Windows 8 or later (laptops from after ~2012). Suggested-by: Matthew Garrett Reported-by: AceLan Kao Closes: https://lore.kernel.org/platform-driver-x86/20230607034331.576623-1-acelan.kao@canonical.com/ Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki (cherry picked from commit aa8a950a5d6b2094830aff834198777371ff91ff) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/acpi/video_detect.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 74abb8eb2e44..022c951a2fb2 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -831,6 +831,27 @@ enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto if (native_available) return acpi_backlight_native; + /* + * The vendor specific BIOS interfaces are only necessary for + * laptops from before ~2008. + * + * For laptops from ~2008 till ~2023 this point is never reached + * because on those (video_caps & ACPI_VIDEO_BACKLIGHT) above is true. + * + * Laptops from after ~2023 no longer support ACPI_VIDEO_BACKLIGHT, + * if this point is reached on those, this likely means that + * the GPU kms driver which sets native_available has not loaded yet. + * + * Returning acpi_backlight_vendor in this case is known to sometimes + * cause a non working vendor specific /sys/class/backlight device to + * get registered. + * + * Return acpi_backlight_none on laptops with ACPI tables written + * for Windows 8 (laptops from after ~2012) to avoid this problem. + */ + if (acpi_osi_is_win8()) + return acpi_backlight_none; + /* No ACPI video/native (old hw), use vendor specific fw methods. */ return acpi_backlight_vendor; }