• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * g2d_bsp/g2d_bsp.h
3  *
4  * Copyright (c) 2007-2019 Allwinnertech Co., Ltd.
5  * Author: zhengxiaobin <zhengxiaobin@allwinnertech.com>
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17 #ifndef __G2D_BSP_H
18 #define __G2D_BSP_H
19 
20 #include "linux/kernel.h"
21 #include "linux/mm.h"
22 #include <asm/uaccess.h>
23 /*#include <asm/memory.h>*/
24 #include <linux/uaccess.h>
25 #include <asm/unistd.h>
26 #include "linux/semaphore.h"
27 #include <linux/vmalloc.h>
28 #include <linux/fs.h>
29 #include <linux/types.h>
30 #include <linux/dma-mapping.h>
31 #include <linux/fb.h>
32 #include <linux/sched.h>
33 #include <linux/kthread.h>
34 #include <linux/err.h>
35 #include <linux/delay.h>
36 #include <linux/platform_device.h>
37 #include "asm-generic/int-ll64.h"
38 #include <linux/module.h>
39 #include <linux/errno.h>
40 #include <linux/slab.h>
41 #include <linux/delay.h>
42 #include <linux/init.h>
43 #include <linux/dma-mapping.h>
44 #include <linux/interrupt.h>
45 #include <linux/platform_device.h>
46 #include <linux/clk.h>
47 #include <linux/cdev.h>
48 #include <linux/types.h>
49 #include <linux/of_irq.h>
50 #include <linux/of_address.h>
51 #include <linux/of_iommu.h>
52 #include <linux/of_device.h>
53 #include <linux/of_platform.h>
54 #include <linux/string.h>
55 #include <sunxi-g2d.h>
56 #include <linux/dma-buf.h>
57 #include <linux/reset.h>
58 
59 #define G2D_FINISH_IRQ		(1<<8)
60 #define G2D_ERROR_IRQ			(1<<9)
61 
62 extern __u32 dbg_info;
63 
64 #define G2D_INFO_MSG(fmt, args...) \
65 	do {\
66 		if (dbg_info)\
67 		pr_info("[G2D] (%s) line:%d: " fmt, __func__, __LINE__, ##args);\
68 	} while (0)
69 
70 #define G2D_ERR_MSG(fmt, args...) \
71 	do {\
72 		pr_warn("[G2D] (%s) line:%d: " fmt, __func__, __LINE__, ##args);\
73 	} while (0)
74 
75 typedef struct {
76 	unsigned long g2d_base;
77 } g2d_init_para;
78 
79 typedef struct {
80 	g2d_init_para init_para;
81 } g2d_dev_t;
82 
83 typedef enum {
84 	G2D_RGB2YUV_709,
85 	G2D_YUV2RGB_709,
86 	G2D_RGB2YUV_601,
87 	G2D_YUV2RGB_601,
88 	G2D_RGB2YUV_2020,
89 	G2D_YUV2RGB_2020,
90 } g2d_csc_sel;
91 
92 typedef enum {
93 	VSU_FORMAT_YUV422 = 0x00,
94 	VSU_FORMAT_YUV420 = 0x01,
95 	VSU_FORMAT_YUV411 = 0x02,
96 	VSU_FORMAT_RGB = 0x03,
97 	VSU_FORMAT_BUTT = 0x04,
98 } vsu_pixel_format;
99 
100 #define VSU_ZOOM0_SIZE	1
101 #define VSU_ZOOM1_SIZE	8
102 #define VSU_ZOOM2_SIZE	4
103 #define VSU_ZOOM3_SIZE	1
104 #define VSU_ZOOM4_SIZE	1
105 #define VSU_ZOOM5_SIZE	1
106 
107 #define VSU_PHASE_NUM            32
108 #define VSU_PHASE_FRAC_BITWIDTH  19
109 #define VSU_PHASE_FRAC_REG_SHIFT 1
110 #define VSU_FB_FRAC_BITWIDTH     32
111 
112 #define VI_LAYER_NUMBER 1
113 #define UI_LAYER_NUMBER 3
114 
115 
116 #endif	/* __G2D_BSP_H */
117 
118