summaryrefstree
path: root/kernel/drivers/vision/npu/include/npu-binary.h
blob: 8370b10ce985ba289fe43437e6b7f582df7dfba7 (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
/*
 * Samsung Exynos SoC series VPU driver
 *
 * Copyright (c) 2015 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef NPU_BINARY_H_
#define NPU_BINARY_H_

#include <linux/device.h>
#include <linux/firmware.h>

#define NPU_FW_PATH1		"/data/"
#define NPU_FW_PATH2		"/vendor/firmware/"
#define NPU_FW_PATH3		"npu/"
#define NPU_FW_NAME		"NPU.bin"
#define NPU_FW_NAME_LEN	100
#define NPU_VERSION_SIZE	42

struct npu_binary {
	struct device		*dev;
	char			fpath1[NPU_FW_NAME_LEN]; /* first try to load */
	char			fpath2[NPU_FW_NAME_LEN]; /* second try to load */
	size_t			image_size;
};

#define NCP_BIN_PATH		"/data/"
#define NCP_BIN_NAME		"ncp_object.bin"
#define NCP_BIN_NAME_LEN	100
#define NCP_VERSION_SIZE	42

struct ncp_binary {
	struct device		*dev;
	char			fpath1[NCP_BIN_NAME_LEN]; /* first try to load */
	char			fpath2[NCP_BIN_NAME_LEN]; /* second try to load */
	size_t			image_size;
};

int npu_binary_init(struct npu_binary *binary,
	struct device *dev,
	char *fpath1,
	char *fpath2,
	char *fname);
int npu_binary_read(struct npu_binary *binary,
	void *target,
	size_t target_size);
int npu_firmware_file_read(struct npu_binary *binary,
	void *target,
	size_t target_size);
int npu_binary_write(struct npu_binary *binary,
	void *target,
	size_t target_size);
int npu_binary_g_size(struct npu_binary *binary, size_t *size);

#endif