From: "Sven Peter" <sven@svenpeter.dev>
To: "Bartosz Golaszewski" <brgl@bgdev.pl>
Cc: "Janne Grunau" <j@jannau.net>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
"Neal Gompa" <neal@gompa.dev>, "Hector Martin" <marcan@marcan.st>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Sebastian Reichel" <sre@kernel.org>,
"Lee Jones" <lee@kernel.org>, "Marc Zyngier" <maz@kernel.org>,
"Russell King" <rmk+kernel@armlinux.org.uk>,
asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs
Date: Tue, 06 May 2025 12:16:06 +0200 [thread overview]
Message-ID: <b96bd2d6-98f7-44da-9293-816daeac80d0@app.fastmail.com> (raw)
In-Reply-To: <CAMRc=MebFf-DBh_=H0J4ORStaxBYhOnfY+jSk2d4UpdyS=m1LA@mail.gmail.com>
Hi,
On Tue, May 6, 2025, at 10:07, Bartosz Golaszewski wrote:
> On Sat, May 3, 2025 at 12:07 PM Sven Peter via B4 Relay
> <devnull+sven.svenpeter.dev@kernel.org> wrote:
>>
>> From: Hector Martin <marcan@marcan.st>
>>
>> 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 <marcan@marcan.st>
>> Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>> Reviewed-by: Sven Peter <sven@svenpeter.dev>
>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>> Signed-off-by: Sven Peter <sven@svenpeter.dev>
>> ---
>
> [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?
Probably, the last version I took from the ML is from November 2022 :-(
Will do that for the next version, I can just pass through the return value
we get from apple_smc_write_u32 anyway.
Thanks,
Sven
-- >8 --
Subject: [PATCH] fixup! gpio: Add new gpio-macsmc driver for Apple Macs
---
drivers/gpio/gpio-macsmc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-macsmc.c b/drivers/gpio/gpio-macsmc.c
index 289be4268f63..a68676239718 100644
--- a/drivers/gpio/gpio-macsmc.c
+++ b/drivers/gpio/gpio-macsmc.c
@@ -135,7 +135,7 @@ static int macsmc_gpio_get(struct gpio_chip *gc, unsigned int offset)
return val ? 1 : 0;
}
-static void macsmc_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
+static int macsmc_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{
struct macsmc_gpio *smcgp = gpiochip_get_data(gc);
smc_key key = macsmc_gpio_key(offset);
@@ -146,6 +146,8 @@ static void macsmc_gpio_set(struct gpio_chip *gc, unsigned int offset, int value
if (ret < 0)
dev_err(smcgp->dev, "GPIO set failed %p4ch = 0x%x\n",
&key, value);
+
+ return ret;
}
static int macsmc_gpio_init_valid_mask(struct gpio_chip *gc,
@@ -214,7 +216,7 @@ static int macsmc_gpio_probe(struct platform_device *pdev)
smcgp->gc.label = "macsmc-pmu-gpio";
smcgp->gc.owner = THIS_MODULE;
smcgp->gc.get = macsmc_gpio_get;
- smcgp->gc.set = macsmc_gpio_set;
+ smcgp->gc.set_rv = macsmc_gpio_set;
smcgp->gc.get_direction = macsmc_gpio_get_direction;
smcgp->gc.init_valid_mask = macsmc_gpio_init_valid_mask;
smcgp->gc.can_sleep = true;
--
2.34.1
next prev parent reply other threads:[~2025-05-06 12:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-03 10:06 [PATCH v4 0/9] Apple Mac System Management Controller Sven Peter via B4 Relay
2025-05-03 10:06 ` [PATCH v4 1/9] dt-bindings: gpio: Add Apple Mac SMC GPIO block Sven Peter via B4 Relay
2025-05-05 9:05 ` Linus Walleij
2025-05-09 13:12 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 2/9] dt-bindings: power: reboot: Add Apple Mac SMC Reboot Controller Sven Peter via B4 Relay
2025-05-09 13:11 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 3/9] dt-bindings: mfd: Add Apple Mac System Management Controller Sven Peter via B4 Relay
2025-05-09 13:12 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 4/9] mfd: Add Apple Silicon " Sven Peter via B4 Relay
2025-05-09 13:09 ` Alyssa Rosenzweig
2025-05-09 13:51 ` Lee Jones
2025-05-09 16:04 ` Sven Peter
2025-05-03 10:06 ` [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs Sven Peter via B4 Relay
2025-05-06 8:07 ` Bartosz Golaszewski
2025-05-06 10:16 ` Sven Peter [this message]
2025-05-09 13:10 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 6/9] power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC Sven Peter via B4 Relay
2025-05-09 13:05 ` Alyssa Rosenzweig
2025-05-09 16:13 ` Sven Peter
2025-05-09 16:21 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 7/9] arm64: dts: apple: t8103: Add SMC node Sven Peter via B4 Relay
2025-05-09 13:14 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 8/9] arm64: dts: apple: t8112: " Sven Peter via B4 Relay
2025-05-09 13:13 ` Alyssa Rosenzweig
2025-05-03 10:06 ` [PATCH v4 9/9] arm64: dts: apple: t600x: " Sven Peter via B4 Relay
2025-05-09 13:13 ` Alyssa Rosenzweig
2025-05-09 13:15 ` [PATCH v4 0/9] Apple Mac System Management Controller Alyssa Rosenzweig
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=b96bd2d6-98f7-44da-9293-816daeac80d0@app.fastmail.com \
--to=sven@svenpeter.dev \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=j@jannau.net \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=maz@kernel.org \
--cc=neal@gompa.dev \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
--cc=sre@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;
as well as URLs for NNTP newsgroup(s).