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 v3 1/5] apple-gmux: use first bit to check switch state
Date: Sun, 19 Feb 2023 00:20:03 +1100 [thread overview]
Message-ID: <20230218132007.3350-2-orlandoch.dev@gmail.com> (raw)
In-Reply-To: <20230218132007.3350-1-orlandoch.dev@gmail.com>
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 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;
--
2.39.1
next prev parent reply other threads:[~2023-02-18 13:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 13:20 [PATCH v3 0/5] apple-gmux: support MMIO gmux type on T2 Macs Orlando Chamberlain
2023-02-18 13:20 ` Orlando Chamberlain [this message]
2023-02-18 13:20 ` [PATCH v3 2/5] apple-gmux: refactor gmux types Orlando Chamberlain
2023-02-18 13:20 ` [PATCH v3 3/5] apple-gmux: Use GMSP acpi method for interrupt clear Orlando Chamberlain
2023-02-19 22:17 ` Lukas Wunner
2023-02-20 12:02 ` Orlando Chamberlain
2023-02-18 13:20 ` [PATCH v3 4/5] apple-gmux: support MMIO gmux on T2 Macs Orlando Chamberlain
2023-02-20 9:20 ` Lukas Wunner
2023-02-20 12:16 ` Orlando Chamberlain
2023-02-18 13:20 ` [PATCH v3 5/5] apple-gmux: add debugfs interface Orlando Chamberlain
2023-03-01 12:54 ` [PATCH v3 0/5] apple-gmux: support MMIO gmux type on T2 Macs Hans de Goede
2023-03-03 7:54 ` Orlando Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230218132007.3350-2-orlandoch.dev@gmail.com \
--to=orlandoch.dev@gmail.com \
--cc=admin@kodeit.net \
--cc=gargaditya08@live.com \
--cc=hdegoede@redhat.com \
--cc=kekrby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sforshee@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox