From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4DB3C3ABAC for ; Tue, 6 May 2025 12:22:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Subject:References:In-Reply-To:Message-Id:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u4ZHetn6p+gj8N2CA7NvMJ9GHPYdTeEKpJ3GrEZD+ck=; b=f6eikrLWtGuc3DPWZ66KgeukeW YzhnCzIu1C1ikfbRKbwv0xGI1K4Bhd6VEacSdJqoYHqr2WzEzP6gNveVBM4/bi8Z8P8/ScMLmNksv jBsN2WsFwaqoNbOezY4+Og89ZiKPwDmD7b5uWgtcv+ckZ5JkI1jW6zlr1zuheuCC21lYmrgZ72pOT a6/KiYWJrOu8AFiv16z1r1H9GFaqKGnMsKlHJA0R6wi4FV23U+T5AdhQlEGiI9GZuHKwbnXbfhUut es0eGi9Qg0ggI+W75UMPeLTmrOZR5/2r8lGl681Jl9RFWKtCtpsZOToFKZHEP/escvYLiEhuXXSAY aAvxVVEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uCHJc-0000000Bsyg-2zD5; Tue, 06 May 2025 12:22:29 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uCFLj-0000000BXdA-3xyI for linux-arm-kernel@lists.infradead.org; Tue, 06 May 2025 10:16:33 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 7375C1381006; Tue, 6 May 2025 06:16:28 -0400 (EDT) Received: from phl-imap-12 ([10.202.2.86]) by phl-compute-04.internal (MEProxy); Tue, 06 May 2025 06:16:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1746526588; x=1746612988; bh=u4ZHetn6p+gj8N2CA7NvMJ9GHPYdTeEK pJ3GrEZD+ck=; b=ZJkhctv9B2NAQMglgaUYteeHtV1edBTOoePYfTVKqlvifJy0 fJWCLZRQRtgNkvYhrsUnxw3VqEcSnH2mjGmYQIchOI+R5o/+J6h4vyI1DiJ0y7Bt fPCugGbW+1MaVK678SxNSuqA4i8+hHJEM2dA3ZGEfSxwKvThgD4X1Yv44hj8vZs7 /GK3JDaonKVlrfnBuw8cJZVKvTNkPnDDX+2L+DiZL8Pf6Ew7IIN+1/71m6jcYaH9 OVd5EizdKJH7Vx3xzAmKy/iZCDEo78QEUXFKjbVonWfMsju39Jy4BjJgA41r/H6D P6iK5l++JlKC5rqChIDW5zophjWsnZzP0zIqww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1746526588; x= 1746612988; bh=u4ZHetn6p+gj8N2CA7NvMJ9GHPYdTeEKpJ3GrEZD+ck=; b=O KahMCMyBsg8bRfkAg2P/TMCEqXjthOylc6NFspaoD0MYT1xQJvAUfAhfcZUzDGVd rsZfAfHuTu5U3jV+ODyWoOvOEughel86KZbeTbyMtg/aP0gEq5NO6lTE2vUqk6Up 4ASIE6vox5B5Bm0UP9a0UgpKyKycQWN5ZI0rwjqbyhd2+P3FgxeYg85DBYhPpuAU XjEu0s9r08MxEiGcvtoYKioR0QYfJR6pk5OBSxbrRWcIHN1fte0ITDLU3Z6QBCcx mICb8y7b7e6P4bh6Ya3DMlPnIT6dVSsgmqKFNorw1KwfuKOC8xkYYe55D9VBzNVD m2ocg6mvOl9qvklVmxmYg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvkeefjeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgfgsehtqhertder tdejnecuhfhrohhmpedfufhvvghnucfrvghtvghrfdcuoehsvhgvnhesshhvvghnphgvth gvrhdruggvvheqnecuggftrfgrthhtvghrnhepgeegheelffdujeduffevfefhieekgeef fedukedtvdduhfffjeehleekfeehhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepshhvvghnsehsvhgvnhhpvghtvghrrdguvghvpdhnsggp rhgtphhtthhopeduledpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprhhmkhdokh gvrhhnvghlsegrrhhmlhhinhhugidrohhrghdruhhkpdhrtghpthhtohepsghrghhlsegs ghguvghvrdhplhdprhgtphhtthhopehnvggrlhesghhomhhprgdruggvvhdprhgtphhtth hopehjsehjrghnnhgruhdrnhgvthdprhgtphhtthhopegtohhnohhrodgutheskhgvrhhn vghlrdhorhhgpdhrtghpthhtohepkhhriihkodgutheskhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhgvvgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgriieskhgvrhhn vghlrdhorhhgpdhrtghpthhtoheprhhosghhsehkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A6BA31C20069; Tue, 6 May 2025 06:16:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: T90a118147f15bbe7 Date: Tue, 06 May 2025 12:16:06 +0200 From: "Sven Peter" To: "Bartosz Golaszewski" Cc: "Janne Grunau" , "Alyssa Rosenzweig" , "Neal Gompa" , "Hector Martin" , "Linus Walleij" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Sebastian Reichel" , "Lee Jones" , "Marc Zyngier" , "Russell King" , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, "open list:GPIO SUBSYSTEM" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Message-Id: In-Reply-To: References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> <20250503-smc-6-15-v4-5-500b9b6546fc@svenpeter.dev> Subject: Re: [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250506_031632_646203_2AC75188 X-CRM114-Status: GOOD ( 24.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Tue, May 6, 2025, at 10:07, Bartosz Golaszewski wrote: > On Sat, May 3, 2025 at 12:07=E2=80=AFPM Sven Peter via B4 Relay > wrote: >> >> From: Hector Martin >> >> 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 >> Reviewed-by: Bartosz Golaszewski >> Reviewed-by: Linus Walleij >> Reviewed-by: Sven Peter >> Signed-off-by: Russell King (Oracle) >> Signed-off-by: Sven Peter >> --- > > [snip] > >> + >> + smcgp->gc.label =3D "macsmc-pmu-gpio"; >> + smcgp->gc.owner =3D THIS_MODULE; >> + smcgp->gc.get =3D macsmc_gpio_get; >> + smcgp->gc.set =3D 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 va= lue 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, uns= igned 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, i= nt value) { struct macsmc_gpio *smcgp =3D gpiochip_get_data(gc); smc_key key =3D macsmc_gpio_key(offset); @@ -146,6 +146,8 @@ static void macsmc_gpio_set(struct gpio_chip *gc, un= signed int offset, int value if (ret < 0) dev_err(smcgp->dev, "GPIO set failed %p4ch =3D 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 =3D "macsmc-pmu-gpio"; smcgp->gc.owner =3D THIS_MODULE; smcgp->gc.get =3D macsmc_gpio_get; - smcgp->gc.set =3D macsmc_gpio_set; + smcgp->gc.set_rv =3D macsmc_gpio_set; smcgp->gc.get_direction =3D macsmc_gpio_get_direction; smcgp->gc.init_valid_mask =3D macsmc_gpio_init_valid_mask; smcgp->gc.can_sleep =3D true; -- 2.34.1