Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7305735rwi; Mon, 24 Oct 2022 12:40:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pHuHNOTuZh+OiFxMVScw/gO105Kz0nHbudUy4dS4tkf4UoW2SbFsXiLQMxnp2WrohIlNH X-Received: by 2002:a05:6402:428f:b0:454:c988:4bb1 with SMTP id g15-20020a056402428f00b00454c9884bb1mr32036794edc.196.1666640449307; Mon, 24 Oct 2022 12:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640449; cv=none; d=google.com; s=arc-20160816; b=PApF96DF7mn3Pl7Asvou5bJSZatsyLJMqC5dIBnq0FeGm5Tkc+ieyaQ1koFDlRecK/ mtbtGDPAqUBZ5zY/nSk8fDnKd4sITgIt0XXnhwYf5vYdXZqj1SU0NGQXYCSKq9yRvnnI RUlmLKMziHSygashz3zBCscALNTJ+YSSF+xiybq7uVVSHSG0l/8gZJb8E4+q0k8pC2WV ttpAGwJShfpm5sxH3bxMmUhxCd5/y0J1heOcwpqI1ciCXV6KekkhbxgOVZRMgFuc66/k j4v2rF6gweObkAzSAmt3EmFL10PZu0JIPUJvben6OoVBjpFm0WXboSLik593giioNjZG ZFSQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bhbg0e+qXul0skbI70C6XAu3HLKXVe3Ie0PitFSwO8w=; b=sxocQ7Hn5a4CkQtX2fOfhpuhZsaGhPXK+Z1+Ywb8wjPmSUmfwon6d6LcFtXnBaIHAk lPxj92/UHBIPe9/FLliUVwWdkkvFfsxZjJF8JluwNgwq6YqmG6pAOVcoNyEji6ovgTAQ xxrFL+pdPlIDwWLG/b+kNcnuOwXmhc7XJB367p0Uwl07wtVGvAvk1BrfWHjLP+pO94kq Myl1mUgIjrhy3JMT+3+UPvTdqkqHwRrSyxqCDpCVE853mLsvY2Sd+5sJ6BLwhqjhjyNp l6y/He81GkQM4opRNbKU0HZ0S4ERT/r0m/xK/u+MalsUABKfiIszhbRqj/UvC9E50HXN F3Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZVgpafSw; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402350800b0045caa8bf80bsi681220edd.307.2022.10.24.12.40.23; Mon, 24 Oct 2022 12:40:49 -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=@linuxfoundation.org header.s=korg header.b=ZVgpafSw; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233271AbiJXTd3 (ORCPT + 99 others); Mon, 24 Oct 2022 15:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbiJXTdG (ORCPT ); Mon, 24 Oct 2022 15:33:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F52631CB; Mon, 24 Oct 2022 11:03:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 82A6DCE13DC; Mon, 24 Oct 2022 12:45:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E97DC433D6; Mon, 24 Oct 2022 12:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615557; bh=uVUZNbmVum8XjsCvhiL32KOeD7JcBwmkjWzm5o8Pmck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVgpafSwJIqAUs5NvJqK/79wUJnGQlnXur+baEoGNetfEn1ZA3p6aSt4R5Gs6np2a eruPeuKa0e88X1VpQ2WD4PMv/vzZoPW8N6qWdNgRxTGs4X15ySvzyXwrXmt5s0HAWC DRlLzttXNc353l8DhLbrYZVAWb8Jf76GIOUmhpaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 267/530] iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024113057.144144718@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Claudiu Beznea [ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ] In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare(). Fixes: 073c662017f2f ("iio: adc: at91-sama5d2_adc: add support for DMA") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-5-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 9cd6a779a217..403a29e4dc3e 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1903,6 +1903,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + at91_adc_buffer_postdisable(indio_dev); + /* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC @@ -1946,14 +1949,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev) if (!iio_buffer_enabled(indio_dev)) return 0; - /* check if we are enabling triggered buffer or the touchscreen */ - if (at91_adc_current_chan_is_touch(indio_dev)) - return at91_adc_configure_touch(st, true); - else - return at91_adc_configure_trigger(st->trig, true); + ret = at91_adc_buffer_prepare(indio_dev); + if (ret) + goto vref_disable_resume; - /* not needed but more explicit */ - return 0; + return at91_adc_configure_trigger(st->trig, true); vref_disable_resume: regulator_disable(st->vref); -- 2.35.1