diff options
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/udlfb/udlfb.c | 358 | ||||
-rw-r--r-- | drivers/staging/udlfb/udlfb.h | 29 |
2 files changed, 299 insertions, 88 deletions
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c index 08165997f80..0ab9d15f343 100644 --- a/drivers/staging/udlfb/udlfb.c +++ b/drivers/staging/udlfb/udlfb.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Based on the amazing work of Florian Echtler and libdlo 0.1 * | 7 | * Based on the amazing work of Florian Echtler and libdlo 0.1 * |
8 | * * | 8 | * * |
9 | * * | 9 | * * |
10 | * 10.06.09 release 0.2.3 (edid ioctl, fallback for unsupported modes) * | ||
11 | * 05.06.09 release 0.2.2 (real screen blanking, rle compression, double buffer) * | ||
10 | * 31.05.09 release 0.2 * | 12 | * 31.05.09 release 0.2 * |
11 | * 22.05.09 First public (ugly) release * | 13 | * 22.05.09 First public (ugly) release * |
12 | *****************************************************************************/ | 14 | *****************************************************************************/ |
@@ -99,6 +101,7 @@ static int dlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
99 | struct dloarea { | 101 | struct dloarea { |
100 | int x, y; | 102 | int x, y; |
101 | int w, h; | 103 | int w, h; |
104 | int x2, y2; | ||
102 | }; | 105 | }; |
103 | 106 | ||
104 | /* | 107 | /* |
@@ -116,6 +119,37 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
116 | 119 | ||
117 | static struct usb_driver dlfb_driver; | 120 | static struct usb_driver dlfb_driver; |
118 | 121 | ||
122 | // thanks to Henrik Bjerregaard Pedersen for this function | ||
123 | static char *rle_compress16(uint16_t * src, char *dst, int rem) | ||
124 | { | ||
125 | |||
126 | int rl; | ||
127 | uint16_t pix0; | ||
128 | char *end_if_raw = dst + 6 + 2 * rem; | ||
129 | |||
130 | dst += 6; // header will be filled in if RLE is worth it | ||
131 | |||
132 | while (rem && dst < end_if_raw) { | ||
133 | char *start = (char *)src; | ||
134 | |||
135 | pix0 = *src++; | ||
136 | rl = 1; | ||
137 | rem--; | ||
138 | while (rem && *src == pix0) | ||
139 | rem--, rl++, src++; | ||
140 | *dst++ = rl; | ||
141 | *dst++ = start[1]; | ||
142 | *dst++ = start[0]; | ||
143 | } | ||
144 | |||
145 | return dst; | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | Thanks to Henrik Bjerregaard Pedersen for rle implementation and code refactoring. | ||
150 | Next step is huffman compression. | ||
151 | */ | ||
152 | |||
119 | static int | 153 | static int |
120 | image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | 154 | image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, |
121 | char *data) | 155 | char *data) |
@@ -125,7 +159,7 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
125 | int rem = width; | 159 | int rem = width; |
126 | int ret; | 160 | int ret; |
127 | 161 | ||
128 | int diff; | 162 | int firstdiff, thistime; |
129 | 163 | ||
130 | char *bufptr; | 164 | char *bufptr; |
131 | 165 | ||
@@ -137,7 +171,8 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
137 | 171 | ||
138 | mutex_lock(&dev_info->bulk_mutex); | 172 | mutex_lock(&dev_info->bulk_mutex); |
139 | 173 | ||
140 | base = dev_info->base16 + (dev_info->info->var.xres * 2 * y) + (x * 2); | 174 | base = |
175 | dev_info->base16 + ((dev_info->info->var.xres * 2 * y) + (x * 2)); | ||
141 | 176 | ||
142 | data += (dev_info->info->var.xres * 2 * y) + (x * 2); | 177 | data += (dev_info->info->var.xres * 2 * y) + (x * 2); |
143 | 178 | ||
@@ -164,86 +199,84 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
164 | bufptr - dev_info->buf); | 199 | bufptr - dev_info->buf); |
165 | bufptr = dev_info->buf; | 200 | bufptr = dev_info->buf; |
166 | } | 201 | } |
167 | 202 | // number of pixels to consider this time | |
168 | if (rem > 255) { | 203 | thistime = rem; |
169 | 204 | if (thistime > 255) | |
170 | diff = 0; | 205 | thistime = 255; |
171 | for (j = 0; j < 510; j++) { | 206 | |
172 | if (dev_info-> | 207 | // find position of first pixel that has changed |
173 | backing_buffer[base + j] != | 208 | firstdiff = -1; |
174 | data[j]) { | 209 | for (j = 0; j < thistime * 2; j++) { |
175 | diff = 1; | 210 | if (dev_info->backing_buffer |
176 | break; | 211 | [base - dev_info->base16 + j] != data[j]) { |
177 | } | 212 | firstdiff = j / 2; |
213 | break; | ||
178 | } | 214 | } |
215 | } | ||
179 | 216 | ||
180 | if (diff == 1) { | 217 | if (firstdiff >= 0) { |
181 | *bufptr++ = 0xAF; | 218 | char *end_of_rle; |
182 | *bufptr++ = 0x68; | 219 | |
183 | 220 | end_of_rle = | |
184 | *bufptr++ = (char)(base >> 16); | 221 | rle_compress16((uint16_t *) (data + |
185 | *bufptr++ = (char)(base >> 8); | 222 | firstdiff * 2), |
186 | *bufptr++ = (char)(base); | 223 | bufptr, |
187 | *bufptr++ = 255; | 224 | thistime - firstdiff); |
188 | /* PUT COMPRESSION HERE */ | 225 | |
189 | for (j = 0; j < 510; j += 2) { | 226 | if (end_of_rle < |
190 | bufptr[j] = data[j + 1]; | 227 | bufptr + 6 + 2 * (thistime - firstdiff)) { |
191 | bufptr[j + 1] = data[j]; | 228 | bufptr[0] = 0xAF; |
192 | } | 229 | bufptr[1] = 0x69; |
193 | bufptr += 510; | 230 | |
194 | } | 231 | bufptr[2] = |
195 | 232 | (char)((base + | |
196 | rem -= 255; | 233 | firstdiff * 2) >> 16); |
197 | base += 510; | 234 | bufptr[3] = |
198 | data += 510; | 235 | (char)((base + firstdiff * 2) >> 8); |
199 | } else { | 236 | bufptr[4] = |
200 | 237 | (char)(base + firstdiff * 2); | |
201 | diff = 0; | 238 | bufptr[5] = thistime - firstdiff; |
202 | 239 | ||
203 | for (j = 0; j < rem * 2; j++) { | 240 | bufptr = end_of_rle; |
204 | if (dev_info-> | 241 | |
205 | backing_buffer[base + j] != | 242 | } else { |
206 | data[j]) { | 243 | // fallback to raw (or some other encoding?) |
207 | diff = 1; | ||
208 | break; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | if (diff == 1) { | ||
213 | |||
214 | *bufptr++ = 0xAF; | 244 | *bufptr++ = 0xAF; |
215 | *bufptr++ = 0x68; | 245 | *bufptr++ = 0x68; |
216 | 246 | ||
217 | *bufptr++ = (char)(base >> 16); | 247 | *bufptr++ = |
218 | *bufptr++ = (char)(base >> 8); | 248 | (char)((base + |
219 | *bufptr++ = (char)(base); | 249 | firstdiff * 2) >> 16); |
220 | *bufptr++ = rem; | 250 | *bufptr++ = |
221 | /* PUT COMPRESSION HERE */ | 251 | (char)((base + firstdiff * 2) >> 8); |
222 | for (j = 0; j < rem * 2; j += 2) { | 252 | *bufptr++ = |
223 | bufptr[j] = data[j + 1]; | 253 | (char)(base + firstdiff * 2); |
224 | bufptr[j + 1] = data[j]; | 254 | *bufptr++ = thistime - firstdiff; |
255 | // PUT COMPRESSION HERE | ||
256 | for (j = firstdiff * 2; | ||
257 | j < thistime * 2; j += 2) { | ||
258 | *bufptr++ = data[j + 1]; | ||
259 | *bufptr++ = data[j]; | ||
225 | } | 260 | } |
226 | bufptr += rem * 2; | ||
227 | |||
228 | } | 261 | } |
229 | |||
230 | base += rem * 2; | ||
231 | data += rem * 2; | ||
232 | rem = 0; | ||
233 | } | 262 | } |
234 | 263 | ||
264 | base += thistime * 2; | ||
265 | data += thistime * 2; | ||
266 | rem -= thistime; | ||
235 | } | 267 | } |
236 | 268 | ||
237 | memcpy(dev_info->backing_buffer + base - (width * 2), | 269 | memcpy(dev_info->backing_buffer + (base - dev_info->base16) - |
238 | data - (width * 2), width * 2); | 270 | (width * 2), data - (width * 2), width * 2); |
239 | 271 | ||
240 | base += (dev_info->info->var.xres * 2) - (width * 2); | 272 | base += (dev_info->info->var.xres * 2) - (width * 2); |
241 | data += (dev_info->info->var.xres * 2) - (width * 2); | 273 | data += (dev_info->info->var.xres * 2) - (width * 2); |
242 | 274 | ||
243 | } | 275 | } |
244 | 276 | ||
245 | if (bufptr > dev_info->buf) | 277 | if (bufptr > dev_info->buf) { |
246 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | 278 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); |
279 | } | ||
247 | 280 | ||
248 | mutex_unlock(&dev_info->bulk_mutex); | 281 | mutex_unlock(&dev_info->bulk_mutex); |
249 | 282 | ||
@@ -280,8 +313,10 @@ draw_rect(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
280 | for (i = y; i < y + height; i++) { | 313 | for (i = y; i < y + height; i++) { |
281 | 314 | ||
282 | for (j = 0; j < width * 2; j += 2) { | 315 | for (j = 0; j < width * 2; j += 2) { |
283 | dev_info->backing_buffer[base + j] = (char)(col >> 8); | 316 | dev_info->backing_buffer[base - dev_info->base16 + j] = |
284 | dev_info->backing_buffer[base + j + 1] = (char)(col); | 317 | (char)(col >> 8); |
318 | dev_info->backing_buffer[base - dev_info->base16 + j + | ||
319 | 1] = (char)(col); | ||
285 | } | 320 | } |
286 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { | 321 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { |
287 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | 322 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); |
@@ -335,6 +370,111 @@ draw_rect(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
335 | return 1; | 370 | return 1; |
336 | } | 371 | } |
337 | 372 | ||
373 | static void swapfb(struct dlfb_data *dev_info) | ||
374 | { | ||
375 | |||
376 | int tmpbase; | ||
377 | char *bufptr; | ||
378 | |||
379 | mutex_lock(&dev_info->bulk_mutex); | ||
380 | |||
381 | tmpbase = dev_info->base16; | ||
382 | |||
383 | dev_info->base16 = dev_info->base16d; | ||
384 | dev_info->base16d = tmpbase; | ||
385 | |||
386 | bufptr = dev_info->buf; | ||
387 | |||
388 | bufptr = dlfb_set_register(bufptr, 0xFF, 0x00); | ||
389 | |||
390 | // set addresses | ||
391 | bufptr = | ||
392 | dlfb_set_register(bufptr, 0x20, (char)(dev_info->base16 >> 16)); | ||
393 | bufptr = dlfb_set_register(bufptr, 0x21, (char)(dev_info->base16 >> 8)); | ||
394 | bufptr = dlfb_set_register(bufptr, 0x22, (char)(dev_info->base16)); | ||
395 | |||
396 | bufptr = dlfb_set_register(bufptr, 0xFF, 0x00); | ||
397 | |||
398 | dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | ||
399 | |||
400 | mutex_unlock(&dev_info->bulk_mutex); | ||
401 | } | ||
402 | |||
403 | static int copyfb(struct dlfb_data *dev_info) | ||
404 | { | ||
405 | int base; | ||
406 | int source; | ||
407 | int rem; | ||
408 | int i, ret; | ||
409 | |||
410 | char *bufptr; | ||
411 | |||
412 | base = dev_info->base16d; | ||
413 | |||
414 | mutex_lock(&dev_info->bulk_mutex); | ||
415 | |||
416 | source = dev_info->base16; | ||
417 | |||
418 | bufptr = dev_info->buf; | ||
419 | |||
420 | for (i = 0; i < dev_info->info->var.yres; i++) { | ||
421 | |||
422 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { | ||
423 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | ||
424 | bufptr = dev_info->buf; | ||
425 | } | ||
426 | |||
427 | rem = dev_info->info->var.xres; | ||
428 | |||
429 | while (rem) { | ||
430 | |||
431 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { | ||
432 | ret = | ||
433 | dlfb_bulk_msg(dev_info, | ||
434 | bufptr - dev_info->buf); | ||
435 | bufptr = dev_info->buf; | ||
436 | |||
437 | } | ||
438 | |||
439 | *bufptr++ = 0xAF; | ||
440 | *bufptr++ = 0x6A; | ||
441 | |||
442 | *bufptr++ = (char)(base >> 16); | ||
443 | *bufptr++ = (char)(base >> 8); | ||
444 | *bufptr++ = (char)(base); | ||
445 | |||
446 | if (rem > 255) { | ||
447 | *bufptr++ = 255; | ||
448 | *bufptr++ = (char)(source >> 16); | ||
449 | *bufptr++ = (char)(source >> 8); | ||
450 | *bufptr++ = (char)(source); | ||
451 | |||
452 | rem -= 255; | ||
453 | base += 255 * 2; | ||
454 | source += 255 * 2; | ||
455 | |||
456 | } else { | ||
457 | *bufptr++ = rem; | ||
458 | *bufptr++ = (char)(source >> 16); | ||
459 | *bufptr++ = (char)(source >> 8); | ||
460 | *bufptr++ = (char)(source); | ||
461 | |||
462 | base += rem * 2; | ||
463 | source += rem * 2; | ||
464 | rem = 0; | ||
465 | } | ||
466 | } | ||
467 | } | ||
468 | |||
469 | if (bufptr > dev_info->buf) | ||
470 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | ||
471 | |||
472 | mutex_unlock(&dev_info->bulk_mutex); | ||
473 | |||
474 | return 1; | ||
475 | |||
476 | } | ||
477 | |||
338 | static int | 478 | static int |
339 | copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, | 479 | copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, |
340 | int width, int height) | 480 | int width, int height) |
@@ -362,7 +502,7 @@ copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, | |||
362 | 502 | ||
363 | for (i = sy; i < sy + height; i++) { | 503 | for (i = sy; i < sy + height; i++) { |
364 | 504 | ||
365 | memcpy(dev_info->backing_buffer + base, | 505 | memcpy(dev_info->backing_buffer + base - dev_info->base16, |
366 | dev_info->backing_buffer + source, width * 2); | 506 | dev_info->backing_buffer + source, width * 2); |
367 | 507 | ||
368 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { | 508 | if (dev_info->bufend - bufptr < BUF_HIGH_WATER_MARK) { |
@@ -447,7 +587,8 @@ static void dlfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
447 | /* printk("IMAGE BLIT (2) %d %d %d %d DEPTH %d {%p} %d!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev, ret); */ | 587 | /* printk("IMAGE BLIT (2) %d %d %d %d DEPTH %d {%p} %d!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev, ret); */ |
448 | } | 588 | } |
449 | 589 | ||
450 | static void dlfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) | 590 | static void dlfb_fillrect(struct fb_info *info, |
591 | const struct fb_fillrect *region) | ||
451 | { | 592 | { |
452 | 593 | ||
453 | unsigned char red, green, blue; | 594 | unsigned char red, green, blue; |
@@ -466,9 +607,18 @@ static int dlfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
466 | { | 607 | { |
467 | 608 | ||
468 | struct dlfb_data *dev_info = info->par; | 609 | struct dlfb_data *dev_info = info->par; |
469 | struct dloarea *area; | 610 | struct dloarea *area = NULL; |
470 | 611 | ||
471 | if (cmd == 0xAA) { | 612 | if (cmd == 0xAD) { |
613 | char *edid = (char *)arg; | ||
614 | dlfb_edid(dev_info); | ||
615 | if (copy_to_user(edid, dev_info->edid, 128)) { | ||
616 | return -EFAULT; | ||
617 | } | ||
618 | return 0; | ||
619 | } | ||
620 | |||
621 | if (cmd == 0xAA || cmd == 0xAB || cmd == 0xAC) { | ||
472 | 622 | ||
473 | area = (struct dloarea *)arg; | 623 | area = (struct dloarea *)arg; |
474 | 624 | ||
@@ -483,10 +633,29 @@ static int dlfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
483 | 633 | ||
484 | if (area->y > info->var.yres) | 634 | if (area->y > info->var.yres) |
485 | area->y = info->var.yres; | 635 | area->y = info->var.yres; |
636 | } | ||
486 | 637 | ||
638 | if (cmd == 0xAA) { | ||
487 | image_blit(dev_info, area->x, area->y, area->w, area->h, | 639 | image_blit(dev_info, area->x, area->y, area->w, area->h, |
488 | info->screen_base); | 640 | info->screen_base); |
489 | } | 641 | } |
642 | if (cmd == 0xAC) { | ||
643 | copyfb(dev_info); | ||
644 | image_blit(dev_info, area->x, area->y, area->w, area->h, | ||
645 | info->screen_base); | ||
646 | swapfb(dev_info); | ||
647 | } else if (cmd == 0xAB) { | ||
648 | |||
649 | if (area->x2 < 0) | ||
650 | area->x2 = 0; | ||
651 | |||
652 | if (area->y2 < 0) | ||
653 | area->y2 = 0; | ||
654 | |||
655 | copyarea(dev_info, | ||
656 | area->x2, area->y2, area->x, area->y, area->w, | ||
657 | area->h); | ||
658 | } | ||
490 | return 0; | 659 | return 0; |
491 | } | 660 | } |
492 | 661 | ||
@@ -528,6 +697,19 @@ static int dlfb_release(struct fb_info *info, int user) | |||
528 | 697 | ||
529 | static int dlfb_blank(int blank_mode, struct fb_info *info) | 698 | static int dlfb_blank(int blank_mode, struct fb_info *info) |
530 | { | 699 | { |
700 | struct dlfb_data *dev_info = info->par; | ||
701 | char *bufptr = dev_info->buf; | ||
702 | |||
703 | bufptr = dlfb_set_register(bufptr, 0xFF, 0x00); | ||
704 | if (blank_mode != FB_BLANK_UNBLANK) { | ||
705 | bufptr = dlfb_set_register(bufptr, 0x1F, 0x01); | ||
706 | } else { | ||
707 | bufptr = dlfb_set_register(bufptr, 0x1F, 0x00); | ||
708 | } | ||
709 | bufptr = dlfb_set_register(bufptr, 0xFF, 0xFF); | ||
710 | |||
711 | dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | ||
712 | |||
531 | return 0; | 713 | return 0; |
532 | } | 714 | } |
533 | 715 | ||
@@ -547,7 +729,6 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
547 | { | 729 | { |
548 | struct dlfb_data *dev_info; | 730 | struct dlfb_data *dev_info; |
549 | struct fb_info *info; | 731 | struct fb_info *info; |
550 | int i; | ||
551 | 732 | ||
552 | int ret; | 733 | int ret; |
553 | char rbuf[4]; | 734 | char rbuf[4]; |
@@ -588,15 +769,7 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
588 | printk("ret control msg 0: %d %x%x%x%x\n", ret, rbuf[0], rbuf[1], | 769 | printk("ret control msg 0: %d %x%x%x%x\n", ret, rbuf[0], rbuf[1], |
589 | rbuf[2], rbuf[3]); | 770 | rbuf[2], rbuf[3]); |
590 | 771 | ||
591 | for (i = 0; i < 128; i++) { | 772 | dlfb_edid(dev_info); |
592 | ret = | ||
593 | usb_control_msg(dev_info->udev, | ||
594 | usb_rcvctrlpipe(dev_info->udev, 0), (0x02), | ||
595 | (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, | ||
596 | 0); | ||
597 | /* printk("ret control msg edid %d: %d [%d]\n",i, ret, rbuf[1]); */ | ||
598 | dev_info->edid[i] = rbuf[1]; | ||
599 | } | ||
600 | 773 | ||
601 | info = framebuffer_alloc(sizeof(u32) * 256, &dev_info->udev->dev); | 774 | info = framebuffer_alloc(sizeof(u32) * 256, &dev_info->udev->dev); |
602 | 775 | ||
@@ -609,8 +782,14 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
609 | 782 | ||
610 | printk("EDID XRES %d YRES %d\n", info->var.xres, info->var.yres); | 783 | printk("EDID XRES %d YRES %d\n", info->var.xres, info->var.yres); |
611 | 784 | ||
612 | if (dlfb_set_video_mode(dev_info, info->var.xres, info->var.yres) != 0) | 785 | if (dlfb_set_video_mode(dev_info, info->var.xres, info->var.yres) != 0) { |
613 | goto out; | 786 | info->var.xres = 1280; |
787 | info->var.yres = 1024; | ||
788 | if (dlfb_set_video_mode | ||
789 | (dev_info, info->var.xres, info->var.yres) != 0) { | ||
790 | goto out; | ||
791 | } | ||
792 | } | ||
614 | 793 | ||
615 | printk("found valid mode...%d\n", info->var.pixclock); | 794 | printk("found valid mode...%d\n", info->var.pixclock); |
616 | 795 | ||
@@ -661,7 +840,12 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
661 | 840 | ||
662 | info->fix.smem_start = (unsigned long)info->screen_base; | 841 | info->fix.smem_start = (unsigned long)info->screen_base; |
663 | info->fix.smem_len = PAGE_ALIGN(dev_info->screen_size); | 842 | info->fix.smem_len = PAGE_ALIGN(dev_info->screen_size); |
664 | memcpy(info->fix.id, "DisplayLink FB", 14); | 843 | if (strlen(dev_info->udev->product) > 15) { |
844 | memcpy(info->fix.id, dev_info->udev->product, 15); | ||
845 | } else { | ||
846 | memcpy(info->fix.id, dev_info->udev->product, | ||
847 | strlen(dev_info->udev->product)); | ||
848 | } | ||
665 | info->fix.type = FB_TYPE_PACKED_PIXELS; | 849 | info->fix.type = FB_TYPE_PACKED_PIXELS; |
666 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 850 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
667 | info->fix.accel = info->flags; | 851 | info->fix.accel = info->flags; |
@@ -679,13 +863,13 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
679 | 863 | ||
680 | return 0; | 864 | return 0; |
681 | 865 | ||
682 | out2: | 866 | out2: |
683 | fb_dealloc_cmap(&info->cmap); | 867 | fb_dealloc_cmap(&info->cmap); |
684 | out1: | 868 | out1: |
685 | rvfree(info->screen_base, dev_info->screen_size); | 869 | rvfree(info->screen_base, dev_info->screen_size); |
686 | out0: | 870 | out0: |
687 | framebuffer_release(info); | 871 | framebuffer_release(info); |
688 | out: | 872 | out: |
689 | usb_set_intfdata(interface, NULL); | 873 | usb_set_intfdata(interface, NULL); |
690 | usb_put_dev(dev_info->udev); | 874 | usb_put_dev(dev_info->udev); |
691 | kfree(dev_info); | 875 | kfree(dev_info); |
diff --git a/drivers/staging/udlfb/udlfb.h b/drivers/staging/udlfb/udlfb.h index f69b1c586c1..08bd671204b 100644 --- a/drivers/staging/udlfb/udlfb.h +++ b/drivers/staging/udlfb/udlfb.h | |||
@@ -26,7 +26,9 @@ struct dlfb_data { | |||
26 | int line_length; | 26 | int line_length; |
27 | struct completion done; | 27 | struct completion done; |
28 | int base16; | 28 | int base16; |
29 | int base16d; | ||
29 | int base8; | 30 | int base8; |
31 | int base8d; | ||
30 | }; | 32 | }; |
31 | 33 | ||
32 | struct dlfb_video_mode { | 34 | struct dlfb_video_mode { |
@@ -48,6 +50,24 @@ static void dlfb_bulk_callback(struct urb *urb) | |||
48 | complete(&dev_info->done); | 50 | complete(&dev_info->done); |
49 | } | 51 | } |
50 | 52 | ||
53 | static void dlfb_edid(struct dlfb_data *dev_info) | ||
54 | { | ||
55 | int i; | ||
56 | int ret; | ||
57 | char rbuf[2]; | ||
58 | |||
59 | for (i = 0; i < 128; i++) { | ||
60 | ret = | ||
61 | usb_control_msg(dev_info->udev, | ||
62 | usb_rcvctrlpipe(dev_info->udev, 0), (0x02), | ||
63 | (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, | ||
64 | 0); | ||
65 | /*printk("ret control msg edid %d: %d [%d]\n",i, ret, rbuf[1]); */ | ||
66 | dev_info->edid[i] = rbuf[1]; | ||
67 | } | ||
68 | |||
69 | } | ||
70 | |||
51 | static int dlfb_bulk_msg(struct dlfb_data *dev_info, int len) | 71 | static int dlfb_bulk_msg(struct dlfb_data *dev_info, int len) |
52 | { | 72 | { |
53 | int ret; | 73 | int ret; |
@@ -129,8 +149,12 @@ static int dlfb_set_video_mode(struct dlfb_data *dev_info, int width, int height | |||
129 | && dlfb_video_modes[i].yres == height) { | 149 | && dlfb_video_modes[i].yres == height) { |
130 | 150 | ||
131 | dev_info->base16 = 0; | 151 | dev_info->base16 = 0; |
152 | dev_info->base16d = width * height * (FB_BPP / 8); | ||
132 | 153 | ||
133 | dev_info->base8 = width * height * (FB_BPP / 8);; | 154 | //dev_info->base8 = width * height * (FB_BPP / 8); |
155 | |||
156 | dev_info->base8 = dev_info->base16; | ||
157 | dev_info->base8d = dev_info->base16d; | ||
134 | 158 | ||
135 | /* set encryption key (null) */ | 159 | /* set encryption key (null) */ |
136 | memcpy(dev_info->buf, STD_CHANNEL, 16); | 160 | memcpy(dev_info->buf, STD_CHANNEL, 16); |
@@ -144,6 +168,9 @@ static int dlfb_set_video_mode(struct dlfb_data *dev_info, int width, int height | |||
144 | /* set registers */ | 168 | /* set registers */ |
145 | bufptr = dlfb_set_register(bufptr, 0xFF, 0x00); | 169 | bufptr = dlfb_set_register(bufptr, 0xFF, 0x00); |
146 | 170 | ||
171 | /* set color depth */ | ||
172 | bufptr = dlfb_set_register(bufptr, 0x00, 0x00); | ||
173 | |||
147 | /* set addresses */ | 174 | /* set addresses */ |
148 | bufptr = | 175 | bufptr = |
149 | dlfb_set_register(bufptr, 0x20, | 176 | dlfb_set_register(bufptr, 0x20, |