Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp861920rwb; Wed, 28 Sep 2022 10:00:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tw1CZ/wVK6cgdbNOlzUkLjIqPNbyexKiJ0NRZ5TW/wSVfx1U+px902GFjS+XpCZiCYsDW X-Received: by 2002:a17:906:4ac1:b0:780:3448:ff06 with SMTP id u1-20020a1709064ac100b007803448ff06mr28513041ejt.403.1664384409478; Wed, 28 Sep 2022 10:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664384409; cv=none; d=google.com; s=arc-20160816; b=buOXXw9WlgH1MD4TqUU/vgyAgHT8h7/B6T4pjnnBSpBqh+5bAeyWVuMizCKPtHjAzz leeWCGDTDPys9dj7WnY1BXUjFhaZQ+FKNcxLThPw/2niuJOYwih/A5pk5x6WCvoO/TMX OCdyi8BhOxswYxtO2fQTm1LsMJRiUGqnHctk0cHFDsbEzXMa8U28kBfz4Ov51mcMMFjV /CULRobSzmiP4rUYLcYiGzrruuhLm+isRfMVgLaiphNJSSX20gRaRLVtl7teGVfQxZwR 48BbMhJOZ/vNbMjfqF+wfs1YiDCJdU8gO8Tn/R2BdI3c8hBvoUrVsMhoU7o/yux3SSEN MevQ== 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=tKBMS7X9LgoNsX57OncGM9Oh7BG8J3G7bUbLiaKVg4E=; b=HEyMzN7Jg13IlkaOM8iEU1mWudR1BnyfmFTf0ablyf+FKBU9fqlK4Sbrysk0uXHQI5 Hr059LYzHz34w/tYlwK00aNKz+TmaOdbECSAeKi7CShgpFlfuYA4WTsMythRhKzcSdDw z2uapF0dz0CjKG3j+2iwop3TiBX3qAb4Q2G5mjpkdk516RbhF+WMVnmnwRYMtTwY0zoJ Fccx60evaZH2kwtd3GyhkgXnD2iAYyhRm7QtULDypERciUbRbImRbD04rqGZLLacY2sX /PPB9wZ1G0PVIbrPdo7GU4cvJVORKk/cDXkrBAvmOLBcALlYRD4y3B7wGOVZe122+hNY H8Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=vMrrMHeT; 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 e17-20020a50fb91000000b004580ae4abfcsi420470edq.460.2022.09.28.09.59.43; Wed, 28 Sep 2022 10:00:09 -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=vMrrMHeT; 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 S234140AbiI1QnD (ORCPT + 99 others); Wed, 28 Sep 2022 12:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234316AbiI1Qms (ORCPT ); Wed, 28 Sep 2022 12:42:48 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F19CE7221; Wed, 28 Sep 2022 09:42:40 -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 28SG4hov005109; Wed, 28 Sep 2022 18:41:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=tKBMS7X9LgoNsX57OncGM9Oh7BG8J3G7bUbLiaKVg4E=; b=vMrrMHeTZnZspoOIztfKoVt2msPCRmxw1JHFJzf16uxFmJb81ggY5XjjMk7z2pom6lX8 hQm90yLRhNMIj5RLoonaVtWgzSMuuEGmZTbGF3j5oaIZCxerGX89TL1Auw4zQJyZzBXZ oSS4N47tuiZXZTnlOt7oHcy9QkVaKsC4PrxQatpQKbL3Ded9x4VA2SEEkBFgsVRPlyh9 m/+guXVT5185jU/A/Y3uML54DcMMjz0RIaunhtpvzvoK2sEUN5fDrspGGTUJuZrssEid S1Rx2cAHqS/GJjiGPDgWyzeAfXYsTyZ1U60T40ayWqU0DW5WwuEensPzyeChYI9Ll2Tv 0g== 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 3jsrsjtp26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Sep 2022 18:41:54 +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 907B4100034; Wed, 28 Sep 2022 18:41:52 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 87D3E23C6B3; Wed, 28 Sep 2022 18:41:52 +0200 (CEST) Received: from localhost (10.75.127.119) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 18:41:52 +0200 From: Olivier Moysan To: Alexandre Torgue , Andy Shevchenko , Fabrice Gasnier , Jonathan Cameron , Lars-Peter Clausen , Maxime Coquelin , , Olivier Moysan , Paul Cercueil , Sebastian Andrzej Siewior , Wan Jiabing , Yannick Brosseau CC: , , , Subject: [PATCH 1/8] iio: adc: stm32-adc: fix channel sampling time init Date: Wed, 28 Sep 2022 18:41:07 +0200 Message-ID: <20220928164114.48339-2-olivier.moysan@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928164114.48339-1-olivier.moysan@foss.st.com> References: <20220928164114.48339-1-olivier.moysan@foss.st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.119] X-ClientProxiedBy: GPXDAG2NODE4.st.com (10.75.127.68) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-28_07,2022-09-28_01,2022-06-22_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS 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 Fix channel init for ADC generic channel bindings. In generic channel initialization, stm32_adc_smpr_init() is called to initialize channel sampling time. The "st,min-sample-time-ns" property is an optional property. If it is not defined, stm32_adc_smpr_init() is currently skipped. However stm32_adc_smpr_init() must always be called, to force a minimum sampling time for the internal channels, as the minimum sampling time is known. Make stm32_adc_smpr_init() call unconditional. Fixes: 796e5d0b1e9b ("iio: adc: stm32-adc: use generic binding for sample-time") Signed-off-by: Olivier Moysan --- drivers/iio/adc/stm32-adc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 6256977eb7f7..3cda529f081d 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -2086,18 +2086,19 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev, stm32_adc_chan_init_one(indio_dev, &channels[scan_index], val, vin[1], scan_index, differential); + val = 0; ret = fwnode_property_read_u32(child, "st,min-sample-time-ns", &val); /* st,min-sample-time-ns is optional */ - if (!ret) { - stm32_adc_smpr_init(adc, channels[scan_index].channel, val); - if (differential) - stm32_adc_smpr_init(adc, vin[1], val); - } else if (ret != -EINVAL) { + if (ret && ret != -EINVAL) { dev_err(&indio_dev->dev, "Invalid st,min-sample-time-ns property %d\n", ret); goto err; } + stm32_adc_smpr_init(adc, channels[scan_index].channel, val); + if (differential) + stm32_adc_smpr_init(adc, vin[1], val); + scan_index++; } -- 2.25.1