mirror of
https://github.com/torvalds/linux.git
synced 2026-04-25 18:12:26 -04:00
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
This commit is contained in:
@@ -1070,21 +1070,6 @@ static const struct ofdrm_device_funcs ofdrm_qemu_device_funcs = {
|
||||
.cmap_write = ofdrm_qemu_cmap_write,
|
||||
};
|
||||
|
||||
static struct drm_display_mode ofdrm_mode(unsigned int width, unsigned int height)
|
||||
{
|
||||
/*
|
||||
* Assume a monitor resolution of 96 dpi to
|
||||
* get a somewhat reasonable screen size.
|
||||
*/
|
||||
const struct drm_display_mode mode = {
|
||||
DRM_MODE_INIT(60, width, height,
|
||||
DRM_MODE_RES_MM(width, 96ul),
|
||||
DRM_MODE_RES_MM(height, 96ul))
|
||||
};
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
static struct ofdrm_device *ofdrm_device_create(struct drm_driver *drv,
|
||||
struct platform_device *pdev)
|
||||
{
|
||||
@@ -1251,7 +1236,7 @@ static struct ofdrm_device *ofdrm_device_create(struct drm_driver *drv,
|
||||
*/
|
||||
|
||||
iosys_map_set_vaddr_iomem(&sysfb->fb_addr, screen_base);
|
||||
sysfb->fb_mode = ofdrm_mode(width, height);
|
||||
sysfb->fb_mode = drm_sysfb_mode(width, height, 0, 0);
|
||||
sysfb->fb_format = format;
|
||||
sysfb->fb_pitch = linebytes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user