From: Zhu Yixin <yzhu@maxlinear.com>
To: <dmaengine@vger.kernel.org>, <vkoul@kernel.org>
Cc: <jchng@maxlinear.com>, <sureshnagaraj@maxlinear.com>,
Zhu Yixin <yzhu@maxlinear.com>
Subject: [PATCH 5/5] dmaengine: lgm_dma: Added HDMA RX interrupt handle functions.
Date: Wed, 30 Jul 2025 10:45:47 +0800 [thread overview]
Message-ID: <20250730024547.3160871-5-yzhu@maxlinear.com> (raw)
In-Reply-To: <20250730024547.3160871-1-yzhu@maxlinear.com>
Enhanced tasklet function to handle HDMA RX interrupt.
Signed-off-by: Zhu Yixin <yzhu@maxlinear.com>
---
drivers/dma/lgm/lgm-hdma.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/lgm/lgm-hdma.c b/drivers/dma/lgm/lgm-hdma.c
index 198005b48d59..531d2b2f51b7 100644
--- a/drivers/dma/lgm/lgm-hdma.c
+++ b/drivers/dma/lgm/lgm-hdma.c
@@ -31,6 +31,12 @@
#define DESC_C BIT(30)
#define DESC_OWN BIT(31)
+/* RX sideband information from DMA */
+struct dma_rx_data {
+ unsigned int data_len;
+ unsigned int chno;
+};
+
struct dw4_desc_hw {
u32 dw0;
u32 dw1;
@@ -68,7 +74,7 @@ static int hdma_chan_init(struct ldma_dev *d, struct ldma_chan *c);
static int hdma_irq_init(struct ldma_dev *d, struct platform_device *pdev);
static void hdma_func_init(struct ldma_dev *d, struct dma_device *dma_dev);
static void hdma_free_chan_resources(struct dma_chan *dma_chan);
-static void dma_tx_chan_complete(struct tasklet_struct *t);
+static void dma_chan_complete(struct tasklet_struct *t);
static inline
struct dw4_desc_sw *to_lgm_dma_dw4_desc(struct virt_dma_desc *vd)
@@ -140,8 +146,7 @@ static int hdma_chan_init(struct ldma_dev *d, struct ldma_chan *c)
c->priv = chan;
chan->c = c;
- if (is_dma_chan_tx(d))
- tasklet_setup(&chan->task, dma_tx_chan_complete);
+ tasklet_setup(&chan->task, dma_chan_complete);
return 0;
}
@@ -177,7 +182,7 @@ void hdma_chan_int_enable(struct ldma_dev *d, struct ldma_chan *c)
spin_unlock_irqrestore(&d->dev_lock, flags);
}
-static void dma_tx_chan_complete(struct tasklet_struct *t)
+static void dma_chan_complete(struct tasklet_struct *t)
{
struct hdma_chan *chan = from_tasklet(chan, t, task);
struct ldma_chan *c = chan->c;
@@ -185,6 +190,7 @@ static void dma_tx_chan_complete(struct tasklet_struct *t)
/* check how many valid descriptor from DMA */
while (chan->prep_desc_cnt > 0) {
+ struct dma_rx_data *data;
struct dmaengine_desc_callback cb;
struct dma_async_tx_descriptor *tx;
struct dw4_desc_sw *desc_sw;
@@ -202,6 +208,12 @@ static void dma_tx_chan_complete(struct tasklet_struct *t)
tx = &desc_sw->vd.tx;
dmaengine_desc_get_callback(tx, &cb);
+ if (is_dma_chan_rx(d)) {
+ data = (struct dma_rx_data *)cb.callback_param;
+ data->data_len = FIELD_GET(DESC_DATA_LEN, desc_hw->dw3);
+ data->chno = c->nr;
+ }
+
dma_cookie_complete(tx);
chan->comp_idx = (chan->comp_idx + 1) % c->desc_cnt;
chan->prep_desc_cnt -= 1;
--
2.43.5
next prev parent reply other threads:[~2025-07-30 2:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 2:45 [PATCH 1/5] dmaengine: lgm-dma: Move platfrom data to device tree Zhu Yixin
2025-07-30 2:45 ` [PATCH 2/5] dmaengine: lgm-dma: Correct ORRC MAX counter value Zhu Yixin
2025-07-30 2:45 ` [PATCH 3/5] dmaengine: lgm-dma: split legacy DMA and HDMA functions Zhu Yixin
2025-07-30 6:20 ` Krzysztof Kozlowski
2025-07-30 8:52 ` Yi xin Zhu
2025-07-30 2:45 ` [PATCH 4/5] dmaengine: lgm-dma: Added HDMA software mode TX function Zhu Yixin
2025-07-30 6:21 ` Krzysztof Kozlowski
2025-07-30 8:59 ` Yi xin Zhu
2025-07-30 16:17 ` kernel test robot
2025-07-30 2:45 ` Zhu Yixin [this message]
2025-07-30 6:19 ` [PATCH 1/5] dmaengine: lgm-dma: Move platfrom data to device tree Krzysztof Kozlowski
2025-07-30 8:43 ` Yi xin Zhu
2025-07-30 8:54 ` Krzysztof Kozlowski
2025-07-31 5:44 ` Yi xin Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250730024547.3160871-5-yzhu@maxlinear.com \
--to=yzhu@maxlinear.com \
--cc=dmaengine@vger.kernel.org \
--cc=jchng@maxlinear.com \
--cc=sureshnagaraj@maxlinear.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox