Skip to content

Commit edcc9d2

Browse files
author
Thomas Zimmermann
committed
drm/arm/hdlcd: Replace struct simplefb_format with custom type
Map DRM FourCC codes to pixel descriptions with an internal struct type. Avoid simplefb's struct simplefb_format, which is for parsing "simple-framebuffer" DT nodes. Drop the unsupported formats with alpha channel from the list. The HDLCD drivers uses struct simplefb_format and its default initializer SIMPLEFB_FORMATS to map DRM_FORMAT_ constants to pixel descriptions. The simplefb helpers are for parsing "simple-framebuffer" DT nodes and should be avoided in other context. Therefore replace it in hdlcd with a custom struct type and pixel descriptions from PIXEL_FORMAT_ constants. This change also removes including <linux/platform_data/simplefb.h>, which includes several unrelated headers, such as <linux/fb.h>. v2: - drop unsupported alpha formats (Liviu) - keep original sorting of formats (Javier) - use anonymous type for supported_formats Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Reviewed-by: Liviu Dudau <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c598d5e commit edcc9d2

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

drivers/gpu/drm/arm/hdlcd_crtc.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
#include <linux/clk.h>
1313
#include <linux/of_graph.h>
14-
#include <linux/platform_data/simplefb.h>
1514

15+
#include <video/pixel_format.h>
1616
#include <video/videomode.h>
1717

1818
#include <drm/drm_atomic.h>
@@ -73,7 +73,17 @@ static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
7373
.disable_vblank = hdlcd_crtc_disable_vblank,
7474
};
7575

76-
static struct simplefb_format supported_formats[] = SIMPLEFB_FORMATS;
76+
static const struct {
77+
u32 fourcc;
78+
struct pixel_format pixel;
79+
} supported_formats[] = {
80+
{ DRM_FORMAT_RGB565, PIXEL_FORMAT_RGB565 },
81+
{ DRM_FORMAT_XRGB1555, PIXEL_FORMAT_XRGB1555 },
82+
{ DRM_FORMAT_RGB888, PIXEL_FORMAT_RGB888 },
83+
{ DRM_FORMAT_XRGB8888, PIXEL_FORMAT_XRGB8888 },
84+
{ DRM_FORMAT_XBGR8888, PIXEL_FORMAT_XBGR8888 },
85+
{ DRM_FORMAT_XRGB2101010, PIXEL_FORMAT_XRGB2101010},
86+
};
7787

7888
/*
7989
* Setup the HDLCD registers for decoding the pixels out of the framebuffer
@@ -83,15 +93,12 @@ static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
8393
unsigned int btpp;
8494
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
8595
const struct drm_framebuffer *fb = crtc->primary->state->fb;
86-
uint32_t pixel_format;
87-
struct simplefb_format *format = NULL;
96+
const struct pixel_format *format = NULL;
8897
int i;
8998

90-
pixel_format = fb->format->format;
91-
9299
for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
93-
if (supported_formats[i].fourcc == pixel_format)
94-
format = &supported_formats[i];
100+
if (supported_formats[i].fourcc == fb->format->format)
101+
format = &supported_formats[i].pixel;
95102
}
96103

97104
if (WARN_ON(!format))

0 commit comments

Comments
 (0)