diff options
author | Paul Kocialkowski <paul.kocialkowski@bootlin.com> | 2018-11-23 10:24:51 +0100 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@bootlin.com> | 2018-11-27 09:55:16 +0100 |
commit | ae4ba1936ab97c6a2733a243370f303da3c11839 (patch) | |
tree | fbec772699e73a7a731f82f6521412b114e4aeaa /drivers/gpu/drm/sun4i/sun4i_frontend.c | |
parent | 9579f9190487cc99ac280beda5da8ba7c3414b92 (diff) | |
download | linux-ae4ba1936ab97c6a2733a243370f303da3c11839.tar.gz |
drm/sun4i: frontend: Determine input mode based on the number of planes
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
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_frontend.c')
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_frontend.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index a305b731b042..a16697b0eac5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -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) |