Message ID | 20221024113513.5205-1-akihiko.odaki@daynix.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404849wru; Mon, 24 Oct 2022 04:55:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5swtzHt58w2ETruhP1XC7h9mreIHxgfbn6YNNTTe9Y09o/0M82X9QnRsa7hJZPqlNLnVK/ X-Received: by 2002:a17:90a:cc7:b0:200:3b3e:4e00 with SMTP id 7-20020a17090a0cc700b002003b3e4e00mr73048184pjt.201.1666612550464; Mon, 24 Oct 2022 04:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612550; cv=none; d=google.com; s=arc-20160816; b=XCMPJ8am5tsRWhwaAX0xuMcKSMBIGzKHVoHz/JR9+uNL/xe14t+MHXRQRi+rkMjtUm embwYYvo3wcGj4QLp9reEMp9gPqobSocDart7Q5mANQdvMp+s9yMwbyg0bTxyLeebUV3 LbP6x8vfC7EKknDo4gryoklwkfQI4yOD21iyYFyv2hpQWMBmtrqUw+BFT3ymbFR4Hg/h pDl9UiVGEgCA1mAiMuRKtDZasjxy30H+0hYMphdXmqEqSReVQAabBTNnK0/7Iq4Y8e2D ieUvhEUfM/zNqSarbnvWkir5p7lcV4XXvCqz6bvBgjgNjoLcCJKrEK68OTW5YaGkUxKX 6fnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=zcdfaNsoIuuSNF9XByhbeUp3KpNdfCPWzGZ8aF5nLxA=; b=rBVr4eiwfEh1eWMLOBvrU4rFyQ78BKIV9DNmPBCDgPdpsZg3HOYq+C4FdJ+y0N9eD+ x254gMSNzjuVK5db5DDKelyBzu7/m5N7bpKbC6BSS4mchi3wCc2v86DPNFLz4p0GyNfG cwF6kWjn0PTL/ERC2wLDSpkNCRQd/+0IZuGoNDxesr+Hr3WQtt1I1sgAa7F1O8GMjNC4 UOY6HDecBgNNu1ZSecjvLDKTAQuHi2eB3b2rJ65XFc5XdHyYZHPX0Aeh0v/fybANGwxQ J1u5IKJdNmgZE/Ik9j6yhflraj7LnyFdycHi0pnzGpnjw1FKNXN+ktlSo1Eu+fCNeYw+ SFqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b="A/SaFlQi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902900700b0017c887295fbsi30724451plp.420.2022.10.24.04.55.37; Mon, 24 Oct 2022 04:55:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b="A/SaFlQi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232067AbiJXLz0 (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 07:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbiJXLyK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 07:54:10 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95AB4C2C9 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 04:45:08 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id e129so8452088pgc.9 for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 04:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zcdfaNsoIuuSNF9XByhbeUp3KpNdfCPWzGZ8aF5nLxA=; b=A/SaFlQiUebp/U4yUjESResGqrVwntBISSfqBzWDzKJibVbtIVr9UUfU6mxLj07U3t BF1P1ziYSaSoZu2hLeXkqtIzAlvAh0MFneC+wQBMWmi0FH1LXXFBqHadJUpo8KeJTncO UfWe0DIEAPCTW/sCTy15HwE2CBjAb+Rx1eEUSB+NNH260sZc5OtfAVjOXussqn3KA347 PpO/tyEscshRJ9N6nCBeacKW6fv3Tw1lcWUes4Zil4fK5WzarbbrLQTA4j7+JXjg1OB5 Nl7VXtFCfuFWoaeikVJ/SxvLnxREoubYa0ceNbAiLW7yzBhF70OMrb+09Y3IJKqA+AuT 576g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zcdfaNsoIuuSNF9XByhbeUp3KpNdfCPWzGZ8aF5nLxA=; b=UMwFockpIfsDFAoI37kkxrNKgQX93+luI2LNtPnCnQkpJFq5hHy6u0JxfZIMon/9SK m11Kf6Tk9dbaSPg57XpGMjKcAag//yhym80/5MZ62xkpRNi7VqfjeCwQVsb/PUzrpFUC lvD5VQn+jIOV4esiqBFkYdcp2Zpp1vPQ0q9vWIoCGgZ7S4EbNm4USQ6jYzIop+8za4R9 x8e+TdrSnDCR2N66yR0dE4yTkjD0WPZ5gK/f2oQenl4AV8k4oprNEolNlVsJ+HzZ21Oq 7SuH0pKrz+t0eMKt7Ben8S4TwJYynwpO8ftXe349tRLw3oExLCkYpzbS2e7alzwkuNMA 3DKw== X-Gm-Message-State: ACrzQf0MpbNyYGEdb7C6sGpz5TjLsAcEO7ASEWkHSOUiiP6JWo0MHz5z swfZJOV6MFCBH8ctM6BEpkl86XdhlsqEzzFq X-Received: by 2002:a63:2345:0:b0:463:7c74:73b with SMTP id u5-20020a632345000000b004637c74073bmr28176901pgm.39.1666611341111; Mon, 24 Oct 2022 04:35:41 -0700 (PDT) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id b8-20020a170903228800b001830ed575c3sm19475075plh.117.2022.10.24.04.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 04:35:40 -0700 (PDT) From: Akihiko Odaki <akihiko.odaki@daynix.com> Cc: David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, Jonathan Corbet <corbet@lwn.net>, "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, "Lee, Chun-Yi" <jlee@suse.com>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Corentin Chary <corentin.chary@gmail.com>, Cezary Jackiewicz <cezary.jackiewicz@gmail.com>, Matthew Garrett <mjg59@srcf.ucam.org>, =?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>, Jonathan Woithe <jwoithe@just42.net>, Ike Panhc <ike.pan@canonical.com>, Daniel Dadap <ddadap@nvidia.com>, Kenneth Chan <kenneth.t.chan@gmail.com>, Mattia Dongili <malattia@linux.it>, Henrique de Moraes Holschuh <hmh@hmh.eng.br>, Azael Avalos <coproscefalo@gmail.com>, Lee Jones <lee@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Jingoo Han <jingoohan1@gmail.com>, Helge Deller <deller@gmx.de>, Robert Moore <robert.moore@intel.com>, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, intel-gfx@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, ibm-acpi-devel@lists.sourceforge.net, linux-fbdev@vger.kernel.org, devel@acpica.org, Akihiko Odaki <akihiko.odaki@daynix.com> Subject: [PATCH 00/22] Fallback to native backlight Date: Mon, 24 Oct 2022 20:34:51 +0900 Message-Id: <20221024113513.5205-1-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569921639536039?= X-GMAIL-MSGID: =?utf-8?q?1747569921639536039?= |
Series |
Fallback to native backlight
|
|
Message
Akihiko Odaki
Oct. 24, 2022, 11:34 a.m. UTC
Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native()
helper") and following commits made native backlight unavailable if
CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is
unavailable, which broke the backlight functionality on Lenovo ThinkPad
C13 Yoga Chromebook. Allow to fall back to native backlight in such
cases.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Akihiko Odaki (22):
drm/i915/opregion: Improve backlight request condition
ACPI: video: Introduce acpi_video_get_backlight_types()
LoongArch: Use acpi_video_get_backlight_types()
platform/x86: acer-wmi: Use acpi_video_get_backlight_types()
platform/x86: asus-laptop: Use acpi_video_get_backlight_types()
platform/x86: asus-wmi: Use acpi_video_get_backlight_types()
platform/x86: compal-laptop: Use acpi_video_get_backlight_types()
platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types()
platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types()
platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types()
platform/x86: msi-laptop: Use acpi_video_get_backlight_types()
platform/x86: msi-wmi: Use acpi_video_get_backlight_types()
platform/x86: nvidia-wmi-ec-backlight: Use
acpi_video_get_backlight_types()
platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types()
platform/x86: samsung-laptop: Use acpi_video_get_backlight_types()
platform/x86: sony-laptop: Use acpi_video_get_backlight_types()
platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types()
platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types()
platform/x86: dell-laptop: Use acpi_video_get_backlight_types()
platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types()
ACPI: video: Remove acpi_video_get_backlight_type()
ACPI: video: Fallback to native backlight
Documentation/gpu/todo.rst | 8 +--
drivers/acpi/acpi_video.c | 2 +-
drivers/acpi/video_detect.c | 54 ++++++++++---------
drivers/gpu/drm/i915/display/intel_opregion.c | 3 +-
drivers/platform/loongarch/loongson-laptop.c | 4 +-
drivers/platform/x86/acer-wmi.c | 2 +-
drivers/platform/x86/asus-laptop.c | 2 +-
drivers/platform/x86/asus-wmi.c | 4 +-
drivers/platform/x86/compal-laptop.c | 2 +-
drivers/platform/x86/dell/dell-laptop.c | 2 +-
drivers/platform/x86/eeepc-laptop.c | 2 +-
drivers/platform/x86/fujitsu-laptop.c | 4 +-
drivers/platform/x86/ideapad-laptop.c | 2 +-
drivers/platform/x86/intel/oaktrail.c | 2 +-
drivers/platform/x86/msi-laptop.c | 2 +-
drivers/platform/x86/msi-wmi.c | 2 +-
.../platform/x86/nvidia-wmi-ec-backlight.c | 2 +-
drivers/platform/x86/panasonic-laptop.c | 2 +-
drivers/platform/x86/samsung-laptop.c | 2 +-
drivers/platform/x86/sony-laptop.c | 2 +-
drivers/platform/x86/thinkpad_acpi.c | 4 +-
drivers/platform/x86/toshiba_acpi.c | 2 +-
drivers/video/backlight/backlight.c | 18 +++++++
include/acpi/video.h | 21 ++++----
include/linux/backlight.h | 1 +
25 files changed, 85 insertions(+), 66 deletions(-)
Comments
On Mon, 24 Oct 2022, Akihiko Odaki <akihiko.odaki@daynix.com> wrote: > Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() > helper") and following commits made native backlight unavailable if > CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is > unavailable, which broke the backlight functionality on Lenovo ThinkPad > C13 Yoga Chromebook. Allow to fall back to native backlight in such > cases. Where's the bug report with relevant logs, kconfigs, etc? BR, Jani. > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > > Akihiko Odaki (22): > drm/i915/opregion: Improve backlight request condition > ACPI: video: Introduce acpi_video_get_backlight_types() > LoongArch: Use acpi_video_get_backlight_types() > platform/x86: acer-wmi: Use acpi_video_get_backlight_types() > platform/x86: asus-laptop: Use acpi_video_get_backlight_types() > platform/x86: asus-wmi: Use acpi_video_get_backlight_types() > platform/x86: compal-laptop: Use acpi_video_get_backlight_types() > platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() > platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() > platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() > platform/x86: msi-laptop: Use acpi_video_get_backlight_types() > platform/x86: msi-wmi: Use acpi_video_get_backlight_types() > platform/x86: nvidia-wmi-ec-backlight: Use > acpi_video_get_backlight_types() > platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() > platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() > platform/x86: sony-laptop: Use acpi_video_get_backlight_types() > platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() > platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() > platform/x86: dell-laptop: Use acpi_video_get_backlight_types() > platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() > ACPI: video: Remove acpi_video_get_backlight_type() > ACPI: video: Fallback to native backlight > > Documentation/gpu/todo.rst | 8 +-- > drivers/acpi/acpi_video.c | 2 +- > drivers/acpi/video_detect.c | 54 ++++++++++--------- > drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- > drivers/platform/loongarch/loongson-laptop.c | 4 +- > drivers/platform/x86/acer-wmi.c | 2 +- > drivers/platform/x86/asus-laptop.c | 2 +- > drivers/platform/x86/asus-wmi.c | 4 +- > drivers/platform/x86/compal-laptop.c | 2 +- > drivers/platform/x86/dell/dell-laptop.c | 2 +- > drivers/platform/x86/eeepc-laptop.c | 2 +- > drivers/platform/x86/fujitsu-laptop.c | 4 +- > drivers/platform/x86/ideapad-laptop.c | 2 +- > drivers/platform/x86/intel/oaktrail.c | 2 +- > drivers/platform/x86/msi-laptop.c | 2 +- > drivers/platform/x86/msi-wmi.c | 2 +- > .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- > drivers/platform/x86/panasonic-laptop.c | 2 +- > drivers/platform/x86/samsung-laptop.c | 2 +- > drivers/platform/x86/sony-laptop.c | 2 +- > drivers/platform/x86/thinkpad_acpi.c | 4 +- > drivers/platform/x86/toshiba_acpi.c | 2 +- > drivers/video/backlight/backlight.c | 18 +++++++ > include/acpi/video.h | 21 ++++---- > include/linux/backlight.h | 1 + > 25 files changed, 85 insertions(+), 66 deletions(-)
Hi Akihiko, On 10/24/22 13:34, Akihiko Odaki wrote: > Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() > helper") and following commits made native backlight unavailable if > CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is > unavailable, which broke the backlight functionality on Lenovo ThinkPad > C13 Yoga Chromebook. Allow to fall back to native backlight in such > cases. I appreciate your work on this, but what this in essence does is it allows 2 backlight drivers (vendor + native) to get registered for the same panel again. While the whole goal of the backlight refactor series landing in 6.1 was to make it so that there always is only *1* backlight device registered instead of (possibly) registering multiple and letting userspace figure it out. It is also important to only always have 1 backlight device per panel for further upcoming changes. So nack for this solution, sorry. I am aware that this breaks backlight control on some Chromebooks, this was already reported and I wrote a long reply explaining why things are done the way they are done now and also suggesting 2 possible (much simpler) fixes, see: https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ Unfortunately the reported has not followed-up on this and I don't have the hardware to test this myself. Can you please try implementing 1 of the fixes suggested there and then submit that upstream ? Regards, Hans > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > > Akihiko Odaki (22): > drm/i915/opregion: Improve backlight request condition > ACPI: video: Introduce acpi_video_get_backlight_types() > LoongArch: Use acpi_video_get_backlight_types() > platform/x86: acer-wmi: Use acpi_video_get_backlight_types() > platform/x86: asus-laptop: Use acpi_video_get_backlight_types() > platform/x86: asus-wmi: Use acpi_video_get_backlight_types() > platform/x86: compal-laptop: Use acpi_video_get_backlight_types() > platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() > platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() > platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() > platform/x86: msi-laptop: Use acpi_video_get_backlight_types() > platform/x86: msi-wmi: Use acpi_video_get_backlight_types() > platform/x86: nvidia-wmi-ec-backlight: Use > acpi_video_get_backlight_types() > platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() > platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() > platform/x86: sony-laptop: Use acpi_video_get_backlight_types() > platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() > platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() > platform/x86: dell-laptop: Use acpi_video_get_backlight_types() > platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() > ACPI: video: Remove acpi_video_get_backlight_type() > ACPI: video: Fallback to native backlight > > Documentation/gpu/todo.rst | 8 +-- > drivers/acpi/acpi_video.c | 2 +- > drivers/acpi/video_detect.c | 54 ++++++++++--------- > drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- > drivers/platform/loongarch/loongson-laptop.c | 4 +- > drivers/platform/x86/acer-wmi.c | 2 +- > drivers/platform/x86/asus-laptop.c | 2 +- > drivers/platform/x86/asus-wmi.c | 4 +- > drivers/platform/x86/compal-laptop.c | 2 +- > drivers/platform/x86/dell/dell-laptop.c | 2 +- > drivers/platform/x86/eeepc-laptop.c | 2 +- > drivers/platform/x86/fujitsu-laptop.c | 4 +- > drivers/platform/x86/ideapad-laptop.c | 2 +- > drivers/platform/x86/intel/oaktrail.c | 2 +- > drivers/platform/x86/msi-laptop.c | 2 +- > drivers/platform/x86/msi-wmi.c | 2 +- > .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- > drivers/platform/x86/panasonic-laptop.c | 2 +- > drivers/platform/x86/samsung-laptop.c | 2 +- > drivers/platform/x86/sony-laptop.c | 2 +- > drivers/platform/x86/thinkpad_acpi.c | 4 +- > drivers/platform/x86/toshiba_acpi.c | 2 +- > drivers/video/backlight/backlight.c | 18 +++++++ > include/acpi/video.h | 21 ++++---- > include/linux/backlight.h | 1 + > 25 files changed, 85 insertions(+), 66 deletions(-) >
On 2022/10/24 20:48, Jani Nikula wrote: > On Mon, 24 Oct 2022, Akihiko Odaki <akihiko.odaki@daynix.com> wrote: >> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >> helper") and following commits made native backlight unavailable if >> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >> unavailable, which broke the backlight functionality on Lenovo ThinkPad >> C13 Yoga Chromebook. Allow to fall back to native backlight in such >> cases. > > Where's the bug report with relevant logs, kconfigs, etc? I haven't filed one. Should I? Please tell me where to report and what information you would need (to bugzilla.kernel.org with things mentioned in Documentation/admin-guide/reporting-issues.rst?) Regards, Akihiko Odaki > > BR, > Jani. > >> >> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> >> >> Akihiko Odaki (22): >> drm/i915/opregion: Improve backlight request condition >> ACPI: video: Introduce acpi_video_get_backlight_types() >> LoongArch: Use acpi_video_get_backlight_types() >> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >> platform/x86: nvidia-wmi-ec-backlight: Use >> acpi_video_get_backlight_types() >> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >> ACPI: video: Remove acpi_video_get_backlight_type() >> ACPI: video: Fallback to native backlight >> >> Documentation/gpu/todo.rst | 8 +-- >> drivers/acpi/acpi_video.c | 2 +- >> drivers/acpi/video_detect.c | 54 ++++++++++--------- >> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >> drivers/platform/loongarch/loongson-laptop.c | 4 +- >> drivers/platform/x86/acer-wmi.c | 2 +- >> drivers/platform/x86/asus-laptop.c | 2 +- >> drivers/platform/x86/asus-wmi.c | 4 +- >> drivers/platform/x86/compal-laptop.c | 2 +- >> drivers/platform/x86/dell/dell-laptop.c | 2 +- >> drivers/platform/x86/eeepc-laptop.c | 2 +- >> drivers/platform/x86/fujitsu-laptop.c | 4 +- >> drivers/platform/x86/ideapad-laptop.c | 2 +- >> drivers/platform/x86/intel/oaktrail.c | 2 +- >> drivers/platform/x86/msi-laptop.c | 2 +- >> drivers/platform/x86/msi-wmi.c | 2 +- >> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >> drivers/platform/x86/panasonic-laptop.c | 2 +- >> drivers/platform/x86/samsung-laptop.c | 2 +- >> drivers/platform/x86/sony-laptop.c | 2 +- >> drivers/platform/x86/thinkpad_acpi.c | 4 +- >> drivers/platform/x86/toshiba_acpi.c | 2 +- >> drivers/video/backlight/backlight.c | 18 +++++++ >> include/acpi/video.h | 21 ++++---- >> include/linux/backlight.h | 1 + >> 25 files changed, 85 insertions(+), 66 deletions(-) >
Hi, On 10/24/22 13:56, Akihiko Odaki wrote: > On 2022/10/24 20:48, Jani Nikula wrote: >> On Mon, 24 Oct 2022, Akihiko Odaki <akihiko.odaki@daynix.com> wrote: >>> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >>> helper") and following commits made native backlight unavailable if >>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>> unavailable, which broke the backlight functionality on Lenovo ThinkPad >>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>> cases. >> >> Where's the bug report with relevant logs, kconfigs, etc? > > I haven't filed one. Should I? Please tell me where to report and what information you would need (to bugzilla.kernel.org with things mentioned in Documentation/admin-guide/reporting-issues.rst?) As mentioned in my other email this is a known issue, and your effort to fix this is appreciated very much, but I don't believe your solution to be the right one. See: https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ for more details and possible solutions. Please try implementing one of those solutions for your Chromebook. I unfortunately do not have hw to test this myself. Regards, Hans > > Regards, > Akihiko Odaki > >> >> BR, >> Jani. >> >>> >>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> >>> >>> Akihiko Odaki (22): >>> drm/i915/opregion: Improve backlight request condition >>> ACPI: video: Introduce acpi_video_get_backlight_types() >>> LoongArch: Use acpi_video_get_backlight_types() >>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: nvidia-wmi-ec-backlight: Use >>> acpi_video_get_backlight_types() >>> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>> ACPI: video: Remove acpi_video_get_backlight_type() >>> ACPI: video: Fallback to native backlight >>> >>> Documentation/gpu/todo.rst | 8 +-- >>> drivers/acpi/acpi_video.c | 2 +- >>> drivers/acpi/video_detect.c | 54 ++++++++++--------- >>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>> drivers/platform/x86/acer-wmi.c | 2 +- >>> drivers/platform/x86/asus-laptop.c | 2 +- >>> drivers/platform/x86/asus-wmi.c | 4 +- >>> drivers/platform/x86/compal-laptop.c | 2 +- >>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>> drivers/platform/x86/msi-laptop.c | 2 +- >>> drivers/platform/x86/msi-wmi.c | 2 +- >>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>> drivers/platform/x86/samsung-laptop.c | 2 +- >>> drivers/platform/x86/sony-laptop.c | 2 +- >>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>> drivers/video/backlight/backlight.c | 18 +++++++ >>> include/acpi/video.h | 21 ++++---- >>> include/linux/backlight.h | 1 + >>> 25 files changed, 85 insertions(+), 66 deletions(-) >> >
On 2022/10/24 20:53, Hans de Goede wrote: > Hi Akihiko, > > On 10/24/22 13:34, Akihiko Odaki wrote: >> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >> helper") and following commits made native backlight unavailable if >> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >> unavailable, which broke the backlight functionality on Lenovo ThinkPad >> C13 Yoga Chromebook. Allow to fall back to native backlight in such >> cases. > > I appreciate your work on this, but what this in essence does is > it allows 2 backlight drivers (vendor + native) to get registered > for the same panel again. While the whole goal of the backlight refactor > series landing in 6.1 was to make it so that there always is only > *1* backlight device registered instead of (possibly) registering > multiple and letting userspace figure it out. It is also important > to only always have 1 backlight device per panel for further > upcoming changes. > > So nack for this solution, sorry. > > I am aware that this breaks backlight control on some Chromebooks, > this was already reported and I wrote a long reply explaining why > things are done the way they are done now and also suggesting > 2 possible (much simpler) fixes, see: > https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ > > Unfortunately the reported has not followed-up on this and > I don't have the hardware to test this myself. > > Can you please try implementing 1 of the fixes suggested there > and then submit that upstream ? > > Regards, > > Hans > Hi Hans, Thanks for reviewing and letting me know the prior attempt. In this case, there is only a native backlight device and no vendor backlight device so the duplication of backlight devices does not happen. I think it is better to handle such a case without quirks. I understand it is still questionable to cover the case by allowing duplication when both of a vendor backlight device and native one. To explain my understanding and reasoning for *not* trying to apply the de-duplication rule to the vendor/native combination, let me first describe that the de-duplication which happens in acpi_video_get_backlight_type() is a heuristics and limited. As the background of acpi_video_get_backlight_type(), there is an assumption that it should be common that both of the firmware, implementing ACPI, and the kernel have code to drive backlight. In the case, the more reliable one should be picked instead of using both, and that is what the statements in `if (video_caps & ACPI_VIDEO_BACKLIGHT)` does. However, the method has two limitations: 1. It does not cover the case where two backlight devices with the same type exist. 2. The underlying assumption does not apply to vendor/native combination. Regarding the second limitation, I don't even understand the difference between vendor and native. My guess is that a vendor backlight device uses vendor-specific ACPI interface, and a native one directly uses hardware registers. If my guess is correct, the difference between vendor and native does not imply that both of them are likely to exist at the same time. As the conclusion, there is no more motivation to try to de-duplicate the vendor/native combination than to try to de-duplicate combination of devices with a single type. Of course, it is better if we could also avoid registering two devices with one type for one physical device. Possibly we can do so by providing a parameter to indicate that it is for the same "internal" backlight to devm_backlight_device_register(), and let the function check for the duplication. However, this rule may be too restrict, or may have problems I missed. Based on the discussion above, we can deduce three possibilities: a. There is no reason to distinguish vendor and native in this case, and we can stick to my current proposal. b. There is a valid reason to distinguish vendor and native, and we can adopt the same strategy that already adopted for ACPI video/vendor combination. c. We can implement de-duplication in devm_backlight_device_register(). d. The other possible options are not worth, and we can just implement quirks specific to Chromebook/coreboot. In case b, it should be noted that vendor and native backlight device do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. In the case, the de-duplication needs to be implemented in backlight class device. Regards, Akihiko Odaki > > > > > > > > >> >> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> >> >> Akihiko Odaki (22): >> drm/i915/opregion: Improve backlight request condition >> ACPI: video: Introduce acpi_video_get_backlight_types() >> LoongArch: Use acpi_video_get_backlight_types() >> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >> platform/x86: nvidia-wmi-ec-backlight: Use >> acpi_video_get_backlight_types() >> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >> ACPI: video: Remove acpi_video_get_backlight_type() >> ACPI: video: Fallback to native backlight >> >> Documentation/gpu/todo.rst | 8 +-- >> drivers/acpi/acpi_video.c | 2 +- >> drivers/acpi/video_detect.c | 54 ++++++++++--------- >> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >> drivers/platform/loongarch/loongson-laptop.c | 4 +- >> drivers/platform/x86/acer-wmi.c | 2 +- >> drivers/platform/x86/asus-laptop.c | 2 +- >> drivers/platform/x86/asus-wmi.c | 4 +- >> drivers/platform/x86/compal-laptop.c | 2 +- >> drivers/platform/x86/dell/dell-laptop.c | 2 +- >> drivers/platform/x86/eeepc-laptop.c | 2 +- >> drivers/platform/x86/fujitsu-laptop.c | 4 +- >> drivers/platform/x86/ideapad-laptop.c | 2 +- >> drivers/platform/x86/intel/oaktrail.c | 2 +- >> drivers/platform/x86/msi-laptop.c | 2 +- >> drivers/platform/x86/msi-wmi.c | 2 +- >> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >> drivers/platform/x86/panasonic-laptop.c | 2 +- >> drivers/platform/x86/samsung-laptop.c | 2 +- >> drivers/platform/x86/sony-laptop.c | 2 +- >> drivers/platform/x86/thinkpad_acpi.c | 4 +- >> drivers/platform/x86/toshiba_acpi.c | 2 +- >> drivers/video/backlight/backlight.c | 18 +++++++ >> include/acpi/video.h | 21 ++++---- >> include/linux/backlight.h | 1 + >> 25 files changed, 85 insertions(+), 66 deletions(-) >> >
On Monday 24 October 2022 21:58:57 Akihiko Odaki wrote: > Regarding the second limitation, I don't even understand the difference > between vendor and native. My guess is that a vendor backlight device uses > vendor-specific ACPI interface, and a native one directly uses hardware > registers. If my guess is correct, the difference between vendor and native > does not imply that both of them are likely to exist at the same time. As > the conclusion, there is no more motivation to try to de-duplicate the > vendor/native combination than to try to de-duplicate combination of devices > with a single type. Hello! I just want to point one thing. On some Dell laptops there are 3 different ways (= 3 different APIs) how to control display backlight. There is ACPI driver (uses ACPI), GPU/DRM driver (i915.ko; uses directly HW) and platform vendor driver (dell-laptop.ko; uses vendor BIOS or firmware API). Just every driver has different pre-calculated scaling values. So sometimes user wants to choose different driver just because it allows to set backlight level with "better" granularity. Registering all 3 device drivers is bad as user does not want to see 3 display panels and forcing registration of specific one without runtime option is also bad (some of those drivers do not have to be suitable or has worse granularity as other).
Hi, On 10/24/22 14:58, Akihiko Odaki wrote: > On 2022/10/24 20:53, Hans de Goede wrote: >> Hi Akihiko, >> >> On 10/24/22 13:34, Akihiko Odaki wrote: >>> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >>> helper") and following commits made native backlight unavailable if >>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>> unavailable, which broke the backlight functionality on Lenovo ThinkPad >>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>> cases. >> >> I appreciate your work on this, but what this in essence does is >> it allows 2 backlight drivers (vendor + native) to get registered >> for the same panel again. While the whole goal of the backlight refactor >> series landing in 6.1 was to make it so that there always is only >> *1* backlight device registered instead of (possibly) registering >> multiple and letting userspace figure it out. It is also important >> to only always have 1 backlight device per panel for further >> upcoming changes. >> >> So nack for this solution, sorry. >> >> I am aware that this breaks backlight control on some Chromebooks, >> this was already reported and I wrote a long reply explaining why >> things are done the way they are done now and also suggesting >> 2 possible (much simpler) fixes, see: >> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >> >> Unfortunately the reported has not followed-up on this and >> I don't have the hardware to test this myself. >> >> Can you please try implementing 1 of the fixes suggested there >> and then submit that upstream ? >> >> Regards, >> >> Hans >> > > Hi Hans, > > Thanks for reviewing and letting me know the prior attempt. > > In this case, there is only a native backlight device and no vendor backlight device so the duplication of backlight devices does not happen. I think it is better to handle such a case without quirks. Adding a single heuristic for all chromebooks is something completely different then adding per model quirks which indeed ideally should be avoided (but this is not always possible). > I understand it is still questionable to cover the case by allowing duplication when both of a vendor backlight device and native one. To explain my understanding and reasoning for *not* trying to apply the de-duplication rule to the vendor/native combination, let me first describe that the de-duplication which happens in acpi_video_get_backlight_type() is a heuristics and limited. > > As the background of acpi_video_get_backlight_type(), there is an assumption that it should be common that both of the firmware, implementing ACPI, and the kernel have code to drive backlight. In the case, the more reliable one should be picked instead of using both, and that is what the statements in `if (video_caps & ACPI_VIDEO_BACKLIGHT)` does. > > However, the method has two limitations: > 1. It does not cover the case where two backlight devices with the same type exist. This only happens when there are 2 panels; or 2 gpus driving a single panel which are both special cases where we actually want 2 backlight devices. > 2. The underlying assumption does not apply to vendor/native combination. > > Regarding the second limitation, I don't even understand the difference between vendor and native. My guess is that a vendor backlight device uses vendor-specific ACPI interface, and a native one directly uses hardware registers. If my guess is correct, the difference between vendor and native does not imply that both of them are likely to exist at the same time. As the conclusion, there is no more motivation to try to de-duplicate the vendor/native combination than to try to de-duplicate combination of devices with a single type. > > Of course, it is better if we could also avoid registering two devices with one type for one physical device. Possibly we can do so by providing a parameter to indicate that it is for the same "internal" backlight to devm_backlight_device_register(), and let the function check for the duplication. However, this rule may be too restrict, or may have problems I missed. > > Based on the discussion above, we can deduce three possibilities: > a. There is no reason to distinguish vendor and native in this case, and we can stick to my current proposal. > b. There is a valid reason to distinguish vendor and native, and we can adopt the same strategy that already adopted for ACPI video/vendor combination. > c. We can implement de-duplication in devm_backlight_device_register(). > d. The other possible options are not worth, and we can just implement quirks specific to Chromebook/coreboot. > > In case b, it should be noted that vendor and native backlight device do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. In the case, the de-duplication needs to be implemented in backlight class device. I have been working on the ACPI/x86 backlight detection code since 2015, please trust me when I say that allowing both vendor + native backlight devices at the same time is a bad idea. I'm currently in direct contact with the ChromeOS team about fixing the Chromebook backlight issue introduced in 6.1-rc1. If you wan to help, please read: https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ And try implementing 1 if the 2 solutions suggested there. Regards, Hans >>> Akihiko Odaki (22): >>> drm/i915/opregion: Improve backlight request condition >>> ACPI: video: Introduce acpi_video_get_backlight_types() >>> LoongArch: Use acpi_video_get_backlight_types() >>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>> platform/x86: nvidia-wmi-ec-backlight: Use >>> acpi_video_get_backlight_types() >>> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>> ACPI: video: Remove acpi_video_get_backlight_type() >>> ACPI: video: Fallback to native backlight >>> >>> Documentation/gpu/todo.rst | 8 +-- >>> drivers/acpi/acpi_video.c | 2 +- >>> drivers/acpi/video_detect.c | 54 ++++++++++--------- >>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>> drivers/platform/x86/acer-wmi.c | 2 +- >>> drivers/platform/x86/asus-laptop.c | 2 +- >>> drivers/platform/x86/asus-wmi.c | 4 +- >>> drivers/platform/x86/compal-laptop.c | 2 +- >>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>> drivers/platform/x86/msi-laptop.c | 2 +- >>> drivers/platform/x86/msi-wmi.c | 2 +- >>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>> drivers/platform/x86/samsung-laptop.c | 2 +- >>> drivers/platform/x86/sony-laptop.c | 2 +- >>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>> drivers/video/backlight/backlight.c | 18 +++++++ >>> include/acpi/video.h | 21 ++++---- >>> include/linux/backlight.h | 1 + >>> 25 files changed, 85 insertions(+), 66 deletions(-) >>> >> >
Hi, On 10/24/22 15:14, Pali Rohár wrote: > On Monday 24 October 2022 21:58:57 Akihiko Odaki wrote: >> Regarding the second limitation, I don't even understand the difference >> between vendor and native. My guess is that a vendor backlight device uses >> vendor-specific ACPI interface, and a native one directly uses hardware >> registers. If my guess is correct, the difference between vendor and native >> does not imply that both of them are likely to exist at the same time. As >> the conclusion, there is no more motivation to try to de-duplicate the >> vendor/native combination than to try to de-duplicate combination of devices >> with a single type. > > Hello! I just want to point one thing. On some Dell laptops there are > 3 different ways (= 3 different APIs) how to control display backlight. > There is ACPI driver (uses ACPI), GPU/DRM driver (i915.ko; uses directly > HW) and platform vendor driver (dell-laptop.ko; uses vendor BIOS or > firmware API). Right and that is just one example of laptops which can register both vendor + native backlight devices, which is why this whole series is a bad idea. Regards, Hans > Just every driver has different pre-calculated scaling > values. So sometimes user wants to choose different driver just because > it allows to set backlight level with "better" granularity. Registering > all 3 device drivers is bad as user does not want to see 3 display > panels and forcing registration of specific one without runtime option > is also bad (some of those drivers do not have to be suitable or has > worse granularity as other).
On 2022/10/24 22:21, Hans de Goede wrote: > Hi, > > On 10/24/22 14:58, Akihiko Odaki wrote: >> On 2022/10/24 20:53, Hans de Goede wrote: >>> Hi Akihiko, >>> >>> On 10/24/22 13:34, Akihiko Odaki wrote: >>>> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >>>> helper") and following commits made native backlight unavailable if >>>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>>> unavailable, which broke the backlight functionality on Lenovo ThinkPad >>>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>>> cases. >>> >>> I appreciate your work on this, but what this in essence does is >>> it allows 2 backlight drivers (vendor + native) to get registered >>> for the same panel again. While the whole goal of the backlight refactor >>> series landing in 6.1 was to make it so that there always is only >>> *1* backlight device registered instead of (possibly) registering >>> multiple and letting userspace figure it out. It is also important >>> to only always have 1 backlight device per panel for further >>> upcoming changes. >>> >>> So nack for this solution, sorry. >>> >>> I am aware that this breaks backlight control on some Chromebooks, >>> this was already reported and I wrote a long reply explaining why >>> things are done the way they are done now and also suggesting >>> 2 possible (much simpler) fixes, see: >>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>> >>> Unfortunately the reported has not followed-up on this and >>> I don't have the hardware to test this myself. >>> >>> Can you please try implementing 1 of the fixes suggested there >>> and then submit that upstream ? >>> >>> Regards, >>> >>> Hans >>> >> >> Hi Hans, >> >> Thanks for reviewing and letting me know the prior attempt. >> >> In this case, there is only a native backlight device and no vendor backlight device so the duplication of backlight devices does not happen. I think it is better to handle such a case without quirks. > > Adding a single heuristic for all chromebooks is something completely different > then adding per model quirks which indeed ideally should be avoided (but this > is not always possible). > >> I understand it is still questionable to cover the case by allowing duplication when both of a vendor backlight device and native one. To explain my understanding and reasoning for *not* trying to apply the de-duplication rule to the vendor/native combination, let me first describe that the de-duplication which happens in acpi_video_get_backlight_type() is a heuristics and limited. >> >> As the background of acpi_video_get_backlight_type(), there is an assumption that it should be common that both of the firmware, implementing ACPI, and the kernel have code to drive backlight. In the case, the more reliable one should be picked instead of using both, and that is what the statements in `if (video_caps & ACPI_VIDEO_BACKLIGHT)` does. >> >> However, the method has two limitations: >> 1. It does not cover the case where two backlight devices with the same type exist. > > This only happens when there are 2 panels; or 2 gpus driving a single panel > which are both special cases where we actually want 2 backlight devices. > >> 2. The underlying assumption does not apply to vendor/native combination. >> >> Regarding the second limitation, I don't even understand the difference between vendor and native. My guess is that a vendor backlight device uses vendor-specific ACPI interface, and a native one directly uses hardware registers. If my guess is correct, the difference between vendor and native does not imply that both of them are likely to exist at the same time. As the conclusion, there is no more motivation to try to de-duplicate the vendor/native combination than to try to de-duplicate combination of devices with a single type. >> >> Of course, it is better if we could also avoid registering two devices with one type for one physical device. Possibly we can do so by providing a parameter to indicate that it is for the same "internal" backlight to devm_backlight_device_register(), and let the function check for the duplication. However, this rule may be too restrict, or may have problems I missed. >> >> Based on the discussion above, we can deduce three possibilities: >> a. There is no reason to distinguish vendor and native in this case, and we can stick to my current proposal. >> b. There is a valid reason to distinguish vendor and native, and we can adopt the same strategy that already adopted for ACPI video/vendor combination. >> c. We can implement de-duplication in devm_backlight_device_register(). >> d. The other possible options are not worth, and we can just implement quirks specific to Chromebook/coreboot. >> >> In case b, it should be noted that vendor and native backlight device do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. In the case, the de-duplication needs to be implemented in backlight class device. > > I have been working on the ACPI/x86 backlight detection code since 2015, please trust > me when I say that allowing both vendor + native backlight devices at the same time > is a bad idea. > > I'm currently in direct contact with the ChromeOS team about fixing the Chromebook > backlight issue introduced in 6.1-rc1. > > If you wan to help, please read: > > https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ > > And try implementing 1 if the 2 solutions suggested there. > > Regards, > > Hans Hi, I just wanted to confirm your intention that we should distinguish vendor and native. In the case I think it is better to modify __acpi_video_get_backlight_type() and add "native_available" check in case of no ACPI video as already done for the ACPI video/native combination. Unfortunately this has one pitfall though: it does not work if CONFIG_ACPI_VIDEO is disabled. If it is, acpi_video_get_backlight_type() always return acpi_backlight_vendor, and acpi_video_backlight_use_native() always returns true. It is not a regression but the current behavior. Fixing it requires also refactoring touching both of ACPI video and backlight class driver so I guess I'm not an appropriate person to do that, and I should just add "native_available" check to __acpi_video_get_backlight_type(). Does that sound good? Regards, Akihiko Odaki > > > >>>> Akihiko Odaki (22): >>>> drm/i915/opregion: Improve backlight request condition >>>> ACPI: video: Introduce acpi_video_get_backlight_types() >>>> LoongArch: Use acpi_video_get_backlight_types() >>>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>>> platform/x86: nvidia-wmi-ec-backlight: Use >>>> acpi_video_get_backlight_types() >>>> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>>> ACPI: video: Remove acpi_video_get_backlight_type() >>>> ACPI: video: Fallback to native backlight >>>> >>>> Documentation/gpu/todo.rst | 8 +-- >>>> drivers/acpi/acpi_video.c | 2 +- >>>> drivers/acpi/video_detect.c | 54 ++++++++++--------- >>>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>>> drivers/platform/x86/acer-wmi.c | 2 +- >>>> drivers/platform/x86/asus-laptop.c | 2 +- >>>> drivers/platform/x86/asus-wmi.c | 4 +- >>>> drivers/platform/x86/compal-laptop.c | 2 +- >>>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>>> drivers/platform/x86/msi-laptop.c | 2 +- >>>> drivers/platform/x86/msi-wmi.c | 2 +- >>>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>>> drivers/platform/x86/samsung-laptop.c | 2 +- >>>> drivers/platform/x86/sony-laptop.c | 2 +- >>>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>>> drivers/video/backlight/backlight.c | 18 +++++++ >>>> include/acpi/video.h | 21 ++++---- >>>> include/linux/backlight.h | 1 + >>>> 25 files changed, 85 insertions(+), 66 deletions(-) >>>> >>> >> >
On 2022/10/24 23:06, Akihiko Odaki wrote: > On 2022/10/24 22:21, Hans de Goede wrote: >> Hi, >> >> On 10/24/22 14:58, Akihiko Odaki wrote: >>> On 2022/10/24 20:53, Hans de Goede wrote: >>>> Hi Akihiko, >>>> >>>> On 10/24/22 13:34, Akihiko Odaki wrote: >>>>> Commit 2600bfa3df99 ("ACPI: video: Add >>>>> acpi_video_backlight_use_native() >>>>> helper") and following commits made native backlight unavailable if >>>>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>>>> unavailable, which broke the backlight functionality on Lenovo >>>>> ThinkPad >>>>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>>>> cases. >>>> >>>> I appreciate your work on this, but what this in essence does is >>>> it allows 2 backlight drivers (vendor + native) to get registered >>>> for the same panel again. While the whole goal of the backlight >>>> refactor >>>> series landing in 6.1 was to make it so that there always is only >>>> *1* backlight device registered instead of (possibly) registering >>>> multiple and letting userspace figure it out. It is also important >>>> to only always have 1 backlight device per panel for further >>>> upcoming changes. >>>> >>>> So nack for this solution, sorry. >>>> >>>> I am aware that this breaks backlight control on some Chromebooks, >>>> this was already reported and I wrote a long reply explaining why >>>> things are done the way they are done now and also suggesting >>>> 2 possible (much simpler) fixes, see: >>>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>>> >>>> Unfortunately the reported has not followed-up on this and >>>> I don't have the hardware to test this myself. >>>> >>>> Can you please try implementing 1 of the fixes suggested there >>>> and then submit that upstream ? >>>> >>>> Regards, >>>> >>>> Hans >>>> >>> >>> Hi Hans, >>> >>> Thanks for reviewing and letting me know the prior attempt. >>> >>> In this case, there is only a native backlight device and no vendor >>> backlight device so the duplication of backlight devices does not >>> happen. I think it is better to handle such a case without quirks. >> >> Adding a single heuristic for all chromebooks is something completely >> different >> then adding per model quirks which indeed ideally should be avoided >> (but this >> is not always possible). >> >>> I understand it is still questionable to cover the case by allowing >>> duplication when both of a vendor backlight device and native one. To >>> explain my understanding and reasoning for *not* trying to apply the >>> de-duplication rule to the vendor/native combination, let me first >>> describe that the de-duplication which happens in >>> acpi_video_get_backlight_type() is a heuristics and limited. >>> >>> As the background of acpi_video_get_backlight_type(), there is an >>> assumption that it should be common that both of the firmware, >>> implementing ACPI, and the kernel have code to drive backlight. In >>> the case, the more reliable one should be picked instead of using >>> both, and that is what the statements in `if (video_caps & >>> ACPI_VIDEO_BACKLIGHT)` does. >>> >>> However, the method has two limitations: >>> 1. It does not cover the case where two backlight devices with the >>> same type exist. >> >> This only happens when there are 2 panels; or 2 gpus driving a single >> panel >> which are both special cases where we actually want 2 backlight devices. >> >>> 2. The underlying assumption does not apply to vendor/native >>> combination. >>> >>> Regarding the second limitation, I don't even understand the >>> difference between vendor and native. My guess is that a vendor >>> backlight device uses vendor-specific ACPI interface, and a native >>> one directly uses hardware registers. If my guess is correct, the >>> difference between vendor and native does not imply that both of them >>> are likely to exist at the same time. As the conclusion, there is no >>> more motivation to try to de-duplicate the vendor/native combination >>> than to try to de-duplicate combination of devices with a single type. >>> >>> Of course, it is better if we could also avoid registering two >>> devices with one type for one physical device. Possibly we can do so >>> by providing a parameter to indicate that it is for the same >>> "internal" backlight to devm_backlight_device_register(), and let the >>> function check for the duplication. However, this rule may be too >>> restrict, or may have problems I missed. >>> >>> Based on the discussion above, we can deduce three possibilities: >>> a. There is no reason to distinguish vendor and native in this case, >>> and we can stick to my current proposal. >>> b. There is a valid reason to distinguish vendor and native, and we >>> can adopt the same strategy that already adopted for ACPI >>> video/vendor combination. >>> c. We can implement de-duplication in devm_backlight_device_register(). >>> d. The other possible options are not worth, and we can just >>> implement quirks specific to Chromebook/coreboot. >>> >>> In case b, it should be noted that vendor and native backlight device >>> do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. >>> In the case, the de-duplication needs to be implemented in backlight >>> class device. >> >> I have been working on the ACPI/x86 backlight detection code since >> 2015, please trust >> me when I say that allowing both vendor + native backlight devices at >> the same time >> is a bad idea. >> >> I'm currently in direct contact with the ChromeOS team about fixing >> the Chromebook >> backlight issue introduced in 6.1-rc1. >> >> If you wan to help, please read: >> >> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >> >> And try implementing 1 if the 2 solutions suggested there. >> >> Regards, >> >> Hans > > Hi, > > I just wanted to confirm your intention that we should distinguish > vendor and native. In the case I think it is better to modify > __acpi_video_get_backlight_type() and add "native_available" check in > case of no ACPI video as already done for the ACPI video/native > combination. > > Unfortunately this has one pitfall though: it does not work if > CONFIG_ACPI_VIDEO is disabled. If it is, acpi_video_get_backlight_type() > always return acpi_backlight_vendor, and > acpi_video_backlight_use_native() always returns true. It is not a > regression but the current behavior. Fixing it requires also refactoring > touching both of ACPI video and backlight class driver so I guess I'm > not an appropriate person to do that, and I should just add > "native_available" check to __acpi_video_get_backlight_type(). > > Does that sound good? Well, it would not be that easy since just adding native_available cannot handle the case where the vendor driver gets registered first. Checking with "native_available" was possible for ACPI video/vendor combination because ACPI video registers its backlight after some delay. I still think it does not overcomplicate things to modify __acpi_video_get_backlight_type() so that it can use both of vendor and native as fallback while preventing duplicate registration. Regards, Akihiko Odaki > > Regards, > Akihiko Odaki > >> > >> >>>>> Akihiko Odaki (22): >>>>> drm/i915/opregion: Improve backlight request condition >>>>> ACPI: video: Introduce acpi_video_get_backlight_types() >>>>> LoongArch: Use acpi_video_get_backlight_types() >>>>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>>>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>>>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>>>> platform/x86: nvidia-wmi-ec-backlight: Use >>>>> acpi_video_get_backlight_types() >>>>> platform/x86: panasonic-laptop: Use >>>>> acpi_video_get_backlight_types() >>>>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>>>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>>>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>>>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>>>> ACPI: video: Remove acpi_video_get_backlight_type() >>>>> ACPI: video: Fallback to native backlight >>>>> >>>>> Documentation/gpu/todo.rst | 8 +-- >>>>> drivers/acpi/acpi_video.c | 2 +- >>>>> drivers/acpi/video_detect.c | 54 >>>>> ++++++++++--------- >>>>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>>>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>>>> drivers/platform/x86/acer-wmi.c | 2 +- >>>>> drivers/platform/x86/asus-laptop.c | 2 +- >>>>> drivers/platform/x86/asus-wmi.c | 4 +- >>>>> drivers/platform/x86/compal-laptop.c | 2 +- >>>>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>>>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>>>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>>>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>>>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>>>> drivers/platform/x86/msi-laptop.c | 2 +- >>>>> drivers/platform/x86/msi-wmi.c | 2 +- >>>>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>>>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>>>> drivers/platform/x86/samsung-laptop.c | 2 +- >>>>> drivers/platform/x86/sony-laptop.c | 2 +- >>>>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>>>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>>>> drivers/video/backlight/backlight.c | 18 +++++++ >>>>> include/acpi/video.h | 21 ++++---- >>>>> include/linux/backlight.h | 1 + >>>>> 25 files changed, 85 insertions(+), 66 deletions(-) >>>>> >>>> >>> >>
Hi, On 10/24/22 16:31, Akihiko Odaki wrote: > On 2022/10/24 23:06, Akihiko Odaki wrote: >> On 2022/10/24 22:21, Hans de Goede wrote: >>> Hi, >>> >>> On 10/24/22 14:58, Akihiko Odaki wrote: >>>> On 2022/10/24 20:53, Hans de Goede wrote: >>>>> Hi Akihiko, >>>>> >>>>> On 10/24/22 13:34, Akihiko Odaki wrote: >>>>>> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >>>>>> helper") and following commits made native backlight unavailable if >>>>>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>>>>> unavailable, which broke the backlight functionality on Lenovo ThinkPad >>>>>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>>>>> cases. >>>>> >>>>> I appreciate your work on this, but what this in essence does is >>>>> it allows 2 backlight drivers (vendor + native) to get registered >>>>> for the same panel again. While the whole goal of the backlight refactor >>>>> series landing in 6.1 was to make it so that there always is only >>>>> *1* backlight device registered instead of (possibly) registering >>>>> multiple and letting userspace figure it out. It is also important >>>>> to only always have 1 backlight device per panel for further >>>>> upcoming changes. >>>>> >>>>> So nack for this solution, sorry. >>>>> >>>>> I am aware that this breaks backlight control on some Chromebooks, >>>>> this was already reported and I wrote a long reply explaining why >>>>> things are done the way they are done now and also suggesting >>>>> 2 possible (much simpler) fixes, see: >>>>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>>>> >>>>> Unfortunately the reported has not followed-up on this and >>>>> I don't have the hardware to test this myself. >>>>> >>>>> Can you please try implementing 1 of the fixes suggested there >>>>> and then submit that upstream ? >>>>> >>>>> Regards, >>>>> >>>>> Hans >>>>> >>>> >>>> Hi Hans, >>>> >>>> Thanks for reviewing and letting me know the prior attempt. >>>> >>>> In this case, there is only a native backlight device and no vendor backlight device so the duplication of backlight devices does not happen. I think it is better to handle such a case without quirks. >>> >>> Adding a single heuristic for all chromebooks is something completely different >>> then adding per model quirks which indeed ideally should be avoided (but this >>> is not always possible). >>> >>>> I understand it is still questionable to cover the case by allowing duplication when both of a vendor backlight device and native one. To explain my understanding and reasoning for *not* trying to apply the de-duplication rule to the vendor/native combination, let me first describe that the de-duplication which happens in acpi_video_get_backlight_type() is a heuristics and limited. >>>> >>>> As the background of acpi_video_get_backlight_type(), there is an assumption that it should be common that both of the firmware, implementing ACPI, and the kernel have code to drive backlight. In the case, the more reliable one should be picked instead of using both, and that is what the statements in `if (video_caps & ACPI_VIDEO_BACKLIGHT)` does. >>>> >>>> However, the method has two limitations: >>>> 1. It does not cover the case where two backlight devices with the same type exist. >>> >>> This only happens when there are 2 panels; or 2 gpus driving a single panel >>> which are both special cases where we actually want 2 backlight devices. >>> >>>> 2. The underlying assumption does not apply to vendor/native combination. >>>> >>>> Regarding the second limitation, I don't even understand the difference between vendor and native. My guess is that a vendor backlight device uses vendor-specific ACPI interface, and a native one directly uses hardware registers. If my guess is correct, the difference between vendor and native does not imply that both of them are likely to exist at the same time. As the conclusion, there is no more motivation to try to de-duplicate the vendor/native combination than to try to de-duplicate combination of devices with a single type. >>>> >>>> Of course, it is better if we could also avoid registering two devices with one type for one physical device. Possibly we can do so by providing a parameter to indicate that it is for the same "internal" backlight to devm_backlight_device_register(), and let the function check for the duplication. However, this rule may be too restrict, or may have problems I missed. >>>> >>>> Based on the discussion above, we can deduce three possibilities: >>>> a. There is no reason to distinguish vendor and native in this case, and we can stick to my current proposal. >>>> b. There is a valid reason to distinguish vendor and native, and we can adopt the same strategy that already adopted for ACPI video/vendor combination. >>>> c. We can implement de-duplication in devm_backlight_device_register(). >>>> d. The other possible options are not worth, and we can just implement quirks specific to Chromebook/coreboot. >>>> >>>> In case b, it should be noted that vendor and native backlight device do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. In the case, the de-duplication needs to be implemented in backlight class device. >>> >>> I have been working on the ACPI/x86 backlight detection code since 2015, please trust >>> me when I say that allowing both vendor + native backlight devices at the same time >>> is a bad idea. >>> >>> I'm currently in direct contact with the ChromeOS team about fixing the Chromebook >>> backlight issue introduced in 6.1-rc1. >>> >>> If you wan to help, please read: >>> >>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>> >>> And try implementing 1 if the 2 solutions suggested there. >>> >>> Regards, >>> >>> Hans >> >> Hi, >> >> I just wanted to confirm your intention that we should distinguish vendor and native. In the case I think it is better to modify __acpi_video_get_backlight_type() and add "native_available" check in case of no ACPI video as already done for the ACPI video/native combination. >> >> Unfortunately this has one pitfall though: it does not work if CONFIG_ACPI_VIDEO is disabled. If it is, acpi_video_get_backlight_type() always return acpi_backlight_vendor, and acpi_video_backlight_use_native() always returns true. It is not a regression but the current behavior. Fixing it requires also refactoring touching both of ACPI video and backlight class driver so I guess I'm not an appropriate person to do that, and I should just add "native_available" check to __acpi_video_get_backlight_type(). >> >> Does that sound good? > > Well, it would not be that easy since just adding native_available cannot handle the case where the vendor driver gets registered first. Checking with "native_available" was possible for ACPI video/vendor combination because ACPI video registers its backlight after some delay. I still think it does not overcomplicate things to modify __acpi_video_get_backlight_type() so that it can use both of vendor and native as fallback while preventing duplicate registration. In the mean time this has already been fixed by a single patch of just a few lines, rather then requiring 22 patches, see: https://lore.kernel.org/dri-devel/20221024141210.67784-1-dmitry.osipenko@collabora.com/ Regards, Hans >>>>>> Akihiko Odaki (22): >>>>>> drm/i915/opregion: Improve backlight request condition >>>>>> ACPI: video: Introduce acpi_video_get_backlight_types() >>>>>> LoongArch: Use acpi_video_get_backlight_types() >>>>>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>>>>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>>>>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>>>>> platform/x86: nvidia-wmi-ec-backlight: Use >>>>>> acpi_video_get_backlight_types() >>>>>> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>>>>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>>>>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>>>>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>>>>> ACPI: video: Remove acpi_video_get_backlight_type() >>>>>> ACPI: video: Fallback to native backlight >>>>>> >>>>>> Documentation/gpu/todo.rst | 8 +-- >>>>>> drivers/acpi/acpi_video.c | 2 +- >>>>>> drivers/acpi/video_detect.c | 54 ++++++++++--------- >>>>>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>>>>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>>>>> drivers/platform/x86/acer-wmi.c | 2 +- >>>>>> drivers/platform/x86/asus-laptop.c | 2 +- >>>>>> drivers/platform/x86/asus-wmi.c | 4 +- >>>>>> drivers/platform/x86/compal-laptop.c | 2 +- >>>>>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>>>>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>>>>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>>>>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>>>>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>>>>> drivers/platform/x86/msi-laptop.c | 2 +- >>>>>> drivers/platform/x86/msi-wmi.c | 2 +- >>>>>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>>>>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>>>>> drivers/platform/x86/samsung-laptop.c | 2 +- >>>>>> drivers/platform/x86/sony-laptop.c | 2 +- >>>>>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>>>>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>>>>> drivers/video/backlight/backlight.c | 18 +++++++ >>>>>> include/acpi/video.h | 21 ++++---- >>>>>> include/linux/backlight.h | 1 + >>>>>> 25 files changed, 85 insertions(+), 66 deletions(-) >>>>>> >>>>> >>>> >>> >
On 2022/10/24 23:37, Hans de Goede wrote: > Hi, > > On 10/24/22 16:31, Akihiko Odaki wrote: >> On 2022/10/24 23:06, Akihiko Odaki wrote: >>> On 2022/10/24 22:21, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 10/24/22 14:58, Akihiko Odaki wrote: >>>>> On 2022/10/24 20:53, Hans de Goede wrote: >>>>>> Hi Akihiko, >>>>>> >>>>>> On 10/24/22 13:34, Akihiko Odaki wrote: >>>>>>> Commit 2600bfa3df99 ("ACPI: video: Add acpi_video_backlight_use_native() >>>>>>> helper") and following commits made native backlight unavailable if >>>>>>> CONFIG_ACPI_VIDEO is set and the backlight feature of ACPI video is >>>>>>> unavailable, which broke the backlight functionality on Lenovo ThinkPad >>>>>>> C13 Yoga Chromebook. Allow to fall back to native backlight in such >>>>>>> cases. >>>>>> >>>>>> I appreciate your work on this, but what this in essence does is >>>>>> it allows 2 backlight drivers (vendor + native) to get registered >>>>>> for the same panel again. While the whole goal of the backlight refactor >>>>>> series landing in 6.1 was to make it so that there always is only >>>>>> *1* backlight device registered instead of (possibly) registering >>>>>> multiple and letting userspace figure it out. It is also important >>>>>> to only always have 1 backlight device per panel for further >>>>>> upcoming changes. >>>>>> >>>>>> So nack for this solution, sorry. >>>>>> >>>>>> I am aware that this breaks backlight control on some Chromebooks, >>>>>> this was already reported and I wrote a long reply explaining why >>>>>> things are done the way they are done now and also suggesting >>>>>> 2 possible (much simpler) fixes, see: >>>>>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>>>>> >>>>>> Unfortunately the reported has not followed-up on this and >>>>>> I don't have the hardware to test this myself. >>>>>> >>>>>> Can you please try implementing 1 of the fixes suggested there >>>>>> and then submit that upstream ? >>>>>> >>>>>> Regards, >>>>>> >>>>>> Hans >>>>>> >>>>> >>>>> Hi Hans, >>>>> >>>>> Thanks for reviewing and letting me know the prior attempt. >>>>> >>>>> In this case, there is only a native backlight device and no vendor backlight device so the duplication of backlight devices does not happen. I think it is better to handle such a case without quirks. >>>> >>>> Adding a single heuristic for all chromebooks is something completely different >>>> then adding per model quirks which indeed ideally should be avoided (but this >>>> is not always possible). >>>> >>>>> I understand it is still questionable to cover the case by allowing duplication when both of a vendor backlight device and native one. To explain my understanding and reasoning for *not* trying to apply the de-duplication rule to the vendor/native combination, let me first describe that the de-duplication which happens in acpi_video_get_backlight_type() is a heuristics and limited. >>>>> >>>>> As the background of acpi_video_get_backlight_type(), there is an assumption that it should be common that both of the firmware, implementing ACPI, and the kernel have code to drive backlight. In the case, the more reliable one should be picked instead of using both, and that is what the statements in `if (video_caps & ACPI_VIDEO_BACKLIGHT)` does. >>>>> >>>>> However, the method has two limitations: >>>>> 1. It does not cover the case where two backlight devices with the same type exist. >>>> >>>> This only happens when there are 2 panels; or 2 gpus driving a single panel >>>> which are both special cases where we actually want 2 backlight devices. >>>> >>>>> 2. The underlying assumption does not apply to vendor/native combination. >>>>> >>>>> Regarding the second limitation, I don't even understand the difference between vendor and native. My guess is that a vendor backlight device uses vendor-specific ACPI interface, and a native one directly uses hardware registers. If my guess is correct, the difference between vendor and native does not imply that both of them are likely to exist at the same time. As the conclusion, there is no more motivation to try to de-duplicate the vendor/native combination than to try to de-duplicate combination of devices with a single type. >>>>> >>>>> Of course, it is better if we could also avoid registering two devices with one type for one physical device. Possibly we can do so by providing a parameter to indicate that it is for the same "internal" backlight to devm_backlight_device_register(), and let the function check for the duplication. However, this rule may be too restrict, or may have problems I missed. >>>>> >>>>> Based on the discussion above, we can deduce three possibilities: >>>>> a. There is no reason to distinguish vendor and native in this case, and we can stick to my current proposal. >>>>> b. There is a valid reason to distinguish vendor and native, and we can adopt the same strategy that already adopted for ACPI video/vendor combination. >>>>> c. We can implement de-duplication in devm_backlight_device_register(). >>>>> d. The other possible options are not worth, and we can just implement quirks specific to Chromebook/coreboot. >>>>> >>>>> In case b, it should be noted that vendor and native backlight device do not require ACPI video, and CONFIG_ACPI_VIDEO may not be enabled. In the case, the de-duplication needs to be implemented in backlight class device. >>>> >>>> I have been working on the ACPI/x86 backlight detection code since 2015, please trust >>>> me when I say that allowing both vendor + native backlight devices at the same time >>>> is a bad idea. >>>> >>>> I'm currently in direct contact with the ChromeOS team about fixing the Chromebook >>>> backlight issue introduced in 6.1-rc1. >>>> >>>> If you wan to help, please read: >>>> >>>> https://lore.kernel.org/linux-acpi/42a5f2c9-a1dc-8fc0-7334-fe6c390ecfbb@redhat.com/ >>>> >>>> And try implementing 1 if the 2 solutions suggested there. >>>> >>>> Regards, >>>> >>>> Hans >>> >>> Hi, >>> >>> I just wanted to confirm your intention that we should distinguish vendor and native. In the case I think it is better to modify __acpi_video_get_backlight_type() and add "native_available" check in case of no ACPI video as already done for the ACPI video/native combination. >>> >>> Unfortunately this has one pitfall though: it does not work if CONFIG_ACPI_VIDEO is disabled. If it is, acpi_video_get_backlight_type() always return acpi_backlight_vendor, and acpi_video_backlight_use_native() always returns true. It is not a regression but the current behavior. Fixing it requires also refactoring touching both of ACPI video and backlight class driver so I guess I'm not an appropriate person to do that, and I should just add "native_available" check to __acpi_video_get_backlight_type(). >>> >>> Does that sound good? >> >> Well, it would not be that easy since just adding native_available cannot handle the case where the vendor driver gets registered first. Checking with "native_available" was possible for ACPI video/vendor combination because ACPI video registers its backlight after some delay. I still think it does not overcomplicate things to modify __acpi_video_get_backlight_type() so that it can use both of vendor and native as fallback while preventing duplicate registration. > > In the mean time this has already been fixed by a single patch of just a few > lines, rather then requiring 22 patches, see: > > https://lore.kernel.org/dri-devel/20221024141210.67784-1-dmitry.osipenko@collabora.com/ > > Regards, > > Hans It should be the smaller indeed. Modifying __acpi_video_get_backlight_type() so that it can fall back to either of vendor and native requires all of the vendor drivers to use something like acpi_video_backlight_use_native() but for vendor. It certainly requires 22 patches. That aside, the first patch in this series can be applied without the later patches so you may have a look at it. It's fine if you don't merge it though since it does not fix really a pragmatic bug as its message says. Regards, Akihiko Odaki > > > > >>>>>>> Akihiko Odaki (22): >>>>>>> drm/i915/opregion: Improve backlight request condition >>>>>>> ACPI: video: Introduce acpi_video_get_backlight_types() >>>>>>> LoongArch: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: acer-wmi: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: asus-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: asus-wmi: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: compal-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: eeepc-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: fujitsu-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: ideapad-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: msi-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: msi-wmi: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: nvidia-wmi-ec-backlight: Use >>>>>>> acpi_video_get_backlight_types() >>>>>>> platform/x86: panasonic-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: samsung-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: sony-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: thinkpad_acpi: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: toshiba_acpi: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: dell-laptop: Use acpi_video_get_backlight_types() >>>>>>> platform/x86: intel_oaktrail: Use acpi_video_get_backlight_types() >>>>>>> ACPI: video: Remove acpi_video_get_backlight_type() >>>>>>> ACPI: video: Fallback to native backlight >>>>>>> >>>>>>> Documentation/gpu/todo.rst | 8 +-- >>>>>>> drivers/acpi/acpi_video.c | 2 +- >>>>>>> drivers/acpi/video_detect.c | 54 ++++++++++--------- >>>>>>> drivers/gpu/drm/i915/display/intel_opregion.c | 3 +- >>>>>>> drivers/platform/loongarch/loongson-laptop.c | 4 +- >>>>>>> drivers/platform/x86/acer-wmi.c | 2 +- >>>>>>> drivers/platform/x86/asus-laptop.c | 2 +- >>>>>>> drivers/platform/x86/asus-wmi.c | 4 +- >>>>>>> drivers/platform/x86/compal-laptop.c | 2 +- >>>>>>> drivers/platform/x86/dell/dell-laptop.c | 2 +- >>>>>>> drivers/platform/x86/eeepc-laptop.c | 2 +- >>>>>>> drivers/platform/x86/fujitsu-laptop.c | 4 +- >>>>>>> drivers/platform/x86/ideapad-laptop.c | 2 +- >>>>>>> drivers/platform/x86/intel/oaktrail.c | 2 +- >>>>>>> drivers/platform/x86/msi-laptop.c | 2 +- >>>>>>> drivers/platform/x86/msi-wmi.c | 2 +- >>>>>>> .../platform/x86/nvidia-wmi-ec-backlight.c | 2 +- >>>>>>> drivers/platform/x86/panasonic-laptop.c | 2 +- >>>>>>> drivers/platform/x86/samsung-laptop.c | 2 +- >>>>>>> drivers/platform/x86/sony-laptop.c | 2 +- >>>>>>> drivers/platform/x86/thinkpad_acpi.c | 4 +- >>>>>>> drivers/platform/x86/toshiba_acpi.c | 2 +- >>>>>>> drivers/video/backlight/backlight.c | 18 +++++++ >>>>>>> include/acpi/video.h | 21 ++++---- >>>>>>> include/linux/backlight.h | 1 + >>>>>>> 25 files changed, 85 insertions(+), 66 deletions(-) >>>>>>> >>>>>> >>>>> >>>> >> >
On Tue, 25 Oct 2022, Akihiko Odaki <akihiko.odaki@daynix.com> wrote: > That aside, the first patch in this series can be applied without the > later patches so you may have a look at it. It's fine if you don't merge > it though since it does not fix really a pragmatic bug as its message says. I think it's problematic because it needlessly ties i915 backlight operation to existence of backlight devices that may not be related to Intel GPU at all. The direction should be multiple supported backlight devices, across GPUs and connectors, but only one per display. BR, Jani.
On 2022/10/25 3:11, Jani Nikula wrote: > On Tue, 25 Oct 2022, Akihiko Odaki <akihiko.odaki@daynix.com> wrote: >> That aside, the first patch in this series can be applied without the >> later patches so you may have a look at it. It's fine if you don't merge >> it though since it does not fix really a pragmatic bug as its message says. > > I think it's problematic because it needlessly ties i915 backlight > operation to existence of backlight devices that may not be related to > Intel GPU at all. The direction should be multiple supported backlight > devices, across GPUs and connectors, but only one per display. > > BR, > Jani. > > Unfortunately it is the current situation (even without this patch), and this patch is not meant to fix the particular issue. This patch replaces the following expression: acpi_video_get_backlight_type() == acpi_backlight_native As you can see, acpi_video_get_backlight_type() doesn't take a parameter which represents the backlight currently being operated. The problem is known and documented in "Brightness handling on devices with multiple internal panels" section of Documentation/gpu/todo.rst. The exiting solution is based on the assumption that no device with i915 and multiple internal backlights. Regards, Akihiko Odaki