From patchwork Mon Dec 4 20:33:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 173555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3025355vqy; Mon, 4 Dec 2023 12:38:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdGwI+3imDRyrQ+dOWJJSjc3Bcc/Zc/epQ+2x3p5peig/I1TFHAN+6vHjNP/NJ0JluNARE X-Received: by 2002:a05:6358:7e0b:b0:16b:f91b:3cef with SMTP id o11-20020a0563587e0b00b0016bf91b3cefmr5565838rwm.31.1701722338916; Mon, 04 Dec 2023 12:38:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701722338; cv=none; d=google.com; s=arc-20160816; b=qhCMA6YocqNtCLjB4wP2+q+GNbWdM4SGZ5h3ZeLfXJzx9AkUEurh4lnwYRwdwLzJwU oco6hvzlzQ/Exv6YuEQOXeX4/VCxxhRq6PaFIvD3CdT062Ph5U6DwsWsdlB622tcS+8r pcTo/GCj7lb/sMyUlOhSeGv14so6zbqcjkzH3abhbjjYXpcAKPQQa1MjAPJZmURxr1uo dZo5LHYbeGkTpC1NrfPWEtdBVjplDalPUMcfkriyA8tgOwMvPz2JcRQSmkElUyMtpXv9 OKA9eIIDL/36rz9LAzgwfeImZwduSep+OY2niXMmgFGSlJkKx/kY7W0L0s9lzlhXkW+4 fVyQ== 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=oMsMKq+fG5BsTJ38ktkUAvKvU/juEXAO2vxB2M78m9A=; fh=6R95xM684t/RtLGS1mkzgWVhZ9Mrm3iDfH0StUmJDQc=; b=bfzpJkdokfYMuXEczWqOcA0IUl+wcqv1qJbiH5Qqmw7FQQowG2btoVHr/XvzgfSPMh OkKS9LonljrWAWaL0HD8DP0wKMM6DFnTYnh+iFl13u09SaZel+B5HZARRKBvWdQZOMxO 4ZQcSOjo4FjgalWEkHGHXAKEsJX5cqGK2Em95h6RMQj/y1khAXJAa8wi++Ss5gP5WApD zWyP1LjB215cnx1VjzLuaTOJZyo+lyAxQXFO/nXRVfWT0sEu+Q1anfWHCmETbzAeEKkT dAWEx3FZBotNFxGU4BnbFOedbQnsffxO5XGsnweucwu2PTz/moCPs82db8k2I6riDjwc KngQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=puPA9UAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g64-20020a636b43000000b005bd043711cbsi8442668pgc.216.2023.12.04.12.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:38:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=puPA9UAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id CDE3C8055565; Mon, 4 Dec 2023 12:38:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346266AbjLDUif (ORCPT + 99 others); Mon, 4 Dec 2023 15:38:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376279AbjLDUiH (ORCPT ); Mon, 4 Dec 2023 15:38:07 -0500 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 643773858 for ; Mon, 4 Dec 2023 12:35:38 -0800 (PST) Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-58d12b53293so3344483eaf.0 for ; Mon, 04 Dec 2023 12:35:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1701722137; x=1702326937; 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=oMsMKq+fG5BsTJ38ktkUAvKvU/juEXAO2vxB2M78m9A=; b=puPA9UAsbsiGjJK4bD5uzqiISC5Auxb/XPKl1W3DkM+OI2MEPNYPbYb6zYzUgicyHa fYIz0J+O0rl1J5qJmJCGa3H5bZAvcGJl8H2AJV7RKvoEKaaU02LFgn0oAwhDe8y7ny6C j0tDqK30HXoVNVZF/lbgHrz4Gv4X6hUAG5msxB5qymDLxOtZaYCwIMYltH9lzss6m4le w1J047+L3fsRt8fuLnwmoQpjcu3oq9Pw44dQXZu64JrF/KqZhbZeRvoK/pbshm1qaU0B gjKBrv9RN83aC8jPuNWH+buofCIhbegY0E1vH9uYgWX2hgYz7HW/SUNcTlv/IEExHGbc MyVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701722137; x=1702326937; 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=oMsMKq+fG5BsTJ38ktkUAvKvU/juEXAO2vxB2M78m9A=; b=j2J2nb2wTFRHgopa6c4NtkgER31Q1qzkT/7PJSO4vTKF9IfkdhfNmy4ajM5630fSZi /xQ7gYUGYaiO2UlMsdeF54htd/G3DAeehkq1IQb6wZDIeBTLUJvGjDYUtE2Ne01zNZfK z6hk0DEymvHY9Wz5JylWWZ0Gnw30uKnRtctE2X2an9rQhR/jShSKKImClwJuCDeuc9Ml UHF1p0nlF1S8KcwehKOlTovNRws+Nzr8nXt/n5ZsuOjak1VT3mGl6IB33IVii72c/R4k F6sFGo7ZxTdN9+sIE98uiBwdiE8fG9Qma09GohgLcFQmMhLFi+k+GCKM7ClS7vaA+yiZ bdig== X-Gm-Message-State: AOJu0Yw83SCOGIfoGraBOuJf035CMiKXZF71HG6LYLeetDyi5k6bxux4 /j6eb+EgCl95AVt9I+vAZFJyaQvtjj0O885/im8= X-Received: by 2002:a05:6871:281:b0:1fa:f230:4c58 with SMTP id i1-20020a056871028100b001faf2304c58mr5820598oae.59.1701722136896; Mon, 04 Dec 2023 12:35:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:35:35 -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 1/2] irqchip/stm32-exti: support retriggering on STM32 MCUs Date: Mon, 4 Dec 2023 15:33:56 -0500 Message-ID: <20231204203357.2897008-2-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 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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 04 Dec 2023 12:38:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784385203217105548 X-GMAIL-MSGID: 1784385203217105548 EXTI retriggering support was missing on STM32 MCUs. Retriggering is required to emulate GPIO level interrupts using edge interrupts in the STM32 pinctrl driver. Signed-off-by: Ben Wolsieffer --- drivers/irqchip/irq-stm32-exti.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 971240e2e31b..6b3f54457812 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c @@ -328,6 +328,18 @@ static void stm32_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static int stm32_irq_retrigger(struct irq_data *d) +{ + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); + struct stm32_exti_chip_data *chip_data = gc->private; + const struct stm32_exti_bank *stm32_bank = chip_data->reg_bank; + u32 mask = BIT(d->hwirq % IRQS_PER_BANK); + + irq_reg_writel(gc, mask, stm32_bank->swier_ofst); + + return 0; +} + static int stm32_exti_set_type(struct irq_data *d, unsigned int type, u32 *rtsr, u32 *ftsr) { @@ -856,6 +868,7 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data, gc->chip_types->chip.irq_ack = stm32_irq_ack; gc->chip_types->chip.irq_mask = irq_gc_mask_clr_bit; gc->chip_types->chip.irq_unmask = irq_gc_mask_set_bit; + gc->chip_types->chip.irq_retrigger = stm32_irq_retrigger; gc->chip_types->chip.irq_set_type = stm32_irq_set_type; gc->chip_types->chip.irq_set_wake = irq_gc_set_wake; gc->suspend = stm32_irq_suspend; From patchwork Mon Dec 4 20:33:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 173554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3024978vqy; Mon, 4 Dec 2023 12:38:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi5FSqkC2kbwQ+0ajIOf9UzzpvOkaqZgeghEgHT304ZMzl6oqRLt/bwSM0ZaNAQbDZR3wT X-Received: by 2002:a05:6a20:4303:b0:18f:4779:6781 with SMTP id h3-20020a056a20430300b0018f47796781mr3315377pzk.105.1701722294839; Mon, 04 Dec 2023 12:38:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701722294; cv=none; d=google.com; s=arc-20160816; b=v9e01M/4aJQkVUq6ew/KJfj9wTcApN0Ysx506nwN6SRI/ZmSjXyHBTo4Ov3ll7nJpD ch0ET6t9jJfgE/pLPN5+ZPM+Ays1Y2mZrt7CPCM2ksNtlwmUabUYNRBM9iONZlmObCFk Rtp+vTgK8sDK8qVBQyEiJtgoTWY5iom8s3/zo/pSpq8rLzIRguOgo6sXt9NEbab1PX9K UR7ShNSQAEPZNyMidrLIBWdPjBB1LwY6fqih3NcuTOpcDWL39sPAKJQWNyoXHwtHxZ61 HcV+zyEnQyngCZY2VMhkFnaGiO7RnIsYC3BFh4ziCw2vSiXujP02+MvDAvjyUe03dXlS C0qg== 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 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h14-20020a056a00230e00b006cbe53e19fdsi8400445pfh.222.2023.12.04.12.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:38:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; 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 2620:137:e000::3:3 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 4076180A9AB8; Mon, 4 Dec 2023 12:38:12 -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 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:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784385157276999275 X-GMAIL-MSGID: 1784385157276999275 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 Reviewed-by: Linus Walleij --- 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: