Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4710045iob; Sun, 8 May 2022 22:51:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeUeQi9jOpCtbEwu6nG0RQM1yEsk0u1TYeytbdJi797wWBpm0eB22uQQYCEPHk9M5+sjqT X-Received: by 2002:a17:903:244c:b0:15e:b3f7:950d with SMTP id l12-20020a170903244c00b0015eb3f7950dmr14579186pls.9.1652075516031; Sun, 08 May 2022 22:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652075516; cv=none; d=google.com; s=arc-20160816; b=nquzafqJEwslS/PkD5aP5Ubk9zX3u79mnpPeLlFG1qdiwXtbE/chRPezaJuzgI2BIX v9JS0Vlvbm06qCu7+7vAJJ22SDQ8P/IzsQ+5QKPh7Q/JnGCqe+39goB/Vg+lu2Rswt+C s43m0fwSGnvunLuqCwYT4UKSUzo7XXaflJmHshJ/Ow5NdKPpRZbGLmswxMXznZ+30FWN kW7qMKusqvLRPQgc7COgsfeE6zf+Ex1X+UYKboAXf7VPNlqlZiznd19Irrjr2TogIgSL QY4z7sNy0khcQm6Gt/goxw16/A4i1rRDcb/zP17wM7bBW0Ma6YpkQKJm3LO4BOs/I/AY EnFw== 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=5Sxt7bLTssTeYGgR+I7SCEoY9oG9Ye7EjzwX7GHS4YA=; b=Y2sNfMtmy4ziuqeLsKN44Xp5R8KaAjq58V3D1k1llBMkTbdcjoKjZoJblI+gsDva9Q ZMBcTsu7fWqlCHfjUpnfapcBhK+8utVQatiYw4xxUDHJWsfffltVsnid/+l13BD0dVuX IlWd3xXcrZKVo130QBOftVK0lxOjj2ftgZAwV/GmK6I6TJ31yuK0dv2H7a1yuNPTijAz jxQc5FHEOA0WQ1sHR+33cdoV63XVXktpK8KCkucW+SXE2edBHFevU5kRy7IhHWG9E3sD h9owJNxQR1JBKzysnRtgO9M6YAv8CZbim40KZctmCm4RuBS7hx2SVPeKWjAwGz/UvB07 MqMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FyEpzqzM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a11-20020a170902eccb00b0015835fea6dbsi10832703plh.403.2022.05.08.22.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FyEpzqzM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1903E165D6A; Sun, 8 May 2022 22:49:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243426AbiEFXBJ (ORCPT + 99 others); Fri, 6 May 2022 19:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351249AbiEFXBB (ORCPT ); Fri, 6 May 2022 19:01:01 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14875A2F4; Fri, 6 May 2022 15:57:08 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id l1so4042293qvh.1; Fri, 06 May 2022 15:57:08 -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=5Sxt7bLTssTeYGgR+I7SCEoY9oG9Ye7EjzwX7GHS4YA=; b=FyEpzqzMqKKRkhENJXzIx1SKNfuiDwTDe2hZnG9S3tlEf6FZtTCZRNgI4vwteFBePZ WK6lOvZ++KV0FS/HZmCxW6uotvBBVbSrt2rl54OwhQK6AbLwk3gcoBzDDnvpl8znNvOM h1fu7FodgNlfedOQZuSdmBIM5Ag1QXpzUrmpT0T/Gk8i3fKHcQBvKj5nmVYkETgpv+ah XdnEsCQ6p+9SGQWmH/fBS9GSsgVPdGBgXPG9V2jkiBSsMFl0T9/vkbJuf3wCc+UuhtPb oQbK7yBwXqT+fQywZQRi+nCglvl4ERdIRtuXmnE78W4U+kxZQoVi7EbtKnISfMXzTRj5 Kjvg== 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=5Sxt7bLTssTeYGgR+I7SCEoY9oG9Ye7EjzwX7GHS4YA=; b=OIYvdlRfRkYXaOpVTP5Lxw+gHtITxrRJZvgDREUUBk75sNwkSAQjF8Vle2FoKzA0NZ Uw+IqPhyZy4xpxG/V4iNzQAS8IkCecyUZHRcXcWBn8RPVtZ/wEc7IQ54ixZxQG5xZANl c2T9IVdgX5pWNkmleAYHXPQAHgEzVg3GHuWCaB+/hAJTA9cjvLAqANn/yo1vX9/UyekR 8v16px0LfXQiH0vL3Lof9m7g1c5btIL8xgHuCfK5/0bBkFmTK0mIHeTmo6oZApKxArm3 xDh7CAOJe90zz75fwwE/j9XuPlrvWkBHA3v+pWf6MoPGPguCEW7yp+ees7EmlvQxsSp3 XqKA== X-Gm-Message-State: AOAM531a1J4ArzSdSKwNAcEJzfs5zWc/SX8kOkbWUNlb4jGMD8gE50JI 8ZmJhFeuyEbm3QWeABTYMp4= X-Received: by 2002:ad4:5c4b:0:b0:45a:8cc9:bdfd with SMTP id a11-20020ad45c4b000000b0045a8cc9bdfdmr4440496qva.1.1651877827789; Fri, 06 May 2022 15:57:07 -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 q188-20020a37a7c5000000b0069fc13ce208sm3187880qke.57.2022.05.06.15.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 15:57:07 -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 1/2] iio: adc: stm32: Iterate through all ADCs in irq handler Date: Fri, 6 May 2022 18:56:16 -0400 Message-Id: <20220506225617.1774604-2-yannick.brosseau@gmail.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506225617.1774604-1-yannick.brosseau@gmail.com> References: <20220506225617.1774604-1-yannick.brosseau@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 using the num_irq value. This patch add the 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. Tested on a STM32F429NIH6 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..11c08c56acb0 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: 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.0