WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / sun4i / sun8i_ui_layer.h
blobf4ab1cf6cded8f0b7da0c60e2c7b4b37dc955fa7
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) Icenowy Zheng <icenowy@aosc.io>
5 * Based on sun4i_layer.h, which is:
6 * Copyright (C) 2015 Free Electrons
7 * Copyright (C) 2015 NextThing Co
9 * Maxime Ripard <maxime.ripard@free-electrons.com>
12 #ifndef _SUN8I_UI_LAYER_H_
13 #define _SUN8I_UI_LAYER_H_
15 #include <drm/drm_plane.h>
17 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \
18 ((base) + 0x20 * (layer) + 0x0)
19 #define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \
20 ((base) + 0x20 * (layer) + 0x4)
21 #define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \
22 ((base) + 0x20 * (layer) + 0x8)
23 #define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \
24 ((base) + 0x20 * (layer) + 0xc)
25 #define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \
26 ((base) + 0x20 * (layer) + 0x10)
27 #define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \
28 ((base) + 0x20 * (layer) + 0x14)
29 #define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \
30 ((base) + 0x20 * (layer) + 0x18)
31 #define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \
32 ((base) + 0x80)
33 #define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \
34 ((base) + 0x84)
35 #define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \
36 ((base) + 0x88)
38 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN BIT(0)
39 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1)
40 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8)
41 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET 8
42 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK GENMASK(31, 24)
44 struct sun8i_mixer;
46 struct sun8i_ui_layer {
47 struct drm_plane plane;
48 struct sun8i_mixer *mixer;
49 int channel;
50 int overlay;
53 static inline struct sun8i_ui_layer *
54 plane_to_sun8i_ui_layer(struct drm_plane *plane)
56 return container_of(plane, struct sun8i_ui_layer, plane);
59 struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
60 struct sun8i_mixer *mixer,
61 int index);
62 #endif /* _SUN8I_UI_LAYER_H_ */