History

drm/sun4i: Rework DE2 register defines

Most, if not all, registers found in DE2 still exists in DE3. However, units are on different base addresses. To prepare for addition of DE3 support, registers macros are reworked so they take base address as parameter.

Jernej Skrabec committed 8 years ago

Commit 4b09c071 parent fb3ef5410 files · +219 −159Browse files

Unified · Split

10 files
  1. drivers/gpu/drm/sun4i/sun8i_mixer.c +9 −5
  2. drivers/gpu/drm/sun4i/sun8i_mixer.h +30 −14
  3. drivers/gpu/drm/sun4i/sun8i_ui_layer.c +30 −17
  4. drivers/gpu/drm/sun4i/sun8i_ui_layer.h +20 −17
  5. drivers/gpu/drm/sun4i/sun8i_ui_scaler.c +25 −16
  6. drivers/gpu/drm/sun4i/sun8i_ui_scaler.h +10 −17
  7. drivers/gpu/drm/sun4i/sun8i_vi_layer.c +30 −17
  8. drivers/gpu/drm/sun4i/sun8i_vi_layer.h +12 −11
  9. drivers/gpu/drm/sun4i/sun8i_vi_scaler.c +32 −21
  10. drivers/gpu/drm/sun4i/sun8i_vi_scaler.h +21 −24
