Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4115962iob; Tue, 17 May 2022 14:28:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwAnlgpYqzqsLhAuq+ZOeWwzrBWgAGBuc2OddypFnFI/BeBGHlyECRlP+y4mT4ax47umOj X-Received: by 2002:a17:906:9749:b0:6f5:38d:d4d8 with SMTP id o9-20020a170906974900b006f5038dd4d8mr21385764ejy.405.1652822903232; Tue, 17 May 2022 14:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652822903; cv=none; d=google.com; s=arc-20160816; b=ScCfQXuiVtQp/v6lDaVEOR5iATJuGg9HQHByTxsC2kTMa22ntAqF52i3gSzbjPCH9f +rZ5wxq/MNdKdj2SWTiwMQ9MjAQl22OVAE84pX9tyQWHZESkoLbCzy/W+IYEuLGufyRW bKRRyUvssmOuv10mu1fVKagmQfODfitHXYoKK+QT98N1SApxWnvQUe1Xc9VMAdTykXLE V1j6c+S5DYifO2GDmAfbFdWrkeD+7ta2ZMkk8v4Pq1NX+6/3a7k6fD3YEPbXDx1/Aj9/ 1HbTQdOzOLluaOavh0HwLFiXq7UtvmOpJUaeSPmPReYBgptPB8LfzjZgNlXpQ3j6e6TM xTGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=s2qEOZlKr9MsuU1i2OUrgyJrLsdjR7f4BRplr0JaGKE=; b=poDPpaDwWPJFt0M40O3Qf0pUAvLWNz1gZ9adUME5zOcYriVJT0F7VVCA3u2M/u3Ba9 K1RtkcRk+OGpoBsc94LTz7nzTrLzJyND0SvF5BmXdsVL00YP7k431sw0KCyhnSobZC8e p/kRd2xIJlaUcHxlOtNwzy/+0zoTWZHbTYn2TIVYRA/LCjp52GtkRQkR/10I83QQfBD0 k6tZVpD2sKTOhoSlsFmcptKZmpWoKLPKEJ4gHsHlYzAcOJq5lJvZb9oaq+kBvLXRudrH ey8AyA09YY+btvQMxKjMxfN4ENbgtjI+RxLjbtqMs2xj4hA4Bj8EyuwLgHYQn/tgOXWy 7+0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=XcGqhU3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs18-20020a1709072d1200b006fe8832ae3dsi153701ejc.839.2022.05.17.14.27.56; Tue, 17 May 2022 14:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=XcGqhU3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244227AbiEQI5p (ORCPT + 99 others); Tue, 17 May 2022 04:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244412AbiEQI4r (ORCPT ); Tue, 17 May 2022 04:56:47 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 824BFF7; Tue, 17 May 2022 01:56:44 -0700 (PDT) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24H5DVRE001600; Tue, 17 May 2022 10:56:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=s2qEOZlKr9MsuU1i2OUrgyJrLsdjR7f4BRplr0JaGKE=; b=XcGqhU3zHJ2vGX7bKwHNLw0WCyn2WeA+XqrtnnVkSqb66SawTiBCsfF+cGcRDIrhhESO oP4Z2x+/mehBwZdNGkWW4YM2GFGHG49nhviHf8Bd2u5PYfVx0p3WhprMZbrMih9rQ53L J9rFQHli1OU2JQUGXo7bVvy9rTFZNRDDqjYhrzgCdR+jeG47T9vaEdza3JzXReVpdLzY 9Vq0MFP+tsbD+2ea62L5p2x0JGp56IIAV+EdhKxwZzJ0nmn4ROdGiwG2RlrV/kwdvli2 6ppjcuYgt2AsL9ZJluWgc+o2FWr4iqu1kqjJvIzMx1ghlSQp0HskgPQn4n/5LXkx8fXn 4g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3g23ahgnqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 May 2022 10:56:10 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6557610002A; Tue, 17 May 2022 10:56:08 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 52128214D27; Tue, 17 May 2022 10:56:08 +0200 (CEST) Received: from [10.48.1.102] (10.75.127.51) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Tue, 17 May 2022 10:56:07 +0200 Message-ID: <2330a9a6-877f-2f67-78ac-42aa3cde99dc@foss.st.com> Date: Tue, 17 May 2022 10:56:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 1/2] iio: adc: stm32: Fix ADCs iteration in irq handler Content-Language: en-US To: Yannick Brosseau , , , , , CC: , , , , References: <20220516203939.3498673-1-yannick.brosseau@gmail.com> <20220516203939.3498673-2-yannick.brosseau@gmail.com> From: Fabrice Gasnier In-Reply-To: <20220516203939.3498673-2-yannick.brosseau@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-17_01,2022-05-16_02,2022-02-23_01 X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 5/16/22 22:39, Yannick Brosseau wrote: > 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 Hi Yannick, Feel free to add my: Reviewed-by: Fabrice Gasnier Thanks, Fabrice > --- > 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[] = {