/*
* Virtual Codec Device Driver
*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* Kitae Kim <kt920.kim@samsung.com>
/* device memory */
#define CODEC_CONTEXT_SIZE 1024
-#define CODEC_S_DEVICE_MEM_COUNT 15 // small (256K) 4M
+#define CODEC_S_DEVICE_MEM_COUNT 16 // small (256K) 4M
#define CODEC_M_DEVICE_MEM_COUNT 8 // medium (2M) 16M
#define CODEC_L_DEVICE_MEM_COUNT 3 // large (4M) 12M
static void maru_brill_codec_divide_device_memory(void)
{
int i = 0, cnt = 0;
- // First small memory block reserved for meta data
- int offset = CODEC_S_DEVICE_MEM_SIZE;
+ int offset = 0;
+
for (i = 0; i < 3; ++i) {
struct memory_block *block = &maru_brill_codec->memory_blocks[i];
block->start_offset = offset;
struct device_mem *unit = NULL;
int index = 0;
struct memory_block *block = NULL;
-
struct list_head *pos, *temp;
for (index = SMALL; index <= LARGE; index++) {
maru_brill_codec->ioaddr + CODEC_CMD_API_INDEX);
LEAVE_CRITICAL_SECTION(flags);
+ release_device_memory(ioparam->mem_offset);
+
wait_event_interruptible(wait_queue, context_flags[ctx_index] != 0);
context_flags[ctx_index] = 0;
}
break;
case CODEC_DECODE_VIDEO ... CODEC_ENCODE_AUDIO:
- {
ENTER_CRITICAL_SECTION(flags);
writel((uint32_t)ioparam->mem_offset,
maru_brill_codec->ioaddr + CODEC_CMD_DEVICE_MEM_OFFSET);
wait_event_interruptible(wait_queue, context_flags[ctx_index] != 0);
context_flags[ctx_index] = 0;
- }
break;
case CODEC_PICTURE_COPY:
- {
ENTER_CRITICAL_SECTION(flags);
writel((uint32_t)ioparam->mem_offset,
maru_brill_codec->ioaddr + CODEC_CMD_DEVICE_MEM_OFFSET);
wait_event_interruptible(wait_queue, context_flags[ctx_index] != 0);
context_flags[ctx_index] = 0;
- }
break;
case CODEC_DEINIT:
ENTER_CRITICAL_SECTION(flags);
maru_brill_codec->ioaddr + CODEC_CMD_API_INDEX);
LEAVE_CRITICAL_SECTION(flags);
+ wait_event_interruptible(wait_queue, context_flags[ctx_index] != 0);
+ context_flags[ctx_index] = 0;
+
dispose_device_memory(ioparam->ctx_index);
break;
case CODEC_FLUSH_BUFFERS:
writel((int32_t)ioparam->api_index,
maru_brill_codec->ioaddr + CODEC_CMD_API_INDEX);
LEAVE_CRITICAL_SECTION(flags);
+
+ wait_event_interruptible(wait_queue, context_flags[ctx_index] != 0);
+ context_flags[ctx_index] = 0;
break;
default:
DEBUG("invalid API commands: %d", api_index);