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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*
* 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 VPU_INTERFACE_H_
#define VPU_INTERFACE_H_
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include "vpu-framemgr.h"
#include "vpu-slab.h"
#define VPU_WORK_MAX_COUNT 20
#define VPU_WORK_MAX_DATA 24
#define VPU_COMMAND_TIMEOUT (3 * HZ)
struct vpu_work {
struct list_head list;
u32 valid:1;
u32 id;
u32 message;
u32 param0;
u32 param1;
u32 param2;
u32 param3;
u8 data[VPU_WORK_MAX_DATA];
};
struct vpu_work_list {
struct vpu_work work[VPU_WORK_MAX_COUNT];
spinlock_t slock;
struct list_head free_head;
u32 free_cnt;
struct list_head reply_head;
u32 reply_cnt;
wait_queue_head_t wait_queue;
};
enum vpu_interface_state {
VPU_ITF_STATE_OPEN,
VPU_ITF_STATE_ENUM,
VPU_ITF_STATE_START
};
struct vpu_interface {
void __iomem *code;
resource_size_t code_size;
void __iomem *regs;
resource_size_t regs_size;
unsigned long state;
struct vpu_slab_allocator slab;
struct vpu_framemgr framemgr;
void *cookie;
u32 done_cnt;
struct vpu_frame *request[VPU_MAX_GRAPH];
struct mutex request_barrier;
struct vpu_work reply[VPU_MAX_GRAPH];
wait_queue_head_t reply_queue;
struct vpu_frame *process;
spinlock_t process_barrier;
struct vpu_work_list work_list;
struct work_struct work_queue;
struct timer_list timer;
void *private_data;
};
int vpu_interface_probe(struct vpu_interface *interface,
struct device *dev,
void __iomem *code,
resource_size_t code_size,
void __iomem *regs,
resource_size_t regs_size,
u32 irq0, u32 irq1);
int vpu_interface_open(struct vpu_interface *interface);
int vpu_interface_close(struct vpu_interface *interface);
int vpu_interface_start(struct vpu_interface *interface);
int vpu_interface_stop(struct vpu_interface *interface);
void vpu_interface_print(struct vpu_interface *interface);
int vpu_hw_enum(struct vpu_interface *interface);
int vpu_hw_init(struct vpu_interface *interface, struct vpu_frame *iframe);
int vpu_hw_create(struct vpu_interface *interface, struct vpu_frame *iframe);
int vpu_hw_destroy(struct vpu_interface *interface, struct vpu_frame *iframe);
int vpu_hw_allocate(struct vpu_interface *interface, struct vpu_frame *iframe);
int vpu_hw_process(struct vpu_interface *interface, struct vpu_frame *iframe);
int vpu_hw_power_down(struct vpu_interface *interface);
#endif
|