[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3af65b5e-1f52-79f6-4130-03901ce76d2f@redhat.com>
Date: Fri, 10 Feb 2023 20:09:59 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Orlando Chamberlain <orlandoch.dev@...il.com>,
platform-driver-x86@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Mark Gross <markgross@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Hawking Zhang <Hawking.Zhang@....com>,
Andrey Grodzovsky <andrey.grodzovsky@....com>,
Lijo Lazar <lijo.lazar@....com>,
YiPeng Chai <YiPeng.Chai@....com>,
Somalapuram Amaranath <Amaranath.Somalapuram@....com>,
Mario Limonciello <mario.limonciello@....com>,
Bokun Zhang <Bokun.Zhang@....com>,
Jack Xiao <Jack.Xiao@....com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Rander Wang <rander.wang@...el.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>,
Yong Zhi <yong.zhi@...el.com>, Evan Quan <evan.quan@....com>,
Kerem Karabay <kekrby@...il.com>,
Aditya Garg <gargaditya08@...e.com>,
Aun-Ali Zaidi <admin@...eit.net>
Subject: Re: [RFC PATCH 1/9] apple-gmux: use cpu_to_be32 instead of manual
reorder
Hi,
On 2/10/23 05:48, Orlando Chamberlain wrote:
> Currently it manually flips the byte order, but we can instead use
> cpu_to_be32(val) for this.
>
> Signed-off-by: Orlando Chamberlain <orlandoch.dev@...il.com>
> ---
> drivers/platform/x86/apple-gmux.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index 9333f82cfa8a..e8cb084cb81f 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -94,13 +94,7 @@ static u32 gmux_pio_read32(struct apple_gmux_data *gmux_data, int port)
> static void gmux_pio_write32(struct apple_gmux_data *gmux_data, int port,
> u32 val)
> {
> - int i;
> - u8 tmpval;
> -
> - for (i = 0; i < 4; i++) {
> - tmpval = (val >> (i * 8)) & 0xff;
> - outb(tmpval, gmux_data->iostart + port + i);
> - }
> + outl(cpu_to_be32(val), gmux_data->iostart + port);
> }
>
> static int gmux_index_wait_ready(struct apple_gmux_data *gmux_data)
The ioport / indexed-ioport accessed apple_gmux-es likely are (part of?)
LPC bus devices . Looking at the bus level you are now changing 4 io
accesses with a size of 1 byte, to 1 32 bit io-access.
Depending on the decoding hw in the chip this may work fine,
or this may work not at all.
I realized that you have asked for more testing, but most surviving
macbooks from the older apple-gmux era appear to be models without
a discrete GPU (which are often the first thing to break) and thus
without a gmux.
Unless we get a bunch of testers to show up, which I doubt. I would
prefer slightly bigger / less pretty code and not change the functional
behavior of the driver on these older models.
Regards,
Hans
> @@ -177,16 +171,8 @@ static u32 gmux_index_read32(struct apple_gmux_data *gmux_data, int port)
> static void gmux_index_write32(struct apple_gmux_data *gmux_data, int port,
> u32 val)
> {
> - int i;
> - u8 tmpval;
> -
> mutex_lock(&gmux_data->index_lock);
> -
> - for (i = 0; i < 4; i++) {
> - tmpval = (val >> (i * 8)) & 0xff;
> - outb(tmpval, gmux_data->iostart + GMUX_PORT_VALUE + i);
> - }
> -
> + outl(cpu_to_be32(val), gmux_data->iostart + GMUX_PORT_VALUE);
> gmux_index_wait_ready(gmux_data);
> outb(port & 0xff, gmux_data->iostart + GMUX_PORT_WRITE);
> gmux_index_wait_complete(gmux_data);
Powered by blists - more mailing lists