Message ID | 20230303112842.3094-2-orlandoch.dev@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp361196wrd; Fri, 3 Mar 2023 03:37:41 -0800 (PST) X-Google-Smtp-Source: AK7set9ckS3qc8H7iJwSPr8LM0J0nq3T9/Hiph9v5MrnCx5niBUv9Cs7DkdLU2eptVkdbL7VFEWs X-Received: by 2002:a62:65c1:0:b0:60b:e13:a10b with SMTP id z184-20020a6265c1000000b0060b0e13a10bmr1542760pfb.3.1677843461015; Fri, 03 Mar 2023 03:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677843460; cv=none; d=google.com; s=arc-20160816; b=i0vwu0PpIWikodSad26SLeuFhg9IxdDeFWcmac1Yn/jf4x0OibM35F7WWALpa2kM/q 3pVnZruut5a6cWog0TJQTFiUGrpI85TnSb4aRhY6hrfwU0at4ryqC32t2mAWB3pMGSVL 0Xsh/b1/L4OlgPUiih5QMBViN/oHD40fdq+s/AJtg7wZCBVGOJsfYR1xRNuE3lIYa35w py7IJxtPSNSYD4NZahx7CtwfJLXcbFRxy2geUDjoH1V5Ny3vywkebm1s1aRMNbNi27ZT m947FSGgU3cINuYCc8nbN96Iw3eJZyVa2ayZGZMeIV8VSr7hnyEINPVzsYIIFBj9oZ7I azow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x6RNuvoFz5fD/fH7/1p3nNqLtid6rjBFpG3wpNETfTY=; b=vARe8rJ6Nra7UbjiFraWGS0KuEf8mE1zW8MIFFeDfPMzaoqv/GVq6BolYCS1ZVj+5h psNiYJHt8gerEHtexuftbaR5d8IVeb+fwlavJTQ82sk0VC3fcJ6syWH27t5xgbArgqPV cI0eZdemCpL9BJFHSwarzXWtADvQCmXLIg0NMX+LVKqn/g7DxO7d7OPxMM2LLudEJ7LH 9CHxq15oYjzPJXiujS853nzJlaVkALlnTLPyh/rc9cZOmeaPMxC3odnhGfsncDXU5Kks swPh5EJBr5iq/vHjOFAZdKBJZY0AtDd1benLN1xBmft6a+8NT9PDhYyoTn3RM8/TSXlZ uBZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=E7J4oCVo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a631a55000000b004fb1be8cd41si1848199pgm.152.2023.03.03.03.37.28; Fri, 03 Mar 2023 03:37:40 -0800 (PST) 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=pass header.i=@gmail.com header.s=20210112 header.b=E7J4oCVo; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230074AbjCCLbS (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Fri, 3 Mar 2023 06:31:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjCCLbO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Mar 2023 06:31:14 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8AC6113EB; Fri, 3 Mar 2023 03:30:49 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id fd25so1349986pfb.1; Fri, 03 Mar 2023 03:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677843045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x6RNuvoFz5fD/fH7/1p3nNqLtid6rjBFpG3wpNETfTY=; b=E7J4oCVoDrSrgXFmHAibCE4JVyXPjYGq/svSesvgERVS2e+39WuRl12DZgkGiwr4tV YJgk2orOigu7rAM/5HWfJeRKEMcma3Ljh3Wtl/Pv62IlaU9JjwCR9Y/oAqvF894LZI1+ N4TNZaljA+G7UZHH+lLpnjXbhB/sPUgLrKWA+ywCHQg0hifyq9PG+d1X4diGGnRtbEeR 5ZCg70phOy0D5+VVs3jtUDRHyxFvSEqlmyd/+gk7Jz7bwq+ktJGs4Nz6TXI1kiPBJBmD tcDKB1Hr2G7jj8kC5GSFtXKe0PNb7cYa+Vl5xCvRYxR0MS6ZAMM/u0ne2+AqZudODLRk OUAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677843045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x6RNuvoFz5fD/fH7/1p3nNqLtid6rjBFpG3wpNETfTY=; b=dBa4jnf9a+ltMTr0WNVay+MfvrkUXYVQUBYyp1pen68E9Zk5jPwpph6zksaUvKPc19 vg2tDT96JNFU5tJhOjKrrTtFdqg4rhVGRj1Fp3l3kneC/jKGunYtxWC7sa8Qki24whKd +aBCvJMqXOYDrlGr8cvxMxTAFA12+ta23/R66U6B6yNehC/m9YrVUAw/hezSyNHAveSg TtxLWD8lVyEq9+jzErWXt+9Pq7ozm95Nox16AY32Ky0lFkRL61HrlLBYlpGOMKfI8dOl 8w7B9Ah8Jt+Y0a/4+/PSWtJxlPUaD7QRzrCsrG40oAgkTSKxQS3Hs5FO2L2T6FISUVD9 zbrg== X-Gm-Message-State: AO0yUKXfYm0feT9x1HmAKKa7B8s6/s0A1h35kzFLpX/gyqo+3RELETFP 1EiBYdw9wjYqbB7QNZYXAAk= X-Received: by 2002:a62:1848:0:b0:5a8:9fc6:6fb5 with SMTP id 69-20020a621848000000b005a89fc66fb5mr1845483pfy.16.1677843045414; Fri, 03 Mar 2023 03:30:45 -0800 (PST) Received: from localhost.localdomain (124-148-239-17.tpgi.com.au. [124.148.239.17]) by smtp.gmail.com with ESMTPSA id n4-20020a62e504000000b005a8c92f7c27sm1356262pff.212.2023.03.03.03.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 03:30:45 -0800 (PST) From: Orlando Chamberlain <orlandoch.dev@gmail.com> To: Hans de Goede <hdegoede@redhat.com> Cc: Mark Gross <markgross@kernel.org>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wunner <lukas@wunner.de>, Seth Forshee <sforshee@kernel.org>, Aditya Garg <gargaditya08@live.com>, Aun-Ali Zaidi <admin@kodeit.net>, Kerem Karabay <kekrby@gmail.com>, Orlando Chamberlain <orlandoch.dev@gmail.com> Subject: [PATCH v4 1/4] apple-gmux: use first bit to check switch state Date: Fri, 3 Mar 2023 22:28:40 +1100 Message-Id: <20230303112842.3094-2-orlandoch.dev@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303112842.3094-1-orlandoch.dev@gmail.com> References: <20230303112842.3094-1-orlandoch.dev@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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?1759346384897860600?= X-GMAIL-MSGID: =?utf-8?q?1759346384897860600?= |
Series |
apple-gmux: support MMIO gmux type on T2 Macs
|
|
Commit Message
Orlando Chamberlain
March 3, 2023, 11:28 a.m. UTC
On T2 Macs with MMIO gmux, when GMUX_PORT_SWITCH_DISPLAY is read, it can have values of 2, 3, 4, and 5. Odd values correspond to the discrete gpu, and even values correspond to the integrated gpu. The current logic is that only 2 corresponds to IGD, but this doesn't work for T2 Macs. Instead, check the first bit to determine the connected gpu. As T2 Macs with gmux only can switch the internal display, it is untested if this change (or a similar change) would be applicable to GMUX_PORT_SWITCH_DDC and GMUX_PORT_SWITCH_EXTERNAL. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com> --- v3->v4: Collect Hans' review drivers/platform/x86/apple-gmux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 9333f82cfa8a..ec99e05e532c 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -346,10 +346,10 @@ static void gmux_read_switch_state(struct apple_gmux_data *gmux_data) else gmux_data->switch_state_ddc = VGA_SWITCHEROO_DIS; - if (gmux_read8(gmux_data, GMUX_PORT_SWITCH_DISPLAY) == 2) - gmux_data->switch_state_display = VGA_SWITCHEROO_IGD; - else + if (gmux_read8(gmux_data, GMUX_PORT_SWITCH_DISPLAY) & 1) gmux_data->switch_state_display = VGA_SWITCHEROO_DIS; + else + gmux_data->switch_state_display = VGA_SWITCHEROO_IGD; if (gmux_read8(gmux_data, GMUX_PORT_SWITCH_EXTERNAL) == 2) gmux_data->switch_state_external = VGA_SWITCHEROO_IGD;