Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4729918rwl; Mon, 3 Apr 2023 08:51:25 -0700 (PDT) X-Google-Smtp-Source: AKy350asDB2WZYqQUK+YzgAHXVb9xZucEn5xRoBbsYxxBcNHwA4QLQdUTaTYb8sKBod2yJOcc4dM X-Received: by 2002:a17:906:9453:b0:932:b7ce:2aaa with SMTP id z19-20020a170906945300b00932b7ce2aaamr38792216ejx.28.1680537085361; Mon, 03 Apr 2023 08:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680537085; cv=none; d=google.com; s=arc-20160816; b=oLARGN/iNDuZEtpVZzMhDclMVAC2wDlftWfuDyLCCYHdY3Nhg+lzfRzjM1xSUz6vvk G/F1Ysqaejay1I7ap3IKG51zEvGZc+IYvsMjChcv0XNA+eN2jmMs6qJ6mxTZVDkpUK4L wnaBk3Ee3fSWC8sO4DeHHeBiZj9ttQNs3HiwFlCadvsQ47xAhNT8mK6HVJiJ4KeLI8kH 6uPfmOqYYqBHs1WbGLr3neIOsskXoEQWAQiZp4IcCT9uEDL1SVjiOirqq8P0pUPDBqTZ nbMuKKLuC53gIesiqv5YxdFVzSoRPpMQtmVhRrXhdZw04lv31Olz4Zmssy+6q/DlLAR+ VQDg== 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=Dku4wXuwudT4q34STxa4FMfMek4fO2ojnwUzBKSuXjA=; b=F7jguF+7l1nK+4Q5Lj0iICuqaFT++45Kra3ua2BdS0ejP8PiNBfqiG1udrN+GB2ugw WUWK/Ujl36kJezeAmyN3ljiPAg0L2WqXv/jbKlQAA7LdQRr0BFMvzvSDkOlJZ6LvHiJM RJj7seeGeRfxPaFRnrGvzLtu6EgyuD/8dx+6RY1iU0LCCr8ljXay6UReQx98VZv2WctS OQ//VlVJ8sPZj4oio8akLU5cTifX79r5V14BbFc33mfNlNGi457S311NDLJtmUPZtWYy FZdu+/N56Ftyzirr0p/e9We62l7UvP4050eYIYbIw1ML+yLTWD55/0nCSRkwdMV8M0jn Gztw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ecN8+hUA; 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=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh9-20020a170906eb8900b00947c995f7cbsi175221ejb.292.2023.04.03.08.51.00; Mon, 03 Apr 2023 08:51:25 -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=@crapouillou.net header.s=mail header.b=ecN8+hUA; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbjDCPtp (ORCPT + 99 others); Mon, 3 Apr 2023 11:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbjDCPtl (ORCPT ); Mon, 3 Apr 2023 11:49:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82AD640F2; Mon, 3 Apr 2023 08:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1680536890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dku4wXuwudT4q34STxa4FMfMek4fO2ojnwUzBKSuXjA=; b=ecN8+hUAzZ3PoWqKSNgaK36hhfmHEAL9q+kQOHkW6Xy1qm2ThwiFt1rf+FyO66SEq6ps3E XRiKDUUYLbEOIC2dIXXyQmp5xjVMBM+BNUcZvgMI0LaDHcIMDkJ4KonmDEz5mxYRKkJNSf ThVDFZ59kByB/lZJ8kyH48P0wXH40/U= From: Paul Cercueil To: Jonathan Cameron , Lars-Peter Clausen , Vinod Koul , Michael Hennerich , =?UTF-8?q?Nuno=20S=C3=A1?= , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Paul Cercueil Subject: [PATCH v3 01/11] dmaengine: Add API function dmaengine_prep_slave_dma_array() Date: Mon, 3 Apr 2023 17:47:50 +0200 Message-Id: <20230403154800.215924-2-paul@crapouillou.net> In-Reply-To: <20230403154800.215924-1-paul@crapouillou.net> References: <20230403154800.215924-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam: Yes X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 This function can be used to initiate a scatter-gather DMA transfer where the DMA addresses and lengths are located inside arrays. The major difference with dmaengine_prep_slave_sg() is that it supports specifying the lengths of each DMA transfer; as trying to override the length of the transfer with dmaengine_prep_slave_sg() is a very tedious process. The introduction of a new API function is also justified by the fact that scatterlists are on their way out. Signed-off-by: Paul Cercueil --- v3: New patch --- include/linux/dmaengine.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index c3656e590213..62efa28c009a 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -912,6 +912,11 @@ struct dma_device { struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( struct dma_chan *chan, unsigned long flags); + struct dma_async_tx_descriptor *(*device_prep_slave_dma_array)( + struct dma_chan *chan, dma_addr_t *addrs, + size_t *lengths, size_t nb, + enum dma_transfer_direction direction, + unsigned long flags); struct dma_async_tx_descriptor *(*device_prep_slave_sg)( struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, enum dma_transfer_direction direction, @@ -974,6 +979,17 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( dir, flags, NULL); } +static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_dma_array( + struct dma_chan *chan, dma_addr_t *addrs, size_t *lengths, + size_t nb, enum dma_transfer_direction dir, unsigned long flags) +{ + if (!chan || !chan->device || !chan->device->device_prep_slave_dma_array) + return NULL; + + return chan->device->device_prep_slave_dma_array(chan, addrs, lengths, + nb, dir, flags); +} + static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg( struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len, enum dma_transfer_direction dir, unsigned long flags) -- 2.39.2