Skip to content

Commit 43148b1

Browse files
grygoriySSantoshShilimkar
authored andcommitted
soc: ti: k3-ringacc: add request pair of rings api.
Add new API k3_ringacc_request_rings_pair() to request pair of rings at once, as in the most cases Rings are used with DMA channels, which need to request pair of rings - one to feed DMA with descriptors (TX/RX FDQ) and one to receive completions (RX/TX CQ). This will allow to simplify Ringacc API users. Signed-off-by: Grygorii Strashko <[email protected]> Reviewed-by: Peter Ujfalusi <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]>
1 parent 175e663 commit 43148b1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

drivers/soc/ti/k3-ringacc.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,30 @@ struct k3_ring *k3_ringacc_request_ring(struct k3_ringacc *ringacc,
322322
}
323323
EXPORT_SYMBOL_GPL(k3_ringacc_request_ring);
324324

325+
int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc,
326+
int fwd_id, int compl_id,
327+
struct k3_ring **fwd_ring,
328+
struct k3_ring **compl_ring)
329+
{
330+
int ret = 0;
331+
332+
if (!fwd_ring || !compl_ring)
333+
return -EINVAL;
334+
335+
*fwd_ring = k3_ringacc_request_ring(ringacc, fwd_id, 0);
336+
if (!(*fwd_ring))
337+
return -ENODEV;
338+
339+
*compl_ring = k3_ringacc_request_ring(ringacc, compl_id, 0);
340+
if (!(*compl_ring)) {
341+
k3_ringacc_ring_free(*fwd_ring);
342+
ret = -ENODEV;
343+
}
344+
345+
return ret;
346+
}
347+
EXPORT_SYMBOL_GPL(k3_ringacc_request_rings_pair);
348+
325349
static void k3_ringacc_ring_reset_sci(struct k3_ring *ring)
326350
{
327351
struct k3_ringacc *ringacc = ring->parent;

include/linux/soc/ti/k3-ringacc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ struct k3_ringacc *of_k3_ringacc_get_by_phandle(struct device_node *np,
107107
struct k3_ring *k3_ringacc_request_ring(struct k3_ringacc *ringacc,
108108
int id, u32 flags);
109109

110+
int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc,
111+
int fwd_id, int compl_id,
112+
struct k3_ring **fwd_ring,
113+
struct k3_ring **compl_ring);
110114
/**
111115
* k3_ringacc_ring_reset - ring reset
112116
* @ring: pointer on Ring

0 commit comments

Comments
 (0)