drivers/gpu/drm/sun4i/sun8i_mixer.c+9−5
@@ -368,6 +368,7 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, · 367 unmodified lines
368368 struct sun8i_mixer *mixer;
369369 struct resource *res;
370370 void __iomem *regs;
371+ unsigned int base;
371372 int plane_cnt;
372373 int i, ret;
373374
@@ -456,6 +457,8 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, · 82 unmodified lines
456457
457458 list_add_tail(&mixer->engine.list, &drv->engine_list);
458459
460+ base = sun8i_blender_base(mixer);
461+
459462 /* Reset the registers */
460463 for (i = 0x0; i < 0x20000; i += 4)
461464 regmap_write(mixer->engine.regs, i, 0);
@@ -465,24 +468,25 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, · 3 unmodified lines
465468 SUN8I_MIXER_GLOBAL_CTL_RT_EN);
466469
467470 /* Set background color to black */
468− regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_BKCOLOR,
471+ regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_BKCOLOR(base),
469472 SUN8I_MIXER_BLEND_COLOR_BLACK);
470473
471474 /*
472475 * Set fill color of bottom plane to black. Generally not needed
473476 * except when VI plane is at bottom (zpos = 0) and enabled.
474477 */
475− regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL,
478+ regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(base),
476479 SUN8I_MIXER_BLEND_PIPE_CTL_FC_EN(0));
477− regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_ATTR_FCOLOR(0),
480+ regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, 0),
478481 SUN8I_MIXER_BLEND_COLOR_BLACK);
479482
480483 plane_cnt = mixer->cfg->vi_num + mixer->cfg->ui_num;
481484 for (i = 0; i < plane_cnt; i++)
482− regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_MODE(i),
485+ regmap_write(mixer->engine.regs,
486+ SUN8I_MIXER_BLEND_MODE(base, i),
483487 SUN8I_MIXER_BLEND_MODE_DEF);
484488
485− regmap_update_bits(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL,
489+ regmap_update_bits(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(base),
486490 SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK, 0);
487491
488492 return 0;
drivers/gpu/drm/sun4i/sun8i_mixer.h+30−14
@@ -29,20 +29,24 @@ · 28 unmodified lines
2929
3030 #define SUN8I_MIXER_GLOBAL_DBUFF_ENABLE BIT(0)
3131
32−#define SUN8I_MIXER_BLEND_PIPE_CTL 0x1000
33−#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(x) (0x1004 + 0x10 * (x) + 0x0)
34−#define SUN8I_MIXER_BLEND_ATTR_INSIZE(x) (0x1004 + 0x10 * (x) + 0x4)
35−#define SUN8I_MIXER_BLEND_ATTR_COORD(x) (0x1004 + 0x10 * (x) + 0x8)
36−#define SUN8I_MIXER_BLEND_ROUTE 0x1080
37−#define SUN8I_MIXER_BLEND_PREMULTIPLY 0x1084
38−#define SUN8I_MIXER_BLEND_BKCOLOR 0x1088
39−#define SUN8I_MIXER_BLEND_OUTSIZE 0x108c
40−#define SUN8I_MIXER_BLEND_MODE(x) (0x1090 + 0x04 * (x))
41−#define SUN8I_MIXER_BLEND_CK_CTL 0x10b0
42−#define SUN8I_MIXER_BLEND_CK_CFG 0x10b4
43−#define SUN8I_MIXER_BLEND_CK_MAX(x) (0x10c0 + 0x04 * (x))
44−#define SUN8I_MIXER_BLEND_CK_MIN(x) (0x10e0 + 0x04 * (x))
45−#define SUN8I_MIXER_BLEND_OUTCTL 0x10fc
32+#define DE2_BLD_BASE 0x1000
33+#define DE2_CH_BASE 0x2000
34+#define DE2_CH_SIZE 0x1000
35+
36+#define SUN8I_MIXER_BLEND_PIPE_CTL(base) ((base) + 0)
37+#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, x) ((base) + 0x4 + 0x10 * (x))
38+#define SUN8I_MIXER_BLEND_ATTR_INSIZE(base, x) ((base) + 0x8 + 0x10 * (x))
39+#define SUN8I_MIXER_BLEND_ATTR_COORD(base, x) ((base) + 0xc + 0x10 * (x))
40+#define SUN8I_MIXER_BLEND_ROUTE(base) ((base) + 0x80)
41+#define SUN8I_MIXER_BLEND_PREMULTIPLY(base) ((base) + 0x84)
42+#define SUN8I_MIXER_BLEND_BKCOLOR(base) ((base) + 0x88)
43+#define SUN8I_MIXER_BLEND_OUTSIZE(base) ((base) + 0x8c)
44+#define SUN8I_MIXER_BLEND_MODE(base, x) ((base) + 0x90 + 0x04 * (x))
45+#define SUN8I_MIXER_BLEND_CK_CTL(base) ((base) + 0xb0)
46+#define SUN8I_MIXER_BLEND_CK_CFG(base) ((base) + 0xb4)
47+#define SUN8I_MIXER_BLEND_CK_MAX(base, x) ((base) + 0xc0 + 0x04 * (x))
48+#define SUN8I_MIXER_BLEND_CK_MIN(base, x) ((base) + 0xe0 + 0x04 * (x))
49+#define SUN8I_MIXER_BLEND_OUTCTL(base) ((base) + 0xfc)
4650
4751 #define SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK GENMASK(12, 8)
4852 #define SUN8I_MIXER_BLEND_PIPE_CTL_EN(pipe) BIT(8 + pipe)
@@ -153,5 +157,17 @@ engine_to_sun8i_mixer(struct sunxi_engine *engine) · 104 unmodified lines
153157 return container_of(engine, struct sun8i_mixer, engine);
154158 }
155159
160+static inline u32
161+sun8i_blender_base(struct sun8i_mixer *mixer)
162+{
163+ return DE2_BLD_BASE;
164+}
165+
166+static inline u32
167+sun8i_channel_base(struct sun8i_mixer *mixer, int channel)
168+{
169+ return DE2_CH_BASE + channel * DE2_CH_SIZE;
170+}
171+
156172 const struct de2_fmt_info *sun8i_mixer_format_info(u32 format);
157173 #endif /* _SUN8I_MIXER_H_ */
drivers/gpu/drm/sun4i/sun8i_ui_layer.c+30−17
@@ -30,7 +30,10 @@ static void sun8i_ui_layer_enable(struct sun8i_mixer *mixer, int channel, · 29 unmodified lines
3030 int overlay, bool enable, unsigned int zpos,
3131 unsigned int old_zpos)
3232 {
33− u32 val;
33+ u32 val, bld_base, ch_base;
34+
35+ bld_base = sun8i_blender_base(mixer);
36+ ch_base = sun8i_channel_base(mixer, channel);
3437
3538 DRM_DEBUG_DRIVER("%sabling channel %d overlay %d\n",
3639 enable ? "En" : "Dis", channel, overlay);
@@ -41,17 +44,17 @@ static void sun8i_ui_layer_enable(struct sun8i_mixer *mixer, int channel, · 4 unmodified lines
4144 val = 0;
4245
4346 regmap_update_bits(mixer->engine.regs,
44− SUN8I_MIXER_CHAN_UI_LAYER_ATTR(channel, overlay),
47+ SUN8I_MIXER_CHAN_UI_LAYER_ATTR(ch_base, overlay),
4548 SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN, val);
4649
4750 if (!enable || zpos != old_zpos) {
4851 regmap_update_bits(mixer->engine.regs,
49− SUN8I_MIXER_BLEND_PIPE_CTL,
52+ SUN8I_MIXER_BLEND_PIPE_CTL(bld_base),
5053 SUN8I_MIXER_BLEND_PIPE_CTL_EN(old_zpos),
5154 0);
5255
5356 regmap_update_bits(mixer->engine.regs,
54− SUN8I_MIXER_BLEND_ROUTE,
57+ SUN8I_MIXER_BLEND_ROUTE(bld_base),
5558 SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(old_zpos),
5659 0);
5760 }
@@ -60,12 +63,13 @@ static void sun8i_ui_layer_enable(struct sun8i_mixer *mixer, int channel, · 2 unmodified lines
6063 val = SUN8I_MIXER_BLEND_PIPE_CTL_EN(zpos);
6164
6265 regmap_update_bits(mixer->engine.regs,
63− SUN8I_MIXER_BLEND_PIPE_CTL, val, val);
66+ SUN8I_MIXER_BLEND_PIPE_CTL(bld_base),
67+ val, val);
6468
6569 val = channel << SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(zpos);
6670
6771 regmap_update_bits(mixer->engine.regs,
68− SUN8I_MIXER_BLEND_ROUTE,
72+ SUN8I_MIXER_BLEND_ROUTE(bld_base),
6973 SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(zpos),
7074 val);
7175 }
@@ -77,12 +81,16 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 5 unmodified lines
7781 {
7882 struct drm_plane_state *state = plane->state;
7983 u32 src_w, src_h, dst_w, dst_h;
84+ u32 bld_base, ch_base;
8085 u32 outsize, insize;
8186 u32 hphase, vphase;
8287
8388 DRM_DEBUG_DRIVER("Updating UI channel %d overlay %d\n",
8489 channel, overlay);
8590
91+ bld_base = sun8i_blender_base(mixer);
92+ ch_base = sun8i_channel_base(mixer, channel);
93+
8694 src_w = drm_rect_width(&state->src) >> 16;
8795 src_h = drm_rect_height(&state->src) >> 16;
8896 dst_w = drm_rect_width(&state->dst);
@@ -103,8 +111,8 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 14 unmodified lines
103111 regmap_write(mixer->engine.regs,
104112 SUN8I_MIXER_GLOBAL_SIZE,
105113 outsize);
106− regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_OUTSIZE,
107− outsize);
114+ regmap_write(mixer->engine.regs,
115+ SUN8I_MIXER_BLEND_OUTSIZE(bld_base), outsize);
108116
109117 if (state->crtc)
110118 interlaced = state->crtc->state->adjusted_mode.flags
@@ -116,7 +124,7 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 5 unmodified lines
116124 val = 0;
117125
118126 regmap_update_bits(mixer->engine.regs,
119− SUN8I_MIXER_BLEND_OUTCTL,
127+ SUN8I_MIXER_BLEND_OUTCTL(bld_base),
120128 SUN8I_MIXER_BLEND_OUTCTL_INTERLACED,
121129 val);
122130
@@ -129,10 +137,10 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 6 unmodified lines
129137 state->src.x1 >> 16, state->src.y1 >> 16);
130138 DRM_DEBUG_DRIVER("Layer source size W: %d H: %d\n", src_w, src_h);
131139 regmap_write(mixer->engine.regs,
132− SUN8I_MIXER_CHAN_UI_LAYER_SIZE(channel, overlay),
140+ SUN8I_MIXER_CHAN_UI_LAYER_SIZE(ch_base, overlay),
133141 insize);
134142 regmap_write(mixer->engine.regs,
135− SUN8I_MIXER_CHAN_UI_OVL_SIZE(channel),
143+ SUN8I_MIXER_CHAN_UI_OVL_SIZE(ch_base),
136144 insize);
137145
138146 if (insize != outsize || hphase || vphase) {
@@ -156,10 +164,10 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 17 unmodified lines
156164 state->dst.x1, state->dst.y1);
157165 DRM_DEBUG_DRIVER("Layer destination size W: %d H: %d\n", dst_w, dst_h);
158166 regmap_write(mixer->engine.regs,
159− SUN8I_MIXER_BLEND_ATTR_COORD(zpos),
167+ SUN8I_MIXER_BLEND_ATTR_COORD(bld_base, zpos),
160168 SUN8I_MIXER_COORD(state->dst.x1, state->dst.y1));
161169 regmap_write(mixer->engine.regs,
162− SUN8I_MIXER_BLEND_ATTR_INSIZE(zpos),
170+ SUN8I_MIXER_BLEND_ATTR_INSIZE(bld_base, zpos),
163171 outsize);
164172
165173 return 0;
@@ -170,7 +178,9 @@ static int sun8i_ui_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 4 unmodified lines
170178 {
171179 struct drm_plane_state *state = plane->state;
172180 const struct de2_fmt_info *fmt_info;
173− u32 val;
181+ u32 val, ch_base;
182+
183+ ch_base = sun8i_channel_base(mixer, channel);
174184
175185 fmt_info = sun8i_mixer_format_info(state->fb->format->format);
176186 if (!fmt_info || !fmt_info->rgb) {
@@ -180,7 +190,7 @@ static int sun8i_ui_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 3 unmodified lines
180190
181191 val = fmt_info->de2_fmt << SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET;
182192 regmap_update_bits(mixer->engine.regs,
183− SUN8I_MIXER_CHAN_UI_LAYER_ATTR(channel, overlay),
193+ SUN8I_MIXER_CHAN_UI_LAYER_ATTR(ch_base, overlay),
184194 SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK, val);
185195
186196 return 0;
@@ -193,8 +203,11 @@ static int sun8i_ui_layer_update_buffer(struct sun8i_mixer *mixer, int channel, · 6 unmodified lines
193203 struct drm_framebuffer *fb = state->fb;
194204 struct drm_gem_cma_object *gem;
195205 dma_addr_t paddr;
206+ u32 ch_base;
196207 int bpp;
197208
209+ ch_base = sun8i_channel_base(mixer, channel);
210+
198211 /* Get the physical address of the buffer in memory */
199212 gem = drm_fb_cma_get_gem_obj(fb, 0);
200213
@@ -211,13 +224,13 @@ static int sun8i_ui_layer_update_buffer(struct sun8i_mixer *mixer, int channel, · 10 unmodified lines
211224 /* Set the line width */
212225 DRM_DEBUG_DRIVER("Layer line width: %d bytes\n", fb->pitches[0]);
213226 regmap_write(mixer->engine.regs,
214− SUN8I_MIXER_CHAN_UI_LAYER_PITCH(channel, overlay),
227+ SUN8I_MIXER_CHAN_UI_LAYER_PITCH(ch_base, overlay),
215228 fb->pitches[0]);
216229
217230 DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr);
218231
219232 regmap_write(mixer->engine.regs,
220− SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(channel, overlay),
233+ SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(ch_base, overlay),
221234 lower_32_bits(paddr));
222235
223236 return 0;
drivers/gpu/drm/sun4i/sun8i_ui_layer.h+20−17
@@ -18,23 +18,26 @@ · 17 unmodified lines
1818
1919 #include <drm/drm_plane.h>
2020
21−#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(ch, layer) \
22− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x0)
23−#define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(ch, layer) \
24− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x4)
25−#define SUN8I_MIXER_CHAN_UI_LAYER_COORD(ch, layer) \
26− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x8)
27−#define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(ch, layer) \
28− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0xc)
29−#define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(ch, layer) \
30− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x10)
31−#define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(ch, layer) \
32− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x14)
33−#define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(ch, layer) \
34− (0x2000 + 0x1000 * (ch) + 0x20 * (layer) + 0x18)
35−#define SUN8I_MIXER_CHAN_UI_TOP_HADDR(ch) (0x2000 + 0x1000 * (ch) + 0x80)
36−#define SUN8I_MIXER_CHAN_UI_BOT_HADDR(ch) (0x2000 + 0x1000 * (ch) + 0x84)
37−#define SUN8I_MIXER_CHAN_UI_OVL_SIZE(ch) (0x2000 + 0x1000 * (ch) + 0x88)
21+#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \
22+ ((base) + 0x20 * (layer) + 0x0)
23+#define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \
24+ ((base) + 0x20 * (layer) + 0x4)
25+#define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \
26+ ((base) + 0x20 * (layer) + 0x8)
27+#define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \
28+ ((base) + 0x20 * (layer) + 0xc)
29+#define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \
30+ ((base) + 0x20 * (layer) + 0x10)
31+#define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \
32+ ((base) + 0x20 * (layer) + 0x14)
33+#define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \
34+ ((base) + 0x20 * (layer) + 0x18)
35+#define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \
36+ ((base) + 0x80)
37+#define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \
38+ ((base) + 0x84)
39+#define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \
40+ ((base) + 0x88)
3841
3942 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN BIT(0)
4043 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1)
drivers/gpu/drm/sun4i/sun8i_ui_scaler.c+25−16
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 */
1111
1212 #include "sun8i_ui_scaler.h"
13+#include "sun8i_vi_scaler.h"
1314
1415 static const u32 lan2coefftab16[240] = {
1516 0x00004000, 0x00033ffe, 0x00063efc, 0x000a3bfb,
@@ -88,6 +89,14 @@ static const u32 lan2coefftab16[240] = { · 72 unmodified lines
8889 0x0b1c1603, 0x0d1c1502, 0x0e1d1401, 0x0f1d1301,
8990 };
9091
92+static u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel)
93+{
94+ int vi_num = mixer->cfg->vi_num;
95+
96+ return DE2_VI_SCALER_UNIT_BASE + DE2_VI_SCALER_UNIT_SIZE * vi_num +
97+ DE2_UI_SCALER_UNIT_SIZE * (channel - vi_num);
98+}
99+
91100 static int sun8i_ui_scaler_coef_index(unsigned int step)
92101 {
93102 unsigned int scale, int_part, float_part;
@@ -114,33 +123,35 @@ static int sun8i_ui_scaler_coef_index(unsigned int step) · 20 unmodified lines
114123
115124 void sun8i_ui_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable)
116125 {
117− int vi_cnt = mixer->cfg->vi_num;
118− u32 val;
126+ u32 val, base;
119127
120− if (WARN_ON(layer < vi_cnt))
128+ if (WARN_ON(layer < mixer->cfg->vi_num))
121129 return;
122130
131+ base = sun8i_ui_scaler_base(mixer, layer);
132+
123133 if (enable)
124134 val = SUN8I_SCALER_GSU_CTRL_EN |
125135 SUN8I_SCALER_GSU_CTRL_COEFF_RDY;
126136 else
127137 val = 0;
128138
129− regmap_write(mixer->engine.regs,
130− SUN8I_SCALER_GSU_CTRL(vi_cnt, layer - vi_cnt), val);
139+ regmap_write(mixer->engine.regs, SUN8I_SCALER_GSU_CTRL(base), val);
131140 }
132141
133142 void sun8i_ui_scaler_setup(struct sun8i_mixer *mixer, int layer,
134143 u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,
135144 u32 hscale, u32 vscale, u32 hphase, u32 vphase)
136145 {
137− int vi_cnt = mixer->cfg->vi_num;
138146 u32 insize, outsize;
139147 int i, offset;
148+ u32 base;
140149
141− if (WARN_ON(layer < vi_cnt))
150+ if (WARN_ON(layer < mixer->cfg->vi_num))
142151 return;
143152
153+ base = sun8i_ui_scaler_base(mixer, layer);
154+
144155 hphase <<= SUN8I_UI_SCALER_PHASE_FRAC - 16;
145156 vphase <<= SUN8I_UI_SCALER_PHASE_FRAC - 16;
146157 hscale <<= SUN8I_UI_SCALER_SCALE_FRAC - 16;
@@ -149,24 +160,22 @@ void sun8i_ui_scaler_setup(struct sun8i_mixer *mixer, int layer, · 2 unmodified lines
149160 insize = SUN8I_UI_SCALER_SIZE(src_w, src_h);
150161 outsize = SUN8I_UI_SCALER_SIZE(dst_w, dst_h);
151162
152− layer -= vi_cnt;
153−
154163 regmap_write(mixer->engine.regs,
155− SUN8I_SCALER_GSU_OUTSIZE(vi_cnt, layer), outsize);
164+ SUN8I_SCALER_GSU_OUTSIZE(base), outsize);
156165 regmap_write(mixer->engine.regs,
157− SUN8I_SCALER_GSU_INSIZE(vi_cnt, layer), insize);
166+ SUN8I_SCALER_GSU_INSIZE(base), insize);
158167 regmap_write(mixer->engine.regs,
159− SUN8I_SCALER_GSU_HSTEP(vi_cnt, layer), hscale);
168+ SUN8I_SCALER_GSU_HSTEP(base), hscale);
160169 regmap_write(mixer->engine.regs,
161− SUN8I_SCALER_GSU_VSTEP(vi_cnt, layer), vscale);
170+ SUN8I_SCALER_GSU_VSTEP(base), vscale);
162171 regmap_write(mixer->engine.regs,
163− SUN8I_SCALER_GSU_HPHASE(vi_cnt, layer), hphase);
172+ SUN8I_SCALER_GSU_HPHASE(base), hphase);
164173 regmap_write(mixer->engine.regs,
165− SUN8I_SCALER_GSU_VPHASE(vi_cnt, layer), vphase);
174+ SUN8I_SCALER_GSU_VPHASE(base), vphase);
166175 offset = sun8i_ui_scaler_coef_index(hscale) *
167176 SUN8I_UI_SCALER_COEFF_COUNT;
168177 for (i = 0; i < SUN8I_UI_SCALER_COEFF_COUNT; i++)
169178 regmap_write(mixer->engine.regs,
170− SUN8I_SCALER_GSU_HCOEFF(vi_cnt, layer, i),
179+ SUN8I_SCALER_GSU_HCOEFF(base, i),
171180 lan2coefftab16[offset + i]);
172181 }
drivers/gpu/drm/sun4i/sun8i_ui_scaler.h+10−17
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111
1212 #include "sun8i_mixer.h"
1313
14+#define DE2_UI_SCALER_UNIT_SIZE 0x10000
15+
1416 /* this two macros assumes 16 fractional bits which is standard in DRM */
1517 #define SUN8I_UI_SCALER_SCALE_MIN 1
1618 #define SUN8I_UI_SCALER_SCALE_MAX ((1UL << 20) - 1)
@@ -20,23 +22,14 @@ · 3 unmodified lines
2022 #define SUN8I_UI_SCALER_COEFF_COUNT 16
2123 #define SUN8I_UI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1))
2224
23−#define SUN8I_SCALER_GSU_CTRL(vi_cnt, ui_idx) \
24− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x0)
25−#define SUN8I_SCALER_GSU_OUTSIZE(vi_cnt, ui_idx) \
26− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x40)
27−#define SUN8I_SCALER_GSU_INSIZE(vi_cnt, ui_idx) \
28− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x80)
29−#define SUN8I_SCALER_GSU_HSTEP(vi_cnt, ui_idx) \
30− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x88)
31−#define SUN8I_SCALER_GSU_VSTEP(vi_cnt, ui_idx) \
32− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x8c)
33−#define SUN8I_SCALER_GSU_HPHASE(vi_cnt, ui_idx) \
34− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x90)
35−#define SUN8I_SCALER_GSU_VPHASE(vi_cnt, ui_idx) \
36− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x98)
37−#define SUN8I_SCALER_GSU_HCOEFF(vi_cnt, ui_idx, index) \
38− (0x20000 + 0x20000 * (vi_cnt) + 0x10000 * (ui_idx) + 0x200 + \
39− 0x4 * (index))
25+#define SUN8I_SCALER_GSU_CTRL(base) ((base) + 0x0)
26+#define SUN8I_SCALER_GSU_OUTSIZE(base) ((base) + 0x40)
27+#define SUN8I_SCALER_GSU_INSIZE(base) ((base) + 0x80)
28+#define SUN8I_SCALER_GSU_HSTEP(base) ((base) + 0x88)
29+#define SUN8I_SCALER_GSU_VSTEP(base) ((base) + 0x8c)
30+#define SUN8I_SCALER_GSU_HPHASE(base) ((base) + 0x90)
31+#define SUN8I_SCALER_GSU_VPHASE(base) ((base) + 0x98)
32+#define SUN8I_SCALER_GSU_HCOEFF(base, index) ((base) + 0x200 + 0x4 * (index))
4033
4134 #define SUN8I_SCALER_GSU_CTRL_EN BIT(0)
4235 #define SUN8I_SCALER_GSU_CTRL_COEFF_RDY BIT(4)
drivers/gpu/drm/sun4i/sun8i_vi_layer.c+30−17
@@ -24,7 +24,10 @@ static void sun8i_vi_layer_enable(struct sun8i_mixer *mixer, int channel, · 23 unmodified lines
2424 int overlay, bool enable, unsigned int zpos,
2525 unsigned int old_zpos)
2626 {
27− u32 val;
27+ u32 val, bld_base, ch_base;
28+
29+ bld_base = sun8i_blender_base(mixer);
30+ ch_base = sun8i_channel_base(mixer, channel);
2831
2932 DRM_DEBUG_DRIVER("%sabling VI channel %d overlay %d\n",
3033 enable ? "En" : "Dis", channel, overlay);
@@ -35,17 +38,17 @@ static void sun8i_vi_layer_enable(struct sun8i_mixer *mixer, int channel, · 4 unmodified lines
3538 val = 0;
3639
3740 regmap_update_bits(mixer->engine.regs,
38− SUN8I_MIXER_CHAN_VI_LAYER_ATTR(channel, overlay),
41+ SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),
3942 SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN, val);
4043
4144 if (!enable || zpos != old_zpos) {
4245 regmap_update_bits(mixer->engine.regs,
43− SUN8I_MIXER_BLEND_PIPE_CTL,
46+ SUN8I_MIXER_BLEND_PIPE_CTL(bld_base),
4447 SUN8I_MIXER_BLEND_PIPE_CTL_EN(old_zpos),
4548 0);
4649
4750 regmap_update_bits(mixer->engine.regs,
48− SUN8I_MIXER_BLEND_ROUTE,
51+ SUN8I_MIXER_BLEND_ROUTE(bld_base),
4952 SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(old_zpos),
5053 0);
5154 }
@@ -54,12 +57,13 @@ static void sun8i_vi_layer_enable(struct sun8i_mixer *mixer, int channel, · 2 unmodified lines
5457 val = SUN8I_MIXER_BLEND_PIPE_CTL_EN(zpos);
5558
5659 regmap_update_bits(mixer->engine.regs,
57− SUN8I_MIXER_BLEND_PIPE_CTL, val, val);
60+ SUN8I_MIXER_BLEND_PIPE_CTL(bld_base),
61+ val, val);
5862
5963 val = channel << SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(zpos);
6064
6165 regmap_update_bits(mixer->engine.regs,
62− SUN8I_MIXER_BLEND_ROUTE,
66+ SUN8I_MIXER_BLEND_ROUTE(bld_base),
6367 SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(zpos),
6468 val);
6569 }
@@ -72,6 +76,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 6 unmodified lines
7276 struct drm_plane_state *state = plane->state;
7377 const struct drm_format_info *format = state->fb->format;
7478 u32 src_w, src_h, dst_w, dst_h;
79+ u32 bld_base, ch_base;
7580 u32 outsize, insize;
7681 u32 hphase, vphase;
7782 bool subsampled;
@@ -79,6 +84,9 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 1 unmodified line
7984 DRM_DEBUG_DRIVER("Updating VI channel %d overlay %d\n",
8085 channel, overlay);
8186
87+ bld_base = sun8i_blender_base(mixer);
88+ ch_base = sun8i_channel_base(mixer, channel);
89+
8290 src_w = drm_rect_width(&state->src) >> 16;
8391 src_h = drm_rect_height(&state->src) >> 16;
8492 dst_w = drm_rect_width(&state->dst);
@@ -115,10 +123,10 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 30 unmodified lines
115123 (state->src.y1 >> 16) & ~(format->vsub - 1));
116124 DRM_DEBUG_DRIVER("Layer source size W: %d H: %d\n", src_w, src_h);
117125 regmap_write(mixer->engine.regs,
118− SUN8I_MIXER_CHAN_VI_LAYER_SIZE(channel, overlay),
126+ SUN8I_MIXER_CHAN_VI_LAYER_SIZE(ch_base, overlay),
119127 insize);
120128 regmap_write(mixer->engine.regs,
121− SUN8I_MIXER_CHAN_VI_OVL_SIZE(channel),
129+ SUN8I_MIXER_CHAN_VI_OVL_SIZE(ch_base),
122130 insize);
123131
124132 /*
@@ -149,10 +157,10 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 24 unmodified lines
149157 state->dst.x1, state->dst.y1);
150158 DRM_DEBUG_DRIVER("Layer destination size W: %d H: %d\n", dst_w, dst_h);
151159 regmap_write(mixer->engine.regs,
152− SUN8I_MIXER_BLEND_ATTR_COORD(zpos),
160+ SUN8I_MIXER_BLEND_ATTR_COORD(bld_base, zpos),
153161 SUN8I_MIXER_COORD(state->dst.x1, state->dst.y1));
154162 regmap_write(mixer->engine.regs,
155− SUN8I_MIXER_BLEND_ATTR_INSIZE(zpos),
163+ SUN8I_MIXER_BLEND_ATTR_INSIZE(bld_base, zpos),
156164 outsize);
157165
158166 return 0;
@@ -163,7 +171,9 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 4 unmodified lines
163171 {
164172 struct drm_plane_state *state = plane->state;
165173 const struct de2_fmt_info *fmt_info;
166− u32 val;
174+ u32 val, ch_base;
175+
176+ ch_base = sun8i_channel_base(mixer, channel);
167177
168178 fmt_info = sun8i_mixer_format_info(state->fb->format->format);
169179 if (!fmt_info) {
@@ -173,7 +183,7 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 3 unmodified lines
173183
174184 val = fmt_info->de2_fmt << SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET;
175185 regmap_update_bits(mixer->engine.regs,
176− SUN8I_MIXER_CHAN_VI_LAYER_ATTR(channel, overlay),
186+ SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),
177187 SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK, val);
178188
179189 if (fmt_info->csc != SUN8I_CSC_MODE_OFF) {
@@ -189,7 +199,7 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 9 unmodified lines
189199 val = 0;
190200
191201 regmap_update_bits(mixer->engine.regs,
192− SUN8I_MIXER_CHAN_VI_LAYER_ATTR(channel, overlay),
202+ SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),
193203 SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE, val);
194204
195205 return 0;
@@ -204,8 +214,11 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel, · 8 unmodified lines
204214 struct drm_gem_cma_object *gem;
205215 u32 dx, dy, src_x, src_y;
206216 dma_addr_t paddr;
217+ u32 ch_base;
207218 int i;
208219
220+ ch_base = sun8i_channel_base(mixer, channel);
221+
209222 /* Adjust x and y to be dividable by subsampling factor */
210223 src_x = (state->src.x1 >> 16) & ~(format->hsub - 1);
211224 src_y = (state->src.y1 >> 16) & ~(format->vsub - 1);
@@ -235,17 +248,17 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel, · 23 unmodified lines
235248 DRM_DEBUG_DRIVER("Layer %d. line width: %d bytes\n",
236249 i + 1, fb->pitches[i]);
237250 regmap_write(mixer->engine.regs,
238− SUN8I_MIXER_CHAN_VI_LAYER_PITCH(channel,
251+ SUN8I_MIXER_CHAN_VI_LAYER_PITCH(ch_base,
239252 overlay, i),
240− fb->pitches[i]);
253+ fb->pitches[i]);
241254
242255 DRM_DEBUG_DRIVER("Setting %d. buffer address to %pad\n",
243256 i + 1, &paddr);
244257
245258 regmap_write(mixer->engine.regs,
246− SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(channel,
259+ SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(ch_base,
247260 overlay, i),
248− lower_32_bits(paddr));
261+ lower_32_bits(paddr));
249262 }
250263
251264 return 0;
drivers/gpu/drm/sun4i/sun8i_vi_layer.h+12−11
@@ -12,17 +12,18 @@ · 11 unmodified lines
1212
1313 #include <drm/drm_plane.h>
1414
15−#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch, layer) \
16− (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x0)
17−#define SUN8I_MIXER_CHAN_VI_LAYER_SIZE(ch, layer) \
18− (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x4)
19−#define SUN8I_MIXER_CHAN_VI_LAYER_COORD(ch, layer) \
20− (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x8)
21−#define SUN8I_MIXER_CHAN_VI_LAYER_PITCH(ch, layer, plane) \
22− (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0xc + 4 * (plane))
23−#define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(ch, layer, plane) \
24− (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x18 + 4 * (plane))
25−#define SUN8I_MIXER_CHAN_VI_OVL_SIZE(ch) (0x2000 + 0x1000 * (ch) + 0xe8)
15+#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR(base, layer) \
16+ ((base) + 0x30 * (layer) + 0x0)
17+#define SUN8I_MIXER_CHAN_VI_LAYER_SIZE(base, layer) \
18+ ((base) + 0x30 * (layer) + 0x4)
19+#define SUN8I_MIXER_CHAN_VI_LAYER_COORD(base, layer) \
20+ ((base) + 0x30 * (layer) + 0x8)
21+#define SUN8I_MIXER_CHAN_VI_LAYER_PITCH(base, layer, plane) \
22+ ((base) + 0x30 * (layer) + 0xc + 4 * (plane))
23+#define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(base, layer, plane) \
24+ ((base) + 0x30 * (layer) + 0x18 + 4 * (plane))
25+#define SUN8I_MIXER_CHAN_VI_OVL_SIZE(base) \
26+ ((base) + 0xe8)
2627
2728 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN BIT(0)
2829 /* RGB mode should be set for RGB formats and cleared for YCbCr */
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c+32−21
@@ -833,6 +833,11 @@ static const u32 bicubic4coefftab32[480] = { · 832 unmodified lines
833833 0x1012110d, 0x1012110d, 0x1013110c, 0x1013110c,
834834 };
835835
836+static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
837+{
838+ return DE2_VI_SCALER_UNIT_BASE + DE2_VI_SCALER_UNIT_SIZE * channel;
839+}
840+
836841 static int sun8i_vi_scaler_coef_index(unsigned int step)
837842 {
838843 unsigned int scale, int_part, float_part;
@@ -857,7 +862,7 @@ static int sun8i_vi_scaler_coef_index(unsigned int step) · 18 unmodified lines
857862 }
858863 }
859864
860−static void sun8i_vi_scaler_set_coeff(struct regmap *map, int layer,
865+static void sun8i_vi_scaler_set_coeff(struct regmap *map, u32 base,
861866 u32 hstep, u32 vstep,
862867 const struct drm_format_info *format)
863868 {
@@ -877,29 +882,31 @@ static void sun8i_vi_scaler_set_coeff(struct regmap *map, int layer, · 13 unmodified lines
877882 offset = sun8i_vi_scaler_coef_index(hstep) *
878883 SUN8I_VI_SCALER_COEFF_COUNT;
879884 for (i = 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++) {
880− regmap_write(map, SUN8I_SCALER_VSU_YHCOEFF0(layer, i),
885+ regmap_write(map, SUN8I_SCALER_VSU_YHCOEFF0(base, i),
881886 lan3coefftab32_left[offset + i]);
882− regmap_write(map, SUN8I_SCALER_VSU_YHCOEFF1(layer, i),
887+ regmap_write(map, SUN8I_SCALER_VSU_YHCOEFF1(base, i),
883888 lan3coefftab32_right[offset + i]);
884− regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF0(layer, i),
889+ regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF0(base, i),
885890 ch_left[offset + i]);
886− regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF1(layer, i),
891+ regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF1(base, i),
887892 ch_right[offset + i]);
888893 }
889894
890895 offset = sun8i_vi_scaler_coef_index(hstep) *
891896 SUN8I_VI_SCALER_COEFF_COUNT;
892897 for (i = 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++) {
893− regmap_write(map, SUN8I_SCALER_VSU_YVCOEFF(layer, i),
898+ regmap_write(map, SUN8I_SCALER_VSU_YVCOEFF(base, i),
894899 lan2coefftab32[offset + i]);
895− regmap_write(map, SUN8I_SCALER_VSU_CVCOEFF(layer, i),
900+ regmap_write(map, SUN8I_SCALER_VSU_CVCOEFF(base, i),
896901 cy[offset + i]);
897902 }
898903 }
899904
900905 void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable)
901906 {
902− u32 val;
907+ u32 val, base;
908+
909+ base = sun8i_vi_scaler_base(mixer, layer);
903910
904911 if (enable)
905912 val = SUN8I_SCALER_VSU_CTRL_EN |
@@ -907,7 +914,8 @@ void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable) · 1 unmodified line
907914 else
908915 val = 0;
909916
910− regmap_write(mixer->engine.regs, SUN8I_SCALER_VSU_CTRL(layer), val);
917+ regmap_write(mixer->engine.regs,
918+ SUN8I_SCALER_VSU_CTRL(base), val);
911919 }
912920
913921 void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,
@@ -917,6 +925,9 @@ void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer, · 3 unmodified lines
917925 {
918926 u32 chphase, cvphase;
919927 u32 insize, outsize;
928+ u32 base;
929+
930+ base = sun8i_vi_scaler_base(mixer, layer);
920931
921932 hphase <<= SUN8I_VI_SCALER_PHASE_FRAC - 16;
922933 vphase <<= SUN8I_VI_SCALER_PHASE_FRAC - 16;
@@ -941,31 +952,31 @@ void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer, · 18 unmodified lines
941952 }
942953
943954 regmap_write(mixer->engine.regs,
944− SUN8I_SCALER_VSU_OUTSIZE(layer), outsize);
955+ SUN8I_SCALER_VSU_OUTSIZE(base), outsize);
945956 regmap_write(mixer->engine.regs,
946− SUN8I_SCALER_VSU_YINSIZE(layer), insize);
957+ SUN8I_SCALER_VSU_YINSIZE(base), insize);
947958 regmap_write(mixer->engine.regs,
948− SUN8I_SCALER_VSU_YHSTEP(layer), hscale);
959+ SUN8I_SCALER_VSU_YHSTEP(base), hscale);
949960 regmap_write(mixer->engine.regs,
950− SUN8I_SCALER_VSU_YVSTEP(layer), vscale);
961+ SUN8I_SCALER_VSU_YVSTEP(base), vscale);
951962 regmap_write(mixer->engine.regs,
952− SUN8I_SCALER_VSU_YHPHASE(layer), hphase);
963+ SUN8I_SCALER_VSU_YHPHASE(base), hphase);
953964 regmap_write(mixer->engine.regs,
954− SUN8I_SCALER_VSU_YVPHASE(layer), vphase);
965+ SUN8I_SCALER_VSU_YVPHASE(base), vphase);
955966 regmap_write(mixer->engine.regs,
956− SUN8I_SCALER_VSU_CINSIZE(layer),
967+ SUN8I_SCALER_VSU_CINSIZE(base),
957968 SUN8I_VI_SCALER_SIZE(src_w / format->hsub,
958969 src_h / format->vsub));
959970 regmap_write(mixer->engine.regs,
960− SUN8I_SCALER_VSU_CHSTEP(layer),
971+ SUN8I_SCALER_VSU_CHSTEP(base),
961972 hscale / format->hsub);
962973 regmap_write(mixer->engine.regs,
963− SUN8I_SCALER_VSU_CVSTEP(layer),
974+ SUN8I_SCALER_VSU_CVSTEP(base),
964975 vscale / format->vsub);
965976 regmap_write(mixer->engine.regs,
966− SUN8I_SCALER_VSU_CHPHASE(layer), chphase);
977+ SUN8I_SCALER_VSU_CHPHASE(base), chphase);
967978 regmap_write(mixer->engine.regs,
968− SUN8I_SCALER_VSU_CVPHASE(layer), cvphase);
969− sun8i_vi_scaler_set_coeff(mixer->engine.regs, layer,
979+ SUN8I_SCALER_VSU_CVPHASE(base), cvphase);
980+ sun8i_vi_scaler_set_coeff(mixer->engine.regs, base,
970981 hscale, vscale, format);
971982 }
drivers/gpu/drm/sun4i/sun8i_vi_scaler.h+21−24
@@ -12,6 +12,9 @@ · 11 unmodified lines
1212 #include <drm/drm_fourcc.h>
1313 #include "sun8i_mixer.h"
1414
15+#define DE2_VI_SCALER_UNIT_BASE 0x20000
16+#define DE2_VI_SCALER_UNIT_SIZE 0x20000
17+
1518 /* this two macros assumes 16 fractional bits which is standard in DRM */
1619 #define SUN8I_VI_SCALER_SCALE_MIN 1
1720 #define SUN8I_VI_SCALER_SCALE_MAX ((1UL << 20) - 1)
@@ -21,30 +24,24 @@ · 3 unmodified lines
2124 #define SUN8I_VI_SCALER_COEFF_COUNT 32
2225 #define SUN8I_VI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1))
2326
24−#define SUN8I_SCALER_VSU_CTRL(ch) (0x20000 + 0x20000 * (ch) + 0x0)
25−#define SUN8I_SCALER_VSU_OUTSIZE(ch) (0x20000 + 0x20000 * (ch) + 0x40)
26−#define SUN8I_SCALER_VSU_YINSIZE(ch) (0x20000 + 0x20000 * (ch) + 0x80)
27−#define SUN8I_SCALER_VSU_YHSTEP(ch) (0x20000 + 0x20000 * (ch) + 0x88)
28−#define SUN8I_SCALER_VSU_YVSTEP(ch) (0x20000 + 0x20000 * (ch) + 0x8c)
29−#define SUN8I_SCALER_VSU_YHPHASE(ch) (0x20000 + 0x20000 * (ch) + 0x90)
30−#define SUN8I_SCALER_VSU_YVPHASE(ch) (0x20000 + 0x20000 * (ch) + 0x98)
31−#define SUN8I_SCALER_VSU_CINSIZE(ch) (0x20000 + 0x20000 * (ch) + 0xc0)
32−#define SUN8I_SCALER_VSU_CHSTEP(ch) (0x20000 + 0x20000 * (ch) + 0xc8)
33−#define SUN8I_SCALER_VSU_CVSTEP(ch) (0x20000 + 0x20000 * (ch) + 0xcc)
34−#define SUN8I_SCALER_VSU_CHPHASE(ch) (0x20000 + 0x20000 * (ch) + 0xd0)
35−#define SUN8I_SCALER_VSU_CVPHASE(ch) (0x20000 + 0x20000 * (ch) + 0xd8)
36−#define SUN8I_SCALER_VSU_YHCOEFF0(ch, i) \
37− (0x20000 + 0x20000 * (ch) + 0x200 + 0x4 * (i))
38−#define SUN8I_SCALER_VSU_YHCOEFF1(ch, i) \
39− (0x20000 + 0x20000 * (ch) + 0x300 + 0x4 * (i))
40−#define SUN8I_SCALER_VSU_YVCOEFF(ch, i) \
41− (0x20000 + 0x20000 * (ch) + 0x400 + 0x4 * (i))
42−#define SUN8I_SCALER_VSU_CHCOEFF0(ch, i) \
43− (0x20000 + 0x20000 * (ch) + 0x600 + 0x4 * (i))
44−#define SUN8I_SCALER_VSU_CHCOEFF1(ch, i) \
45− (0x20000 + 0x20000 * (ch) + 0x700 + 0x4 * (i))
46−#define SUN8I_SCALER_VSU_CVCOEFF(ch, i) \
47− (0x20000 + 0x20000 * (ch) + 0x800 + 0x4 * (i))
27+#define SUN8I_SCALER_VSU_CTRL(base) ((base) + 0x0)
28+#define SUN8I_SCALER_VSU_OUTSIZE(base) ((base) + 0x40)
29+#define SUN8I_SCALER_VSU_YINSIZE(base) ((base) + 0x80)
30+#define SUN8I_SCALER_VSU_YHSTEP(base) ((base) + 0x88)
31+#define SUN8I_SCALER_VSU_YVSTEP(base) ((base) + 0x8c)
32+#define SUN8I_SCALER_VSU_YHPHASE(base) ((base) + 0x90)
33+#define SUN8I_SCALER_VSU_YVPHASE(base) ((base) + 0x98)
34+#define SUN8I_SCALER_VSU_CINSIZE(base) ((base) + 0xc0)
35+#define SUN8I_SCALER_VSU_CHSTEP(base) ((base) + 0xc8)
36+#define SUN8I_SCALER_VSU_CVSTEP(base) ((base) + 0xcc)
37+#define SUN8I_SCALER_VSU_CHPHASE(base) ((base) + 0xd0)
38+#define SUN8I_SCALER_VSU_CVPHASE(base) ((base) + 0xd8)
39+#define SUN8I_SCALER_VSU_YHCOEFF0(base, i) ((base) + 0x200 + 0x4 * (i))
40+#define SUN8I_SCALER_VSU_YHCOEFF1(base, i) ((base) + 0x300 + 0x4 * (i))
41+#define SUN8I_SCALER_VSU_YVCOEFF(base, i) ((base) + 0x400 + 0x4 * (i))
42+#define SUN8I_SCALER_VSU_CHCOEFF0(base, i) ((base) + 0x600 + 0x4 * (i))
43+#define SUN8I_SCALER_VSU_CHCOEFF1(base, i) ((base) + 0x700 + 0x4 * (i))
44+#define SUN8I_SCALER_VSU_CVCOEFF(base, i) ((base) + 0x800 + 0x4 * (i))
4845
4946 #define SUN8I_SCALER_VSU_CTRL_EN BIT(0)
5047 #define SUN8I_SCALER_VSU_CTRL_COEFF_RDY BIT(4)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t