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 962BFC4332F for ; Thu, 15 Dec 2022 10:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbiLOKWf (ORCPT ); Thu, 15 Dec 2022 05:22:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiLOKWP (ORCPT ); Thu, 15 Dec 2022 05:22:15 -0500 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A30629801; Thu, 15 Dec 2022 02:22:13 -0800 (PST) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id BCBC130016112; Thu, 15 Dec 2022 11:22:11 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B0E4338193; Thu, 15 Dec 2022 11:22:11 +0100 (CET) Date: Thu, 15 Dec 2022 11:22:11 +0100 From: Lukas Wunner To: Hans de Goede Cc: "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, Aditya Garg Subject: Re: [PATCH] ACPI: video: Fix Apple GMUX backlight detection Message-ID: <20221215102211.GA5147@wunner.de> References: <20221215094138.7120-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221215094138.7120-1-hdegoede@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Thu, Dec 15, 2022 at 10:41:38AM +0100, Hans de Goede wrote: > The apple-gmux driver only binds to old GMUX devices which have an > IORESOURCE_IO resource (using inb()/outb()) rather then memory-mapped > IO (IORESOURCE_MEM). > > T2 MacBooks use the new style GMUX devices (with IORESOURCE_MEM access), > so these are not supported by the apple-gmux driver. This is not a problem > since they have working ACPI video backlight support. Interesting. > +static bool apple_gmux_backlight_present(void) > +{ > + struct acpi_device *adev; > + struct device *dev; > + > + adev = acpi_dev_get_first_match_dev(GMUX_ACPI_HID, NULL, -1); > + if (!adev) > + return false; > + > + dev = acpi_get_first_physical_node(adev); > + if (!dev) > + return false; > + > + /* > + * drivers/platform/x86/apple-gmux.c only supports old style > + * Apple GMUX with an IO-resource. > + */ > + return pnp_get_resource(to_pnp_dev(dev), IORESOURCE_IO, 0) != NULL; > +} The T2 is represented by a PCI device with ID 106B:1802. Instead of the above, how about amending apple_gmux_present() with a simple check like this: /* T2 Macs drive GMUX via MMIO, which is unsupported for now */ if (pci_dev_present({{PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x1802)}, {}})) return false; Thanks, Lukas