From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F863C433EF for ; Tue, 12 Jul 2022 19:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234634AbiGLTrx (ORCPT ); Tue, 12 Jul 2022 15:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234366AbiGLTrR (ORCPT ); Tue, 12 Jul 2022 15:47:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30E9041D22 for ; Tue, 12 Jul 2022 12:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657654793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EOdZWfJ0s00LfG3ihwHm2AlZ5TsRZCM/ycawztBlr3E=; b=ZN3uGMf8TdbB2IjX91OSjyLjSFXkah7oSylPR2Pqm80vFnSoXNbsX7Ev17j3/FU0+N/0sJ 3ilc1Yd8t3aFmGRs7/TQEGUVjCyhvXsuNDnRBbvPLdJB+TmsavcgedSC2dQcRw6dUgrhf3 v8rxWfvUi/3zvxeHuAH3qNPCz3nfcq0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-310-rzdjylmQOoOwRSXtRbcvfA-1; Tue, 12 Jul 2022 15:39:42 -0400 X-MC-Unique: rzdjylmQOoOwRSXtRbcvfA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8D9C805AF5; Tue, 12 Jul 2022 19:39:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA23D40E80E1; Tue, 12 Jul 2022 19:39:36 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@vger.kernel.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Cc: Hans de Goede , nouveau@lists.freedesktop.org, Daniel Vetter , David Airlie , intel-gfx , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Len Brown , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v2 05/29] drm/nouveau: Don't register backlight when another backlight should be used Date: Tue, 12 Jul 2022 21:38:46 +0200 Message-Id: <20220712193910.439171-6-hdegoede@redhat.com> In-Reply-To: <20220712193910.439171-1-hdegoede@redhat.com> References: <20220712193910.439171-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Before this commit when we want userspace to use the acpi_video backlight device we register both the GPU's native backlight device and acpi_video's firmware acpi_video# backlight device. This relies on userspace preferring firmware type backlight devices over native ones. Registering 2 backlight devices for a single display really is undesirable, don't register the GPU's native backlight device when another backlight device should be used. Reviewed-by: Lyude Paul Signed-off-by: Hans de Goede --- drivers/gpu/drm/nouveau/nouveau_backlight.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index a2141d3d9b1d..91c504c7b82c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -34,6 +34,8 @@ #include #include +#include + #include "nouveau_drv.h" #include "nouveau_reg.h" #include "nouveau_encoder.h" @@ -405,6 +407,11 @@ nouveau_backlight_init(struct drm_connector *connector) goto fail_alloc; } + if (!acpi_video_backlight_use_native()) { + NV_INFO(drm, "Skipping nv_backlight registration\n"); + goto fail_alloc; + } + if (!nouveau_get_backlight_name(backlight_name, bl)) { NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n"); goto fail_alloc; -- 2.36.0