summaryrefstree
path: root/kernel/drivers/vision/npu/npu-vertex.h
blob: 34049e895db23969950b1783ff939595273493d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Samsung Exynos SoC series NPU driver
 *
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *              http://www.samsung.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef _NPU_VERTEX_H_
#define _NPU_VERTEX_H_

#include "vision-dev.h"
#include "vision-ioctl.h"
#include "npu-queue.h"

struct npu_vertex;

enum npu_vertex_state {
	NPU_VERTEX_OPEN,
	NPU_VERTEX_GRAPH,
	NPU_VERTEX_FORMAT,
	NPU_VERTEX_STREAMON,
	NPU_VERTEX_STREAMOFF,
	NPU_VERTEX_CLOSE
};

struct npu_vertex_refcount {
	atomic_t			refcount;
	struct npu_vertex		*vertex;
	int				(*first)(struct npu_vertex *vertex);
	int				(*final)(struct npu_vertex *vertex);
};

struct npu_vertex {
	struct mutex lock;
	struct vision_device vd;
	struct npu_vertex_refcount open_cnt;
	struct npu_vertex_refcount start_cnt;
};

struct npu_vertex_ctx {
	u32 state;
	u32 id;
	struct mutex lock;
	struct npu_queue queue;
	struct npu_vertex *vertex;
};

int npu_vertex_probe(struct npu_vertex *vertex, struct device *parent);
#endif