]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/sun4i: Rename DE2 RGB format macros
authorJernej Skrabec <jernej.skrabec@siol.net>
Fri, 1 Dec 2017 06:05:25 +0000 (07:05 +0100)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Tue, 5 Dec 2017 12:22:41 +0000 (13:22 +0100)
Current RGB formats macros are actually not specific to UI planes.
Rename it to something more universal and introduce shift macro.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-3-jernej.skrabec@siol.net
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_mixer.h

index cb193c5f168621e4338035cea930e83031d1e33a..b9c48c60131f86d62b4facfd832b885c87e60245 100644 (file)
@@ -71,15 +71,15 @@ static int sun8i_mixer_drm_format_to_layer(struct drm_plane *plane,
 {
        switch (format) {
        case DRM_FORMAT_ARGB8888:
-               *mode = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_ARGB8888;
+               *mode = SUN8I_MIXER_FBFMT_ARGB8888;
                break;
 
        case DRM_FORMAT_XRGB8888:
-               *mode = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_XRGB8888;
+               *mode = SUN8I_MIXER_FBFMT_XRGB8888;
                break;
 
        case DRM_FORMAT_RGB888:
-               *mode = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888;
+               *mode = SUN8I_MIXER_FBFMT_RGB888;
                break;
 
        default:
@@ -173,6 +173,7 @@ int sun8i_mixer_update_layer_formats(struct sun8i_mixer *mixer,
                return ret;
        }
 
+       val <<= SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET;
        regmap_update_bits(mixer->engine.regs,
                           SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer),
                           SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK, val);
index c142fbb8661e19844417e231f36376f369eaea4f..82c3416fbf3a56a8a1314421b2f0ca0fa6faa14c 100644 (file)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN              BIT(0)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK      GENMASK(12, 8)
+#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET    8
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK      GENMASK(31, 24)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_DEF  (1 << 1)
-#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_ARGB8888  (0 << 8)
-#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_XRGB8888  (4 << 8)
-#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_RGB888    (8 << 8)
 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF       (0xff << 24)
 
+#define SUN8I_MIXER_FBFMT_ARGB8888     0
+#define SUN8I_MIXER_FBFMT_XRGB8888     4
+#define SUN8I_MIXER_FBFMT_RGB888       8
+
 /*
  * These sub-engines are still unknown now, the EN registers are here only to
  * be used to disable these sub-engines.