# \[PATCH v1 0/1\] pinctrl/GPIO driver for Apple SoCs

- From: Joey Gouly \<joey.gouly@arm.com\>
- Date: 2021-09-21 22:30:50 
- List: linux-gpio
- Page: https://ratatoskr.run/linux-gpio/2021/09/8513666
- Thread: https://ratatoskr.run/linux-gpio/2021/09/8513666/t.md

```text
Hi all,

This is a driver for the combined pinctrl / GPIO hw in the Apple M1 computers.
The driver is based on Corellium's driver [1], and has been rebased and cleaned up.
The bindings are in Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml

This has been tested with out-of-tree patches for the keyboard on the Macbook
Air, it has also been tested with i2c for the USB PD driver and PCIe (all
out-of-tree drivers currently).

I left two defines at the top 'USE_PINMUX_GENERIC_FN' and
'USE_PINCTRL_GENERIC_FN', I wasn't sure if I should use the generic functions for
getting the groups/functions, so I left both approaches in and will remove one
of them for the next version! Which approach should I use?

There is a branch here with the driver:
  https://gitlab.arm.com/linux-arm/jg-open/-/commits/pinctrl_apple_v1

There is also a branch which contains all the commits as I was
developing here (and keyboard drivers):
  https://gitlab.arm.com/linux-arm/jg-open/-/commits/m1-keyboard

I look forward to feedback!

Thanks,
Joey

note: I'm sending this from my arm work e-mail address, however it was done on
personal time.

note2: For those that have been testing this with PCIe etc, you will probably
want to also include the last commit in the following branch, as I dropped the
clock references in the code (due to the switch to power domains):
https://gitlab.arm.com/linux-arm/jg-open/-/commits/pinctrl_apple_v1_clock

[1]
https://github.com/corellium/linux-m1/blob/d5ec2a737e64de23a21025f9eddc554588deb23f/drivers/pinctrl/pinctrl-apple-gpio.c

Stan Skowronek (1):
  pinctrl: add pinctrl/GPIO driver for Apple SoCs

 MAINTAINERS                          |   1 +
 drivers/pinctrl/Kconfig              |  13 +
 drivers/pinctrl/Makefile             |   1 +
 drivers/pinctrl/pinctrl-apple-gpio.c | 652 +++++++++++++++++++++++++++
 4 files changed, 667 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-apple-gpio.c

-- 
2.17.1

```
