Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include <debug.h> |
| 30 | #include <reg.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <string.h> |
| 33 | #include <dev/fbcon.h> |
| 34 | #include <kernel/thread.h> |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 35 | #include <mddi.h> |
| 36 | #include <target/display.h> |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 37 | #include <platform/timer.h> |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 38 | |
| 39 | #include "mddi_hw.h" |
| 40 | |
| 41 | static mddi_llentry *mlist = NULL; |
| 42 | static mddi_llentry *mlist_remote_write = NULL; |
| 43 | |
| 44 | #define MDDI_MAX_REV_PKT_SIZE 0x60 |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 45 | #define MDDI_REV_PKT_BUF_SIZE 256 |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 46 | static void *rev_pkt_buf; |
| 47 | |
| 48 | /* functions provided by the target specific panel code */ |
| 49 | void panel_init(struct mddi_client_caps *client_caps); |
| 50 | void panel_poweron(void); |
| 51 | void panel_backlight(int on); |
| 52 | |
| 53 | /* forward decls */ |
| 54 | static void mddi_start_update(void); |
| 55 | static int mddi_update_done(void); |
| 56 | |
| 57 | static struct fbcon_config fb_cfg = { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 58 | .format = FB_FORMAT_RGB565, |
| 59 | .bpp = 16, |
| 60 | .update_start = mddi_start_update, |
| 61 | .update_done = mddi_update_done, |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | static void printcaps(struct mddi_client_caps *c) |
| 65 | { |
| 66 | if ((c->length != 0x4a) || (c->type != 0x42)) { |
| 67 | dprintf(INFO, "bad caps header\n"); |
| 68 | memset(c, 0, sizeof(*c)); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | dprintf(INFO, "mddi: bm: %d,%d win %d,%d rgb %x\n", |
| 73 | c->bitmap_width, c->bitmap_height, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 74 | c->display_window_width, c->display_window_height, c->rgb_cap); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 75 | dprintf(INFO, "mddi: vend %x prod %x\n", |
| 76 | c->manufacturer_name, c->product_code); |
| 77 | } |
| 78 | |
| 79 | /* TODO: add timeout */ |
| 80 | static int mddi_wait_status(unsigned statmask) |
| 81 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 82 | while ((readl(MDDI_STAT) & statmask) == 0) ; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | /* TODO: add timeout */ |
| 87 | static int mddi_wait_interrupt(unsigned intmask) |
| 88 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 89 | while ((readl(MDDI_INT) & intmask) == 0) ; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | void mddi_remote_write(unsigned val, unsigned reg) |
| 94 | { |
| 95 | mddi_llentry *ll; |
| 96 | mddi_register_access *ra; |
| 97 | |
| 98 | ll = mlist_remote_write; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 99 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 100 | ra = &(ll->u.r); |
| 101 | ra->length = 14 + 4; |
| 102 | ra->type = TYPE_REGISTER_ACCESS; |
| 103 | ra->client_id = 0; |
| 104 | ra->rw_info = MDDI_WRITE | 1; |
| 105 | ra->crc = 0; |
| 106 | |
| 107 | ra->reg_addr = reg; |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 108 | ra->reg_data[0] = val; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 109 | |
| 110 | ll->flags = 1; |
| 111 | ll->header_count = 14; |
| 112 | ll->data_count = 4; |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 113 | ll->data = &ra->reg_data[0]; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 114 | ll->next = (void *)0; |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 115 | ll->reserved = 0; |
| 116 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 117 | writel((unsigned)ll, MDDI_PRI_PTR); |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 118 | |
| 119 | mddi_wait_status(MDDI_STAT_PRI_LINK_LIST_DONE); |
| 120 | } |
| 121 | |
| 122 | #ifdef MDDI_MULTI_WRITE |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 123 | void |
| 124 | mddi_remote_multiwrite(unsigned *val_list, unsigned reg, unsigned val_count) |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 125 | { |
| 126 | mddi_llentry *ll; |
| 127 | mddi_register_access *ra; |
| 128 | |
| 129 | ll = mlist_remote_write; |
| 130 | |
| 131 | ra = &(ll->u.r); |
| 132 | ra->length = 14 + (val_count * 4); |
| 133 | ra->type = TYPE_REGISTER_ACCESS; |
| 134 | ra->client_id = 0; |
| 135 | ra->rw_info = MDDI_WRITE | val_count; |
| 136 | ra->crc = 0; |
| 137 | |
| 138 | ra->reg_addr = reg; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 139 | memcpy((void *)&ra->reg_data[0], val_list, val_count); |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 140 | |
| 141 | ll->flags = 1; |
| 142 | ll->header_count = 14; |
| 143 | ll->data_count = val_count * 4; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 144 | ll->data = &ra->reg_data; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 145 | ll->next = (void *)0; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 146 | ll->reserved = 0; |
| 147 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 148 | writel((unsigned)ll, MDDI_PRI_PTR); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 149 | |
| 150 | mddi_wait_status(MDDI_STAT_PRI_LINK_LIST_DONE); |
| 151 | } |
Channagoud Kadabi | 51ea972 | 2011-08-25 14:56:53 +0530 | [diff] [blame] | 152 | #endif |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 153 | |
| 154 | static void mddi_start_update(void) |
| 155 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 156 | writel((unsigned)mlist, MDDI_PRI_PTR); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | static int mddi_update_done(void) |
| 160 | { |
| 161 | return !!(readl(MDDI_STAT) & MDDI_STAT_PRI_LINK_LIST_DONE); |
| 162 | } |
| 163 | |
| 164 | static void mddi_do_cmd(unsigned cmd) |
| 165 | { |
| 166 | writel(cmd, MDDI_CMD); |
| 167 | mddi_wait_interrupt(MDDI_INT_NO_REQ_PKTS_PENDING); |
| 168 | } |
| 169 | |
| 170 | static void mddi_init_rev_encap(void) |
| 171 | { |
| 172 | memset(rev_pkt_buf, 0xee, MDDI_REV_PKT_BUF_SIZE); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 173 | writel((unsigned)rev_pkt_buf, MDDI_REV_PTR); |
| 174 | writel((unsigned)rev_pkt_buf, MDDI_REV_PTR); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 175 | writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_SIZE); |
| 176 | writel(MDDI_REV_PKT_BUF_SIZE, MDDI_REV_ENCAP_SZ); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 177 | mddi_do_cmd(CMD_FORCE_NEW_REV_PTR); |
| 178 | } |
| 179 | |
| 180 | static void mddi_set_auto_hibernate(unsigned on) |
| 181 | { |
| 182 | writel(CMD_POWER_DOWN, MDDI_CMD); |
| 183 | mddi_wait_interrupt(MDDI_INT_IN_HIBERNATION); |
| 184 | mddi_do_cmd(CMD_HIBERNATE | !!on); |
| 185 | } |
| 186 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 187 | void mddi_set_caps(mddi_client_caps * c) |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 188 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 189 | /* Hardcoding the capability values */ |
| 190 | c->length = 74; |
| 191 | c->type = 66; |
| 192 | c->client_id = 0; |
| 193 | c->protocol_ver = 1; |
| 194 | c->min_protocol_ver = 1; |
| 195 | c->data_rate_cap = 400; |
| 196 | c->interface_type_cap = 0; |
| 197 | c->num_alt_displays = 1; |
| 198 | c->postcal_data_rate = 400; |
| 199 | c->bitmap_width = TARGET_XRES; |
| 200 | c->bitmap_height = TARGET_YRES; |
| 201 | c->display_window_width = TARGET_XRES; |
| 202 | c->display_window_height = TARGET_YRES; |
| 203 | c->cmap_size = 0; |
| 204 | c->cmap_rgb_width = 0; |
| 205 | c->rgb_cap = 34592; |
| 206 | c->mono_cap = 0; |
| 207 | c->reserved1 = 0; |
| 208 | c->ycbcr_cap = 0; |
| 209 | c->bayer_cap = 0; |
| 210 | c->alpha_cursor_planes = 0; |
| 211 | c->client_feature_cap = 4489216; |
| 212 | c->max_video_frame_rate_cap = 60; |
| 213 | c->min_video_frame_rate_cap = 0; |
| 214 | c->min_sub_frame_rate = 0; |
| 215 | c->audio_buf_depth = 0; |
| 216 | c->audio_channel_cap = 0; |
| 217 | c->audio_sampe_rate_rap = 0; |
| 218 | c->audio_sample_res = 0; |
| 219 | c->mic_audio_sample_res = 0; |
| 220 | c->mic_sample_rate_cap = 0; |
| 221 | c->keyboard_data_fmt = 0; |
| 222 | c->pointing_device_data_fmt = 0; |
| 223 | c->content_protection_type = 0; |
| 224 | c->manufacturer_name = 53859; |
| 225 | c->product_code = 34594; |
| 226 | c->reserved3 = 0; |
| 227 | c->serial_no = 1; |
| 228 | c->week_of_manufacture = 0; |
| 229 | c->year_of_manufacture = 0; |
| 230 | c->crc = 53536; |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 233 | static void mddi_get_caps(struct mddi_client_caps *caps) |
| 234 | { |
| 235 | unsigned timeout = 100000; |
| 236 | unsigned n; |
| 237 | |
| 238 | writel(0xffffffff, MDDI_INT); |
| 239 | mddi_do_cmd(CMD_LINK_ACTIVE); |
| 240 | |
| 241 | /* sometimes this will fail -- do it three times for luck... */ |
| 242 | mddi_do_cmd(CMD_RTD_MEASURE); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 243 | thread_sleep(1); //mdelay(1); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 244 | |
| 245 | mddi_do_cmd(CMD_RTD_MEASURE); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 246 | thread_sleep(1); //mdelay(1); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 247 | |
| 248 | mddi_do_cmd(CMD_RTD_MEASURE); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 249 | thread_sleep(1); //mdelay(1); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 250 | |
| 251 | mddi_do_cmd(CMD_GET_CLIENT_CAP); |
| 252 | |
| 253 | do { |
| 254 | n = readl(MDDI_INT); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 255 | } |
| 256 | while (!(n & MDDI_INT_REV_DATA_AVAIL) && (--timeout)); |
| 257 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 258 | if (timeout == 0) |
| 259 | dprintf(INFO, "timeout\n"); |
| 260 | |
| 261 | memcpy(caps, rev_pkt_buf, sizeof(struct mddi_client_caps)); |
| 262 | } |
| 263 | |
| 264 | static unsigned mddi_init_regs(void) |
| 265 | { |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 266 | mddi_do_cmd(CMD_RESET); |
| 267 | |
| 268 | mddi_do_cmd(CMD_PERIODIC_REV_ENC); |
| 269 | |
| 270 | writel(0x0001, MDDI_VERSION); |
| 271 | writel(0x3C00, MDDI_BPS); |
| 272 | writel(0x0003, MDDI_SPM); |
| 273 | |
| 274 | writel(0x0005, MDDI_TA1_LEN); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 275 | writel(0x001A, MDDI_TA2_LEN); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 276 | writel(0x0096, MDDI_DRIVE_HI); |
| 277 | writel(0x0050, MDDI_DRIVE_LO); |
| 278 | writel(0x003C, MDDI_DISP_WAKE); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 279 | writel(0x0004, MDDI_REV_RATE_DIV); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 280 | |
| 281 | /* needs to settle for 5uS */ |
| 282 | if (readl(MDDI_PAD_CTL) == 0) { |
| 283 | writel(0x08000, MDDI_PAD_CTL); |
Chandan Uddaraju | 61e6d7c | 2010-07-20 17:57:06 -0700 | [diff] [blame] | 284 | udelay(5); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | writel(0xA850F, MDDI_PAD_CTL); |
| 288 | writel(0x60006, MDDI_DRIVER_START_CNT); |
| 289 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 290 | mddi_init_rev_encap(); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 291 | |
| 292 | /* disable hibernate */ |
| 293 | mddi_do_cmd(CMD_HIBERNATE | 0); |
| 294 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 295 | return readl(MDDI_CORE_VER) & 0xffff; |
| 296 | } |
| 297 | |
| 298 | struct fbcon_config *mddi_init(void) |
| 299 | { |
| 300 | unsigned n; |
| 301 | struct mddi_client_caps client_caps; |
| 302 | |
| 303 | dprintf(INFO, "mddi_init()\n"); |
| 304 | |
| 305 | rev_pkt_buf = memalign(32, MDDI_REV_PKT_BUF_SIZE); |
| 306 | mlist_remote_write = memalign(32, sizeof(struct mddi_llentry)); |
| 307 | |
| 308 | n = mddi_init_regs(); |
| 309 | dprintf(INFO, "mddi version: 0x%08x\n", n); |
| 310 | |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 311 | //mddi_get_caps(&client_caps); |
| 312 | //if(!(client_caps.length == 0x4a && client_caps.type == 0x42)) |
| 313 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 314 | mddi_set_caps(&client_caps); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 315 | } |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 316 | |
| 317 | fb_cfg.width = client_caps.bitmap_width; |
| 318 | fb_cfg.stride = fb_cfg.width; |
| 319 | fb_cfg.height = client_caps.bitmap_height; |
| 320 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 321 | panel_init(&client_caps); |
| 322 | |
| 323 | panel_backlight(0); |
| 324 | panel_poweron(); |
| 325 | |
| 326 | /* v > 8? v > 8 && < 0x19 ? */ |
| 327 | writel(2, MDDI_TEST); |
| 328 | |
| 329 | dprintf(INFO, "panel is %d x %d\n", fb_cfg.width, fb_cfg.height); |
| 330 | |
| 331 | fb_cfg.base = |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 332 | memalign(4096, fb_cfg.width * fb_cfg.height * (fb_cfg.bpp / 8)); |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 333 | |
| 334 | mlist = memalign(32, sizeof(mddi_llentry) * (fb_cfg.height / 8)); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 335 | dprintf(INFO, "FB @ %p mlist @ %x\n", fb_cfg.base, (unsigned)mlist); |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 336 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 337 | for (n = 0; n < (fb_cfg.height / 8); n++) { |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 338 | unsigned y = n * 8; |
| 339 | unsigned pixels = fb_cfg.width * 8; |
| 340 | mddi_video_stream *vs = &(mlist[n].u.v); |
| 341 | |
| 342 | vs->length = sizeof(mddi_video_stream) - 2 + (pixels * 2); |
| 343 | vs->type = TYPE_VIDEO_STREAM; |
| 344 | vs->client_id = 0; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 345 | vs->format = 0x5565; // FORMAT_16BPP; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 346 | vs->pixattr = PIXATTR_BOTH_EYES | PIXATTR_TO_ALL; |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 347 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 348 | vs->left = 0; |
| 349 | vs->right = fb_cfg.width - 1; |
| 350 | vs->top = y; |
| 351 | vs->bottom = y + 7; |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 352 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 353 | vs->start_x = 0; |
| 354 | vs->start_y = y; |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 355 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 356 | vs->pixels = pixels; |
| 357 | vs->crc = 0; |
| 358 | vs->reserved = 0; |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 359 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 360 | mlist[n].header_count = sizeof(mddi_video_stream) - 2; |
| 361 | mlist[n].data_count = pixels * 2; |
| 362 | mlist[n].reserved = 0; |
| 363 | mlist[n].data = fb_cfg.base + (y * fb_cfg.width * 2); |
| 364 | mlist[n].next = &mlist[n + 1]; |
| 365 | mlist[n].flags = 0; |
| 366 | } |
| 367 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 368 | mlist[n - 1].flags = 1; |
| 369 | mlist[n - 1].next = 0; |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 370 | |
| 371 | mddi_set_auto_hibernate(1); |
| 372 | mddi_do_cmd(CMD_LINK_ACTIVE); |
| 373 | |
| 374 | panel_backlight(1); |
| 375 | |
| 376 | return &fb_cfg; |
| 377 | } |