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 0FA55C32793 for ; Wed, 24 Aug 2022 12:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237023AbiHXMRb (ORCPT ); Wed, 24 Aug 2022 08:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237394AbiHXMQ5 (ORCPT ); Wed, 24 Aug 2022 08:16:57 -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 ESMTPS id E03767330C for ; Wed, 24 Aug 2022 05:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661343414; 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=C30+JylXoiqfCL1QVhV6xN5vRbXmIR8YpoQkV4jNNtM=; b=YwJhU4lad6clAVbjPBZgZjtTzwbGcMS0ra3c/lQ+Nvb/vQOEzRP6n5gU9tirQqnbRPOP0x Y0VE4ejiCstip8Q/9rdKmXzTGRv9pDPv5ofc1Itpd0hYYnfEeFzkGHe/LT8tw03vQdXl0c AHHVHoq4RgbJBh02/srQBwvGugkiWLM= 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-323-xljP5gJ1MZavC8D1kIwOaA-1; Wed, 24 Aug 2022 08:16:51 -0400 X-MC-Unique: xljP5gJ1MZavC8D1kIwOaA-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 3B76C101A54E; Wed, 24 Aug 2022 12:16:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACA9C15BB3; Wed, 24 Aug 2022 12:16:46 +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, "Rafael J . Wysocki" Subject: [PATCH v4 18/31] ACPI: video: Add Apple GMUX brightness control detection Date: Wed, 24 Aug 2022 14:15:10 +0200 Message-Id: <20220824121523.1291269-19-hdegoede@redhat.com> In-Reply-To: <20220824121523.1291269-1-hdegoede@redhat.com> References: <20220824121523.1291269-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Apple laptops with an Apple GMUX using this for brightness control, should take precedence of any other brightness control methods. Add apple-gmux detection to acpi_video_get_backlight_type() using the already existing apple_gmux_present() helper function. This will allow removig the (ab)use of: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); Inside the apple-gmux driver. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/video_detect.c | 4 ++++ include/acpi/video.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4dc7fb865083..be2fc43418af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -607,6 +608,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) if (nvidia_wmi_ec_present) return acpi_backlight_nvidia_wmi_ec; + if (apple_gmux_present()) + return acpi_backlight_apple_gmux; + /* On systems with ACPI video use either native or ACPI video. */ if (video_caps & ACPI_VIDEO_BACKLIGHT) { /* diff --git a/include/acpi/video.h b/include/acpi/video.h index 91578e77ac4e..dbd48cb8bd23 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -49,6 +49,7 @@ enum acpi_backlight_type { acpi_backlight_vendor, acpi_backlight_native, acpi_backlight_nvidia_wmi_ec, + acpi_backlight_apple_gmux, }; #if IS_ENABLED(CONFIG_ACPI_VIDEO) -- 2.37.2 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9928C38142 for ; Wed, 24 Aug 2022 12:20:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 368409B5B9; Wed, 24 Aug 2022 12:17:41 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8511C11B554 for ; Wed, 24 Aug 2022 12:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661343415; 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=C30+JylXoiqfCL1QVhV6xN5vRbXmIR8YpoQkV4jNNtM=; b=Mwqp+UF3wcdBUORPen7nZB/16VfbhERuCb7HMJUrTvSydmVjOkUE6X6XAAlWHZze69mOxr eUoQ1D2sQYakvR+JRDUyD18toErSI8/JQG+whR2hfYWSipn3DZRqlXR/GBtxAF9z3oPUM0 FRqDOF/4oNalYi4EIBY5cB37kjOykDc= 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-323-xljP5gJ1MZavC8D1kIwOaA-1; Wed, 24 Aug 2022 08:16:51 -0400 X-MC-Unique: xljP5gJ1MZavC8D1kIwOaA-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 3B76C101A54E; Wed, 24 Aug 2022 12:16:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACA9C15BB3; Wed, 24 Aug 2022 12:16:46 +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@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Subject: [PATCH v4 18/31] ACPI: video: Add Apple GMUX brightness control detection Date: Wed, 24 Aug 2022 14:15:10 +0200 Message-Id: <20220824121523.1291269-19-hdegoede@redhat.com> In-Reply-To: <20220824121523.1291269-1-hdegoede@redhat.com> References: <20220824121523.1291269-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, David Airlie , nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, Len Brown Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Apple laptops with an Apple GMUX using this for brightness control, should take precedence of any other brightness control methods. Add apple-gmux detection to acpi_video_get_backlight_type() using the already existing apple_gmux_present() helper function. This will allow removig the (ab)use of: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); Inside the apple-gmux driver. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/video_detect.c | 4 ++++ include/acpi/video.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4dc7fb865083..be2fc43418af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -607,6 +608,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) if (nvidia_wmi_ec_present) return acpi_backlight_nvidia_wmi_ec; + if (apple_gmux_present()) + return acpi_backlight_apple_gmux; + /* On systems with ACPI video use either native or ACPI video. */ if (video_caps & ACPI_VIDEO_BACKLIGHT) { /* diff --git a/include/acpi/video.h b/include/acpi/video.h index 91578e77ac4e..dbd48cb8bd23 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -49,6 +49,7 @@ enum acpi_backlight_type { acpi_backlight_vendor, acpi_backlight_native, acpi_backlight_nvidia_wmi_ec, + acpi_backlight_apple_gmux, }; #if IS_ENABLED(CONFIG_ACPI_VIDEO) -- 2.37.2 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E5C7C00140 for ; Wed, 24 Aug 2022 12:20:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 79734A8AB9; Wed, 24 Aug 2022 12:17:47 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F09211BF4B for ; Wed, 24 Aug 2022 12:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661343418; 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=C30+JylXoiqfCL1QVhV6xN5vRbXmIR8YpoQkV4jNNtM=; b=FtTm19WTxKCFXWPvGNXlBltYVGeUy602Tmwxlh7dOwiA1uZHf10Ob5XwFvo5M0VMI5j8th XeD8OC6AfU1mNjcT5C7GNOYRqkwKQltPtExkbW1N6s25vRNt9TMKvkcH17ZGo0gaaynUUt ca2sxMelSFk4j8iD5pY6MThCCCk8jb4= 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-323-xljP5gJ1MZavC8D1kIwOaA-1; Wed, 24 Aug 2022 08:16:51 -0400 X-MC-Unique: xljP5gJ1MZavC8D1kIwOaA-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 3B76C101A54E; Wed, 24 Aug 2022 12:16:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACA9C15BB3; Wed, 24 Aug 2022 12:16:46 +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@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Date: Wed, 24 Aug 2022 14:15:10 +0200 Message-Id: <20220824121523.1291269-19-hdegoede@redhat.com> In-Reply-To: <20220824121523.1291269-1-hdegoede@redhat.com> References: <20220824121523.1291269-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Subject: [Intel-gfx] [PATCH v4 18/31] ACPI: video: Add Apple GMUX brightness control detection X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, David Airlie , nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, amd-gfx@lists.freedesktop.org, Daniel Vetter , Len Brown Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Apple laptops with an Apple GMUX using this for brightness control, should take precedence of any other brightness control methods. Add apple-gmux detection to acpi_video_get_backlight_type() using the already existing apple_gmux_present() helper function. This will allow removig the (ab)use of: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); Inside the apple-gmux driver. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/video_detect.c | 4 ++++ include/acpi/video.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4dc7fb865083..be2fc43418af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -607,6 +608,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) if (nvidia_wmi_ec_present) return acpi_backlight_nvidia_wmi_ec; + if (apple_gmux_present()) + return acpi_backlight_apple_gmux; + /* On systems with ACPI video use either native or ACPI video. */ if (video_caps & ACPI_VIDEO_BACKLIGHT) { /* diff --git a/include/acpi/video.h b/include/acpi/video.h index 91578e77ac4e..dbd48cb8bd23 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -49,6 +49,7 @@ enum acpi_backlight_type { acpi_backlight_vendor, acpi_backlight_native, acpi_backlight_nvidia_wmi_ec, + acpi_backlight_apple_gmux, }; #if IS_ENABLED(CONFIG_ACPI_VIDEO) -- 2.37.2 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AD77C00140 for ; Wed, 24 Aug 2022 12:21:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9399893D22; Wed, 24 Aug 2022 12:17:44 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6302B12B037 for ; Wed, 24 Aug 2022 12:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661343416; 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=C30+JylXoiqfCL1QVhV6xN5vRbXmIR8YpoQkV4jNNtM=; b=SVNIGiVLRGpnuy/NJVTwCSdFv0rTLaMB5b/5DJvUyYTxkkFxUoTBqVCAhskzmz7zuKJ8rq tqOh7CX7lF61YXZ6BntUinZH5Hu8obI7eJVF4qq9B0kaswnTwiqchUw3oE9KgK4NfwJ5fd BJvWbGz5zy3YFWOZ7fligYRrzPHFNTc= 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-323-xljP5gJ1MZavC8D1kIwOaA-1; Wed, 24 Aug 2022 08:16:51 -0400 X-MC-Unique: xljP5gJ1MZavC8D1kIwOaA-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 3B76C101A54E; Wed, 24 Aug 2022 12:16:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACA9C15BB3; Wed, 24 Aug 2022 12:16:46 +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@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Date: Wed, 24 Aug 2022 14:15:10 +0200 Message-Id: <20220824121523.1291269-19-hdegoede@redhat.com> In-Reply-To: <20220824121523.1291269-1-hdegoede@redhat.com> References: <20220824121523.1291269-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Subject: [Nouveau] [PATCH v4 18/31] ACPI: video: Add Apple GMUX brightness control detection X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, David Airlie , nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, Daniel Vetter , Len Brown Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Apple laptops with an Apple GMUX using this for brightness control, should take precedence of any other brightness control methods. Add apple-gmux detection to acpi_video_get_backlight_type() using the already existing apple_gmux_present() helper function. This will allow removig the (ab)use of: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); Inside the apple-gmux driver. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/video_detect.c | 4 ++++ include/acpi/video.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4dc7fb865083..be2fc43418af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -607,6 +608,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) if (nvidia_wmi_ec_present) return acpi_backlight_nvidia_wmi_ec; + if (apple_gmux_present()) + return acpi_backlight_apple_gmux; + /* On systems with ACPI video use either native or ACPI video. */ if (video_caps & ACPI_VIDEO_BACKLIGHT) { /* diff --git a/include/acpi/video.h b/include/acpi/video.h index 91578e77ac4e..dbd48cb8bd23 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -49,6 +49,7 @@ enum acpi_backlight_type { acpi_backlight_vendor, acpi_backlight_native, acpi_backlight_nvidia_wmi_ec, + acpi_backlight_apple_gmux, }; #if IS_ENABLED(CONFIG_ACPI_VIDEO) -- 2.37.2 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2AFEC32774 for ; Thu, 25 Aug 2022 07:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29230D8F3F; Thu, 25 Aug 2022 07:19:02 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6094711B554 for ; Wed, 24 Aug 2022 12:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661343417; 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=C30+JylXoiqfCL1QVhV6xN5vRbXmIR8YpoQkV4jNNtM=; b=hmkaUXyTtECDebnksKCW00Ls5RB/e+GK8ZOpJdczaApDVVM7yzw7LETzo+qrIALlgOUVAv Rb1SUX5IuL+ufawFMMG6Y70O4cfjvE0QvHW5x4L3WZwrpvq0+9NdLMKHq7TYLxWfniUC0Z SALpBZQScG7pHRS/C19zJhx84llNCw8= 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-323-xljP5gJ1MZavC8D1kIwOaA-1; Wed, 24 Aug 2022 08:16:51 -0400 X-MC-Unique: xljP5gJ1MZavC8D1kIwOaA-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 3B76C101A54E; Wed, 24 Aug 2022 12:16:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACA9C15BB3; Wed, 24 Aug 2022 12:16:46 +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@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Subject: [PATCH v4 18/31] ACPI: video: Add Apple GMUX brightness control detection Date: Wed, 24 Aug 2022 14:15:10 +0200 Message-Id: <20220824121523.1291269-19-hdegoede@redhat.com> In-Reply-To: <20220824121523.1291269-1-hdegoede@redhat.com> References: <20220824121523.1291269-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mailman-Approved-At: Thu, 25 Aug 2022 07:18:48 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, David Airlie , nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, Daniel Vetter , Len Brown Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Apple laptops with an Apple GMUX using this for brightness control, should take precedence of any other brightness control methods. Add apple-gmux detection to acpi_video_get_backlight_type() using the already existing apple_gmux_present() helper function. This will allow removig the (ab)use of: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); Inside the apple-gmux driver. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/video_detect.c | 4 ++++ include/acpi/video.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4dc7fb865083..be2fc43418af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -607,6 +608,9 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native) if (nvidia_wmi_ec_present) return acpi_backlight_nvidia_wmi_ec; + if (apple_gmux_present()) + return acpi_backlight_apple_gmux; + /* On systems with ACPI video use either native or ACPI video. */ if (video_caps & ACPI_VIDEO_BACKLIGHT) { /* diff --git a/include/acpi/video.h b/include/acpi/video.h index 91578e77ac4e..dbd48cb8bd23 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -49,6 +49,7 @@ enum acpi_backlight_type { acpi_backlight_vendor, acpi_backlight_native, acpi_backlight_nvidia_wmi_ec, + acpi_backlight_apple_gmux, }; #if IS_ENABLED(CONFIG_ACPI_VIDEO) -- 2.37.2