[PATCH] i2c: pasemi: Add IRQ support for Apple Silicon
Martin Povišer
povik at protonmail.com
Sun Aug 21 06:17:23 AEST 2022
> On 20. 8. 2022, at 21:45, Arminder Singh <arminders208 at outlook.com> wrote:
>
> This is the first time I'm interacting with the Linux mailing lists, so
> please don't eviscerate me *too much* if I get the formatting wrong.
> Of course I'm always willing to take criticism and improve my formatting
> in the future.
>
> This patch adds support for IRQs to the PASemi I2C controller driver.
> This will allow for faster performing I2C transactions on Apple Silicon
> hardware, as previously, the driver was forced to poll the SMSTA register
> for a set amount of time.
>
> With this patchset the driver on Apple silicon hardware will instead wait
> for an interrupt which will signal the completion of the I2C transaction.
> The timeout value for this completion will be the same as the current
> amount of time the I2C driver polls for.
>
> This will result in some performance improvement since the driver will be
> waiting for less time than it does right now on Apple Silicon hardware.
>
> The patch right now will only enable IRQs for Apple Silicon I2C chips,
> and only if it's able to successfully request the IRQ from the kernel.
>
> === Testing ===
>
> This patch has been tested on both the mainline Linux kernel tree and
> the Asahi branch (https://github.com/AsahiLinux/linux.git) on both an
> M1 and M2 MacBook Air, and it compiles successfully as both a module and
> built-in to the kernel itself. The patch in both trees successfully boots
> to userspace without any hitch.
>
> I do not have PASemi hardware on hand unfortunately, so I'm unable to test
> the impact of this patch on old PASemi hardware. This is also why I've
> elected to do the IRQ request and enablement on the Apple platform driver
> and not in the common file, as I'm not sure if PASemi hardware supports
> IRQs.
>
> I also fixed a quick checkpatch warning on line 303. "i ++" is now "i++".
>
> Any and all critiques of the patch would be well appreciated.
>
>
>
>
> Signed-off-by: Arminder Singh <arminders208 at outlook.com>
Thanks for the patch!
Tested-by: Martin Povišer <povik+lin at cutebit.org>
on Mac mini (2020) with M1, with in-kernel WIP sound drivers.
Some timing comparison on boot logs follows, three runs with
and without the patch.
With:
[ 0.631034] ALSA device list:
[ 0.631403] #0: Mac mini J274 integrated audio
[ 0.625559] ALSA device list:
[ 0.625997] #0: Mac mini J274 integrated audio
[ 0.624561] ALSA device list:
[ 0.624913] #0: Mac mini J274 integrated audio
Without:
[ 0.681599] ALSA device list:
[ 0.682051] #0: Mac mini J274 integrated audio
[ 0.677538] ALSA device list:
[ 0.677968] #0: Mac mini J274 integrated audio
[ 0.686037] ALSA device list:
[ 0.686400] #0: Mac mini J274 integrated audio
(After I collected these I realised I don’t know to what exactly
the timing of the print is anchored, but anyway it still suggests
there is speed-up.)
Best,
Martin
More information about the Linuxppc-dev
mailing list