Message ID | 20230210044826.9834-4-orlandoch.dev@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp755759wrn; Thu, 9 Feb 2023 20:52:22 -0800 (PST) X-Google-Smtp-Source: AK7set/Qpziwcwja+mPpdGc6T9IY8Osz4Mf7Dqaqk/LidVytSUOYx52auMkKAUhYZorW+JGZOcei X-Received: by 2002:a17:906:ecb0:b0:84d:4325:7f7a with SMTP id qh16-20020a170906ecb000b0084d43257f7amr14190224ejb.65.1676004742625; Thu, 09 Feb 2023 20:52:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676004742; cv=none; d=google.com; s=arc-20160816; b=tZVhINR5qOXK1kwqxIcs7+5cF0rVKaoLxkXPHogUEekLLs2FI7uUTvumSoMoK53k4y ugiXnHxPLAA3Ytn8imJF/aegeRDOZ9Dolp+XeBnJGdibSHQxU1x7+PCjbSNoBNkBFhTY 2ryLO42wp7xkX5I0SPPI4heFt4YzgqSgeVnA0MXEeQMASXVAjCm3yJzV4WyaiRm//LCo OHetQkbPyDH1kGEk3pnEGvDPHAERVFcP/4KcEkRnYPrd2DbVjYjDlusHVy1bP9JelUeH LHT8jY/jCQw+rUh0u0DWTnojvQDDvFtIdGszSZ4BPUtJ2Eg9QK/k1fI2VSvRZ9pHvBrH kh7g== 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=zqShi3EgLDtgztLIgW/MuPsWv2vSLPgVWXrp/LobXww=; b=msxkFUW3M6cCvUhJ9l4rq++cXZd3goTTSEi2hyr8IUgymfNtWd/EMEP9Wkmv8SsMEx 0nWwdEOCCMcoHCDTDxVxxGLW1lP1Ozvi+esIqUZ2p7TDNZecWgSIT0PdQbQn/CNGFe2y OG7L9LmiXklBb/gW9nnq3JEZzlRmUxV8FmICvr9VgZijf4arOY7fAMKtkamjp4D3cYrP lgUoiNuqu/ELmH9mkixbuet8Ek5iC32JoN/qyLbpenNmoJ5OPzW6oSmtKXqyFSEBLxeQ wkVDLbUCgOfWybAyNpRjBl5WyZX8kGjp1fmEfniDoXXqR4JQ4gZKxdiVOSEUpNPeJYeq 3Gag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Om+u/6Vn"; 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 uk7-20020a170907ca0700b008897b74cf85si4170293ejc.839.2023.02.09.20.51.59; Thu, 09 Feb 2023 20:52:22 -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="Om+u/6Vn"; 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 S231219AbjBJEut (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 9 Feb 2023 23:50:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231255AbjBJEuf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Feb 2023 23:50:35 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E4D56E984; Thu, 9 Feb 2023 20:50:29 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id ay1so2754295pfb.7; Thu, 09 Feb 2023 20:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=zqShi3EgLDtgztLIgW/MuPsWv2vSLPgVWXrp/LobXww=; b=Om+u/6VnAJG9TE8AtmP7qvhlFAe++DibsHxfnKB/uw1rT0M0wwXXptoFr0Xv+20ydo eakNNTYlCCk2g+ALxRE6kmjCfzNbNOYJFbMBHqWvHvIm2k/uZfv6KIo0xugx3nQig2py J1no3BHk6c8ezYo6oWs4KfkhLQOu7YRb0G1aFzEpM6YreNPESvbQ4vwbkdQg1ll66Mfa qmCJAD9lIdQ09n5BrE3kzDSLu8s0jx5ZJ2hqM233WpFqKrLUDc8SXFgEQ8iWwYwFo7zR SkcsIvSD7qiSPHhO2o5OR47wO55x0ECXZiVlRFfBnNKUyj1V+gZQOOhi2rAshPHtOKDE yP0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=zqShi3EgLDtgztLIgW/MuPsWv2vSLPgVWXrp/LobXww=; b=fEeGayo9oSAzFo55k3ySjp9dRHOLyVpkVHUAQLhs6NMfgpobzEcneEwX0GCGoAPL1k inzOgFbsc4FqjNOaeus3HcJXvryd6FpqmpQ1eRFaz2pKz7jt7wHqHeL7Ok4+LTJGlasA Gze1LK+dbPwy2xWFBv2dbPg0WbBz7cofpp6MxvGPwwCwnB33c8JKhBMUumMT7m0i5hhd GqqdQNvwZEGDklH6CwrRXYOUshe2YoPRFOLcvZFgj4KYYE7vlB4W7O+vbtpWG1pnUxVG uNh9kLANRm58vmpHNKMZmvZiXvvJE9JUAU+r/swii0C4TQEzxVWDMkruecn21TQQJDGQ Fg4w== X-Gm-Message-State: AO0yUKUUFvCDhQ+cyw7Ve4kNvneNkPZs4ct4OKuGtN9xX+VE+kTgqzNW 31sRkEG3DRJhUJFwTrLcNb9lpSzQMvJCMQ== X-Received: by 2002:a62:6458:0:b0:5a8:6bb7:5fc5 with SMTP id y85-20020a626458000000b005a86bb75fc5mr1170747pfb.19.1676004628485; Thu, 09 Feb 2023 20:50:28 -0800 (PST) Received: from localhost.localdomain ([202.53.32.211]) by smtp.gmail.com with ESMTPSA id t13-20020a62ea0d000000b0057fec210d33sm2269218pfh.152.2023.02.09.20.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 20:50:28 -0800 (PST) From: Orlando Chamberlain <orlandoch.dev@gmail.com> To: platform-driver-x86@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: Alex Deucher <alexander.deucher@amd.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, "Pan, Xinhui" <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Hawking Zhang <Hawking.Zhang@amd.com>, Andrey Grodzovsky <andrey.grodzovsky@amd.com>, Lijo Lazar <lijo.lazar@amd.com>, YiPeng Chai <YiPeng.Chai@amd.com>, Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>, Mario Limonciello <mario.limonciello@amd.com>, Bokun Zhang <Bokun.Zhang@amd.com>, Jack Xiao <Jack.Xiao@amd.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Rander Wang <rander.wang@intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, =?utf-8?q?Amadeusz_S?= =?utf-8?q?=C5=82awi=C5=84ski?= <amadeuszx.slawinski@linux.intel.com>, Yong Zhi <yong.zhi@intel.com>, Evan Quan <evan.quan@amd.com>, Kerem Karabay <kekrby@gmail.com>, Aditya Garg <gargaditya08@live.com>, Aun-Ali Zaidi <admin@kodeit.net>, Orlando Chamberlain <orlandoch.dev@gmail.com> Subject: [RFC PATCH 3/9] apple-gmux: use first bit to check switch state Date: Fri, 10 Feb 2023 15:48:20 +1100 Message-Id: <20230210044826.9834-4-orlandoch.dev@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230210044826.9834-1-orlandoch.dev@gmail.com> References: <20230210044826.9834-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?1757418348759472245?= X-GMAIL-MSGID: =?utf-8?q?1757418348759472245?= |
Series |
apple-gmux: support MMIO gmux type on T2 Macs
|
|
Commit Message
Orlando Chamberlain
Feb. 10, 2023, 4:48 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.
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
---
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 67628104f31a..6109f4c2867c 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -332,10 +332,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;