.. | .. |
---|
16 | 16 | #include <linux/dma-mapping.h> |
---|
17 | 17 | #include <linux/err.h> |
---|
18 | 18 | #include <linux/fb.h> |
---|
| 19 | +#include <linux/fdtable.h> |
---|
19 | 20 | #include <linux/fs.h> |
---|
20 | 21 | #include <linux/init.h> |
---|
21 | 22 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
48 | 49 | |
---|
49 | 50 | #include <linux/iommu.h> |
---|
50 | 51 | #include <linux/iova.h> |
---|
51 | | -#include <linux/dma-iommu.h> |
---|
52 | 52 | #include <linux/pagemap.h> |
---|
53 | 53 | |
---|
54 | 54 | #ifdef CONFIG_DMABUF_CACHE |
---|
.. | .. |
---|
86 | 86 | #define STR(x) STR_HELPER(x) |
---|
87 | 87 | |
---|
88 | 88 | #define DRIVER_MAJOR_VERISON 1 |
---|
89 | | -#define DRIVER_MINOR_VERSION 2 |
---|
90 | | -#define DRIVER_REVISION_VERSION 20 |
---|
| 89 | +#define DRIVER_MINOR_VERSION 3 |
---|
| 90 | +#define DRIVER_REVISION_VERSION 1 |
---|
91 | 91 | #define DRIVER_PATCH_VERSION |
---|
92 | 92 | |
---|
93 | 93 | #define DRIVER_VERSION (STR(DRIVER_MAJOR_VERISON) "." STR(DRIVER_MINOR_VERSION) \ |
---|
.. | .. |
---|
97 | 97 | #define RGA_JOB_TIMEOUT_DELAY HZ |
---|
98 | 98 | #define RGA_RESET_TIMEOUT 1000 |
---|
99 | 99 | |
---|
100 | | -#define RGA_MAX_SCHEDULER 3 |
---|
| 100 | +#define RGA_MAX_SCHEDULER RGA_HW_SIZE |
---|
101 | 101 | #define RGA_MAX_BUS_CLK 10 |
---|
102 | 102 | |
---|
103 | 103 | #define RGA_BUFFER_POOL_MAX_SIZE 64 |
---|
.. | .. |
---|
135 | 135 | RGA_SCHEDULER_IDLE = 0, |
---|
136 | 136 | RGA_SCHEDULER_WORKING, |
---|
137 | 137 | RGA_SCHEDULER_ABORT, |
---|
| 138 | +}; |
---|
| 139 | + |
---|
| 140 | +enum rga_job_state { |
---|
| 141 | + RGA_JOB_STATE_PENDING = 0, |
---|
| 142 | + RGA_JOB_STATE_PREPARE, |
---|
| 143 | + RGA_JOB_STATE_RUNNING, |
---|
| 144 | + RGA_JOB_STATE_FINISH, |
---|
| 145 | + RGA_JOB_STATE_DONE, |
---|
| 146 | + RGA_JOB_STATE_INTR_ERR, |
---|
| 147 | + RGA_JOB_STATE_HW_TIMEOUT, |
---|
| 148 | + RGA_JOB_STATE_ABORT, |
---|
138 | 149 | }; |
---|
139 | 150 | |
---|
140 | 151 | struct rga_iommu_dma_cookie { |
---|
.. | .. |
---|
261 | 272 | struct rga_req rga_command_base; |
---|
262 | 273 | uint32_t cmd_reg[32 * 8]; |
---|
263 | 274 | struct rga_full_csc full_csc; |
---|
| 275 | + struct rga_csc_clip full_csc_clip; |
---|
264 | 276 | struct rga_pre_intr_info pre_intr_info; |
---|
265 | 277 | |
---|
266 | 278 | struct rga_job_buffer src_buffer; |
---|
.. | .. |
---|
285 | 297 | int ret; |
---|
286 | 298 | pid_t pid; |
---|
287 | 299 | bool use_batch_mode; |
---|
| 300 | + |
---|
| 301 | + struct kref refcount; |
---|
| 302 | + unsigned long state; |
---|
| 303 | + uint32_t intr_status; |
---|
| 304 | + uint32_t hw_status; |
---|
| 305 | + uint32_t cmd_status; |
---|
288 | 306 | }; |
---|
289 | 307 | |
---|
290 | 308 | struct rga_backend_ops { |
---|
.. | .. |
---|
292 | 310 | int (*set_reg)(struct rga_job *job, struct rga_scheduler_t *scheduler); |
---|
293 | 311 | int (*init_reg)(struct rga_job *job); |
---|
294 | 312 | void (*soft_reset)(struct rga_scheduler_t *scheduler); |
---|
| 313 | + int (*read_back_reg)(struct rga_job *job, struct rga_scheduler_t *scheduler); |
---|
| 314 | + int (*irq)(struct rga_scheduler_t *scheduler); |
---|
| 315 | + int (*isr_thread)(struct rga_job *job, struct rga_scheduler_t *scheduler); |
---|
295 | 316 | }; |
---|
296 | 317 | |
---|
297 | 318 | struct rga_timer { |
---|
.. | .. |
---|
359 | 380 | */ |
---|
360 | 381 | struct mm_struct *current_mm; |
---|
361 | 382 | |
---|
| 383 | + struct rga_feature feature; |
---|
362 | 384 | /* TODO: add some common work */ |
---|
363 | 385 | }; |
---|
364 | 386 | |
---|
.. | .. |
---|
421 | 443 | struct rga_match_data_t { |
---|
422 | 444 | const char * const *clks; |
---|
423 | 445 | int num_clks; |
---|
424 | | - const struct rga_irqs_data_t *irqs; |
---|
425 | | - int num_irqs; |
---|
426 | 446 | }; |
---|
427 | 447 | |
---|
428 | 448 | static inline int rga_read(int offset, struct rga_scheduler_t *scheduler) |
---|