]> Git Repo - u-boot.git/blob - drivers/video/imx/mxc_ipuv3_fb.c
mxc_ipuv3_fb.c: call display_enable
[u-boot.git] / drivers / video / imx / mxc_ipuv3_fb.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Porting to u-boot:
4  *
5  * (C) Copyright 2010
6  * Stefano Babic, DENX Software Engineering, [email protected]
7  *
8  * MX51 Linux framebuffer:
9  *
10  * (C) Copyright 2004-2010 Freescale Semiconductor, Inc.
11  */
12
13 #include <common.h>
14 #include <linux/errno.h>
15 #include <asm/global_data.h>
16 #include <linux/string.h>
17 #include <linux/list.h>
18 #include <linux/fb.h>
19 #include <asm/io.h>
20 #include <asm/mach-imx/video.h>
21 #include <malloc.h>
22 #include <video_fb.h>
23 #include "../videomodes.h"
24 #include "ipu.h"
25 #include "mxcfb.h"
26 #include "ipu_regs.h"
27 #include "display.h"
28
29 #include <dm.h>
30 #include <video.h>
31
32 DECLARE_GLOBAL_DATA_PTR;
33
34 static int mxcfb_map_video_memory(struct fb_info *fbi);
35 static int mxcfb_unmap_video_memory(struct fb_info *fbi);
36
37 /* graphics setup */
38 static GraphicDevice panel;
39 static struct fb_videomode const *gmode;
40 static uint8_t gdisp;
41 static uint32_t gpixfmt;
42
43 static void fb_videomode_to_var(struct fb_var_screeninfo *var,
44                          const struct fb_videomode *mode)
45 {
46         var->xres = mode->xres;
47         var->yres = mode->yres;
48         var->xres_virtual = mode->xres;
49         var->yres_virtual = mode->yres;
50         var->xoffset = 0;
51         var->yoffset = 0;
52         var->pixclock = mode->pixclock;
53         var->left_margin = mode->left_margin;
54         var->right_margin = mode->right_margin;
55         var->upper_margin = mode->upper_margin;
56         var->lower_margin = mode->lower_margin;
57         var->hsync_len = mode->hsync_len;
58         var->vsync_len = mode->vsync_len;
59         var->sync = mode->sync;
60         var->vmode = mode->vmode & FB_VMODE_MASK;
61 }
62
63 /*
64  * Structure containing the MXC specific framebuffer information.
65  */
66 struct mxcfb_info {
67         int blank;
68         ipu_channel_t ipu_ch;
69         int ipu_di;
70         u32 ipu_di_pix_fmt;
71         unsigned char overlay;
72         unsigned char alpha_chan_en;
73         dma_addr_t alpha_phy_addr0;
74         dma_addr_t alpha_phy_addr1;
75         void *alpha_virt_addr0;
76         void *alpha_virt_addr1;
77         uint32_t alpha_mem_len;
78         uint32_t cur_ipu_buf;
79         uint32_t cur_ipu_alpha_buf;
80
81         u32 pseudo_palette[16];
82 };
83
84 enum {
85         BOTH_ON,
86         SRC_ON,
87         TGT_ON,
88         BOTH_OFF
89 };
90
91 static unsigned long default_bpp = 16;
92 static unsigned char g_dp_in_use;
93 static struct fb_info *mxcfb_info[3];
94 static int ext_clk_used;
95
96 static uint32_t bpp_to_pixfmt(struct fb_info *fbi)
97 {
98         uint32_t pixfmt = 0;
99
100         debug("bpp_to_pixfmt: %d\n", fbi->var.bits_per_pixel);
101
102         if (fbi->var.nonstd)
103                 return fbi->var.nonstd;
104
105         switch (fbi->var.bits_per_pixel) {
106         case 24:
107                 pixfmt = IPU_PIX_FMT_BGR24;
108                 break;
109         case 32:
110                 pixfmt = IPU_PIX_FMT_BGR32;
111                 break;
112         case 16:
113                 pixfmt = IPU_PIX_FMT_RGB565;
114                 break;
115         }
116         return pixfmt;
117 }
118
119 /*
120  * Set fixed framebuffer parameters based on variable settings.
121  *
122  * @param       info     framebuffer information pointer
123  */
124 static int mxcfb_set_fix(struct fb_info *info)
125 {
126         struct fb_fix_screeninfo *fix = &info->fix;
127         struct fb_var_screeninfo *var = &info->var;
128
129         fix->line_length = var->xres_virtual * var->bits_per_pixel / 8;
130
131         fix->type = FB_TYPE_PACKED_PIXELS;
132         fix->accel = FB_ACCEL_NONE;
133         fix->visual = FB_VISUAL_TRUECOLOR;
134         fix->xpanstep = 1;
135         fix->ypanstep = 1;
136
137         return 0;
138 }
139
140 static int setup_disp_channel1(struct fb_info *fbi)
141 {
142         ipu_channel_params_t params;
143         struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
144
145         memset(&params, 0, sizeof(params));
146         params.mem_dp_bg_sync.di = mxc_fbi->ipu_di;
147
148         debug("%s called\n", __func__);
149         /*
150          * Assuming interlaced means yuv output, below setting also
151          * valid for mem_dc_sync. FG should have the same vmode as BG.
152          */
153         if (fbi->var.vmode & FB_VMODE_INTERLACED) {
154                 params.mem_dp_bg_sync.interlaced = 1;
155                 params.mem_dp_bg_sync.out_pixel_fmt =
156                         IPU_PIX_FMT_YUV444;
157         } else {
158                 if (mxc_fbi->ipu_di_pix_fmt) {
159                         params.mem_dp_bg_sync.out_pixel_fmt =
160                                 mxc_fbi->ipu_di_pix_fmt;
161                 } else {
162                         params.mem_dp_bg_sync.out_pixel_fmt =
163                                 IPU_PIX_FMT_RGB666;
164                 }
165         }
166         params.mem_dp_bg_sync.in_pixel_fmt = bpp_to_pixfmt(fbi);
167         if (mxc_fbi->alpha_chan_en)
168                 params.mem_dp_bg_sync.alpha_chan_en = 1;
169
170         ipu_init_channel(mxc_fbi->ipu_ch, &params);
171
172         return 0;
173 }
174
175 static int setup_disp_channel2(struct fb_info *fbi)
176 {
177         int retval = 0;
178         struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
179
180         mxc_fbi->cur_ipu_buf = 1;
181         if (mxc_fbi->alpha_chan_en)
182                 mxc_fbi->cur_ipu_alpha_buf = 1;
183
184         fbi->var.xoffset = fbi->var.yoffset = 0;
185
186         debug("%s: %x %d %d %d %lx %lx\n",
187                 __func__,
188                 mxc_fbi->ipu_ch,
189                 fbi->var.xres,
190                 fbi->var.yres,
191                 fbi->fix.line_length,
192                 fbi->fix.smem_start,
193                 fbi->fix.smem_start +
194                 (fbi->fix.line_length * fbi->var.yres));
195
196         retval = ipu_init_channel_buffer(mxc_fbi->ipu_ch, IPU_INPUT_BUFFER,
197                                          bpp_to_pixfmt(fbi),
198                                          fbi->var.xres, fbi->var.yres,
199                                          fbi->fix.line_length,
200                                          fbi->fix.smem_start +
201                                          (fbi->fix.line_length * fbi->var.yres),
202                                          fbi->fix.smem_start,
203                                          0, 0);
204         if (retval)
205                 printf("ipu_init_channel_buffer error %d\n", retval);
206
207         return retval;
208 }
209
210 /*
211  * Set framebuffer parameters and change the operating mode.
212  *
213  * @param       info     framebuffer information pointer
214  */
215 static int mxcfb_set_par(struct fb_info *fbi)
216 {
217         int retval = 0;
218         u32 mem_len;
219         ipu_di_signal_cfg_t sig_cfg;
220         struct mxcfb_info *mxc_fbi = (struct mxcfb_info *)fbi->par;
221         uint32_t out_pixel_fmt;
222
223         ipu_disable_channel(mxc_fbi->ipu_ch);
224         ipu_uninit_channel(mxc_fbi->ipu_ch);
225         mxcfb_set_fix(fbi);
226
227         mem_len = fbi->var.yres_virtual * fbi->fix.line_length;
228         if (!fbi->fix.smem_start || (mem_len > fbi->fix.smem_len)) {
229                 if (fbi->fix.smem_start)
230                         mxcfb_unmap_video_memory(fbi);
231
232                 if (mxcfb_map_video_memory(fbi) < 0)
233                         return -ENOMEM;
234         }
235
236         setup_disp_channel1(fbi);
237
238         memset(&sig_cfg, 0, sizeof(sig_cfg));
239         if (fbi->var.vmode & FB_VMODE_INTERLACED) {
240                 sig_cfg.interlaced = 1;
241                 out_pixel_fmt = IPU_PIX_FMT_YUV444;
242         } else {
243                 if (mxc_fbi->ipu_di_pix_fmt)
244                         out_pixel_fmt = mxc_fbi->ipu_di_pix_fmt;
245                 else
246                         out_pixel_fmt = IPU_PIX_FMT_RGB666;
247         }
248         if (fbi->var.vmode & FB_VMODE_ODD_FLD_FIRST) /* PAL */
249                 sig_cfg.odd_field_first = 1;
250         if ((fbi->var.sync & FB_SYNC_EXT) || ext_clk_used)
251                 sig_cfg.ext_clk = 1;
252         if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT)
253                 sig_cfg.Hsync_pol = 1;
254         if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT)
255                 sig_cfg.Vsync_pol = 1;
256         if (!(fbi->var.sync & FB_SYNC_CLK_LAT_FALL))
257                 sig_cfg.clk_pol = 1;
258         if (fbi->var.sync & FB_SYNC_DATA_INVERT)
259                 sig_cfg.data_pol = 1;
260         if (!(fbi->var.sync & FB_SYNC_OE_LOW_ACT))
261                 sig_cfg.enable_pol = 1;
262         if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN)
263                 sig_cfg.clkidle_en = 1;
264
265         debug("pixclock = %lu Hz\n", PICOS2KHZ(fbi->var.pixclock) * 1000UL);
266
267         if (ipu_init_sync_panel(mxc_fbi->ipu_di,
268                                 (PICOS2KHZ(fbi->var.pixclock)) * 1000UL,
269                                 fbi->var.xres, fbi->var.yres,
270                                 out_pixel_fmt,
271                                 fbi->var.left_margin,
272                                 fbi->var.hsync_len,
273                                 fbi->var.right_margin,
274                                 fbi->var.upper_margin,
275                                 fbi->var.vsync_len,
276                                 fbi->var.lower_margin,
277                                 0, sig_cfg) != 0) {
278                 puts("mxcfb: Error initializing panel.\n");
279                 return -EINVAL;
280         }
281
282         retval = setup_disp_channel2(fbi);
283         if (retval)
284                 return retval;
285
286         if (mxc_fbi->blank == FB_BLANK_UNBLANK)
287                 ipu_enable_channel(mxc_fbi->ipu_ch);
288
289         return retval;
290 }
291
292 /*
293  * Check framebuffer variable parameters and adjust to valid values.
294  *
295  * @param       var      framebuffer variable parameters
296  *
297  * @param       info     framebuffer information pointer
298  */
299 static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
300 {
301         u32 vtotal;
302         u32 htotal;
303
304         if (var->xres_virtual < var->xres)
305                 var->xres_virtual = var->xres;
306         if (var->yres_virtual < var->yres)
307                 var->yres_virtual = var->yres;
308
309         if ((var->bits_per_pixel != 32) && (var->bits_per_pixel != 24) &&
310             (var->bits_per_pixel != 16) && (var->bits_per_pixel != 8))
311                 var->bits_per_pixel = default_bpp;
312
313         switch (var->bits_per_pixel) {
314         case 8:
315                 var->red.length = 3;
316                 var->red.offset = 5;
317                 var->red.msb_right = 0;
318
319                 var->green.length = 3;
320                 var->green.offset = 2;
321                 var->green.msb_right = 0;
322
323                 var->blue.length = 2;
324                 var->blue.offset = 0;
325                 var->blue.msb_right = 0;
326
327                 var->transp.length = 0;
328                 var->transp.offset = 0;
329                 var->transp.msb_right = 0;
330                 break;
331         case 16:
332                 var->red.length = 5;
333                 var->red.offset = 11;
334                 var->red.msb_right = 0;
335
336                 var->green.length = 6;
337                 var->green.offset = 5;
338                 var->green.msb_right = 0;
339
340                 var->blue.length = 5;
341                 var->blue.offset = 0;
342                 var->blue.msb_right = 0;
343
344                 var->transp.length = 0;
345                 var->transp.offset = 0;
346                 var->transp.msb_right = 0;
347                 break;
348         case 24:
349                 var->red.length = 8;
350                 var->red.offset = 16;
351                 var->red.msb_right = 0;
352
353                 var->green.length = 8;
354                 var->green.offset = 8;
355                 var->green.msb_right = 0;
356
357                 var->blue.length = 8;
358                 var->blue.offset = 0;
359                 var->blue.msb_right = 0;
360
361                 var->transp.length = 0;
362                 var->transp.offset = 0;
363                 var->transp.msb_right = 0;
364                 break;
365         case 32:
366                 var->red.length = 8;
367                 var->red.offset = 16;
368                 var->red.msb_right = 0;
369
370                 var->green.length = 8;
371                 var->green.offset = 8;
372                 var->green.msb_right = 0;
373
374                 var->blue.length = 8;
375                 var->blue.offset = 0;
376                 var->blue.msb_right = 0;
377
378                 var->transp.length = 8;
379                 var->transp.offset = 24;
380                 var->transp.msb_right = 0;
381                 break;
382         }
383
384         if (var->pixclock < 1000) {
385                 htotal = var->xres + var->right_margin + var->hsync_len +
386                     var->left_margin;
387                 vtotal = var->yres + var->lower_margin + var->vsync_len +
388                     var->upper_margin;
389                 var->pixclock = (vtotal * htotal * 6UL) / 100UL;
390                 var->pixclock = KHZ2PICOS(var->pixclock);
391                 printf("pixclock set for 60Hz refresh = %u ps\n",
392                         var->pixclock);
393         }
394
395         var->height = -1;
396         var->width = -1;
397         var->grayscale = 0;
398
399         return 0;
400 }
401
402 static int mxcfb_map_video_memory(struct fb_info *fbi)
403 {
404         if (fbi->fix.smem_len < fbi->var.yres_virtual * fbi->fix.line_length) {
405                 fbi->fix.smem_len = fbi->var.yres_virtual *
406                                     fbi->fix.line_length;
407         }
408         fbi->fix.smem_len = roundup(fbi->fix.smem_len, ARCH_DMA_MINALIGN);
409
410 #if CONFIG_IS_ENABLED(DM_VIDEO)
411         fbi->screen_base = (char *)gd->video_bottom;
412 #else
413         fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
414                                             fbi->fix.smem_len);
415 #endif
416
417         fbi->fix.smem_start = (unsigned long)fbi->screen_base;
418         if (fbi->screen_base == 0) {
419                 puts("Unable to allocate framebuffer memory\n");
420                 fbi->fix.smem_len = 0;
421                 fbi->fix.smem_start = 0;
422                 return -EBUSY;
423         }
424
425         debug("allocated fb @ paddr=0x%08X, size=%d.\n",
426                 (uint32_t) fbi->fix.smem_start, fbi->fix.smem_len);
427
428         fbi->screen_size = fbi->fix.smem_len;
429
430 #if CONFIG_IS_ENABLED(VIDEO)
431         gd->fb_base = fbi->fix.smem_start;
432 #endif
433
434         /* Clear the screen */
435         memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);
436
437         return 0;
438 }
439
440 static int mxcfb_unmap_video_memory(struct fb_info *fbi)
441 {
442         fbi->screen_base = 0;
443         fbi->fix.smem_start = 0;
444         fbi->fix.smem_len = 0;
445         return 0;
446 }
447
448 /*
449  * Initializes the framebuffer information pointer. After allocating
450  * sufficient memory for the framebuffer structure, the fields are
451  * filled with custom information passed in from the configurable
452  * structures.  This includes information such as bits per pixel,
453  * color maps, screen width/height and RGBA offsets.
454  *
455  * @return      Framebuffer structure initialized with our information
456  */
457 static struct fb_info *mxcfb_init_fbinfo(void)
458 {
459 #define BYTES_PER_LONG 4
460 #define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG))
461         struct fb_info *fbi;
462         struct mxcfb_info *mxcfbi;
463         char *p;
464         int size = sizeof(struct mxcfb_info) + PADDING +
465                 sizeof(struct fb_info);
466
467         debug("%s: %d %d %d %d\n",
468                 __func__,
469                 PADDING,
470                 size,
471                 sizeof(struct mxcfb_info),
472                 sizeof(struct fb_info));
473         /*
474          * Allocate sufficient memory for the fb structure
475          */
476
477         p = malloc(size);
478         if (!p)
479                 return NULL;
480
481         memset(p, 0, size);
482
483         fbi = (struct fb_info *)p;
484         fbi->par = p + sizeof(struct fb_info) + PADDING;
485
486         mxcfbi = (struct mxcfb_info *)fbi->par;
487         debug("Framebuffer structures at: fbi=0x%x mxcfbi=0x%x\n",
488                 (unsigned int)fbi, (unsigned int)mxcfbi);
489
490         fbi->var.activate = FB_ACTIVATE_NOW;
491
492         fbi->flags = FBINFO_FLAG_DEFAULT;
493         fbi->pseudo_palette = mxcfbi->pseudo_palette;
494
495         return fbi;
496 }
497
498 /*
499  * Probe routine for the framebuffer driver. It is called during the
500  * driver binding process. The following functions are performed in
501  * this routine: Framebuffer initialization, Memory allocation and
502  * mapping, Framebuffer registration, IPU initialization.
503  *
504  * @return      Appropriate error code to the kernel common code
505  */
506 static int mxcfb_probe(u32 interface_pix_fmt, uint8_t disp,
507                         struct fb_videomode const *mode)
508 {
509         struct fb_info *fbi;
510         struct mxcfb_info *mxcfbi;
511         int ret = 0;
512
513         /*
514          * Initialize FB structures
515          */
516         fbi = mxcfb_init_fbinfo();
517         if (!fbi) {
518                 ret = -ENOMEM;
519                 goto err0;
520         }
521         mxcfbi = (struct mxcfb_info *)fbi->par;
522
523         if (!g_dp_in_use) {
524                 mxcfbi->ipu_ch = MEM_BG_SYNC;
525                 mxcfbi->blank = FB_BLANK_UNBLANK;
526         } else {
527                 mxcfbi->ipu_ch = MEM_DC_SYNC;
528                 mxcfbi->blank = FB_BLANK_POWERDOWN;
529         }
530
531         mxcfbi->ipu_di = disp;
532
533         ipu_disp_set_global_alpha(mxcfbi->ipu_ch, 1, 0x80);
534         ipu_disp_set_color_key(mxcfbi->ipu_ch, 0, 0);
535         strcpy(fbi->fix.id, "DISP3 BG");
536
537         g_dp_in_use = 1;
538
539         mxcfb_info[mxcfbi->ipu_di] = fbi;
540
541         /* Need dummy values until real panel is configured */
542
543         mxcfbi->ipu_di_pix_fmt = interface_pix_fmt;
544         fb_videomode_to_var(&fbi->var, mode);
545         fbi->var.bits_per_pixel = 16;
546         fbi->fix.line_length = fbi->var.xres * (fbi->var.bits_per_pixel / 8);
547         fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
548
549         mxcfb_check_var(&fbi->var, fbi);
550
551         /* Default Y virtual size is 2x panel size */
552         fbi->var.yres_virtual = fbi->var.yres * 2;
553
554         mxcfb_set_fix(fbi);
555
556         /* allocate fb first */
557         if (mxcfb_map_video_memory(fbi) < 0)
558                 return -ENOMEM;
559
560         mxcfb_set_par(fbi);
561
562         panel.winSizeX = mode->xres;
563         panel.winSizeY = mode->yres;
564         panel.plnSizeX = mode->xres;
565         panel.plnSizeY = mode->yres;
566
567         panel.frameAdrs = (u32)fbi->screen_base;
568         panel.memSize = fbi->screen_size;
569
570         panel.gdfBytesPP = 2;
571         panel.gdfIndex = GDF_16BIT_565RGB;
572
573         ipu_dump_registers();
574
575         return 0;
576
577 err0:
578         return ret;
579 }
580
581 void ipuv3_fb_shutdown(void)
582 {
583         int i;
584         struct ipu_stat *stat = (struct ipu_stat *)IPU_STAT;
585
586         if (!ipu_clk_enabled())
587                 return;
588
589         for (i = 0; i < ARRAY_SIZE(mxcfb_info); i++) {
590                 struct fb_info *fbi = mxcfb_info[i];
591                 if (fbi) {
592                         struct mxcfb_info *mxc_fbi = fbi->par;
593                         ipu_disable_channel(mxc_fbi->ipu_ch);
594                         ipu_uninit_channel(mxc_fbi->ipu_ch);
595                 }
596         }
597         for (i = 0; i < ARRAY_SIZE(stat->int_stat); i++) {
598                 __raw_writel(__raw_readl(&stat->int_stat[i]),
599                              &stat->int_stat[i]);
600         }
601 }
602
603 void *video_hw_init(void)
604 {
605         int ret;
606
607         ret = ipu_probe();
608         if (ret)
609                 puts("Error initializing IPU\n");
610
611         ret = mxcfb_probe(gpixfmt, gdisp, gmode);
612         debug("Framebuffer at 0x%x\n", (unsigned int)panel.frameAdrs);
613         gd->fb_base = panel.frameAdrs;
614
615         return (void *)&panel;
616 }
617
618 int ipuv3_fb_init(struct fb_videomode const *mode,
619                   uint8_t disp,
620                   uint32_t pixfmt)
621 {
622         gmode = mode;
623         gdisp = disp;
624         gpixfmt = pixfmt;
625
626         return 0;
627 }
628
629 #if CONFIG_IS_ENABLED(DM_VIDEO)
630 enum {
631         /* Maximum display size we support */
632         LCD_MAX_WIDTH           = 1920,
633         LCD_MAX_HEIGHT          = 1080,
634         LCD_MAX_LOG2_BPP        = VIDEO_BPP16,
635 };
636
637 static int ipuv3_video_probe(struct udevice *dev)
638 {
639         struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
640         struct video_priv *uc_priv = dev_get_uclass_priv(dev);
641 #if defined(CONFIG_DISPLAY)
642         struct udevice *disp_dev;
643 #endif
644         u32 fb_start, fb_end;
645         int ret;
646
647         debug("%s() plat: base 0x%lx, size 0x%x\n",
648               __func__, plat->base, plat->size);
649
650         ret = ipu_probe();
651         if (ret)
652                 return ret;
653
654         ret = ipu_displays_init();
655         if (ret < 0)
656                 return ret;
657
658         ret = mxcfb_probe(gpixfmt, gdisp, gmode);
659         if (ret < 0)
660                 return ret;
661
662 #if defined(CONFIG_DISPLAY)
663         ret = uclass_first_device(UCLASS_DISPLAY, &disp_dev);
664         if (disp_dev) {
665                 ret = display_enable(disp_dev, 16, NULL);
666                 if (ret < 0)
667                         return ret;
668         }
669 #endif
670
671         uc_priv->xsize = gmode->xres;
672         uc_priv->ysize = gmode->yres;
673         uc_priv->bpix = LCD_MAX_LOG2_BPP;
674
675         /* Enable dcache for the frame buffer */
676         fb_start = plat->base & ~(MMU_SECTION_SIZE - 1);
677         fb_end = plat->base + plat->size;
678         fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
679         mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
680                                         DCACHE_WRITEBACK);
681         video_set_flush_dcache(dev, true);
682         gd->fb_base = fb_start;
683
684         return 0;
685 }
686
687 struct ipuv3_video_priv {
688         ulong regs;
689 };
690
691 static int ipuv3_video_bind(struct udevice *dev)
692 {
693         struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
694
695         plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT *
696                      (1 << VIDEO_BPP32) / 8;
697
698         return 0;
699 }
700
701 static const struct udevice_id ipuv3_video_ids[] = {
702         { .compatible = "fsl,imx6q-ipu" },
703         { .compatible = "fsl,imx53-ipu" },
704         { }
705 };
706
707 U_BOOT_DRIVER(ipuv3_video) = {
708         .name   = "ipuv3_video",
709         .id     = UCLASS_VIDEO,
710         .of_match = ipuv3_video_ids,
711         .bind   = ipuv3_video_bind,
712         .probe  = ipuv3_video_probe,
713         .priv_auto_alloc_size = sizeof(struct ipuv3_video_priv),
714         .flags  = DM_FLAG_PRE_RELOC,
715 };
716 #endif /* CONFIG_DM_VIDEO */
This page took 0.068054 seconds and 4 git commands to generate.