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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C76F1C433F5 for ; Sun, 24 Oct 2021 16:04:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8516760F9C for ; Sun, 24 Oct 2021 16:04:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8516760F9C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+hjGm36vkLxsJjt4jJnJ/sCecpz/rJteXW/9EGO/GF0=; b=H8Twkb3/EXT8oD h7OFtz4tzVmP7wNp7PS63oED4NPL7rS6UIJaYgWqAhs5rMDLp0TCq4p/khJpVMGXPSYot0Cb1JnW6 9SvG2dvmhDbngAelf3fx4JSMcRUPH63Az/qhhfe1+vSrROcqabdkKUSnFAK3VkBbGZ953SUMqEhSL 0DCNyLKTQ+ak2pRnatdvunIJfZgQ3Nm5nJyuwk7HTq843XerY4dk0xqE+3ZTCy3annc58UkAFjQyX Zn6zhQ26hZ2tirGxxn1mdWnW4C30ITF0aD+L3UG2aaDsS1YWweHeiB6dPA4uj6EQBpAe/d0TJkG9p DyMYIpj3f4lyDKeLb5Vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mefyD-00EJiw-S5; Sun, 24 Oct 2021 16:03:38 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mefyA-00EJiB-AI for linux-arm-kernel@lists.infradead.org; Sun, 24 Oct 2021 16:03:35 +0000 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CBA7360F9C; Sun, 24 Oct 2021 16:03:27 +0000 (UTC) Date: Sun, 24 Oct 2021 17:07:49 +0100 From: Jonathan Cameron To: Olivier MOYSAN Cc: Fabrice Gasnier , , , , , Subject: Re: [PATCH] iio: adc: stm32: fix a leak by resetting pcsel before disabling vdda Message-ID: <20211024170749.44c0d81f@jic23-huawei> In-Reply-To: <77f3593a-0e94-f5ab-f102-86ba8d0f1a3b@foss.st.com> References: <1634905169-23762-1-git-send-email-fabrice.gasnier@foss.st.com> <77f3593a-0e94-f5ab-f102-86ba8d0f1a3b@foss.st.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211024_090334_410799_9A92FA9E X-CRM114-Status: GOOD ( 23.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 On Fri, 22 Oct 2021 14:38:52 +0200 Olivier MOYSAN wrote: I'll probably reword the description here as 'leak' tends to mean memory leak rather than current. > Hi Fabrice, > > On 10/22/21 2:19 PM, Fabrice Gasnier wrote: > > Some I/Os are connected to ADC input channels, when the corresponding bit > > in PCSEL register are set on STM32H7 and STM32MP15. This is done in the > > prepare routine of stm32-adc driver. > > There are constraints here, as PCSEL shouldn't be set when VDDA supply > > is disabled. Enabling/disabling of VDDA supply in done via stm32-adc-core > > runtime PM routines (before/after ADC is enabled/disabled). > > > > Currently, PCSEL remains set when disabling ADC. Later on, PM runtime > > can disable the VDDA supply. This creates some conditions on I/Os that > > can start to leak current. > > So PCSEL needs to be cleared when disabling the ADC. > > > > Fixes: 95e339b6e85d ("iio: adc: stm32: add support for STM32H7") > > No line break here as Fixes forms part of the tag block. > > Signed-off-by: Fabrice Gasnier Given timing wrt to being too near merge window, I'll let this it on list a while longer as it'll be post rc1 material now anyway. I can fix the above whilst applying if nothing else comes up. Jonathan > > --- > > drivers/iio/adc/stm32-adc.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c > > index 5088de8..e3e7541 100644 > > --- a/drivers/iio/adc/stm32-adc.c > > +++ b/drivers/iio/adc/stm32-adc.c > > @@ -975,6 +975,7 @@ static void stm32h7_adc_unprepare(struct iio_dev *indio_dev) > > { > > struct stm32_adc *adc = iio_priv(indio_dev); > > > > + stm32_adc_writel(adc, STM32H7_ADC_PCSEL, 0); > > stm32h7_adc_disable(indio_dev); > > stm32h7_adc_enter_pwr_down(adc); > > } > > > > Reviewed-by: Olivier Moysan > > Thanks > Olivier _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel