Merge branch 'u-boot-sunxi/master' into 'u-boot-arm/master'
[platform/kernel/u-boot.git] / board / bf527-ezkit / video.c
index 87e7658..c2bf145 100644 (file)
 #include <linux/types.h>
 #include <stdio_dev.h>
 
+#include <lzma/LzmaTypes.h>
+#include <lzma/LzmaDec.h>
+#include <lzma/LzmaTools.h>
+
 #include <asm/mach-common/bits/ppi.h>
 #include <asm/mach-common/bits/timer.h>
 
 #define LCD_Y_RES              240     /* Vertical Resolution */
 #define DMA_BUS_SIZE           16
 
-#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1 /* lq035q1 */
+#include EASYLOGO_HEADER
 
-#if !defined(CONFIG_LQ035Q1_USE_RGB888_8_BIT_PPI) && \
-    !defined(CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI)
-# define CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI
-#endif
+#ifdef CONFIG_BF527_EZKIT_REV_2_1 /* lq035q1 */
 
 /* Interface 16/18-bit TFT over an 8-bit wide PPI using a
  * small Programmable Logic Device (CPLD)
  */
 
 #ifdef CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI
-#include <asm/bfin_logo_rgb565_230x230.h>
 #define LCD_BPP                16      /* Bit Per Pixel */
 #define CLOCKS_PPIX    2       /* Clocks per pixel */
 #define CPLD_DELAY     3       /* RGB565 pipeline delay */
 #endif
 
 #ifdef CONFIG_LQ035Q1_USE_RGB888_8_BIT_PPI
-#include <asm/bfin_logo_230x230.h>
 #define LCD_BPP                24      /* Bit Per Pixel */
 #define CLOCKS_PPIX    3       /* Clocks per pixel */
 #define CPLD_DELAY     5       /* RGB888 pipeline delay */
@@ -96,7 +95,6 @@
 #endif
 
 #else /* t350mcqb */
-#include <asm/bfin_logo_230x230.h>
 
 #define LCD_BPP                24      /* Bit Per Pixel */
 #define CLOCKS_PPIX    3       /* Clocks per pixel */
 #define PPI_PACK_EN            0x80
 #define PPI_POLS_1             0x8000
 
-#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
+#ifdef CONFIG_BF527_EZKIT_REV_2_1
 static struct spi_slave *slave;
 static int lq035q1_control(unsigned char reg, unsigned short value)
 {
@@ -305,7 +303,7 @@ void EnableTIMER12(void)
 int video_init(void *dst)
 {
 
-#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
+#ifdef CONFIG_BF527_EZKIT_REV_2_1
        lq035q1_control(LQ035_SHUT_CTL, LQ035_ON);
        lq035q1_control(LQ035_DRIVER_OUTPUT_CTL, (CONFIG_LQ035Q1_LCD_MODE &
                LQ035_DRIVER_OUTPUT_MASK) | LQ035_DRIVER_OUTPUT_DEFAULT);
@@ -318,7 +316,7 @@ int video_init(void *dst)
        Init_PPI();
        EnablePPI();
 
-#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
+#ifdef CONFIG_BF527_EZKIT_REV_2_1
        EnableTIMER12();
 #else
        /* Frame sync 2 (VS) needs to start at least one PPI clk earlier */
@@ -388,19 +386,11 @@ void video_stop(void)
        DisableDMA();
        DisableTIMER0();
        DisableTIMER1();
-#ifdef CONFIG_MK_BF527_EZKIT_REV_2_1
+#ifdef CONFIG_BF527_EZKIT_REV_2_1
        lq035q1_control(LQ035_SHUT_CTL, LQ035_SHUT);
 #endif
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
        int error, devices = 1;
@@ -419,13 +409,23 @@ int drv_video_init(void)
 #ifdef EASYLOGO_ENABLE_GZIP
        unsigned char *data = EASYLOGO_DECOMP_BUFFER;
        unsigned long src_len = EASYLOGO_ENABLE_GZIP;
-       if (gunzip(data, bfin_logo.size, bfin_logo.data, &src_len)) {
+       error = gunzip(data, bfin_logo.size, bfin_logo.data, &src_len);
+       bfin_logo.data = data;
+#elif defined(EASYLOGO_ENABLE_LZMA)
+       unsigned char *data = EASYLOGO_DECOMP_BUFFER;
+       SizeT lzma_len = bfin_logo.size;
+       error = lzmaBuffToBuffDecompress(data, &lzma_len,
+               bfin_logo.data, EASYLOGO_ENABLE_LZMA);
+       bfin_logo.data = data;
+#else
+       error = 0;
+#endif
+
+       if (error) {
                puts("Failed to decompress logo\n");
                free(dst);
                return -1;
        }
-       bfin_logo.data = data;
-#endif
 
        memset(dst + ACTIVE_VIDEO_MEM_OFFSET, bfin_logo.data[0], fbmem_size - ACTIVE_VIDEO_MEM_OFFSET);
 
@@ -440,8 +440,6 @@ int drv_video_init(void)
        strcpy(videodev.name, "video");
        videodev.ext = DEV_EXT_VIDEO;   /* Video extensions */
        videodev.flags = DEV_FLAGS_SYSTEM;      /* No Output */
-       videodev.putc = video_putc;     /* 'putc' function */
-       videodev.puts = video_puts;     /* 'puts' function */
 
        error = stdio_register(&videodev);