camera: rockchip: camsys driver v0.0x21.0xf

add reference count for marvin

Change-Id: Ic410da2524a8972d782ccfdcb121e1727b02e9d8
Signed-off-by: zhangyunlong <dalon.zhang@rock-chips.com>
This commit is contained in:
zhangyunlong 2017-05-09 11:41:19 +08:00 committed by Huang, Tao
commit 3df3989b1a
2 changed files with 12 additions and 4 deletions

View file

@ -803,7 +803,12 @@ static int camsys_open(struct inode *inode, struct file *file)
}
}
spin_unlock(&camsys_devs.lock);
if (atomic_read(&camsys_dev->refcount) >= 1) {
camsys_err("%s has been opened!",
dev_name(camsys_dev->miscdev.this_device));
err = -EBUSY;
goto end;
}
INIT_LIST_HEAD(&camsys_dev->extdevs.active);
if (camsys_dev->mipiphy != NULL) {
@ -822,6 +827,7 @@ static int camsys_open(struct inode *inode, struct file *file)
err = -ENODEV;
goto end;
} else {
atomic_inc(&camsys_dev->refcount);
camsys_trace(1,
"%s(%p) is opened!",
dev_name(camsys_dev->miscdev.this_device), camsys_dev);
@ -847,7 +853,7 @@ static int camsys_release(struct inode *inode, struct file *file)
}
}
}
atomic_dec(&camsys_dev->refcount);
camsys_trace(1,
"%s(%p) is closed",
dev_name(camsys_dev->miscdev.this_device),

View file

@ -162,8 +162,10 @@
*v0.0x21.0xe
1) correct mipiphy_hsfreqrange of 3368.
2) add csi-phy timing setting for 3368.
*v0.0x21.0xf:
1) add reference count for marvin.
*/
#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x21, 0xe)
#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x21, 0xf)
#define CAMSYS_PLATFORM_DRV_NAME "RockChip-CamSys"
#define CAMSYS_PLATFORM_MARVIN_NAME "Platform_MarvinDev"
@ -323,7 +325,7 @@ typedef struct camsys_dev_s {
unsigned long rk_grf_base;
unsigned long rk_cru_base;
unsigned long rk_isp_base;
atomic_t refcount;
struct iommu_domain *domain;
camsys_dma_buf_t dma_buf[CAMSYS_DMA_BUF_MAX_NUM];
int dma_buf_cnt;