int ipaqlcd_fbinit(struct ipaqlcd_softc *sc) { struct hpcfb_fbconf *fb; fb = &sc->sc_fbconf; /* Initialize fb */ memset(fb, 0, sizeof(*fb)); fb->hf_conf_index = 0; /* configuration index */ fb->hf_nconfs = 1; strcpy(fb->hf_name, "built-in video"); strcpy(fb->hf_conf_name, "LCD"); /* configuration name */ fb->hf_height = bootinfo->fb_height; fb->hf_width = bootinfo->fb_width; if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr, bootinfo->fb_height * bootinfo->fb_line_bytes, 0, &fb->hf_baseaddr)) { aprint_normal("unable to map framebuffer\n"); return (-1); } fb->hf_offset = (u_long)bootinfo->fb_addr - __PTOB(__BTOP(bootinfo->fb_addr)); /* frame buffer start offset */ fb->hf_bytes_per_line = bootinfo->fb_line_bytes; fb->hf_nplanes = 1; fb->hf_bytes_per_plane = bootinfo->fb_height * bootinfo->fb_line_bytes; fb->hf_access_flags |= HPCFB_ACCESS_BYTE; fb->hf_access_flags |= HPCFB_ACCESS_WORD; fb->hf_access_flags |= HPCFB_ACCESS_DWORD; switch (bootinfo->fb_type) { /* * gray scale */ case BIFB_D2_M2L_3: case BIFB_D2_M2L_3x2: fb->hf_access_flags |= HPCFB_ACCESS_REVERSE; case BIFB_D2_M2L_0: case BIFB_D2_M2L_0x2: fb->hf_class = HPCFB_CLASS_GRAYSCALE; break; case BIFB_D4_M2L_F: case BIFB_D4_M2L_Fx2: fb->hf_access_flags |= HPCFB_ACCESS_REVERSE; case BIFB_D4_M2L_0: case BIFB_D4_M2L_0x2: fb->hf_class = HPCFB_CLASS_GRAYSCALE; break; /* * indexed color */ case BIFB_D8_FF: case BIFB_D8_00: fb->hf_offset = 0x200; break; /* * RGB color */ case BIFB_D16_FFFF: case BIFB_D16_0000: fb->hf_class = HPCFB_CLASS_RGBCOLOR; fb->hf_access_flags |= HPCFB_ACCESS_STATIC; fb->hf_order_flags = HPCFB_REVORDER_BYTE; fb->hf_pack_width = 16; fb->hf_pixels_per_pack = 1; fb->hf_pixel_width = 16; fb->hf_class_data_length = sizeof(struct hf_rgb_tag); fb->hf_u.hf_rgb.hf_flags = 0; /* reserved for future use */ fb->hf_u.hf_rgb.hf_red_width = 5; fb->hf_u.hf_rgb.hf_red_shift = 11; fb->hf_u.hf_rgb.hf_green_width = 6; fb->hf_u.hf_rgb.hf_green_shift = 5; fb->hf_u.hf_rgb.hf_blue_width = 5; fb->hf_u.hf_rgb.hf_blue_shift = 0; fb->hf_u.hf_rgb.hf_alpha_width = 0; fb->hf_u.hf_rgb.hf_alpha_shift = 0; break; default : aprint_normal("unknown type (=%d).\n", bootinfo->fb_type); return (-1); break; } return(0); }
static int sed1356_init(struct hpcfb_fbconf *fb) { /* * get fb settings from bootinfo */ if (bootinfo == NULL || bootinfo->fb_addr == 0 || bootinfo->fb_line_bytes == 0 || bootinfo->fb_width == 0 || bootinfo->fb_height == 0) { printf("no frame buffer information.\n"); return -1; } /* zero fill */ memset(fb, 0, sizeof(*fb)); fb->hf_conf_index = 0; /* configuration index */ fb->hf_nconfs = 1; /* how many configurations */ strcpy(fb->hf_name, "built-in video"); /* frame buffer name */ strcpy(fb->hf_conf_name, "default"); /* configuration name */ fb->hf_height = bootinfo->fb_height; fb->hf_width = bootinfo->fb_width; if (bus_space_map(&sa11x0_bs_tag, (bus_addr_t)bootinfo->fb_addr, bootinfo->fb_height * bootinfo->fb_line_bytes, 0, &fb->hf_baseaddr)) { printf("unable to map framebuffer\n"); return -1; } fb->hf_offset = (u_long)bootinfo->fb_addr - __PTOB(__BTOP(bootinfo->fb_addr)); /* frame buffer start offset */ fb->hf_bytes_per_line = bootinfo->fb_line_bytes; fb->hf_nplanes = 1; fb->hf_bytes_per_plane = bootinfo->fb_height * bootinfo->fb_line_bytes; fb->hf_access_flags |= HPCFB_ACCESS_BYTE; fb->hf_access_flags |= HPCFB_ACCESS_WORD; fb->hf_access_flags |= HPCFB_ACCESS_DWORD; switch (bootinfo->fb_type) { /* * gray scale */ case BIFB_D4_M2L_F: case BIFB_D4_M2L_Fx2: fb->hf_access_flags |= HPCFB_ACCESS_REVERSE; /* fall through */ case BIFB_D4_M2L_0: case BIFB_D4_M2L_0x2: fb->hf_class = HPCFB_CLASS_GRAYSCALE; fb->hf_access_flags |= HPCFB_ACCESS_STATIC; fb->hf_pack_width = 8; fb->hf_pixels_per_pack = 2; fb->hf_pixel_width = 4; fb->hf_class_data_length = sizeof(struct hf_gray_tag); fb->hf_u.hf_gray.hf_flags = 0; /* reserved for future use */ break; /* * indexed color */ case BIFB_D8_FF: fb->hf_access_flags |= HPCFB_ACCESS_REVERSE; /* fall through */ case BIFB_D8_00: fb->hf_class = HPCFB_CLASS_INDEXCOLOR; fb->hf_access_flags |= HPCFB_ACCESS_STATIC; fb->hf_pack_width = 8; fb->hf_pixels_per_pack = 1; fb->hf_pixel_width = 8; fb->hf_class_data_length = sizeof(struct hf_indexed_tag); fb->hf_u.hf_indexed.hf_flags = 0; /* reserved for future use */ break; /* * RGB color */ case BIFB_D16_FFFF: fb->hf_access_flags |= HPCFB_ACCESS_REVERSE; /* fall through */ case BIFB_D16_0000: fb->hf_class = HPCFB_CLASS_RGBCOLOR; fb->hf_access_flags |= HPCFB_ACCESS_STATIC; fb->hf_order_flags = HPCFB_REVORDER_BYTE; fb->hf_pack_width = 16; fb->hf_pixels_per_pack = 1; fb->hf_pixel_width = 16; fb->hf_class_data_length = sizeof(struct hf_rgb_tag); fb->hf_u.hf_rgb.hf_flags = 0; /* reserved for future use */ fb->hf_u.hf_rgb.hf_red_width = 5; fb->hf_u.hf_rgb.hf_red_shift = 11; fb->hf_u.hf_rgb.hf_green_width = 6; fb->hf_u.hf_rgb.hf_green_shift = 5; fb->hf_u.hf_rgb.hf_blue_width = 5; fb->hf_u.hf_rgb.hf_blue_shift = 0; fb->hf_u.hf_rgb.hf_alpha_width = 0; fb->hf_u.hf_rgb.hf_alpha_shift = 0; break; default: printf("unsupported type %d.\n", bootinfo->fb_type); return -1; } return 0; /* no error */ }