summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2013-09-30 15:34:44 +0200
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-10-28 18:23:10 +0100
commit0cddc7e9a0dd4b77471889d436b4a4ed8d8385bb (patch)
tree4d1c3bf0812452236be94b52356df990858e4801 /drivers/media/platform/coda.c
parent[media] v4l2-mem2mem: Don't schedule the context if abort job is called (diff)
downloadlinux-0cddc7e9a0dd4b77471889d436b4a4ed8d8385bb.tar.xz
linux-0cddc7e9a0dd4b77471889d436b4a4ed8d8385bb.zip
[media] coda: allow more than four instances on CODA7541
With the new firmware, there are not anymore four register sets, but a single register set, which the driver has to conserve across context switches. This allows to handle more than four instances at the same time. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/coda.c')
-rw-r--r--drivers/media/platform/coda.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 449d2fec9e87..28055388f2e8 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -39,7 +39,7 @@
#define CODA_NAME "coda"
-#define CODA_MAX_INSTANCES 4
+#define CODADX6_MAX_INSTANCES 4
#define CODA_FMO_BUF_SIZE 32
#define CODADX6_WORK_BUF_SIZE (288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 1024)
@@ -2371,7 +2371,13 @@ static int coda_queue_init(void *priv, struct vb2_queue *src_vq,
static int coda_next_free_instance(struct coda_dev *dev)
{
- return ffz(dev->instance_mask);
+ int idx = ffz(dev->instance_mask);
+
+ if ((idx < 0) ||
+ (dev->devtype->product == CODA_DX6 && idx > CODADX6_MAX_INSTANCES))
+ return -EBUSY;
+
+ return idx;
}
static int coda_open(struct file *file)
@@ -2386,8 +2392,8 @@ static int coda_open(struct file *file)
return -ENOMEM;
idx = coda_next_free_instance(dev);
- if (idx >= CODA_MAX_INSTANCES) {
- ret = -EBUSY;
+ if (idx < 0) {
+ ret = idx;
goto err_coda_max;
}
set_bit(idx, &dev->instance_mask);