hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/qcom/venus/hfi.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
34 * Copyright (C) 2017 Linaro Ltd.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 and
7
- * only version 2 as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
145 */
156 #include <linux/slab.h>
167 #include <linux/mutex.h>
....@@ -113,6 +104,9 @@
113104 mutex_lock(&core->lock);
114105 }
115106
107
+ if (!core->ops)
108
+ goto unlock;
109
+
116110 ret = core->ops->core_deinit(core);
117111
118112 if (!ret)
....@@ -207,6 +201,9 @@
207201 const struct hfi_ops *ops = core->ops;
208202 int ret;
209203
204
+ if (inst->state != INST_UNINIT)
205
+ return -EINVAL;
206
+
210207 inst->hfi_codec = to_codec_type(pixfmt);
211208 reinit_completion(&inst->done);
212209
....@@ -285,6 +282,7 @@
285282
286283 return 0;
287284 }
285
+EXPORT_SYMBOL_GPL(hfi_session_start);
288286
289287 int hfi_session_stop(struct venus_inst *inst)
290288 {
....@@ -308,6 +306,7 @@
308306
309307 return 0;
310308 }
309
+EXPORT_SYMBOL_GPL(hfi_session_stop);
311310
312311 int hfi_session_continue(struct venus_inst *inst)
313312 {
....@@ -337,6 +336,7 @@
337336
338337 return 0;
339338 }
339
+EXPORT_SYMBOL_GPL(hfi_session_abort);
340340
341341 int hfi_session_load_res(struct venus_inst *inst)
342342 {
....@@ -383,21 +383,24 @@
383383
384384 return 0;
385385 }
386
+EXPORT_SYMBOL_GPL(hfi_session_unload_res);
386387
387
-int hfi_session_flush(struct venus_inst *inst)
388
+int hfi_session_flush(struct venus_inst *inst, u32 type, bool block)
388389 {
389390 const struct hfi_ops *ops = inst->core->ops;
390391 int ret;
391392
392393 reinit_completion(&inst->done);
393394
394
- ret = ops->session_flush(inst, HFI_FLUSH_ALL);
395
+ ret = ops->session_flush(inst, type);
395396 if (ret)
396397 return ret;
397398
398
- ret = wait_session_msg(inst);
399
- if (ret)
400
- return ret;
399
+ if (block) {
400
+ ret = wait_session_msg(inst);
401
+ if (ret)
402
+ return ret;
403
+ }
401404
402405 return 0;
403406 }
....@@ -517,3 +520,8 @@
517520 {
518521 venus_hfi_destroy(core);
519522 }
523
+
524
+void hfi_reinit(struct venus_core *core)
525
+{
526
+ venus_hfi_queues_reinit(core);
527
+}