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 EC8DAECAAA1 for ; Tue, 6 Sep 2022 07:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ihEudAMdKrfqQYIynud+7akgQijrguxiprTp0Fh/Dc0=; b=DmRsSZfyE4KAbg K9cOX+M0/O6JPUSa9ATEW3KAeFRJhlFKNBGFJ6wiX0PiNKLKQ/kNVDWF/Bv8TZN8LO6dgdQwLCv0t R8IbMBZ5FKD9wZoPDoIQpzkqabn8PTZmmCT/i6GCXbZz6y3Dy30wGlLmUv8KbWNOGHDrJH1FXFzPK 03cU6I6v8kLfx4Xu6eazCJA2GXze6fdcPWwbT/wUhIYTA0RcHfT0dCMqhzNDgs8Awl4VgFvreumza 0J6G703I/vj4urQ8dx0C6QxG7PeDk0QGbKf5ODJltJ7CoboTU+u1+M7WB2DMQjvd3M4Rc6Z1hy4Sn IPn6h9b5wZHg3vhiXyXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVTJR-00AvOZ-BL; Tue, 06 Sep 2022 07:48:01 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVTJM-00AvJd-O0 for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2022 07:47:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Xzv1rkXF3bUyuFREK5l/vsMAZch21PDPSsW27u7YLO0=; b=cakWJzSRaQWvLaWvUnaEFyBc0y BeNdsnCZf4udq1k0bMl0Nkc0F2xRwrEVEFJcW5dgdpu4RVwDsQzzcBbviIIAzX62k6ez2KyqJw8HQ 8x0H9BXBWj0acElPGmDo88g7q05pN1CO7xzbx/RnfjHHPZRm5Zw6JyK5urWNvl+PJyQIApGxz6hoD exW11RMtYASRGNv4LVZgfPvCOz2zy7gDRbbu2W/S4A17/Dkscy2aLyUVlbqVI91rJf49vx86qnHlO EhD4O6GMHLPePQCUW+NtxvapqYekczqVC29xpJcmRAg/afmGvh8xFGelw+5UflHfV/tJeGDAqeKU1 lLGy7GtA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34138) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oVTJ3-0003ZF-Jp; Tue, 06 Sep 2022 08:47:37 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oVTJ0-00086b-AC; Tue, 06 Sep 2022 08:47:34 +0100 Date: Tue, 6 Sep 2022 08:47:34 +0100 From: "Russell King (Oracle)" To: Hector Martin Cc: Linus Walleij , Arnd Bergmann , Lee Jones , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Sven Peter Subject: Re: [PATCH 6/6] gpio: macsmc: Add IRQ support Message-ID: References: <9cf54921-c6a5-b328-6941-d1cbe086bcda@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9cf54921-c6a5-b328-6941-d1cbe086bcda@marcan.st> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220906_004757_074683_3F26521B X-CRM114-Status: GOOD ( 29.55 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 06, 2022 at 04:00:31PM +0900, Hector Martin wrote: > On 02/09/2022 22.21, Linus Walleij wrote: > >> + switch (type & IRQ_TYPE_SENSE_MASK) { > >> + case IRQ_TYPE_LEVEL_HIGH: > >> + mode = IRQ_MODE_HIGH; > >> + break; > >> + case IRQ_TYPE_LEVEL_LOW: > >> + mode = IRQ_MODE_LOW; > >> + break; > >> + case IRQ_TYPE_EDGE_RISING: > >> + mode = IRQ_MODE_RISING; > >> + break; > >> + case IRQ_TYPE_EDGE_FALLING: > >> + mode = IRQ_MODE_FALLING; > >> + break; > >> + case IRQ_TYPE_EDGE_BOTH: > >> + mode = IRQ_MODE_BOTH; > >> + break; > >> + default: > >> + return -EINVAL; > > > > I don't know how level IRQs would work on this essentially > > message-passing process context interrupt. Maybe I am getting > > it all wrong, but for level the line should be held low/high until > > the IRQ is serviced, it would be possible to test if this actually > > works by *not* servicing an IRQ and see if the SMC then sends > > another message notifier for the same IRQ. > > > > I strongly suspect that actually only edges are supported, but > > there might be semantics I don't understand here. > > IIRC that is exactly what happens - the SMC will re-fire the IRQ after > the ACK if it is set to level mode and still at the active level. > > I do remember testing all the modes carefully when implementing this to > figure out what the precise semantics are, and I *think* I agonized over > the flow handlers quite a bit and decided this way would work properly > for all the modes, but it's been a while so I'd have to take a look > again to convince myself again :) Thanks for the clarification - I think it would be useful to put some of that as comments before the CMD_IRQ_ACK write to head off any questions about this in the future. Something like this maybe? /* * This is not an "ack" int he i8253 PIC sense - it is used for level * interrupts as well. The SMC will re-fire the interrupt event after * this ACK if the level interrupt is still active. */ if (apple_smc_write_u32(smcgp->smc, key, CMD_IRQ_ACK | 1) < 0) dev_err(smcgp->dev, "GPIO IRQ ack failed for %p4ch\n", &key); -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel