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 5F01FC38145 for ; Tue, 6 Sep 2022 08:02:17 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZUNvf1RmpqqSqCZT2+dfSCYIyjb2SFY3bVTTkCGoXCQ=; b=r/bAPEpMYGnGoT MUSKL3J6r8aKoVBp8PKppoxciHM0Emnwjy3g3PnCs4KF3iiaqt9jccKvkjEwQ/OIS7xQ//aAy/mAO s+E3wLS086xA6iYKTBhbhfHWpps9L6b4AmOqdNMApWcqeymvkjV0ZWVpfwIBsW378JKQWwbcHUxc9 2WUQLAaw8aX8mNGI7pOcPVVfc1BB02mPrezFBHswxo49F2FUF3Hyv6frSySt0kVraZbtAQrfGXlgq zeRz+QWVTmY6TFUGElQ66U5PtRMxRlfjzDx9K1F4OobmWRRkLBXRjpvjGHgcNI/7a67MBQLFXbT3W HooDjikj1oVScWKmL1JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVTVt-00B1J3-Bu; Tue, 06 Sep 2022 08:00:53 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVTVm-00B1DW-IK for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2022 08:00:49 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 598EC4195A; Tue, 6 Sep 2022 08:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1662451242; bh=k5TWm1XP5pcR2xRgfu1N6rqx92XM+FWn7U6xtLXwbik=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=jq7ENYaok8ZfdAiT7t4E0EbQfmSKQ49SQfDHxVr8lMF6iQuzHYZPzwC2PnEJkefQa Rccd2cyxAwNLETulV5JSv6hrzFjGBT22rK0h2n9CjCNSwwFqcKVsSdD0B5HLPdUEJI gxjZXMswgEid9b0SX+rI4lZ4DdB8b6Kw8jTl74jc+oGLfEobvfbzExPeRhyiLym4Ts cel2lnQCzVBBevwFaGc198/gHLllKyYa24AttnoTxo6pi5RsvewlE1BRpzefNGBLlc hcZ4uEXg4abCFzZBa6WjSNea1cy3spzvD9h/RaFvj/BqCMLZBJGK8sLAf5paZ4rGuX GAEVD5/aJbWrg== Message-ID: <6f93d53d-4771-15a2-f76d-38eb4b60e66e@marcan.st> Date: Tue, 6 Sep 2022 17:00:36 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 6/6] gpio: macsmc: Add IRQ support Content-Language: es-ES To: "Russell King (Oracle)" 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 References: <9cf54921-c6a5-b328-6941-d1cbe086bcda@marcan.st> From: Hector Martin In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220906_010047_581254_5D3549AF X-CRM114-Status: GOOD ( 27.53 ) 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 06/09/2022 16.47, Russell King (Oracle) wrote: > 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); > Sounds good to me! (nit: typo on "int he") - Hector _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel