1 /* drivers/video/msm/logo.c
3 * Show Logo in RLE 565 format
5 * Copyright (C) 2008 Google Incorporated
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/module.h>
18 #include <linux/types.h>
20 #include <linux/vt_kern.h>
21 #include <linux/unistd.h>
22 #include <linux/syscalls.h>
24 #include <linux/irq.h>
25 #include <asm/system.h>
27 #define fb_width(fb) ((fb)->var.xres)
28 #define fb_height(fb) ((fb)->var.yres)
29 #define fb_size(fb) ((fb)->var.xres * (fb)->var.yres * 2)
31 static void memset16(void *_ptr
, unsigned short val
, unsigned count
)
33 unsigned short *ptr
= _ptr
;
39 /* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
40 int load_565rle_image(char *filename
)
45 unsigned short *data
, *bits
, *ptr
;
47 info
= registered_fb
[0];
49 printk(KERN_WARNING
"%s: Can not access framebuffer\n",
54 fd
= sys_open(filename
, O_RDONLY
, 0);
56 printk(KERN_WARNING
"%s: Can not open %s\n",
60 count
= (unsigned)sys_lseek(fd
, (off_t
)0, 2);
64 goto err_logo_close_file
;
66 sys_lseek(fd
, (off_t
)0, 0);
67 data
= kmalloc(count
, GFP_KERNEL
);
69 printk(KERN_WARNING
"%s: Can not alloc data\n", __func__
);
71 goto err_logo_close_file
;
73 if ((unsigned)sys_read(fd
, (char *)data
, count
) != count
) {
75 goto err_logo_free_data
;
78 max
= fb_width(info
) * fb_height(info
);
80 bits
= (unsigned short *)(info
->screen_base
);
85 memset16(bits
, ptr
[1], n
<< 1);
98 EXPORT_SYMBOL(load_565rle_image
);