summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c')
-rw-r--r--firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c148
1 files changed, 148 insertions, 0 deletions
diff --git a/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c b/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c
new file mode 100644
index 0000000000..932154da8d
--- /dev/null
+++ b/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c
@@ -0,0 +1,148 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 Andrew Ryabinin
11 *
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#include "config.h"
24#include "kernel.h"
25#include "lcd.h"
26#include "system.h"
27#include "cpu.h"
28#include "lcdif-rk27xx.h"
29
30
31/* TODO */
32static void lcd_sleep(unsigned int sleep)
33{
34 (void)sleep;
35}
36
37void lcd_display_init()
38{
39 unsigned int x, y;
40
41 /* Driving ability setting */
42 lcd_write_reg(0x60, 0x00);
43 lcd_write_reg(0x61, 0x06);
44 lcd_write_reg(0x62, 0x00);
45 lcd_write_reg(0x63, 0xC8);
46
47 /* Gamma 2.2 Setting */
48 lcd_write_reg(0x40, 0x00);
49 lcd_write_reg(0x41, 0x40);
50 lcd_write_reg(0x42, 0x45);
51 lcd_write_reg(0x43, 0x01);
52 lcd_write_reg(0x44, 0x60);
53 lcd_write_reg(0x45, 0x05);
54 lcd_write_reg(0x46, 0x0C);
55 lcd_write_reg(0x47, 0xD1);
56 lcd_write_reg(0x48, 0x05);
57
58 lcd_write_reg(0x50, 0x75);
59 lcd_write_reg(0x51, 0x01);
60 lcd_write_reg(0x52, 0x67);
61 lcd_write_reg(0x53, 0x14);
62 lcd_write_reg(0x54, 0xF2);
63 lcd_write_reg(0x55, 0x07);
64 lcd_write_reg(0x56, 0x03);
65 lcd_write_reg(0x57, 0x49);
66
67 /* Power voltage setting */
68 lcd_write_reg(0x1F, 0x03);
69 lcd_write_reg(0x20, 0x00);
70 lcd_write_reg(0x24, 0x28);
71 lcd_write_reg(0x25, 0x45);
72
73 lcd_write_reg(0x23, 0x2F);
74
75 /* Power on setting */
76 lcd_write_reg(0x18, 0x44);
77 lcd_write_reg(0x21, 0x01);
78 lcd_write_reg(0x01, 0x00);
79 lcd_write_reg(0x1C, 0x03);
80 lcd_write_reg(0x19, 0x06);
81 udelay(5);
82
83 /* Display on setting */
84 lcd_write_reg(0x26, 0x84);
85 udelay(40);
86 lcd_write_reg(0x26, 0xB8);
87 udelay(40);
88 lcd_write_reg(0x26, 0xBC);
89 udelay(40);
90
91 /* Memmory access setting */
92 lcd_write_reg(0x16, 0x48);
93 /* Setup 16bit mode */
94 lcd_write_reg(0x17, 0x05);
95
96 /* Set GRAM area */
97 lcd_write_reg(0x02, 0x00);
98 lcd_write_reg(0x03, 0x00);
99 lcd_write_reg(0x04, 0x00);
100 lcd_write_reg(0x05, LCD_HEIGHT - 1);
101 lcd_write_reg(0x06, 0x00);
102 lcd_write_reg(0x07, 0x00);
103 lcd_write_reg(0x08, 0x00);
104 lcd_write_reg(0x09, LCD_WIDTH - 1);
105
106 /* Start GRAM write */
107 lcd_cmd(0x22);
108
109 for (x=0; x<LCD_WIDTH; x++)
110 for(y=0; y<LCD_HEIGHT; y++)
111 lcd_data(0x00);
112
113 lcd_sleep(0);
114}
115
116
117
118void lcd_update_rect(int x, int y, int width, int height)
119{
120 int px = x, py = y;
121 int pxmax = x + width, pymax = y + height;
122
123 lcd_write_reg(0x03, y);
124 lcd_write_reg(0x05, pymax-1);
125 lcd_write_reg(0x07, x);
126 lcd_write_reg(0x09, pxmax-1);
127
128 lcd_cmd(0x22);
129
130 for (px=x; px<pxmax; px++)
131 for (py=y; py<pymax; py++)
132 lcd_data(lcd_framebuffer[py][px]);
133}
134
135/* Blit a YUV bitmap directly to the LCD */
136void lcd_blit_yuv(unsigned char * const src[3],
137 int src_x, int src_y, int stride,
138 int x, int y, int width, int height)
139{
140 (void)src;
141 (void)src_x;
142 (void)src_y;
143 (void)stride;
144 (void)x;
145 (void)y;
146 (void)width;
147 (void)height;
148}