summaryrefstree
path: root/kernel/drivers/vision/npu/npu-device.h
blob: d3ade7cb5dc1e46fd748042bdc111d5e7edac74e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * 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_DEVICE_H_
#define _NPU_DEVICE_H_

#include "vision-dev.h"
#include "npu-log.h"
#include "npu-debug.h"
#include "npu-vertex.h"
#include "npu-system.h"
#include "npu-protodrv.h"
#include "npu-sessionmgr.h"

#ifdef CONFIG_NPU_HARDWARE
//#include "interface/hardware/npu-interface.h"
#endif

#ifdef CONFIG_NPU_GOLDEN_MATCH
#include "npu-golden.h"
#endif

//#define NPU_MINOR	10
#define NPU_DEVICE_NAME	"npu-turing"
//#define NPU_VERTEX_NAME "vertex"


enum npu_device_state {
	NPU_DEVICE_STATE_OPEN,
	NPU_DEVICE_STATE_START
};

enum npu_device_mode {
	NPU_DEVICE_MODE_NORMAL,
	NPU_DEVICE_MODE_TEST
};

enum npu_device_err_state {
	NPU_DEVICE_ERR_STATE_EMERGENCY
};

struct npu_device {
	struct device *dev;
	unsigned long state;
	unsigned long err_state;
	u32 mode;
	struct npu_system system;
	struct npu_vertex vertex;
	struct npu_debug debug;
	struct npu_proto_drv *proto_drv;
	struct npu_sessionmgr sessionmgr;
#ifdef CONFIG_NPU_GOLDEN_MATCH
	struct npu_golden_ctx *npu_golden_ctx;
#endif
	int magic;
};

int npu_device_open(struct npu_device *device);
int npu_device_close(struct npu_device *device);
int npu_device_start(struct npu_device *device);
int npu_device_stop(struct npu_device *device);

//int npu_device_emergency_recover(struct npu_device *device);
void npu_device_set_emergency_err(struct npu_device *device);
int npu_device_is_emergency_err(struct npu_device *device);
int npu_device_recovery_close(struct npu_device *device);
#endif // _NPU_DEVICE_H_