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 3FCD8C433F5 for ; Mon, 16 May 2022 20:41:14 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OsETZ/3Dury8A3zp68S2U3E+TsCkTT6PUo8PSjM6+h0=; b=sYux9etnGvSEoV VD4RJaHigQk2LoR1ONWPuKxSn5X7NNtByCFL2cQ1DCAMaZU53z7TwOvG+/GlBU2GfUVWtp9Wyv/+U RX70BrcuOzwQ+zt6+Btscqe6TotTZ3uLFnFkhEdXfFBHWvr08sNRc8dyMVrC6NxQgGRKfJoQLPBwv 1WV9Xnr5CHWyPCmAE+uibsg8XaJKs8ERS2c6AkwKpEchGOjDsDbBRGTG8KCHMLn2lpiINxTWZ0nS0 MvJ6MDGtfrje5vwxkcMkdKKmWZ6+gz+g428thoD/wK5ffQC/w08FClLD9qh1j9ZpJ74UG7UbVE2DC xVzlbTtGqVucQPGOoOTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqhVl-00A6lS-On; Mon, 16 May 2022 20:40:13 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqhVc-00A6gj-TX for linux-arm-kernel@lists.infradead.org; Mon, 16 May 2022 20:40:06 +0000 Received: by mail-qk1-x72e.google.com with SMTP id m1so13173012qkn.10 for ; Mon, 16 May 2022 13:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L3le14rhaSocQeKQwxrRTldErgYW+NHKabztIF2/qZ4=; b=YwBuId0XmN7JIWITFrXT+8veOWLqw7slTOSwB3fed+CJpB+0z/tm4v5Rf2B+9pj+pQ T7mdFXHx9Hg1Ca4MmX/x9HtjhrlDEWLEXPA5auHE2CRdEKkG8fJbYktrABWoYO8nQzNL XINzLvXYqqjOseUog68ZikVGx7Rx4ghnE65h2Z7PZ5/ZKKlnWgEqCifCFLgqRpZYM34d mYeJAv5soR7JZGQSnd8TGdhPO6Xetsu1JJjy9oSrI1u2bxlbgcUTDgoVmDXExlzVa5gW RGqfTRbCbX8CGu4a3gbLIC3EaK8p3r+/PJ5w/5Chu/nZA0Huo/nPxgCBXWt3MjOI/XIh CAJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L3le14rhaSocQeKQwxrRTldErgYW+NHKabztIF2/qZ4=; b=5HH5KaZbBE4HaajvcqMrUsklvBCzNVLxdKTNeaRN1I37qrIXCUUP5pH9XWA/hyZLsU X9eNlYOAQQvcnO5ei75ffD20B1N8Rv2A8KcMs1PBDrEo9bn7wRxVwKa+1QSDaUQKCySj fE6NL/rFWt2uIgCr7Q6ppLYX3lSrm4CA0t/m1fnJwW0Cwkq+x66tCIm7c3oRZRebxZ/j MWvFgXHuXqPKlJbfPWtPyyAMlP7tgUe4Q7WQSQvLAHmhyM6Bi9qbImKnZ9DtNVbzuTTp 6ICpcIl7RDQ6XEImjLtamTwng2tEp+L4ErgzWFeDhCipl/TVaYghLuZxw+PgJbzr0dcY XZ8Q== X-Gm-Message-State: AOAM533zBFMPVPl2ujIbJusbIklLciPlABSUO93iGtnN3TqBmlgq3ATh HwVm9G26vrRHMd6TTXLC47c= X-Google-Smtp-Source: ABdhPJxJnWTboPrcAFadimt77on92UDhywlvLKxVgUleScXkQ+vnAbz0mZZhuvSEuAjMyTfTw8dscA== X-Received: by 2002:a37:a953:0:b0:69f:9314:ba62 with SMTP id s80-20020a37a953000000b0069f9314ba62mr13554460qke.398.1652733602008; Mon, 16 May 2022 13:40:02 -0700 (PDT) Received: from grrm.lan (bras-base-mtrlpq4809w-grc-17-70-53-205-21.dsl.bell.ca. [70.53.205.21]) by smtp.gmail.com with ESMTPSA id k67-20020a378846000000b006a00fabde68sm6364016qkd.10.2022.05.16.13.40.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 13:40:01 -0700 (PDT) From: Yannick Brosseau To: jic23@kernel.org, lars@metafoo.de, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, fabrice.gasnier@foss.st.com, olivier.moysan@foss.st.com Cc: paul@crapouillou.net, linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yannick Brosseau Subject: [PATCH v2 1/2] iio: adc: stm32: Fix ADCs iteration in irq handler Date: Mon, 16 May 2022 16:39:38 -0400 Message-Id: <20220516203939.3498673-2-yannick.brosseau@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516203939.3498673-1-yannick.brosseau@gmail.com> References: <20220516203939.3498673-1-yannick.brosseau@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220516_134005_015690_F2F8D3AD X-CRM114-Status: GOOD ( 17.24 ) 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 The irq handler was only checking the mask for the first ADCs in the case of the F4 and H7 generation, since it was iterating up to the num_irq value. This patch add the maximum number of ADC in the common register, which map to the number of entries of eoc_msk and ovr_msk in stm32_adc_common_regs. This allow the handler to check all ADCs in that module. Tested on a STM32F429NIH6. Fixes: 695e2f5c289b ("iio: adc: stm32-adc: fix a regression when using dma and irq") Signed-off-by: Yannick Brosseau --- drivers/iio/adc/stm32-adc-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index 142656232157..bb04deeb7992 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -64,6 +64,7 @@ struct stm32_adc_priv; * @max_clk_rate_hz: maximum analog clock rate (Hz, from datasheet) * @has_syscfg: SYSCFG capability flags * @num_irqs: number of interrupt lines + * @num_adcs: maximum number of ADC instances in the common registers */ struct stm32_adc_priv_cfg { const struct stm32_adc_common_regs *regs; @@ -71,6 +72,7 @@ struct stm32_adc_priv_cfg { u32 max_clk_rate_hz; unsigned int has_syscfg; unsigned int num_irqs; + unsigned int num_adcs; }; /** @@ -352,7 +354,7 @@ static void stm32_adc_irq_handler(struct irq_desc *desc) * before invoking the interrupt handler (e.g. call ISR only for * IRQ-enabled ADCs). */ - for (i = 0; i < priv->cfg->num_irqs; i++) { + for (i = 0; i < priv->cfg->num_adcs; i++) { if ((status & priv->cfg->regs->eoc_msk[i] && stm32_adc_eoc_enabled(priv, i)) || (status & priv->cfg->regs->ovr_msk[i])) @@ -792,6 +794,7 @@ static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = { .clk_sel = stm32f4_adc_clk_sel, .max_clk_rate_hz = 36000000, .num_irqs = 1, + .num_adcs = 3, }; static const struct stm32_adc_priv_cfg stm32h7_adc_priv_cfg = { @@ -800,6 +803,7 @@ static const struct stm32_adc_priv_cfg stm32h7_adc_priv_cfg = { .max_clk_rate_hz = 36000000, .has_syscfg = HAS_VBOOSTER, .num_irqs = 1, + .num_adcs = 2, }; static const struct stm32_adc_priv_cfg stm32mp1_adc_priv_cfg = { @@ -808,6 +812,7 @@ static const struct stm32_adc_priv_cfg stm32mp1_adc_priv_cfg = { .max_clk_rate_hz = 40000000, .has_syscfg = HAS_VBOOSTER | HAS_ANASWVDD, .num_irqs = 2, + .num_adcs = 2, }; static const struct of_device_id stm32_adc_of_match[] = { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel