aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/media/atomisp/pci/runtime/queue/src
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/media/atomisp/pci/runtime/queue/src')
-rw-r--r--drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c45
-rw-r--r--drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c28
-rw-r--r--drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.h4
3 files changed, 41 insertions, 36 deletions
diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
index dd79c6f180af..aea6c66a3cee 100644
--- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
+++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2015, Intel Corporation.
@@ -28,7 +29,7 @@ int ia_css_queue_local_init(
if (NULL == qhandle || NULL == desc
|| NULL == desc->cb_elems || NULL == desc->cb_desc) {
/* Invalid parameters, return error*/
- return EINVAL;
+ return -EINVAL;
}
/* Mark the queue as Local */
@@ -48,7 +49,7 @@ int ia_css_queue_remote_init(
{
if (NULL == qhandle || NULL == desc) {
/* Invalid parameters, return error*/
- return EINVAL;
+ return -EINVAL;
}
/* Mark the queue as remote*/
@@ -72,7 +73,7 @@ int ia_css_queue_uninit(
ia_css_queue_t *qhandle)
{
if (!qhandle)
- return EINVAL;
+ return -EINVAL;
/* Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -90,7 +91,7 @@ int ia_css_queue_enqueue(
int error = 0;
if (!qhandle)
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -99,7 +100,7 @@ int ia_css_queue_enqueue(
*/
if (ia_css_circbuf_is_full(&qhandle->desc.cb_local)) {
/* Cannot push the element. Return*/
- return ENOBUFS;
+ return -ENOBUFS;
}
/* Push the element*/
@@ -117,7 +118,7 @@ int ia_css_queue_enqueue(
/* b. Operate on the queue */
if (ia_css_circbuf_desc_is_full(&cb_desc))
- return ENOBUFS;
+ return -ENOBUFS;
cb_elem.val = item;
@@ -149,7 +150,7 @@ int ia_css_queue_dequeue(
int error = 0;
if (!qhandle || NULL == item)
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -158,7 +159,7 @@ int ia_css_queue_dequeue(
*/
if (ia_css_circbuf_is_empty(&qhandle->desc.cb_local)) {
/* Nothing to pop. Return empty queue*/
- return ENODATA;
+ return -ENODATA;
}
*item = ia_css_circbuf_pop(&qhandle->desc.cb_local);
@@ -176,7 +177,7 @@ int ia_css_queue_dequeue(
/* b. Operate on the queue */
if (ia_css_circbuf_desc_is_empty(&cb_desc))
- return ENODATA;
+ return -ENODATA;
error = ia_css_queue_item_load(qhandle, cb_desc.start, &cb_elem);
if (error != 0)
@@ -206,7 +207,7 @@ int ia_css_queue_is_full(
int error = 0;
if ((!qhandle) || (!is_full))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -230,7 +231,7 @@ int ia_css_queue_is_full(
return 0;
}
- return EINVAL;
+ return -EINVAL;
}
int ia_css_queue_get_free_space(
@@ -240,7 +241,7 @@ int ia_css_queue_get_free_space(
int error = 0;
if ((!qhandle) || (!size))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -264,7 +265,7 @@ int ia_css_queue_get_free_space(
return 0;
}
- return EINVAL;
+ return -EINVAL;
}
int ia_css_queue_get_used_space(
@@ -274,7 +275,7 @@ int ia_css_queue_get_used_space(
int error = 0;
if ((!qhandle) || (!size))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -298,7 +299,7 @@ int ia_css_queue_get_used_space(
return 0;
}
- return EINVAL;
+ return -EINVAL;
}
int ia_css_queue_peek(
@@ -310,7 +311,7 @@ int ia_css_queue_peek(
int error = 0;
if ((!qhandle) || (!element))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -320,7 +321,7 @@ int ia_css_queue_peek(
/* Check if offset is valid */
num_elems = ia_css_circbuf_get_num_elems(&qhandle->desc.cb_local);
if (offset > num_elems)
- return EINVAL;
+ return -EINVAL;
*element = ia_css_circbuf_peek_from_start(&qhandle->desc.cb_local, (int)offset);
return 0;
@@ -339,7 +340,7 @@ int ia_css_queue_peek(
/* Check if offset is valid */
num_elems = ia_css_circbuf_desc_get_num_elems(&cb_desc);
if (offset > num_elems)
- return EINVAL;
+ return -EINVAL;
offset = OP_std_modadd(cb_desc.start, offset, cb_desc.size);
error = ia_css_queue_item_load(qhandle, (uint8_t)offset, &cb_elem);
@@ -350,7 +351,7 @@ int ia_css_queue_peek(
return 0;
}
- return EINVAL;
+ return -EINVAL;
}
int ia_css_queue_is_empty(
@@ -360,7 +361,7 @@ int ia_css_queue_is_empty(
int error = 0;
if ((!qhandle) || (!is_empty))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
@@ -384,7 +385,7 @@ int ia_css_queue_is_empty(
return 0;
}
- return EINVAL;
+ return -EINVAL;
}
int ia_css_queue_get_size(
@@ -394,7 +395,7 @@ int ia_css_queue_get_size(
int error = 0;
if ((!qhandle) || (!size))
- return EINVAL;
+ return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c
index 1e8d3eb82eab..fdca743c4ab7 100644
--- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c
+++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2010 - 2015, Intel Corporation.
@@ -12,11 +13,12 @@
* more details.
*/
+#include "hmm.h"
+
#include "type_support.h"
#include "queue_access.h"
#include "ia_css_circbuf.h"
#include "sp.h"
-#include "memory_access.h"
#include "assert_support.h"
int ia_css_queue_load(
@@ -25,7 +27,7 @@ int ia_css_queue_load(
uint32_t ignore_desc_flags)
{
if (!rdesc || !cb_desc)
- return EINVAL;
+ return -EINVAL;
if (rdesc->location == IA_CSS_QUEUE_LOC_SP) {
assert(ignore_desc_flags <= QUEUE_IGNORE_DESC_FLAGS_MAX);
@@ -63,12 +65,12 @@ int ia_css_queue_load(
} else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) {
/* doing DMA transfer of entire structure */
- mmgr_load(rdesc->desc.remote.cb_desc_addr,
+ hmm_load(rdesc->desc.remote.cb_desc_addr,
(void *)cb_desc,
sizeof(ia_css_circbuf_desc_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) {
/* Not supported yet */
- return ENOTSUP;
+ return -ENOTSUPP;
}
return 0;
@@ -80,7 +82,7 @@ int ia_css_queue_store(
uint32_t ignore_desc_flags)
{
if (!rdesc || !cb_desc)
- return EINVAL;
+ return -EINVAL;
if (rdesc->location == IA_CSS_QUEUE_LOC_SP) {
assert(ignore_desc_flags <= QUEUE_IGNORE_DESC_FLAGS_MAX);
@@ -110,12 +112,12 @@ int ia_css_queue_store(
cb_desc->step);
} else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) {
/* doing DMA transfer of entire structure */
- mmgr_store(rdesc->desc.remote.cb_desc_addr,
+ hmm_store(rdesc->desc.remote.cb_desc_addr,
(void *)cb_desc,
sizeof(ia_css_circbuf_desc_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) {
/* Not supported yet */
- return ENOTSUP;
+ return -ENOTSUPP;
}
return 0;
@@ -127,7 +129,7 @@ int ia_css_queue_item_load(
ia_css_circbuf_elem_t *item)
{
if (!rdesc || !item)
- return EINVAL;
+ return -EINVAL;
if (rdesc->location == IA_CSS_QUEUE_LOC_SP) {
sp_dmem_load(rdesc->proc_id,
@@ -136,13 +138,13 @@ int ia_css_queue_item_load(
item,
sizeof(ia_css_circbuf_elem_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) {
- mmgr_load(rdesc->desc.remote.cb_elems_addr
+ hmm_load(rdesc->desc.remote.cb_elems_addr
+ position * sizeof(ia_css_circbuf_elem_t),
(void *)item,
sizeof(ia_css_circbuf_elem_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) {
/* Not supported yet */
- return ENOTSUP;
+ return -ENOTSUPP;
}
return 0;
@@ -154,7 +156,7 @@ int ia_css_queue_item_store(
ia_css_circbuf_elem_t *item)
{
if (!rdesc || !item)
- return EINVAL;
+ return -EINVAL;
if (rdesc->location == IA_CSS_QUEUE_LOC_SP) {
sp_dmem_store(rdesc->proc_id,
@@ -163,13 +165,13 @@ int ia_css_queue_item_store(
item,
sizeof(ia_css_circbuf_elem_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) {
- mmgr_store(rdesc->desc.remote.cb_elems_addr
+ hmm_store(rdesc->desc.remote.cb_elems_addr
+ position * sizeof(ia_css_circbuf_elem_t),
(void *)item,
sizeof(ia_css_circbuf_elem_t));
} else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) {
/* Not supported yet */
- return ENOTSUP;
+ return -ENOTSUPP;
}
return 0;
diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.h b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.h
index 884c55a754d1..d5107adccef9 100644
--- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.h
+++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2010 - 2015, Intel Corporation.
@@ -15,10 +16,11 @@
#ifndef __QUEUE_ACCESS_H
#define __QUEUE_ACCESS_H
+#include <linux/errno.h>
+
#include <type_support.h>
#include <ia_css_queue_comm.h>
#include <ia_css_circbuf.h>
-#include <error_support.h>
#define QUEUE_IGNORE_START_FLAG 0x0001
#define QUEUE_IGNORE_END_FLAG 0x0002