Thread (27 messages) 27 messages, 6 authors, 2025-05-09

Re: [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs

From: Bartosz Golaszewski <hidden>
Date: 2025-05-06 08:07:13
Also in: asahi, linux-devicetree, linux-gpio, linux-pm, lkml

On Sat, May 3, 2025 at 12:07 PM Sven Peter via B4 Relay
[off-list ref] wrote:
From: Hector Martin <redacted>

This driver implements the GPIO service on top of the SMC framework
on Apple Mac machines. In particular, these are the GPIOs present in the
PMU IC which are used to control power to certain on-board devices.

Although the underlying hardware supports various pin config settings
(input/output, open drain, etc.), this driver does not implement that
functionality and leaves it up to the firmware to configure things
properly. We also don't yet support interrupts/events. This is
sufficient for device power control, which is the only thing we need to
support at this point. More features will be implemented when needed.

To our knowledge, only Apple Silicon Macs implement this SMC feature.

Signed-off-by: Hector Martin <redacted>
Reviewed-by: Bartosz Golaszewski <redacted>
Reviewed-by: Linus Walleij <redacted>
Reviewed-by: Sven Peter <redacted>
Signed-off-by: Russell King (Oracle) <redacted>
Signed-off-by: Sven Peter <redacted>
---
[snip]
+
+       smcgp->gc.label = "macsmc-pmu-gpio";
+       smcgp->gc.owner = THIS_MODULE;
+       smcgp->gc.get = macsmc_gpio_get;
+       smcgp->gc.set = macsmc_gpio_set;
I must have given my Reviewed-by under this driver before we started
the conversion to the new GPIO driver setters. Could you please
replace this with set_rv() as the old set() is now deprecated?
+       smcgp->gc.get_direction = macsmc_gpio_get_direction;
+       smcgp->gc.init_valid_mask = macsmc_gpio_init_valid_mask;
+       smcgp->gc.can_sleep = true;
+       smcgp->gc.ngpio = MAX_GPIO;
+       smcgp->gc.base = -1;
+       smcgp->gc.parent = &pdev->dev;
+
Bart
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help