drm/sun4i: frontend: Determine input mode based on the number of planes
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Fri, 23 Nov 2018 09:24:51 +0000 (10:24 +0100)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Tue, 27 Nov 2018 08:55:16 +0000 (09:55 +0100)
Use the number of planes associated with the DRM format to determine the
input mode configuration instead of the format iteself. This way, the
helper can be used for all packed formats without future changes.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-20-paul.kocialkowski@bootlin.com
drivers/gpu/drm/sun4i/sun4i_frontend.c

index a305b731b04272b775f14821634bc3670c230a47..a16697b0eac5f01c272f4254bc0ff121cd4d302b 100644 (file)
@@ -118,14 +118,12 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val)
 
 static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
 {
-       switch (fmt) {
-       case DRM_FORMAT_XRGB8888:
+       if (drm_format_num_planes(fmt) == 1)
                *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED;
-               return 0;
-
-       default:
+       else
                return -EINVAL;
-       }
+
+       return 0;
 }
 
 static int sun4i_frontend_drm_format_to_input_sequence(uint32_t fmt, u32 *val)