blob: b258a8a00fca7c50748a468be3e9654e04ccdfc4 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glass1acafc72016-01-18 19:52:15 -07002/*
3 * Copyright (c) 2015 Google, Inc
Simon Glass1acafc72016-01-18 19:52:15 -07004 */
5
Patrick Delaunayb953ec22021-04-27 11:02:19 +02006#define LOG_CATEGORY UCLASS_VIDEO
7
Simon Glass1acafc72016-01-18 19:52:15 -07008#include <common.h>
Simon Glass9beac5d2020-07-02 21:12:20 -06009#include <console.h>
Simon Glass1eb69ae2019-11-14 12:57:39 -070010#include <cpu_func.h>
Simon Glass1acafc72016-01-18 19:52:15 -070011#include <dm.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060012#include <log.h>
Simon Glass336d4612020-02-03 07:36:16 -070013#include <malloc.h>
Simon Glass1acafc72016-01-18 19:52:15 -070014#include <mapmem.h>
15#include <stdio_dev.h>
16#include <video.h>
17#include <video_console.h>
Simon Glass90526e92020-05-10 11:39:56 -060018#include <asm/cache.h>
Simon Glass401d1c42020-10-30 21:38:53 -060019#include <asm/global_data.h>
Simon Glass1acafc72016-01-18 19:52:15 -070020#include <dm/lists.h>
Michal Simek9de731f2020-12-14 08:47:52 +010021#include <dm/device_compat.h>
Simon Glass1acafc72016-01-18 19:52:15 -070022#include <dm/device-internal.h>
23#include <dm/uclass-internal.h>
24#ifdef CONFIG_SANDBOX
25#include <asm/sdl.h>
26#endif
27
28/*
29 * Theory of operation:
30 *
31 * Before relocation each device is bound. The driver for each device must
Simon Glass8a8d24b2020-12-03 16:55:23 -070032 * set the @align and @size values in struct video_uc_plat. This
Simon Glass1acafc72016-01-18 19:52:15 -070033 * information represents the requires size and alignment of the frame buffer
34 * for the device. The values can be an over-estimate but cannot be too
35 * small. The actual values will be suppled (in the same manner) by the bind()
Pali Rohárbd0df822022-03-09 20:46:00 +010036 * method after relocation. Additionally driver can allocate frame buffer
37 * itself by setting plat->base.
Simon Glass1acafc72016-01-18 19:52:15 -070038 *
39 * This information is then picked up by video_reserve() which works out how
40 * much memory is needed for all devices. This is allocated between
41 * gd->video_bottom and gd->video_top.
42 *
43 * After relocation the same process occurs. The driver supplies the same
44 * @size and @align information and this time video_post_bind() checks that
45 * the drivers does not overflow the allocated memory.
46 *
47 * The frame buffer address is actually set (to plat->base) in
48 * video_post_probe(). This function also clears the frame buffer and
49 * allocates a suitable text console device. This can then be used to write
50 * text to the video device.
51 */
52DECLARE_GLOBAL_DATA_PTR;
53
Simon Glass7812bbd2020-07-02 21:12:32 -060054/**
55 * struct video_uc_priv - Information for the video uclass
56 *
57 * @video_ptr: Current allocation position of the video framebuffer pointer.
58 * While binding devices after relocation, this points to the next
59 * available address to use for a device's framebuffer. It starts at
60 * gd->video_top and works downwards, running out of space when it hits
61 * gd->video_bottom.
62 */
63struct video_uc_priv {
64 ulong video_ptr;
65};
66
Simon Glassa032e4b2022-10-06 08:36:03 -060067/** struct vid_rgb - Describes a video colour */
68struct vid_rgb {
69 u32 r;
70 u32 g;
71 u32 b;
72};
73
Simon Glass68dcdc92016-01-21 19:44:52 -070074void video_set_flush_dcache(struct udevice *dev, bool flush)
75{
76 struct video_priv *priv = dev_get_uclass_priv(dev);
77
78 priv->flush_dcache = flush;
79}
80
Simon Glass1acafc72016-01-18 19:52:15 -070081static ulong alloc_fb(struct udevice *dev, ulong *addrp)
82{
Simon Glass8a8d24b2020-12-03 16:55:23 -070083 struct video_uc_plat *plat = dev_get_uclass_plat(dev);
Simon Glass1acafc72016-01-18 19:52:15 -070084 ulong base, align, size;
85
Bin Meng39683982016-10-09 04:14:17 -070086 if (!plat->size)
87 return 0;
88
Pali Rohárbd0df822022-03-09 20:46:00 +010089 /* Allow drivers to allocate the frame buffer themselves */
90 if (plat->base)
91 return 0;
92
Simon Glass1acafc72016-01-18 19:52:15 -070093 align = plat->align ? plat->align : 1 << 20;
94 base = *addrp - plat->size;
95 base &= ~(align - 1);
96 plat->base = base;
97 size = *addrp - base;
98 *addrp = base;
99
100 return size;
101}
102
103int video_reserve(ulong *addrp)
104{
105 struct udevice *dev;
106 ulong size;
107
108 gd->video_top = *addrp;
109 for (uclass_find_first_device(UCLASS_VIDEO, &dev);
110 dev;
111 uclass_find_next_device(&dev)) {
112 size = alloc_fb(dev, addrp);
113 debug("%s: Reserving %lx bytes at %lx for video device '%s'\n",
114 __func__, size, *addrp, dev->name);
115 }
Simon Glass551ca0e2020-07-02 21:12:33 -0600116
117 /* Allocate space for PCI video devices in case there were not bound */
118 if (*addrp == gd->video_top)
119 *addrp -= CONFIG_VIDEO_PCI_DEFAULT_FB_SIZE;
120
Simon Glass1acafc72016-01-18 19:52:15 -0700121 gd->video_bottom = *addrp;
Simon Glassaef43ea2020-05-10 14:17:01 -0600122 gd->fb_base = *addrp;
Simon Glass1acafc72016-01-18 19:52:15 -0700123 debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
124 gd->video_top);
125
126 return 0;
127}
128
Simon Glassc6ebd012018-10-01 12:22:26 -0600129int video_clear(struct udevice *dev)
Simon Glass1acafc72016-01-18 19:52:15 -0700130{
131 struct video_priv *priv = dev_get_uclass_priv(dev);
Simon Glass138dfea2020-07-02 21:12:22 -0600132 int ret;
Simon Glass1acafc72016-01-18 19:52:15 -0700133
Heinrich Schuchardtd7a75d32018-02-08 21:47:10 +0100134 switch (priv->bpix) {
Simon Glass0c20aaf2019-12-20 18:10:37 -0700135 case VIDEO_BPP16:
136 if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
137 u16 *ppix = priv->fb;
138 u16 *end = priv->fb + priv->fb_size;
Heinrich Schuchardtd7a75d32018-02-08 21:47:10 +0100139
Simon Glass0c20aaf2019-12-20 18:10:37 -0700140 while (ppix < end)
141 *ppix++ = priv->colour_bg;
142 break;
143 }
144 case VIDEO_BPP32:
145 if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
146 u32 *ppix = priv->fb;
147 u32 *end = priv->fb + priv->fb_size;
Simon Glass1acafc72016-01-18 19:52:15 -0700148
Simon Glass0c20aaf2019-12-20 18:10:37 -0700149 while (ppix < end)
150 *ppix++ = priv->colour_bg;
151 break;
152 }
Heinrich Schuchardtd7a75d32018-02-08 21:47:10 +0100153 default:
Simon Glass1acafc72016-01-18 19:52:15 -0700154 memset(priv->fb, priv->colour_bg, priv->fb_size);
Heinrich Schuchardtd7a75d32018-02-08 21:47:10 +0100155 break;
Simon Glass1acafc72016-01-18 19:52:15 -0700156 }
Simon Glass138dfea2020-07-02 21:12:22 -0600157 ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size);
158 if (ret)
159 return ret;
Simon Glassc6ebd012018-10-01 12:22:26 -0600160
Michal Simek53376632020-12-15 15:12:09 +0100161 return video_sync(dev, false);
Simon Glass1acafc72016-01-18 19:52:15 -0700162}
163
Simon Glassa032e4b2022-10-06 08:36:03 -0600164static const struct vid_rgb colours[VID_COLOUR_COUNT] = {
165 { 0x00, 0x00, 0x00 }, /* black */
166 { 0xc0, 0x00, 0x00 }, /* red */
167 { 0x00, 0xc0, 0x00 }, /* green */
168 { 0xc0, 0x60, 0x00 }, /* brown */
169 { 0x00, 0x00, 0xc0 }, /* blue */
170 { 0xc0, 0x00, 0xc0 }, /* magenta */
171 { 0x00, 0xc0, 0xc0 }, /* cyan */
172 { 0xc0, 0xc0, 0xc0 }, /* light gray */
173 { 0x80, 0x80, 0x80 }, /* gray */
174 { 0xff, 0x00, 0x00 }, /* bright red */
175 { 0x00, 0xff, 0x00 }, /* bright green */
176 { 0xff, 0xff, 0x00 }, /* yellow */
177 { 0x00, 0x00, 0xff }, /* bright blue */
178 { 0xff, 0x00, 0xff }, /* bright magenta */
179 { 0x00, 0xff, 0xff }, /* bright cyan */
180 { 0xff, 0xff, 0xff }, /* white */
181};
182
183u32 video_index_to_colour(struct video_priv *priv, unsigned int idx)
184{
185 switch (priv->bpix) {
186 case VIDEO_BPP16:
187 if (CONFIG_IS_ENABLED(VIDEO_BPP16)) {
188 return ((colours[idx].r >> 3) << 11) |
189 ((colours[idx].g >> 2) << 5) |
190 ((colours[idx].b >> 3) << 0);
191 }
192 break;
193 case VIDEO_BPP32:
194 if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
195 if (priv->format == VIDEO_X2R10G10B10)
196 return (colours[idx].r << 22) |
197 (colours[idx].g << 12) |
198 (colours[idx].b << 2);
199 else
200 return (colours[idx].r << 16) |
201 (colours[idx].g << 8) |
202 (colours[idx].b << 0);
203 }
204 break;
205 default:
206 break;
207 }
208
209 /*
210 * For unknown bit arrangements just support
211 * black and white.
212 */
213 if (idx)
214 return 0xffffff; /* white */
215
216 return 0x000000; /* black */
217}
218
Simon Glassb9f210a2018-11-06 15:21:36 -0700219void video_set_default_colors(struct udevice *dev, bool invert)
Heinrich Schuchardt5c30fbb2018-02-08 21:47:11 +0100220{
Simon Glassb9f210a2018-11-06 15:21:36 -0700221 struct video_priv *priv = dev_get_uclass_priv(dev);
222 int fore, back;
223
Simon Glass0c20aaf2019-12-20 18:10:37 -0700224 if (CONFIG_IS_ENABLED(SYS_WHITE_ON_BLACK)) {
225 /* White is used when switching to bold, use light gray here */
226 fore = VID_LIGHT_GRAY;
227 back = VID_BLACK;
228 } else {
229 fore = VID_BLACK;
230 back = VID_WHITE;
231 }
Simon Glassb9f210a2018-11-06 15:21:36 -0700232 if (invert) {
233 int temp;
234
235 temp = fore;
236 fore = back;
237 back = temp;
238 }
239 priv->fg_col_idx = fore;
Andre Przywaraeabb0722019-03-23 01:29:56 +0000240 priv->bg_col_idx = back;
Simon Glassa032e4b2022-10-06 08:36:03 -0600241 priv->colour_fg = video_index_to_colour(priv, fore);
242 priv->colour_bg = video_index_to_colour(priv, back);
Heinrich Schuchardt5c30fbb2018-02-08 21:47:11 +0100243}
244
Simon Glass1acafc72016-01-18 19:52:15 -0700245/* Flush video activity to the caches */
Michal Simek9de731f2020-12-14 08:47:52 +0100246int video_sync(struct udevice *vid, bool force)
Simon Glass1acafc72016-01-18 19:52:15 -0700247{
Michal Simek9d69c2d2020-12-03 09:30:00 +0100248 struct video_ops *ops = video_get_ops(vid);
249 int ret;
250
251 if (ops && ops->video_sync) {
252 ret = ops->video_sync(vid);
253 if (ret)
254 return ret;
255 }
256
Simon Glass1acafc72016-01-18 19:52:15 -0700257 /*
258 * flush_dcache_range() is declared in common.h but it seems that some
259 * architectures do not actually implement it. Is there a way to find
260 * out whether it exists? For now, ARM is safe.
261 */
Trevor Woerner10015022019-05-03 09:41:00 -0400262#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
Simon Glass1acafc72016-01-18 19:52:15 -0700263 struct video_priv *priv = dev_get_uclass_priv(vid);
264
265 if (priv->flush_dcache) {
266 flush_dcache_range((ulong)priv->fb,
Simon Glass79813942016-11-13 14:22:06 -0700267 ALIGN((ulong)priv->fb + priv->fb_size,
268 CONFIG_SYS_CACHELINE_SIZE));
Simon Glass1acafc72016-01-18 19:52:15 -0700269 }
270#elif defined(CONFIG_VIDEO_SANDBOX_SDL)
271 struct video_priv *priv = dev_get_uclass_priv(vid);
272 static ulong last_sync;
273
Simon Glass7c19e4c2022-02-28 15:13:48 -0700274 if (force || get_timer(last_sync) > 100) {
Simon Glass1acafc72016-01-18 19:52:15 -0700275 sandbox_sdl_sync(priv->fb);
276 last_sync = get_timer(0);
277 }
278#endif
Michal Simek9de731f2020-12-14 08:47:52 +0100279 return 0;
Simon Glass1acafc72016-01-18 19:52:15 -0700280}
281
282void video_sync_all(void)
283{
284 struct udevice *dev;
Michal Simek9de731f2020-12-14 08:47:52 +0100285 int ret;
Simon Glass1acafc72016-01-18 19:52:15 -0700286
287 for (uclass_find_first_device(UCLASS_VIDEO, &dev);
288 dev;
289 uclass_find_next_device(&dev)) {
Michal Simek9de731f2020-12-14 08:47:52 +0100290 if (device_active(dev)) {
291 ret = video_sync(dev, true);
292 if (ret)
293 dev_dbg(dev, "Video sync failed\n");
294 }
Simon Glass1acafc72016-01-18 19:52:15 -0700295 }
296}
297
Patrick Delaunay2e2e6d82021-11-15 16:32:20 +0100298bool video_is_active(void)
299{
300 struct udevice *dev;
301
302 for (uclass_find_first_device(UCLASS_VIDEO, &dev);
303 dev;
304 uclass_find_next_device(&dev)) {
305 if (device_active(dev))
306 return true;
307 }
308
309 return false;
310}
311
Simon Glass1acafc72016-01-18 19:52:15 -0700312int video_get_xsize(struct udevice *dev)
313{
314 struct video_priv *priv = dev_get_uclass_priv(dev);
315
316 return priv->xsize;
317}
318
319int video_get_ysize(struct udevice *dev)
320{
321 struct video_priv *priv = dev_get_uclass_priv(dev);
322
323 return priv->ysize;
324}
325
Simon Glass9beac5d2020-07-02 21:12:20 -0600326#ifdef CONFIG_VIDEO_COPY
327int video_sync_copy(struct udevice *dev, void *from, void *to)
328{
329 struct video_priv *priv = dev_get_uclass_priv(dev);
330
331 if (priv->copy_fb) {
332 long offset, size;
333
334 /* Find the offset of the first byte to copy */
335 if ((ulong)to > (ulong)from) {
336 size = to - from;
337 offset = from - priv->fb;
338 } else {
339 size = from - to;
340 offset = to - priv->fb;
341 }
342
343 /*
344 * Allow a bit of leeway for valid requests somewhere near the
345 * frame buffer
346 */
347 if (offset < -priv->fb_size || offset > 2 * priv->fb_size) {
348#ifdef DEBUG
Simon Glass6a19e932021-11-19 13:23:51 -0700349 char str[120];
Simon Glass9beac5d2020-07-02 21:12:20 -0600350
351 snprintf(str, sizeof(str),
Simon Glass6a19e932021-11-19 13:23:51 -0700352 "[** FAULT sync_copy fb=%p, from=%p, to=%p, offset=%lx]",
Simon Glass9beac5d2020-07-02 21:12:20 -0600353 priv->fb, from, to, offset);
354 console_puts_select_stderr(true, str);
355#endif
356 return -EFAULT;
357 }
358
359 /*
360 * Silently crop the memcpy. This allows callers to avoid doing
361 * this themselves. It is common for the end pointer to go a
362 * few lines after the end of the frame buffer, since most of
363 * the update algorithms terminate a line after their last write
364 */
365 if (offset + size > priv->fb_size) {
366 size = priv->fb_size - offset;
367 } else if (offset < 0) {
368 size += offset;
369 offset = 0;
370 }
371
372 memcpy(priv->copy_fb + offset, priv->fb + offset, size);
373 }
374
375 return 0;
376}
Simon Glass7d701162021-01-13 20:29:46 -0700377
378int video_sync_copy_all(struct udevice *dev)
379{
380 struct video_priv *priv = dev_get_uclass_priv(dev);
381
382 video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size);
383
384 return 0;
385}
386
Simon Glass9beac5d2020-07-02 21:12:20 -0600387#endif
388
Simon Glass84e63ab2021-11-19 13:24:03 -0700389#define SPLASH_DECL(_name) \
390 extern u8 __splash_ ## _name ## _begin[]; \
391 extern u8 __splash_ ## _name ## _end[]
392
393#define SPLASH_START(_name) __splash_ ## _name ## _begin
394
395SPLASH_DECL(u_boot_logo);
396
397static int show_splash(struct udevice *dev)
398{
399 u8 *data = SPLASH_START(u_boot_logo);
400 int ret;
401
402 ret = video_bmp_display(dev, map_to_sysmem(data), -4, 4, true);
403
404 return 0;
405}
406
Simon Glass1acafc72016-01-18 19:52:15 -0700407/* Set up the display ready for use */
408static int video_post_probe(struct udevice *dev)
409{
Simon Glass8a8d24b2020-12-03 16:55:23 -0700410 struct video_uc_plat *plat = dev_get_uclass_plat(dev);
Simon Glass1acafc72016-01-18 19:52:15 -0700411 struct video_priv *priv = dev_get_uclass_priv(dev);
412 char name[30], drv[15], *str;
Simon Glass826f35f2016-01-14 18:10:48 -0700413 const char *drv_name = drv;
Simon Glass1acafc72016-01-18 19:52:15 -0700414 struct udevice *cons;
415 int ret;
416
417 /* Set up the line and display size */
418 priv->fb = map_sysmem(plat->base, plat->size);
Simon Glass06696eb2018-11-29 15:08:52 -0700419 if (!priv->line_length)
420 priv->line_length = priv->xsize * VNBYTES(priv->bpix);
421
Simon Glass1acafc72016-01-18 19:52:15 -0700422 priv->fb_size = priv->line_length * priv->ysize;
423
Simon Glass6efa8092020-07-02 21:12:21 -0600424 if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base)
425 priv->copy_fb = map_sysmem(plat->copy_base, plat->size);
426
Heinrich Schuchardt5c30fbb2018-02-08 21:47:11 +0100427 /* Set up colors */
Simon Glassb9f210a2018-11-06 15:21:36 -0700428 video_set_default_colors(dev, false);
Rob Clark8ef05352017-08-03 12:47:01 -0400429
430 if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
431 video_clear(dev);
Simon Glass1acafc72016-01-18 19:52:15 -0700432
Simon Glass83510762016-01-18 19:52:17 -0700433 /*
Simon Glass826f35f2016-01-14 18:10:48 -0700434 * Create a text console device. For now we always do this, although
Simon Glass83510762016-01-18 19:52:17 -0700435 * it might be useful to support only bitmap drawing on the device
Simon Glass826f35f2016-01-14 18:10:48 -0700436 * for boards that don't need to display text. We create a TrueType
437 * console if enabled, a rotated console if the video driver requests
438 * it, otherwise a normal console.
439 *
440 * The console can be override by setting vidconsole_drv_name before
441 * probing this video driver, or in the probe() method.
442 *
443 * TrueType does not support rotation at present so fall back to the
444 * rotated console in that case.
Simon Glass83510762016-01-18 19:52:17 -0700445 */
Simon Glass826f35f2016-01-14 18:10:48 -0700446 if (!priv->rot && IS_ENABLED(CONFIG_CONSOLE_TRUETYPE)) {
Simon Glassa29b0122016-01-14 18:10:42 -0700447 snprintf(name, sizeof(name), "%s.vidconsole_tt", dev->name);
448 strcpy(drv, "vidconsole_tt");
449 } else {
450 snprintf(name, sizeof(name), "%s.vidconsole%d", dev->name,
451 priv->rot);
452 snprintf(drv, sizeof(drv), "vidconsole%d", priv->rot);
453 }
454
Simon Glass83510762016-01-18 19:52:17 -0700455 str = strdup(name);
456 if (!str)
457 return -ENOMEM;
Simon Glass826f35f2016-01-14 18:10:48 -0700458 if (priv->vidconsole_drv_name)
459 drv_name = priv->vidconsole_drv_name;
460 ret = device_bind_driver(dev, drv_name, str, &cons);
Simon Glass83510762016-01-18 19:52:17 -0700461 if (ret) {
462 debug("%s: Cannot bind console driver\n", __func__);
463 return ret;
464 }
Simon Glass826f35f2016-01-14 18:10:48 -0700465
Simon Glass83510762016-01-18 19:52:17 -0700466 ret = device_probe(cons);
467 if (ret) {
468 debug("%s: Cannot probe console driver\n", __func__);
469 return ret;
470 }
471
Fabio Estevam25a44832022-03-28 16:40:36 -0300472 if (IS_ENABLED(CONFIG_VIDEO_LOGO) &&
473 !IS_ENABLED(CONFIG_SPLASH_SCREEN) && !plat->hide_logo) {
Simon Glass84e63ab2021-11-19 13:24:03 -0700474 ret = show_splash(dev);
475 if (ret) {
476 log_debug("Cannot show splash screen\n");
477 return ret;
478 }
479 }
480
Simon Glass1acafc72016-01-18 19:52:15 -0700481 return 0;
482};
483
484/* Post-relocation, allocate memory for the frame buffer */
485static int video_post_bind(struct udevice *dev)
486{
Simon Glass7812bbd2020-07-02 21:12:32 -0600487 struct video_uc_priv *uc_priv;
488 ulong addr;
Simon Glass1acafc72016-01-18 19:52:15 -0700489 ulong size;
490
491 /* Before relocation there is nothing to do here */
Tom Rini75164182018-04-22 09:47:48 -0400492 if (!(gd->flags & GD_FLG_RELOC))
Simon Glass1acafc72016-01-18 19:52:15 -0700493 return 0;
Simon Glass7812bbd2020-07-02 21:12:32 -0600494
495 /* Set up the video pointer, if this is the first device */
Simon Glass0fd3d912020-12-22 19:30:28 -0700496 uc_priv = uclass_get_priv(dev->uclass);
Simon Glass7812bbd2020-07-02 21:12:32 -0600497 if (!uc_priv->video_ptr)
498 uc_priv->video_ptr = gd->video_top;
499
500 /* Allocate framebuffer space for this device */
501 addr = uc_priv->video_ptr;
Simon Glass1acafc72016-01-18 19:52:15 -0700502 size = alloc_fb(dev, &addr);
503 if (addr < gd->video_bottom) {
Patrick Delaunay69989742019-05-21 19:19:12 +0200504 /* Device tree node may need the 'u-boot,dm-pre-reloc' or
505 * 'u-boot,dm-pre-proper' tag
506 */
Simon Glass1acafc72016-01-18 19:52:15 -0700507 printf("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n",
508 dev->name);
509 return -ENOSPC;
510 }
511 debug("%s: Claiming %lx bytes at %lx for video device '%s'\n",
512 __func__, size, addr, dev->name);
Simon Glass7812bbd2020-07-02 21:12:32 -0600513 uc_priv->video_ptr = addr;
Simon Glass1acafc72016-01-18 19:52:15 -0700514
515 return 0;
516}
517
518UCLASS_DRIVER(video) = {
519 .id = UCLASS_VIDEO,
520 .name = "video",
521 .flags = DM_UC_FLAG_SEQ_ALIAS,
522 .post_bind = video_post_bind,
Simon Glass1acafc72016-01-18 19:52:15 -0700523 .post_probe = video_post_probe,
Simon Glass41575d82020-12-03 16:55:17 -0700524 .priv_auto = sizeof(struct video_uc_priv),
525 .per_device_auto = sizeof(struct video_priv),
Simon Glass8a8d24b2020-12-03 16:55:23 -0700526 .per_device_plat_auto = sizeof(struct video_uc_plat),
Simon Glass1acafc72016-01-18 19:52:15 -0700527};