Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp515146lqh; Fri, 31 May 2024 08:10:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU59HM97zlC2uIluIj8Mvw7fsxixE1sqNLslQVGCKnIcmsZ5ugYAazTXMhtK5ik0aWK0FN7BW8EfYUSKMMVwb82x3hXAMnJdKebsvDcIw== X-Google-Smtp-Source: AGHT+IGEdqro9MzBZUaCgpHTj7yPKecjY5UH0tYxVxL/6lRJhVFJh0ZoXnm1fmmgenm/8rraebdu X-Received: by 2002:a05:6a20:96c2:b0:1ac:3d3c:c1e7 with SMTP id adf61e73a8af0-1b264d0c725mr7145025637.12.1717168258102; Fri, 31 May 2024 08:10:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717168258; cv=pass; d=google.com; s=arc-20160816; b=rC84uXBJcJiqAAYyHWP8RRo3o2yttKzyy/hqHVxeKo32luw7PW9uN/KO2mhvkixDkJ mi6rn7V6ZFDTtIK5LS0HzUVZBt2bBTYAxyojG6TdRcy7OvrLWW9Ur3q0navhFTqLZ7mP N1WZSx69+o1Tr61N6nUQO+FuFb1/j3sjF5ljf+lGLfcmkigy2WiWHMQ/SGiUe52wUHlq cOOzoGErhDOJ7Zj3r81JaiQ657meeWUyPYYqASgSlvVEFqYeXpxJbR9vK2VutCAKWG8A V++EclD8opCfCBVbMTBfl9KwM8b0xH8imZXOmb1c79s7YZ8Ts0TstulVCKT7e2eHrf7I G/fQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=d/41qmVRGtCEJSSQ0gxUanK9zaOsFRj77dN7gb5e9uY=; fh=GMVtMPLlwt/lj9i49KuTObjDq8olvs384ecnCjKLSCY=; b=NHnmBK7ZrCLpqrNPvgn70Ek3yU4ZyV9awLQAdS1nUE4+3SN30q2QlHpPj+i9JI1C6X v5sI8kJ1vYM2BXcUeIDiGaZ6uPX2YP87fIZJi2hnflrbXQHJLYaGapF3QD/I++S7WNJH iJDUa2v7NzXlOSaeE8VLgs5oKChYQnQXvbM8JKuhGXKg1ngtWhGvSvMripNxOsd9+zzr Tt7CygCTZzek8nB9GVEG7ETsn/tka93/Klq6y6Da/JX5+C4yuuB5z7B57IUTzwS3rTSY 0UD6KfYgdB5fiAOA90uERYiZxG2Hbe9f4gmRFDv45QO0Hv2yE+hMzuXpUnUr4yAFH0P4 kLEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="tHCPvq/T"; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-197034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197034-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d59ed9csi1674346a12.855.2024.05.31.08.10.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 08:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="tHCPvq/T"; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-197034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197034-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 711D728D439 for ; Fri, 31 May 2024 15:10:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 494A0768EC; Fri, 31 May 2024 15:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="tHCPvq/T" Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E352974E3D; Fri, 31 May 2024 15:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717168163; cv=none; b=LupfhJKD2HAlPXDAjCSSsfpcbOk7bAV4VJDLmdF2tTk21hIHLcffb+KVCMMOhaSIvoCN8HHRHSsR8/NDmSU0D9+zvZL+C1BhqQ1rh5/epRZEqZpoK14ZXqoMSVA7jGtrARBaxVpFMLRMorFs2/Acw8jQCXzRC4GMheoDlnz5gGE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717168163; c=relaxed/simple; bh=oW2t5ag0ZkozlerNKcl0RbY79P6OzHDZCz9xIY+kkqA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fWWe3FK7g4lOKHy7MVHlDduMDczJSfXFgibk20oqmm8e3e7GepKpAtk4zsO4H97lIbG9klmRfjTW3MAsZUy4MhP5TbkoEYiZ+LImwj17bOGox3gNhnyFQpJ7geXE/13n4LxF3jGE3BZ1YWCzjk/ujgsEeEHTPSknzK4sLSXHFD0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=tHCPvq/T; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44VBgIaT017539; Fri, 31 May 2024 17:09:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= d/41qmVRGtCEJSSQ0gxUanK9zaOsFRj77dN7gb5e9uY=; b=tHCPvq/Tt0gf6ck/ TgOdLcNqzgXPjuzkKqN9kLtZ+3xSskSbhr9sWiJdTJS/y/ahfX0oUqapRpOMz8Fe WrydgMUcqvPS/dvC3SScC8QLs8WEvuEczrVWQYs0mFbsao4ZpG9CJ+o+OYcoCfFE DojYQ04PTiIn7t+oNEBtpRmVgACnpJxcZIfwnNVQheLJYJZJqJESHAm7QK5oyqUd OeqyoJrMX2yaDFntiCFra+ozS+eSM98s3zf9zwmNCjhzzUE4UaSw5yMHxADqN4q1 ihI1rcoa8R06kTfdcpyZQuFADUHBH5/4KrdCT9lqAgzOfIjrOIvaRDsAQhfglZZL 6u4Rtw== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3ybsj1357g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 17:09:11 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C2F8940049; Fri, 31 May 2024 17:09:06 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 95B75220B60; Fri, 31 May 2024 17:08:22 +0200 (CEST) Received: from localhost (10.252.27.179) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 31 May 2024 17:08:22 +0200 From: Amelie Delaunay To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , , Amelie Delaunay Subject: [PATCH v4 08/12] dmaengine: stm32-dma3: add device_pause and device_resume ops Date: Fri, 31 May 2024 17:07:08 +0200 Message-ID: <20240531150712.2503554-9-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240531150712.2503554-1-amelie.delaunay@foss.st.com> References: <20240531150712.2503554-1-amelie.delaunay@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-31_11,2024-05-30_01,2024-05-17_01 STM32 DMA3 controller is able to suspend an ongoing transfer (the transfer is suspended after the ongoing burst is flushed to the destination) and resume it from the point it was suspended. No need to reconfigure any register. Signed-off-by: Amelie Delaunay --- drivers/dma/stm32/stm32-dma3.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c index 31c5b0e3fd18..5032d74d6288 100644 --- a/drivers/dma/stm32/stm32-dma3.c +++ b/drivers/dma/stm32/stm32-dma3.c @@ -1249,6 +1249,35 @@ static int stm32_dma3_config(struct dma_chan *c, struct dma_slave_config *config return 0; } +static int stm32_dma3_pause(struct dma_chan *c) +{ + struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c); + int ret; + + ret = stm32_dma3_chan_suspend(chan, true); + if (ret) + return ret; + + chan->dma_status = DMA_PAUSED; + + dev_dbg(chan2dev(chan), "vchan %pK: paused\n", &chan->vchan); + + return 0; +} + +static int stm32_dma3_resume(struct dma_chan *c) +{ + struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c); + + stm32_dma3_chan_suspend(chan, false); + + chan->dma_status = DMA_IN_PROGRESS; + + dev_dbg(chan2dev(chan), "vchan %pK: resumed\n", &chan->vchan); + + return 0; +} + static int stm32_dma3_terminate_all(struct dma_chan *c) { struct stm32_dma3_chan *chan = to_stm32_dma3_chan(c); @@ -1485,6 +1514,8 @@ static int stm32_dma3_probe(struct platform_device *pdev) dma_dev->device_prep_dma_cyclic = stm32_dma3_prep_dma_cyclic; dma_dev->device_caps = stm32_dma3_caps; dma_dev->device_config = stm32_dma3_config; + dma_dev->device_pause = stm32_dma3_pause; + dma_dev->device_resume = stm32_dma3_resume; dma_dev->device_terminate_all = stm32_dma3_terminate_all; dma_dev->device_synchronize = stm32_dma3_synchronize; dma_dev->device_tx_status = dma_cookie_status; -- 2.25.1