1/*- 2 * Copyright (c) 2013 Oleksandr Tymoshenko <gonzo@freebsd.org> 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 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26#include <sys/cdefs.h> 27__FBSDID("$FreeBSD: stable/11/sys/arm/ti/am335x/am335x_lcd_syscons.c 356110 2019-12-27 03:00:18Z kevans $"); 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> 32#include <sys/conf.h> 33#include <sys/endian.h> 34#include <sys/kernel.h> 35#include <sys/lock.h> 36#include <sys/malloc.h> 37#include <sys/module.h> 38#include <sys/mutex.h> 39#include <sys/resource.h> 40#include <sys/rman.h> 41#include <sys/fbio.h> 42#include <sys/consio.h> 43 44#include <sys/kdb.h> 45 46#include <machine/bus.h> 47#include <machine/resource.h> 48#include <machine/intr.h> 49 50#include <dev/fdt/fdt_common.h> 51#include <dev/ofw/ofw_bus.h> 52#include <dev/ofw/ofw_bus_subr.h> 53 54#include <dev/fb/fbreg.h> 55#include <dev/syscons/syscons.h> 56 57#include "am335x_lcd.h" 58 59struct video_adapter_softc { 60 /* Videoadpater part */ 61 video_adapter_t va; 62 int console; 63 64 intptr_t fb_addr; 65 intptr_t fb_paddr; 66 unsigned int fb_size; 67 68 unsigned int height; 69 unsigned int width; 70 unsigned int depth; 71 unsigned int stride; 72 73 unsigned int xmargin; 74 unsigned int ymargin; 75 76 unsigned char *font; 77 int initialized; 78}; 79 80struct argb { 81 uint8_t a; 82 uint8_t r; 83 uint8_t g; 84 uint8_t b; 85}; 86 87static struct argb am335x_syscons_palette[16] = { 88 {0x00, 0x00, 0x00, 0x00}, 89 {0x00, 0x00, 0x00, 0xaa}, 90 {0x00, 0x00, 0xaa, 0x00}, 91 {0x00, 0x00, 0xaa, 0xaa}, 92 {0x00, 0xaa, 0x00, 0x00}, 93 {0x00, 0xaa, 0x00, 0xaa}, 94 {0x00, 0xaa, 0x55, 0x00}, 95 {0x00, 0xaa, 0xaa, 0xaa}, 96 {0x00, 0x55, 0x55, 0x55}, 97 {0x00, 0x55, 0x55, 0xff}, 98 {0x00, 0x55, 0xff, 0x55}, 99 {0x00, 0x55, 0xff, 0xff}, 100 {0x00, 0xff, 0x55, 0x55}, 101 {0x00, 0xff, 0x55, 0xff}, 102 {0x00, 0xff, 0xff, 0x55}, 103 {0x00, 0xff, 0xff, 0xff} 104}; 105 106/* mouse pointer from dev/syscons/scgfbrndr.c */ 107static u_char mouse_pointer[16] = { 108 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, 109 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 110}; 111 112#define AM335X_FONT_HEIGHT 16 113 114#define FB_WIDTH 640 115#define FB_HEIGHT 480 116#define FB_DEPTH 24 117 118static struct video_adapter_softc va_softc; 119 120static int am335x_syscons_configure(int flags); 121 122/* 123 * Video driver routines and glue. 124 */ 125static vi_probe_t am335x_syscons_probe; 126static vi_init_t am335x_syscons_init; 127static vi_get_info_t am335x_syscons_get_info; 128static vi_query_mode_t am335x_syscons_query_mode; 129static vi_set_mode_t am335x_syscons_set_mode; 130static vi_save_font_t am335x_syscons_save_font; 131static vi_load_font_t am335x_syscons_load_font; 132static vi_show_font_t am335x_syscons_show_font; 133static vi_save_palette_t am335x_syscons_save_palette; 134static vi_load_palette_t am335x_syscons_load_palette; 135static vi_set_border_t am335x_syscons_set_border; 136static vi_save_state_t am335x_syscons_save_state; 137static vi_load_state_t am335x_syscons_load_state; 138static vi_set_win_org_t am335x_syscons_set_win_org; 139static vi_read_hw_cursor_t am335x_syscons_read_hw_cursor; 140static vi_set_hw_cursor_t am335x_syscons_set_hw_cursor; 141static vi_set_hw_cursor_shape_t am335x_syscons_set_hw_cursor_shape; 142static vi_blank_display_t am335x_syscons_blank_display; 143static vi_mmap_t am335x_syscons_mmap; 144static vi_ioctl_t am335x_syscons_ioctl; 145static vi_clear_t am335x_syscons_clear; 146static vi_fill_rect_t am335x_syscons_fill_rect; 147static vi_bitblt_t am335x_syscons_bitblt; 148static vi_diag_t am335x_syscons_diag; 149static vi_save_cursor_palette_t am335x_syscons_save_cursor_palette; 150static vi_load_cursor_palette_t am335x_syscons_load_cursor_palette; 151static vi_copy_t am335x_syscons_copy; 152static vi_putp_t am335x_syscons_putp; 153static vi_putc_t am335x_syscons_putc; 154static vi_puts_t am335x_syscons_puts; 155static vi_putm_t am335x_syscons_putm; 156 157static video_switch_t am335x_sysconsvidsw = { 158 .probe = am335x_syscons_probe, 159 .init = am335x_syscons_init, 160 .get_info = am335x_syscons_get_info, 161 .query_mode = am335x_syscons_query_mode, 162 .set_mode = am335x_syscons_set_mode, 163 .save_font = am335x_syscons_save_font, 164 .load_font = am335x_syscons_load_font, 165 .show_font = am335x_syscons_show_font, 166 .save_palette = am335x_syscons_save_palette, 167 .load_palette = am335x_syscons_load_palette, 168 .set_border = am335x_syscons_set_border, 169 .save_state = am335x_syscons_save_state, 170 .load_state = am335x_syscons_load_state, 171 .set_win_org = am335x_syscons_set_win_org, 172 .read_hw_cursor = am335x_syscons_read_hw_cursor, 173 .set_hw_cursor = am335x_syscons_set_hw_cursor, 174 .set_hw_cursor_shape = am335x_syscons_set_hw_cursor_shape, 175 .blank_display = am335x_syscons_blank_display, 176 .mmap = am335x_syscons_mmap, 177 .ioctl = am335x_syscons_ioctl, 178 .clear = am335x_syscons_clear, 179 .fill_rect = am335x_syscons_fill_rect, 180 .bitblt = am335x_syscons_bitblt, 181 .diag = am335x_syscons_diag, 182 .save_cursor_palette = am335x_syscons_save_cursor_palette, 183 .load_cursor_palette = am335x_syscons_load_cursor_palette, 184 .copy = am335x_syscons_copy, 185 .putp = am335x_syscons_putp, 186 .putc = am335x_syscons_putc, 187 .puts = am335x_syscons_puts, 188 .putm = am335x_syscons_putm, 189}; 190 191VIDEO_DRIVER(am335x_syscons, am335x_sysconsvidsw, am335x_syscons_configure); 192 193static vr_init_t am335x_rend_init; 194static vr_clear_t am335x_rend_clear; 195static vr_draw_border_t am335x_rend_draw_border; 196static vr_draw_t am335x_rend_draw; 197static vr_set_cursor_t am335x_rend_set_cursor; 198static vr_draw_cursor_t am335x_rend_draw_cursor; 199static vr_blink_cursor_t am335x_rend_blink_cursor; 200static vr_set_mouse_t am335x_rend_set_mouse; 201static vr_draw_mouse_t am335x_rend_draw_mouse; 202 203/* 204 * We use our own renderer; this is because we must emulate a hardware 205 * cursor. 206 */ 207static sc_rndr_sw_t am335x_rend = { 208 am335x_rend_init, 209 am335x_rend_clear, 210 am335x_rend_draw_border, 211 am335x_rend_draw, 212 am335x_rend_set_cursor, 213 am335x_rend_draw_cursor, 214 am335x_rend_blink_cursor, 215 am335x_rend_set_mouse, 216 am335x_rend_draw_mouse 217}; 218 219RENDERER(am335x_syscons, 0, am335x_rend, gfb_set); 220RENDERER_MODULE(am335x_syscons, gfb_set); 221 222static void 223am335x_rend_init(scr_stat* scp) 224{ 225} 226 227static void 228am335x_rend_clear(scr_stat* scp, int c, int attr) 229{ 230} 231 232static void 233am335x_rend_draw_border(scr_stat* scp, int color) 234{ 235} 236 237static void 238am335x_rend_draw(scr_stat* scp, int from, int count, int flip) 239{ 240 video_adapter_t* adp = scp->sc->adp; 241 int i, c, a; 242 243 if (!flip) { 244 /* Normal printing */ 245 vidd_puts(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); 246 } else { 247 /* This is for selections and such: invert the color attribute */ 248 for (i = count; i-- > 0; ++from) { 249 c = sc_vtb_getc(&scp->vtb, from); 250 a = sc_vtb_geta(&scp->vtb, from) >> 8; 251 vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); 252 } 253 } 254} 255 256static void 257am335x_rend_set_cursor(scr_stat* scp, int base, int height, int blink) 258{ 259} 260 261static void 262am335x_rend_draw_cursor(scr_stat* scp, int off, int blink, int on, int flip) 263{ 264 video_adapter_t* adp = scp->sc->adp; 265 struct video_adapter_softc *sc; 266 int row, col; 267 uint8_t *addr; 268 int i, j, bytes; 269 270 sc = (struct video_adapter_softc *)adp; 271 272 if (scp->curs_attr.height <= 0) 273 return; 274 275 if (sc->fb_addr == 0) 276 return; 277 278 if (off >= adp->va_info.vi_width * adp->va_info.vi_height) 279 return; 280 281 /* calculate the coordinates in the video buffer */ 282 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; 283 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; 284 285 addr = (uint8_t *)sc->fb_addr 286 + (row + sc->ymargin)*(sc->stride) 287 + (sc->depth/8) * (col + sc->xmargin); 288 289 bytes = sc->depth/8; 290 291 /* our cursor consists of simply inverting the char under it */ 292 for (i = 0; i < adp->va_info.vi_cheight; i++) { 293 for (j = 0; j < adp->va_info.vi_cwidth; j++) { 294 switch (sc->depth) { 295 case 32: 296 case 24: 297 addr[bytes*j + 2] ^= 0xff; 298 /* FALLTHROUGH */ 299 case 16: 300 addr[bytes*j + 1] ^= 0xff; 301 addr[bytes*j] ^= 0xff; 302 break; 303 default: 304 break; 305 } 306 } 307 308 addr += sc->stride; 309 } 310} 311 312static void 313am335x_rend_blink_cursor(scr_stat* scp, int at, int flip) 314{ 315} 316 317static void 318am335x_rend_set_mouse(scr_stat* scp) 319{ 320} 321 322static void 323am335x_rend_draw_mouse(scr_stat* scp, int x, int y, int on) 324{ 325 vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); 326} 327 328static uint16_t am335x_syscons_static_window[ROW*COL]; 329extern u_char dflt_font_16[]; 330 331/* 332 * Update videoadapter settings after changing resolution 333 */ 334static void 335am335x_syscons_update_margins(video_adapter_t *adp) 336{ 337 struct video_adapter_softc *sc; 338 video_info_t *vi; 339 340 sc = (struct video_adapter_softc *)adp; 341 vi = &adp->va_info; 342 343 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; 344 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; 345} 346 347static phandle_t 348am335x_syscons_find_panel_node(phandle_t start) 349{ 350 phandle_t child; 351 phandle_t result; 352 353 for (child = OF_child(start); child != 0; child = OF_peer(child)) { 354 if (fdt_is_compatible(child, "ti,am335x-lcd")) 355 return (child); 356 if ((result = am335x_syscons_find_panel_node(child))) 357 return (result); 358 } 359 360 return (0); 361} 362 363static int 364am335x_syscons_configure(int flags) 365{ 366 struct video_adapter_softc *va_sc; 367 368 va_sc = &va_softc; 369 phandle_t display, root; 370 pcell_t cell; 371 372 if (va_sc->initialized) 373 return (0); 374 375 va_sc->width = 0; 376 va_sc->height = 0; 377 378 /* 379 * It seems there is no way to let syscons framework know 380 * that framebuffer resolution has changed. So just try 381 * to fetch data from FDT and go with defaults if failed 382 */ 383 root = OF_finddevice("/"); 384 if ((root != 0) && 385 (display = am335x_syscons_find_panel_node(root))) { 386 if ((OF_getencprop(display, "panel_width", &cell, 387 sizeof(cell))) > 0) 388 va_sc->width = cell; 389 390 if ((OF_getencprop(display, "panel_height", &cell, 391 sizeof(cell))) > 0) 392 va_sc->height = cell; 393 } 394 395 if (va_sc->width == 0) 396 va_sc->width = FB_WIDTH; 397 if (va_sc->height == 0) 398 va_sc->height = FB_HEIGHT; 399 400 am335x_syscons_init(0, &va_sc->va, 0); 401 402 va_sc->initialized = 1; 403 404 return (0); 405} 406 407static int 408am335x_syscons_probe(int unit, video_adapter_t **adp, void *arg, int flags) 409{ 410 411 return (0); 412} 413 414static int 415am335x_syscons_init(int unit, video_adapter_t *adp, int flags) 416{ 417 struct video_adapter_softc *sc; 418 video_info_t *vi; 419 420 sc = (struct video_adapter_softc *)adp; 421 vi = &adp->va_info; 422 423 vid_init_struct(adp, "am335x_syscons", -1, unit); 424 425 sc->font = dflt_font_16; 426 vi->vi_cheight = AM335X_FONT_HEIGHT; 427 vi->vi_cwidth = 8; 428 429 vi->vi_width = sc->width/8; 430 vi->vi_height = sc->height/vi->vi_cheight; 431 432 /* 433 * Clamp width/height to syscons maximums 434 */ 435 if (vi->vi_width > COL) 436 vi->vi_width = COL; 437 if (vi->vi_height > ROW) 438 vi->vi_height = ROW; 439 440 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2; 441 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2; 442 443 444 adp->va_window = (vm_offset_t) am335x_syscons_static_window; 445 adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */; 446 447 vid_register(&sc->va); 448 449 return (0); 450} 451 452static int 453am335x_syscons_get_info(video_adapter_t *adp, int mode, video_info_t *info) 454{ 455 bcopy(&adp->va_info, info, sizeof(*info)); 456 return (0); 457} 458 459static int 460am335x_syscons_query_mode(video_adapter_t *adp, video_info_t *info) 461{ 462 return (0); 463} 464 465static int 466am335x_syscons_set_mode(video_adapter_t *adp, int mode) 467{ 468 return (0); 469} 470 471static int 472am335x_syscons_save_font(video_adapter_t *adp, int page, int size, int width, 473 u_char *data, int c, int count) 474{ 475 return (0); 476} 477 478static int 479am335x_syscons_load_font(video_adapter_t *adp, int page, int size, int width, 480 u_char *data, int c, int count) 481{ 482 struct video_adapter_softc *sc = (struct video_adapter_softc *)adp; 483 484 sc->font = data; 485 486 return (0); 487} 488 489static int 490am335x_syscons_show_font(video_adapter_t *adp, int page) 491{ 492 return (0); 493} 494 495static int 496am335x_syscons_save_palette(video_adapter_t *adp, u_char *palette) 497{ 498 return (0); 499} 500 501static int 502am335x_syscons_load_palette(video_adapter_t *adp, u_char *palette) 503{ 504 return (0); 505} 506 507static int 508am335x_syscons_set_border(video_adapter_t *adp, int border) 509{ 510 return (am335x_syscons_blank_display(adp, border)); 511} 512 513static int 514am335x_syscons_save_state(video_adapter_t *adp, void *p, size_t size) 515{ 516 return (0); 517} 518 519static int 520am335x_syscons_load_state(video_adapter_t *adp, void *p) 521{ 522 return (0); 523} 524 525static int 526am335x_syscons_set_win_org(video_adapter_t *adp, off_t offset) 527{ 528 return (0); 529} 530 531static int 532am335x_syscons_read_hw_cursor(video_adapter_t *adp, int *col, int *row) 533{ 534 *col = *row = 0; 535 536 return (0); 537} 538 539static int 540am335x_syscons_set_hw_cursor(video_adapter_t *adp, int col, int row) 541{ 542 return (0); 543} 544 545static int 546am335x_syscons_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, 547 int celsize, int blink) 548{ 549 return (0); 550} 551 552static int 553am335x_syscons_blank_display(video_adapter_t *adp, int mode) 554{ 555 556 struct video_adapter_softc *sc; 557 558 sc = (struct video_adapter_softc *)adp; 559 if (sc && sc->fb_addr) 560 memset((void*)sc->fb_addr, 0, sc->fb_size); 561 562 return (0); 563} 564 565static int 566am335x_syscons_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr, 567 int prot, vm_memattr_t *memattr) 568{ 569 struct video_adapter_softc *sc; 570 571 sc = (struct video_adapter_softc *)adp; 572 573 /* 574 * This might be a legacy VGA mem request: if so, just point it at the 575 * framebuffer, since it shouldn't be touched 576 */ 577 if (offset < sc->stride*sc->height) { 578 *paddr = sc->fb_paddr + offset; 579 return (0); 580 } 581 582 return (EINVAL); 583} 584 585static int 586am335x_syscons_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data) 587{ 588 struct video_adapter_softc *sc; 589 struct fbtype *fb; 590 591 sc = (struct video_adapter_softc *)adp; 592 593 switch (cmd) { 594 case FBIOGTYPE: 595 fb = (struct fbtype *)data; 596 fb->fb_type = FBTYPE_PCIMISC; 597 fb->fb_height = sc->height; 598 fb->fb_width = sc->width; 599 fb->fb_depth = sc->depth; 600 if (sc->depth <= 1 || sc->depth > 8) 601 fb->fb_cmsize = 0; 602 else 603 fb->fb_cmsize = 1 << sc->depth; 604 fb->fb_size = sc->fb_size; 605 break; 606 default: 607 return (fb_commonioctl(adp, cmd, data)); 608 } 609 610 return (0); 611} 612 613static int 614am335x_syscons_clear(video_adapter_t *adp) 615{ 616 617 return (am335x_syscons_blank_display(adp, 0)); 618} 619 620static int 621am335x_syscons_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) 622{ 623 624 return (0); 625} 626 627static int 628am335x_syscons_bitblt(video_adapter_t *adp, ...) 629{ 630 631 return (0); 632} 633 634static int 635am335x_syscons_diag(video_adapter_t *adp, int level) 636{ 637 638 return (0); 639} 640 641static int 642am335x_syscons_save_cursor_palette(video_adapter_t *adp, u_char *palette) 643{ 644 645 return (0); 646} 647 648static int 649am335x_syscons_load_cursor_palette(video_adapter_t *adp, u_char *palette) 650{ 651 652 return (0); 653} 654 655static int 656am335x_syscons_copy(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, int n) 657{ 658 659 return (0); 660} 661 662static int 663am335x_syscons_putp(video_adapter_t *adp, vm_offset_t off, uint32_t p, uint32_t a, 664 int size, int bpp, int bit_ltor, int byte_ltor) 665{ 666 667 return (0); 668} 669 670static int 671am335x_syscons_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a) 672{ 673 struct video_adapter_softc *sc; 674 int row; 675 int col; 676 int i, j, k; 677 uint8_t *addr; 678 u_char *p; 679 uint8_t fg, bg, color; 680 uint16_t rgb; 681 682 sc = (struct video_adapter_softc *)adp; 683 684 if (sc->fb_addr == 0) 685 return (0); 686 687 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; 688 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; 689 p = sc->font + c*AM335X_FONT_HEIGHT; 690 addr = (uint8_t *)sc->fb_addr 691 + (row + sc->ymargin)*(sc->stride) 692 + (sc->depth/8) * (col + sc->xmargin); 693 694 fg = a & 0xf ; 695 bg = (a >> 4) & 0xf; 696 697 for (i = 0; i < AM335X_FONT_HEIGHT; i++) { 698 for (j = 0, k = 7; j < 8; j++, k--) { 699 if ((p[i] & (1 << k)) == 0) 700 color = bg; 701 else 702 color = fg; 703 704 switch (sc->depth) { 705 case 32: 706 addr[4*j+0] = am335x_syscons_palette[color].r; 707 addr[4*j+1] = am335x_syscons_palette[color].g; 708 addr[4*j+2] = am335x_syscons_palette[color].b; 709 addr[4*j+3] = am335x_syscons_palette[color].a; 710 break; 711 case 24: 712 addr[3*j] = am335x_syscons_palette[color].r; 713 addr[3*j+1] = am335x_syscons_palette[color].g; 714 addr[3*j+2] = am335x_syscons_palette[color].b; 715 break; 716 case 16: 717 rgb = (am335x_syscons_palette[color].r >> 3) << 11; 718 rgb |= (am335x_syscons_palette[color].g >> 2) << 5; 719 rgb |= (am335x_syscons_palette[color].b >> 3); 720 addr[2*j] = rgb & 0xff; 721 addr[2*j + 1] = (rgb >> 8) & 0xff; 722 default: 723 /* Not supported yet */ 724 break; 725 } 726 } 727 728 addr += (sc->stride); 729 } 730 731 return (0); 732} 733 734static int 735am335x_syscons_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len) 736{ 737 int i; 738 739 for (i = 0; i < len; i++) 740 am335x_syscons_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8); 741 742 return (0); 743} 744 745static int 746am335x_syscons_putm(video_adapter_t *adp, int x, int y, uint8_t *pixel_image, 747 uint32_t pixel_mask, int size, int width) 748{ 749 750 return (0); 751} 752 753/* Initialization function */ 754int am335x_lcd_syscons_setup(vm_offset_t vaddr, vm_paddr_t paddr, 755 struct panel_info *panel) 756{ 757 struct video_adapter_softc *va_sc = &va_softc; 758 759 va_sc->fb_addr = vaddr; 760 va_sc->fb_paddr = paddr; 761 va_sc->depth = panel->bpp; 762 va_sc->stride = panel->bpp*panel->panel_width/8; 763 764 va_sc->width = panel->panel_width; 765 va_sc->height = panel->panel_height; 766 va_sc->fb_size = va_sc->width * va_sc->height 767 * va_sc->depth/8; 768 am335x_syscons_update_margins(&va_sc->va); 769 770 return (0); 771} 772