]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - common/lcd_simplefb.c
2 * Simplefb device tree support
5 * Stephen Warren <swarren@wwwdotorg.org>
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <fdt_support.h>
14 #include <linux/libfdt.h>
17 DECLARE_GLOBAL_DATA_PTR
;
19 static int lcd_dt_simplefb_configure_node(void *blob
, int off
)
22 int bpix
; /* log2 of bits per pixel */
25 #ifdef CONFIG_DM_VIDEO
26 struct video_uc_platdata
*plat
;
27 struct video_priv
*uc_priv
;
31 ret
= uclass_first_device_err(UCLASS_VIDEO
, &dev
);
34 uc_priv
= dev_get_uclass_priv(dev
);
35 plat
= dev_get_uclass_platdata(dev
);
36 xsize
= uc_priv
->xsize
;
37 ysize
= uc_priv
->ysize
;
41 xsize
= lcd_get_pixel_width();
42 ysize
= lcd_get_pixel_height();
44 fb_base
= gd
->fb_base
;
47 case 4: /* VIDEO_BPP16 */
50 case 5: /* VIDEO_BPP32 */
57 return fdt_setup_simplefb_node(blob
, off
, fb_base
, xsize
, ysize
,
58 xsize
* (1 << bpix
) / 8, name
);
61 int lcd_dt_simplefb_add_node(void *blob
)
63 static const char compat
[] = "simple-framebuffer";
64 static const char disabled
[] = "disabled";
67 off
= fdt_add_subnode(blob
, 0, "framebuffer");
71 ret
= fdt_setprop(blob
, off
, "status", disabled
, sizeof(disabled
));
75 ret
= fdt_setprop(blob
, off
, "compatible", compat
, sizeof(compat
));
79 return lcd_dt_simplefb_configure_node(blob
, off
);
82 int lcd_dt_simplefb_enable_existing_node(void *blob
)
86 off
= fdt_node_offset_by_compatible(blob
, -1, "simple-framebuffer");
90 return lcd_dt_simplefb_configure_node(blob
, off
);