upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / media / video / s5p-mfc / s5p_mfc_inst.c
1 /*
2  * linux/drivers/media/video/s5p-mfc/s5p_mfc_inst.c
3  *
4  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5  *              http://www.samsung.com/
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12
13 #include "s5p_mfc_common.h"
14 #include "s5p_mfc_cmd.h"
15 #include "s5p_mfc_debug.h"
16 #include "s5p_mfc_intr.h"
17
18 int s5p_mfc_open_inst(struct s5p_mfc_ctx *ctx)
19 {
20         struct s5p_mfc_dev *dev = ctx->dev;
21         int ret;
22
23         /* Preparing decoding - getting instance number */
24         mfc_debug(2, "Getting instance number\n");
25         dev->curr_ctx = ctx->num;
26         s5p_mfc_clean_ctx_int_flags(ctx);
27         ret = s5p_mfc_open_inst_cmd(ctx);
28         if (ret) {
29                 mfc_err("Failed to create a new instance.\n");
30                 ctx->state = MFCINST_ERROR;
31         }
32         return ret;
33 }
34
35 int s5p_mfc_close_inst(struct s5p_mfc_ctx *ctx)
36 {
37         struct s5p_mfc_dev *dev = ctx->dev;
38         int ret;
39
40         /* Closing decoding instance  */
41         mfc_debug(2, "Returning instance number\n");
42         dev->curr_ctx = ctx->num;
43         s5p_mfc_clean_ctx_int_flags(ctx);
44         ret = s5p_mfc_close_inst_cmd(ctx);
45         if (ret) {
46                 mfc_err("Failed to return an instance.\n");
47                 ctx->state = MFCINST_ERROR;
48                 return ret;
49         }
50         return ret;
51 }
52