blob: 6b5fd068d1df64a5a171aea51951dc5219cc7aa0 (
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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*
* StarFive Vout driver
*
* Copyright 2020 StarFive Inc.
*
* Licensed under the GPL-2.
*/
#ifndef __SF_FRAMEBUFFER_H__
#define __SF_FRAMEBUFFER_H__
#include <linux/fb.h>
#include <linux/miscdevice.h>
#define FB_MEM_SIZE 0x1000000
#define H_SIZE 1920//352//1920//1280
#define V_SIZE 1080//288//1080//720
#define H_SIZE_DST H_SIZE
#define V_SIZE_DST V_SIZE
#define H_WID 40
#define H_BP 220
#define H_FP 110
#define V_WID 5
#define V_BP 20
#define V_FP 5
#define VD_1080P 1080
#define VD_720P 720
#define VD_PAL 480
#define VD_HEIGHT_1080P VD_1080P
#define VD_WIDTH_1080P 1920
#define RGB_OFFSET_ADDR 0//H_SIZE*(PIX_BPP+1)
#define MIN_XRES 64
#define MIN_YRES 64
#define STARFIVEFB_RGB_IF (0x00000002)
#define STARFIVEFB_MIPI_IF (0x00000003)
#define STARFIVEFB_HDMI_IF (0x00000004)
#define STARFIVE_NAME "starfive"
#define BUFFER_NUMS 2
//sys registers
#define SYS_CONF_LCDC 0x00
#define SYS_CONF_PP 0x04
#define SYS_MAP_CONV 0x08
//pp ioctl
#define FBIOPAN_GET_PP_MODE 0x4609
#define FBIOPAN_SET_PP_MODE 0x460a
#define FBIOPAN_GET_PIX_FORMAT 0x460b
#define FBIOPAN_SET_PIX_FORMAT 0x460c
//vout clk registers
#define CLK_LCDC_OCLK_CTRL 0x14
struct res_name {
char name[10];
};
struct dis_panel_info {
const char *name;
// supported pixel format
int w;
int h;
int bpp;
int fps;
/* dpi parameters */
u32 dpi_pclk;
// pixels
int dpi_hsa;
int dpi_hbp;
int dpi_hfp;
// lines
int dpi_vsa;
int dpi_vbp;
int dpi_vfp;
/* dsi parameters */
int dphy_lanes;
u32 dphy_bps;
int dsi_burst_mode;
int dsi_sync_pulse;
// bytes
int dsi_hsa;
int dsi_hbp;
int dsi_hfp;
// lines
int dsi_vsa;
int dsi_vbp;
int dsi_vfp;
};
struct sf_fb_data {
struct device *dev;
char *dis_dev_name;
struct miscdevice stfbcdev;
int lcdc_irq;
int vpp0_irq;
int vpp1_irq;
int vpp2_irq;
void __iomem *base_clk;
void __iomem *base_rst;
void __iomem *base_syscfg;
void __iomem *base_vpp0;
void __iomem *base_vpp1;
void __iomem *base_vpp2;
void __iomem *base_dsitx;
void __iomem *base_lcdc;
struct notifier_block vin;
struct clk *mclk;
/*
* Hardware control information
*/
struct fb_info fb;
struct fb_videomode display_info; /* reparent video mode source*/
struct dis_panel_info panel_info; /* mipi parameters for panel */
unsigned int refresh_en;
unsigned int pixclock; /*lcdc_mclk*/
unsigned int buf_num; /* frame buffer number. */
unsigned int buf_size; /* frame buffer size. */
int cmap_inverse;
int cmap_static;
/* keep these registers in case we need to re-write palette */
u32 palette_buffer[256];
u32 pseudo_pal[16];
struct sf_fb_display_dev *display_dev;
struct pp_mode *pp;
int winNum;
int pp_conn_lcdc;
int ddr_format;
};
#endif
|