From patchwork Tue May 17 15:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12852671 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 8099EC43217 for ; Tue, 17 May 2022 15:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345464AbiEQPYQ (ORCPT ); Tue, 17 May 2022 11:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349947AbiEQPYE (ORCPT ); Tue, 17 May 2022 11:24:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05E144F47D for ; Tue, 17 May 2022 08:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652801043; 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=sbKbgxKeWNRiPObZFk8Py7N2yB0e9SBa2BgfmtpZj3c=; b=JcIcUSG/5ldWT2cJ+bxtZv3OvKL9KIWE9pZ5YyyD/mC9tiFTXJZGa3KfblqYHwSX5B+i7N J3z8DAidMjvIDn3s8OM+P3bDuuaPzRkq24KfaPOTGS/2Qo6kjRrshYEWkbVM//tauwosOo CPWkiYXZ/iCyc4mytv/orHoAX/xoolM= 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-435-l7vbtma-MUS5bLsB3LxK-A-1; Tue, 17 May 2022 11:24:00 -0400 X-MC-Unique: l7vbtma-MUS5bLsB3LxK-A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E253780418F; Tue, 17 May 2022 15:23:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 655F5C080BC; Tue, 17 May 2022 15:23:55 +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_K=C3=B6nig?= , Pan@vger.kernel.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , 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 05/14] drm/nouveau: Don't register backlight when another backlight should be used Date: Tue, 17 May 2022 17:23:22 +0200 Message-Id: <20220517152331.16217-6-hdegoede@redhat.com> In-Reply-To: <20220517152331.16217-1-hdegoede@redhat.com> References: <20220517152331.16217-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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. Signed-off-by: Hans de Goede Reviewed-by: Lyude Paul --- 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 daf9f87477ba..f56ff797c78c 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" @@ -404,6 +406,11 @@ nouveau_backlight_init(struct drm_connector *connector) goto fail_alloc; } + if (acpi_video_get_backlight_type(true) != acpi_backlight_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;