WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / litevideo / litevideo.h
blobc0fbaaa83d9f501be04cdbaf90bd309acef81048
1 /* SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2020 Antmicro <www.antmicro.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef _LITEVIDEO_LITEVIDEO_H_
16 #define _LITEVIDEO_LITEVIDEO_H_
18 #include <drm/drm.h>
19 #include <linux/of.h>
20 #include <linux/clk.h>
21 #include <linux/wait.h>
23 /* register offsets */
25 #define LITEVIDEO_CORE_HRES_OFF 0x1c
26 #define LITEVIDEO_CORE_HSYNC_START_OFF 0x24
27 #define LITEVIDEO_CORE_HSYNC_END_OFF 0x2c
28 #define LITEVIDEO_CORE_HSCAN_OFF 0x34
29 #define LITEVIDEO_CORE_VRES_OFF 0x3c
30 #define LITEVIDEO_CORE_VSYNC_START_OFF 0x44
31 #define LITEVIDEO_CORE_VSYNC_END_OFF 0x4c
32 #define LITEVIDEO_CORE_VSCAN_OFF 0x54
34 #define LITEVIDEO_MMCM_WRITE_OFF 0x94
35 #define LITEVIDEO_MMCM_READY_OFF 0x98
36 #define LITEVIDEO_MMCM_ADDR_OFF 0x9c
37 #define LITEVIDEO_MMCM_DATA_OFF 0xa0
39 #define LITEVIDEO_DMA_ENABLE_OFF 0x18
40 #define LITEVIDEO_DMA_BASE_ADDR_OFF 0x5c
41 #define LITEVIDEO_DMA_LENGTH_OFF 0x6c
43 /* register sizes */
45 #define LITEVIDEO_CORE_HRES_SIZE 2
46 #define LITEVIDEO_CORE_HSYNC_START_SIZE 2
47 #define LITEVIDEO_CORE_HSYNC_END_SIZE 2
48 #define LITEVIDEO_CORE_HSCAN_SIZE 2
49 #define LITEVIDEO_CORE_VRES_SIZE 2
50 #define LITEVIDEO_CORE_VSYNC_START_SIZE 2
51 #define LITEVIDEO_CORE_VSYNC_END_SIZE 2
52 #define LITEVIDEO_CORE_VSCAN_SIZE 2
54 #define LITEVIDEO_MMCM_WRITE_SIZE 1
55 #define LITEVIDEO_MMCM_READY_SIZE 1
56 #define LITEVIDEO_MMCM_ADDR_SIZE 1
57 #define LITEVIDEO_MMCM_DATA_SIZE 2
59 #define LITEVIDEO_DMA_ENABLE_SIZE 1
60 #define LITEVIDEO_DMA_BASE_ADDR_SIZE 4
61 #define LITEVIDEO_DMA_LENGTH_SIZE 4
63 /* constants */
65 /* clk100 has to be used for LiteX VideoOut */
66 #define LITEVIDEO_IDEAL_DIV_VALUE 10000
68 struct litevideo_prv {
69 struct drm_device *drm_dev;
70 void __iomem *base;
71 struct clk *hdmi_clk;
72 wait_queue_head_t wq;
73 u32 h_active;
74 u32 h_blanking;
75 u32 h_front_porch;
76 u32 h_sync;
77 u32 v_active;
78 u32 v_blanking;
79 u32 v_front_porch;
80 u32 v_sync;
81 u32 dma_offset;
82 u32 dma_length;
83 u32 pixel_clock;
86 #endif /* _LITEVIDEO_LITEVIDEO_H_ */