uboot/board/freescale/ls1021aiot/dcu.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * Copyright 2016 Freescale Semiconductor, Inc.
   4 *
   5 * FSL DCU Framebuffer driver
   6 */
   7
   8#include <common.h>
   9#include <fsl_dcu_fb.h>
  10#include "div64.h"
  11#include "../common/dcu_sii9022a.h"
  12
  13DECLARE_GLOBAL_DATA_PTR;
  14
  15unsigned int dcu_set_pixel_clock(unsigned int pixclock)
  16{
  17        unsigned long long div;
  18
  19        div = (unsigned long long)(gd->bus_clk / 1000);
  20        div *= (unsigned long long)pixclock;
  21        do_div(div, 1000000000);
  22
  23        return div;
  24}
  25
  26int platform_dcu_init(unsigned int xres, unsigned int yres,
  27                const char *port,
  28                struct fb_videomode *dcu_fb_videomode)
  29{
  30        const char *name;
  31        unsigned int pixel_format;
  32
  33        if (strncmp(port, "twr_lcd", 4) == 0) {
  34                name = "TWR_LCD_RGB card";
  35        } else {
  36                name = "HDMI";
  37                dcu_set_dvi_encoder(dcu_fb_videomode);
  38        }
  39
  40        printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres);
  41
  42        pixel_format = 32;
  43        fsl_dcu_init(xres, yres, pixel_format);
  44
  45        return 0;
  46}
  47