Skip to content

Commit 4b11cb7

Browse files
committed
drm/ingenic: Move register definitions to ingenic-drm.h
Move the register definitions to ingenic-drm.h, to keep ingenic-drm-drv.c tidy. v2: Fix SPDX license tag v3: No change Signed-off-by: Paul Cercueil <paul@crapouillou.net> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200716163846.174790-7-paul@crapouillou.net
1 parent e5507d2 commit 4b11cb7

2 files changed

Lines changed: 128 additions & 114 deletions

File tree

‎drivers/gpu/drm/ingenic/ingenic-drm-drv.c‎

Lines changed: 2 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//
55
// Copyright (C) 2019, Paul Cercueil <paul@crapouillou.net>
66

7+
#include "ingenic-drm.h"
8+
79
#include <linux/clk.h>
810
#include <linux/dma-mapping.h>
911
#include <linux/module.h>
@@ -32,120 +34,6 @@
3234
#include <drm/drm_simple_kms_helper.h>
3335
#include <drm/drm_vblank.h>
3436

35-
#define JZ_REG_LCD_CFG 0x00
36-
#define JZ_REG_LCD_VSYNC 0x04
37-
#define JZ_REG_LCD_HSYNC 0x08
38-
#define JZ_REG_LCD_VAT 0x0C
39-
#define JZ_REG_LCD_DAH 0x10
40-
#define JZ_REG_LCD_DAV 0x14
41-
#define JZ_REG_LCD_PS 0x18
42-
#define JZ_REG_LCD_CLS 0x1C
43-
#define JZ_REG_LCD_SPL 0x20
44-
#define JZ_REG_LCD_REV 0x24
45-
#define JZ_REG_LCD_CTRL 0x30
46-
#define JZ_REG_LCD_STATE 0x34
47-
#define JZ_REG_LCD_IID 0x38
48-
#define JZ_REG_LCD_DA0 0x40
49-
#define JZ_REG_LCD_SA0 0x44
50-
#define JZ_REG_LCD_FID0 0x48
51-
#define JZ_REG_LCD_CMD0 0x4C
52-
#define JZ_REG_LCD_DA1 0x50
53-
#define JZ_REG_LCD_SA1 0x54
54-
#define JZ_REG_LCD_FID1 0x58
55-
#define JZ_REG_LCD_CMD1 0x5C
56-
57-
#define JZ_LCD_CFG_SLCD BIT(31)
58-
#define JZ_LCD_CFG_PS_DISABLE BIT(23)
59-
#define JZ_LCD_CFG_CLS_DISABLE BIT(22)
60-
#define JZ_LCD_CFG_SPL_DISABLE BIT(21)
61-
#define JZ_LCD_CFG_REV_DISABLE BIT(20)
62-
#define JZ_LCD_CFG_HSYNCM BIT(19)
63-
#define JZ_LCD_CFG_PCLKM BIT(18)
64-
#define JZ_LCD_CFG_INV BIT(17)
65-
#define JZ_LCD_CFG_SYNC_DIR BIT(16)
66-
#define JZ_LCD_CFG_PS_POLARITY BIT(15)
67-
#define JZ_LCD_CFG_CLS_POLARITY BIT(14)
68-
#define JZ_LCD_CFG_SPL_POLARITY BIT(13)
69-
#define JZ_LCD_CFG_REV_POLARITY BIT(12)
70-
#define JZ_LCD_CFG_HSYNC_ACTIVE_LOW BIT(11)
71-
#define JZ_LCD_CFG_PCLK_FALLING_EDGE BIT(10)
72-
#define JZ_LCD_CFG_DE_ACTIVE_LOW BIT(9)
73-
#define JZ_LCD_CFG_VSYNC_ACTIVE_LOW BIT(8)
74-
#define JZ_LCD_CFG_18_BIT BIT(7)
75-
#define JZ_LCD_CFG_PDW (BIT(5) | BIT(4))
76-
77-
#define JZ_LCD_CFG_MODE_GENERIC_16BIT 0
78-
#define JZ_LCD_CFG_MODE_GENERIC_18BIT BIT(7)
79-
#define JZ_LCD_CFG_MODE_GENERIC_24BIT BIT(6)
80-
81-
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_1 1
82-
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_2 2
83-
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_3 3
84-
85-
#define JZ_LCD_CFG_MODE_TV_OUT_P 4
86-
#define JZ_LCD_CFG_MODE_TV_OUT_I 6
87-
88-
#define JZ_LCD_CFG_MODE_SINGLE_COLOR_STN 8
89-
#define JZ_LCD_CFG_MODE_SINGLE_MONOCHROME_STN 9
90-
#define JZ_LCD_CFG_MODE_DUAL_COLOR_STN 10
91-
#define JZ_LCD_CFG_MODE_DUAL_MONOCHROME_STN 11
92-
93-
#define JZ_LCD_CFG_MODE_8BIT_SERIAL 12
94-
#define JZ_LCD_CFG_MODE_LCM 13
95-
96-
#define JZ_LCD_VSYNC_VPS_OFFSET 16
97-
#define JZ_LCD_VSYNC_VPE_OFFSET 0
98-
99-
#define JZ_LCD_HSYNC_HPS_OFFSET 16
100-
#define JZ_LCD_HSYNC_HPE_OFFSET 0
101-
102-
#define JZ_LCD_VAT_HT_OFFSET 16
103-
#define JZ_LCD_VAT_VT_OFFSET 0
104-
105-
#define JZ_LCD_DAH_HDS_OFFSET 16
106-
#define JZ_LCD_DAH_HDE_OFFSET 0
107-
108-
#define JZ_LCD_DAV_VDS_OFFSET 16
109-
#define JZ_LCD_DAV_VDE_OFFSET 0
110-
111-
#define JZ_LCD_CTRL_BURST_4 (0x0 << 28)
112-
#define JZ_LCD_CTRL_BURST_8 (0x1 << 28)
113-
#define JZ_LCD_CTRL_BURST_16 (0x2 << 28)
114-
#define JZ_LCD_CTRL_RGB555 BIT(27)
115-
#define JZ_LCD_CTRL_OFUP BIT(26)
116-
#define JZ_LCD_CTRL_FRC_GRAYSCALE_16 (0x0 << 24)
117-
#define JZ_LCD_CTRL_FRC_GRAYSCALE_4 (0x1 << 24)
118-
#define JZ_LCD_CTRL_FRC_GRAYSCALE_2 (0x2 << 24)
119-
#define JZ_LCD_CTRL_PDD_MASK (0xff << 16)
120-
#define JZ_LCD_CTRL_EOF_IRQ BIT(13)
121-
#define JZ_LCD_CTRL_SOF_IRQ BIT(12)
122-
#define JZ_LCD_CTRL_OFU_IRQ BIT(11)
123-
#define JZ_LCD_CTRL_IFU0_IRQ BIT(10)
124-
#define JZ_LCD_CTRL_IFU1_IRQ BIT(9)
125-
#define JZ_LCD_CTRL_DD_IRQ BIT(8)
126-
#define JZ_LCD_CTRL_QDD_IRQ BIT(7)
127-
#define JZ_LCD_CTRL_REVERSE_ENDIAN BIT(6)
128-
#define JZ_LCD_CTRL_LSB_FISRT BIT(5)
129-
#define JZ_LCD_CTRL_DISABLE BIT(4)
130-
#define JZ_LCD_CTRL_ENABLE BIT(3)
131-
#define JZ_LCD_CTRL_BPP_1 0x0
132-
#define JZ_LCD_CTRL_BPP_2 0x1
133-
#define JZ_LCD_CTRL_BPP_4 0x2
134-
#define JZ_LCD_CTRL_BPP_8 0x3
135-
#define JZ_LCD_CTRL_BPP_15_16 0x4
136-
#define JZ_LCD_CTRL_BPP_18_24 0x5
137-
#define JZ_LCD_CTRL_BPP_MASK (JZ_LCD_CTRL_RGB555 | (0x7 << 0))
138-
139-
#define JZ_LCD_CMD_SOF_IRQ BIT(31)
140-
#define JZ_LCD_CMD_EOF_IRQ BIT(30)
141-
#define JZ_LCD_CMD_ENABLE_PAL BIT(28)
142-
143-
#define JZ_LCD_SYNC_MASK 0x3ff
144-
145-
#define JZ_LCD_STATE_EOF_IRQ BIT(5)
146-
#define JZ_LCD_STATE_SOF_IRQ BIT(4)
147-
#define JZ_LCD_STATE_DISABLED BIT(0)
148-
14937
struct ingenic_dma_hwdesc {
15038
u32 next;
15139
u32 addr;
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
//
3+
// Ingenic JZ47xx KMS driver - Register definitions and private API
4+
//
5+
// Copyright (C) 2020, Paul Cercueil <paul@crapouillou.net>
6+
7+
#ifndef DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H
8+
#define DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H
9+
10+
#include <linux/bitops.h>
11+
12+
#define JZ_REG_LCD_CFG 0x00
13+
#define JZ_REG_LCD_VSYNC 0x04
14+
#define JZ_REG_LCD_HSYNC 0x08
15+
#define JZ_REG_LCD_VAT 0x0C
16+
#define JZ_REG_LCD_DAH 0x10
17+
#define JZ_REG_LCD_DAV 0x14
18+
#define JZ_REG_LCD_PS 0x18
19+
#define JZ_REG_LCD_CLS 0x1C
20+
#define JZ_REG_LCD_SPL 0x20
21+
#define JZ_REG_LCD_REV 0x24
22+
#define JZ_REG_LCD_CTRL 0x30
23+
#define JZ_REG_LCD_STATE 0x34
24+
#define JZ_REG_LCD_IID 0x38
25+
#define JZ_REG_LCD_DA0 0x40
26+
#define JZ_REG_LCD_SA0 0x44
27+
#define JZ_REG_LCD_FID0 0x48
28+
#define JZ_REG_LCD_CMD0 0x4C
29+
#define JZ_REG_LCD_DA1 0x50
30+
#define JZ_REG_LCD_SA1 0x54
31+
#define JZ_REG_LCD_FID1 0x58
32+
#define JZ_REG_LCD_CMD1 0x5C
33+
34+
#define JZ_LCD_CFG_SLCD BIT(31)
35+
#define JZ_LCD_CFG_PS_DISABLE BIT(23)
36+
#define JZ_LCD_CFG_CLS_DISABLE BIT(22)
37+
#define JZ_LCD_CFG_SPL_DISABLE BIT(21)
38+
#define JZ_LCD_CFG_REV_DISABLE BIT(20)
39+
#define JZ_LCD_CFG_HSYNCM BIT(19)
40+
#define JZ_LCD_CFG_PCLKM BIT(18)
41+
#define JZ_LCD_CFG_INV BIT(17)
42+
#define JZ_LCD_CFG_SYNC_DIR BIT(16)
43+
#define JZ_LCD_CFG_PS_POLARITY BIT(15)
44+
#define JZ_LCD_CFG_CLS_POLARITY BIT(14)
45+
#define JZ_LCD_CFG_SPL_POLARITY BIT(13)
46+
#define JZ_LCD_CFG_REV_POLARITY BIT(12)
47+
#define JZ_LCD_CFG_HSYNC_ACTIVE_LOW BIT(11)
48+
#define JZ_LCD_CFG_PCLK_FALLING_EDGE BIT(10)
49+
#define JZ_LCD_CFG_DE_ACTIVE_LOW BIT(9)
50+
#define JZ_LCD_CFG_VSYNC_ACTIVE_LOW BIT(8)
51+
#define JZ_LCD_CFG_18_BIT BIT(7)
52+
#define JZ_LCD_CFG_PDW (BIT(5) | BIT(4))
53+
54+
#define JZ_LCD_CFG_MODE_GENERIC_16BIT 0
55+
#define JZ_LCD_CFG_MODE_GENERIC_18BIT BIT(7)
56+
#define JZ_LCD_CFG_MODE_GENERIC_24BIT BIT(6)
57+
58+
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_1 1
59+
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_2 2
60+
#define JZ_LCD_CFG_MODE_SPECIAL_TFT_3 3
61+
62+
#define JZ_LCD_CFG_MODE_TV_OUT_P 4
63+
#define JZ_LCD_CFG_MODE_TV_OUT_I 6
64+
65+
#define JZ_LCD_CFG_MODE_SINGLE_COLOR_STN 8
66+
#define JZ_LCD_CFG_MODE_SINGLE_MONOCHROME_STN 9
67+
#define JZ_LCD_CFG_MODE_DUAL_COLOR_STN 10
68+
#define JZ_LCD_CFG_MODE_DUAL_MONOCHROME_STN 11
69+
70+
#define JZ_LCD_CFG_MODE_8BIT_SERIAL 12
71+
#define JZ_LCD_CFG_MODE_LCM 13
72+
73+
#define JZ_LCD_VSYNC_VPS_OFFSET 16
74+
#define JZ_LCD_VSYNC_VPE_OFFSET 0
75+
76+
#define JZ_LCD_HSYNC_HPS_OFFSET 16
77+
#define JZ_LCD_HSYNC_HPE_OFFSET 0
78+
79+
#define JZ_LCD_VAT_HT_OFFSET 16
80+
#define JZ_LCD_VAT_VT_OFFSET 0
81+
82+
#define JZ_LCD_DAH_HDS_OFFSET 16
83+
#define JZ_LCD_DAH_HDE_OFFSET 0
84+
85+
#define JZ_LCD_DAV_VDS_OFFSET 16
86+
#define JZ_LCD_DAV_VDE_OFFSET 0
87+
88+
#define JZ_LCD_CTRL_BURST_4 (0x0 << 28)
89+
#define JZ_LCD_CTRL_BURST_8 (0x1 << 28)
90+
#define JZ_LCD_CTRL_BURST_16 (0x2 << 28)
91+
#define JZ_LCD_CTRL_RGB555 BIT(27)
92+
#define JZ_LCD_CTRL_OFUP BIT(26)
93+
#define JZ_LCD_CTRL_FRC_GRAYSCALE_16 (0x0 << 24)
94+
#define JZ_LCD_CTRL_FRC_GRAYSCALE_4 (0x1 << 24)
95+
#define JZ_LCD_CTRL_FRC_GRAYSCALE_2 (0x2 << 24)
96+
#define JZ_LCD_CTRL_PDD_MASK (0xff << 16)
97+
#define JZ_LCD_CTRL_EOF_IRQ BIT(13)
98+
#define JZ_LCD_CTRL_SOF_IRQ BIT(12)
99+
#define JZ_LCD_CTRL_OFU_IRQ BIT(11)
100+
#define JZ_LCD_CTRL_IFU0_IRQ BIT(10)
101+
#define JZ_LCD_CTRL_IFU1_IRQ BIT(9)
102+
#define JZ_LCD_CTRL_DD_IRQ BIT(8)
103+
#define JZ_LCD_CTRL_QDD_IRQ BIT(7)
104+
#define JZ_LCD_CTRL_REVERSE_ENDIAN BIT(6)
105+
#define JZ_LCD_CTRL_LSB_FISRT BIT(5)
106+
#define JZ_LCD_CTRL_DISABLE BIT(4)
107+
#define JZ_LCD_CTRL_ENABLE BIT(3)
108+
#define JZ_LCD_CTRL_BPP_1 0x0
109+
#define JZ_LCD_CTRL_BPP_2 0x1
110+
#define JZ_LCD_CTRL_BPP_4 0x2
111+
#define JZ_LCD_CTRL_BPP_8 0x3
112+
#define JZ_LCD_CTRL_BPP_15_16 0x4
113+
#define JZ_LCD_CTRL_BPP_18_24 0x5
114+
#define JZ_LCD_CTRL_BPP_MASK (JZ_LCD_CTRL_RGB555 | 0x7)
115+
116+
#define JZ_LCD_CMD_SOF_IRQ BIT(31)
117+
#define JZ_LCD_CMD_EOF_IRQ BIT(30)
118+
#define JZ_LCD_CMD_ENABLE_PAL BIT(28)
119+
120+
#define JZ_LCD_SYNC_MASK 0x3ff
121+
122+
#define JZ_LCD_STATE_EOF_IRQ BIT(5)
123+
#define JZ_LCD_STATE_SOF_IRQ BIT(4)
124+
#define JZ_LCD_STATE_DISABLED BIT(0)
125+
126+
#endif /* DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H */

0 commit comments

Comments
 (0)