Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2970857rdb; Mon, 4 Dec 2023 12:38:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrQFm6tnVi1oc30QlS8eVxF2cw0+zd7PemBQN1FsKwFFTDH6vNnuLnenZAM0TJWziyEQEz X-Received: by 2002:a05:6a21:360e:b0:187:d93f:b0fa with SMTP id yg14-20020a056a21360e00b00187d93fb0famr4209286pzb.27.1701722302097; Mon, 04 Dec 2023 12:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701722302; cv=none; d=google.com; s=arc-20160816; b=pXhQ1sEYZtW3NX0itZqGK3E0iYLL5xs9eu0ybiPAqYBP4jPG7ish93g9q1JjJ5ZMOv XMz/gbDTu8wsMQTHnh18TKLxwDRJJCNI+0DOW46xisXvKDckHIcugrWyOjQ0e/L2vLWu TzmhihayQcwrdv9aD9T5ljBvDLWmoTsappSZFXlchSLY+Vey59WdaDm5r4ZqPNMWLNcY ZFr5QFC1hFwNVRjiSRGtIIHDoMZWT3Tis+0axqsGVIjUGhtnaHIyRHMGiB2z4PiEEb+C 01f5WBNl2grNaaMk913Akz8Ql6SFoHZY4RSfZZOhYvt/+HKapxyL280TxTbUkKBAuhLP 6hDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FWagGRv/i1MW5G1zwpH94jc78fOBc/tv6/pgOnwcx6k=; fh=6R95xM684t/RtLGS1mkzgWVhZ9Mrm3iDfH0StUmJDQc=; b=DdBaPNQtFig4A3m0y9m9Yj2mJOehdUmOOp00sDtv+LjGgiPtKgWtDYZpYeyDkdL/fu ec2bRkLX7H3azPMGCjJr5ghBQmXBkEBNwvQoSObzUAr/n/97NKl0Nvjl+NhHhCB90usJ IJ87d8kj1HuVnMuuYoGzDyKvTK3T1SS54DRv55dEMiaN4C1uXf5NXm3IoWjQw9Crcxbj Dt65U8DTFCeHCLCzc+v5BLbyz9Yc/yDf+sb75zx1gWVxzpzAvp6I9kup+381JemIWIc6 Egs1nHe8DztsN+1j4fyzBGdvk5Rb+mcFfUr+f1htK7epIyJczPveTlrg+qQrOaKG35AE s7bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=b+vDXRMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m14-20020a056a00080e00b006cdc6a210d9si8542321pfk.223.2023.12.04.12.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:38:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=b+vDXRMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EC68880A9ABB; Mon, 4 Dec 2023 12:38:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345790AbjLDUhy (ORCPT + 99 others); Mon, 4 Dec 2023 15:37:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235536AbjLDUhY (ORCPT ); Mon, 4 Dec 2023 15:37:24 -0500 Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD9A1BFB for ; Mon, 4 Dec 2023 12:35:39 -0800 (PST) Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-58d9a4e9464so2021190eaf.0 for ; Mon, 04 Dec 2023 12:35:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1701722138; x=1702326938; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FWagGRv/i1MW5G1zwpH94jc78fOBc/tv6/pgOnwcx6k=; b=b+vDXRMze/C1r4e24CUeK2VhFvtLtGE/yojAiTPjpqNP0zOjoF5EGSYgkfebMM87Ok 41+lNvkLHVfg5wYqgC1KSv/uAwiPfJSyj4j7Wd1KK50zRp8lCKOJ1j47MMBI5scT3KD/ WAQ+MtoH1Wjx5c0IqOD9lgVW3pCnmt35I8R4Rs4bsn7a2x0XWEBGWQ8tfy/5XhRoIA2h Hgw2AlUxovbI+3Wt1XQKjrH6EjX5lLQfObCXV0uUrlyzWLCZB4o7LlxBuhU/hwYBVx9f g7qKnCxGz68O4qb8h1t+Nz5dGEw3Bn8nkXAHX0vsYyFMLcVKhpQ7D+EgH3/bOuJMjNoC YdDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701722138; x=1702326938; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FWagGRv/i1MW5G1zwpH94jc78fOBc/tv6/pgOnwcx6k=; b=kBLLVQ/0+VJscP7aT3TRBfNtpHBCI2UCcZVzfnN+0Z/rpwNmVsnGGGnLgXR5YB/Zm7 Mbki3n6GPL5tqsQW/uQlys2zyaFunk/uyC2xNNNUAZe1PN3nwMfI9nanksUzOn8RALKe qWpuw1Za3n/dOCoXw6d/dOHHdv6aJfFCEvjPqD+0I4eMR9m3etXLroEUtNRMZ6/goum5 b5DV/GndkQ4WqGawZYTfdeM4GoED9ymc0FwclZM1IEWS3Rb543A2qgTLe05dl/8BQH2H +QlFjApURHP21Mjsa+A6FD7++IZoBWHUd9yruvt231IgWU+F1+jBDBAVgKx+1AFtZuF0 6Fnw== X-Gm-Message-State: AOJu0YzPMTC3xM1QaTQtl/ASM95Z//SVuqkEY03newOf2VlHC+QOttwt Boz5feoK03dLuc+hzjDRvcAEMSFcCY32PQI3/Tk= X-Received: by 2002:a05:6358:640b:b0:16d:f932:b5f with SMTP id f11-20020a056358640b00b0016df9320b5fmr1254764rwh.30.1701722138274; Mon, 04 Dec 2023 12:35:38 -0800 (PST) Received: from localhost.localdomain ([50.212.55.89]) by smtp.gmail.com with ESMTPSA id jo23-20020a056214501700b0067ac930d17asm1123469qvb.141.2023.12.04.12.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:35:37 -0800 (PST) From: Ben Wolsieffer To: linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Cc: Thomas Gleixner , Maxime Coquelin , Alexandre Torgue , Linus Walleij , Ben Wolsieffer Subject: [PATCH 2/2] pinctrl: stm32: fix GPIO level interrupts Date: Mon, 4 Dec 2023 15:33:57 -0500 Message-ID: <20231204203357.2897008-3-ben.wolsieffer@hefring.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231204203357.2897008-1-ben.wolsieffer@hefring.com> References: <20231204203357.2897008-1-ben.wolsieffer@hefring.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 04 Dec 2023 12:38:18 -0800 (PST) The STM32 doesn't support GPIO level interrupts in hardware, so the driver tries to emulate them using edge interrupts, by retriggering the interrupt if necessary based on the pin state after the handler finishes. Currently, this functionality does not work because the irqchip uses handle_edge_irq(), which doesn't run the irq_eoi() or irq_unmask() callbacks after handling the interrupt. This patch fixes this by using handle_level_irq() for level interrupts, which causes irq_unmask() to be called to retrigger the interrupt. Signed-off-by: Ben Wolsieffer --- drivers/pinctrl/stm32/pinctrl-stm32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 603f900e88c1..fb9532601cbb 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -348,12 +348,15 @@ static int stm32_gpio_set_type(struct irq_data *d, unsigned int type) case IRQ_TYPE_EDGE_RISING: case IRQ_TYPE_EDGE_FALLING: case IRQ_TYPE_EDGE_BOTH: + irq_set_handler_locked(d, handle_edge_irq); parent_type = type; break; case IRQ_TYPE_LEVEL_HIGH: + irq_set_handler_locked(d, handle_level_irq); parent_type = IRQ_TYPE_EDGE_RISING; break; case IRQ_TYPE_LEVEL_LOW: + irq_set_handler_locked(d, handle_level_irq); parent_type = IRQ_TYPE_EDGE_FALLING; break; default: -- 2.42.1