Files
linux/drivers/gpu/drm/sysfb/drm_sysfb_helper.c
Thomas Zimmermann 333376e9cf drm/sysfb: Provide single mode-init helper
Merge the mode-init functions of ofdrm and simpledrm to the new helper
drm_sysfb_mode(). Also implement the DPI defaults there. Replace the
code in each driver with the shared helper.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20250401094056.32904-7-tzimmermann@suse.de
2025-04-07 11:02:06 +02:00

33 lines
716 B
C

// SPDX-License-Identifier: GPL-2.0-only
#include <linux/module.h>
#include "drm_sysfb_helper.h"
MODULE_DESCRIPTION("Helpers for DRM sysfb drivers");
MODULE_LICENSE("GPL");
struct drm_display_mode drm_sysfb_mode(unsigned int width,
unsigned int height,
unsigned int width_mm,
unsigned int height_mm)
{
/*
* Assume a monitor resolution of 96 dpi to
* get a somewhat reasonable screen size.
*/
if (!width_mm)
width_mm = DRM_MODE_RES_MM(width, 96ul);
if (!height_mm)
height_mm = DRM_MODE_RES_MM(height, 96ul);
{
const struct drm_display_mode mode = {
DRM_MODE_INIT(60, width, height, width_mm, height_mm)
};
return mode;
}
}
EXPORT_SYMBOL(drm_sysfb_mode);