void viafb_set_gamma_table(int bpp, unsigned int *gamma_table) { int i, sr1a; int active_device_amount = 0; int device_status = viafb_DeviceStatus; for (i = 0; i < sizeof(viafb_DeviceStatus) * 8; i++) { if (device_status & 1) active_device_amount++; device_status >>= 1; } if (bpp == 8) return ; switch (viaparinfo->chip_info->gfx_chip_name) { case UNICHROME_CLE266: case UNICHROME_K400: viafb_write_reg_mask(SR16, VIASR, 0x80, BIT7); break; case UNICHROME_K800: case UNICHROME_PM800: case UNICHROME_CN700: case UNICHROME_CX700: case UNICHROME_K8M890: case UNICHROME_P4M890: case UNICHROME_P4M900: viafb_write_reg_mask(CR33, VIACR, 0x80, BIT7); break; } sr1a = (unsigned int)viafb_read_reg(VIASR, SR1A); viafb_write_reg_mask(SR1A, VIASR, 0x0, BIT0); outb(0, LUT_INDEX_WRITE); for (i = 0; i < 256; i++) { outb(gamma_table[i] >> 16, LUT_DATA); outb(gamma_table[i] >> 8 & 0xFF, LUT_DATA); outb(gamma_table[i] & 0xFF, LUT_DATA); } if ((active_device_amount > 1) && !((viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) && (viaparinfo->chip_info->gfx_chip_revision < 15))) { viafb_write_reg_mask(SR1A, VIASR, 0x01, BIT0); viafb_write_reg_mask(CR6A, VIACR, 0x02, BIT1); outb(0, LUT_INDEX_WRITE); for (i = 0; i < 256; i++) { outb(gamma_table[i] >> 16, LUT_DATA); outb(gamma_table[i] >> 8 & 0xFF, LUT_DATA); outb(gamma_table[i] & 0xFF, LUT_DATA); } }
unsigned int viafb_get_memsize(void) { unsigned int m; /* If memory size provided by user */ if (viafb_memsize) m = viafb_memsize * Mb; else { m = (unsigned int)viafb_read_reg(VIASR, SR39); m = m * (4 * Mb); if ((m < (16 * Mb)) || (m > (64 * Mb))) m = 16 * Mb; } DEBUG_MSG(KERN_INFO "framebuffer size = %d Mb\n", m / Mb); return m; }
void viafb_init_lcd_size(void) { struct lvds_setting_information *lvds_info = viaparinfo->lvds_setting_info, *lvds_info2 = viaparinfo->lvds_setting_info2; int index, method = viaparinfo->lvds_setting_info->get_lcd_size_method; DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n"); DEBUG_MSG(KERN_INFO "viaparinfo->lvds_setting_info->get_lcd_size_method %d\n", lvds_info->get_lcd_size_method); if (method != GET_LCD_SIZE_BY_SYSTEM_BIOS && method != GET_LCD_SZIE_BY_HW_STRAPPING) { if (method != GET_LCD_SIZE_BY_VGA_BIOS && method != GET_LCD_SIZE_BY_USER_SETTING) viafb_lcd_panel_id = 1; if (viafb_lcd_panel_id > LCD_PANEL_ID_MAXIMUM) viafb_lcd_panel_id = viafb_read_reg(VIACR, CR3F) & 0x0F; if (viafb_lcd_panel_id > sizeof( flat_panel_id2info ) / sizeof( flat_panel_id2info[0] )) viafb_lcd_panel_id = 1; index = flat_panel_id2info[ viafb_lcd_panel_id ].lcd_panel_id; lvds_info->lcd_panel_hres = lcd_panel_id2res[ index ].xres; lvds_info->lcd_panel_vres = lcd_panel_id2res[ index ].yres; lvds_info->lcd_panel_id = index; lvds_info->device_lcd_dualedge = flat_panel_id2info[ viafb_lcd_panel_id ].dualedge; lvds_info->LCDDithering = flat_panel_id2info[ viafb_lcd_panel_id ].dithering; lvds_info->lcd_panel_size =lcd_panel_id2res[ index ].res_id; } lvds_info2->lcd_panel_id = lvds_info->lcd_panel_id; lvds_info2->lcd_panel_size = lvds_info->lcd_panel_size; lvds_info2->lcd_panel_hres = lvds_info->lcd_panel_hres; lvds_info2->lcd_panel_vres = lvds_info->lcd_panel_vres; lvds_info2->device_lcd_dualedge = lvds_info->device_lcd_dualedge; lvds_info2->LCDDithering = lvds_info->LCDDithering; }
bool __devinit viafb_tmds_trasmitter_identify(void) { unsigned char sr2a = 0, sr1e = 0, sr3e = 0; /* Turn on ouputting pad */ switch (viaparinfo->chip_info->gfx_chip_name) { case UNICHROME_K8M890: /*=* DFP Low Pad on *=*/ sr2a = viafb_read_reg(VIASR, SR2A); viafb_write_reg_mask(SR2A, VIASR, 0x03, BIT0 + BIT1); break; case UNICHROME_P4M900: case UNICHROME_P4M890: /* DFP Low Pad on */ sr2a = viafb_read_reg(VIASR, SR2A); viafb_write_reg_mask(SR2A, VIASR, 0x03, BIT0 + BIT1); /* DVP0 Pad on */ sr1e = viafb_read_reg(VIASR, SR1E); viafb_write_reg_mask(SR1E, VIASR, 0xC0, BIT6 + BIT7); break; default: /* DVP0/DVP1 Pad on */ sr1e = viafb_read_reg(VIASR, SR1E); viafb_write_reg_mask(SR1E, VIASR, 0xF0, BIT4 + BIT5 + BIT6 + BIT7); /* SR3E[1]Multi-function selection: 0 = Emulate I2C and DDC bus by GPIO2/3/4. */ sr3e = viafb_read_reg(VIASR, SR3E); viafb_write_reg_mask(SR3E, VIASR, 0x0, BIT5); break; } /* Check for VT1632: */ viaparinfo->chip_info->tmds_chip_info.tmds_chip_name = VT1632_TMDS; viaparinfo->chip_info-> tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR; viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_31; if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) { /* * Currently only support 12bits,dual edge,add 24bits mode later */ tmds_register_write(0x08, 0x3b); DEBUG_MSG(KERN_INFO "\n VT1632 TMDS ! \n"); DEBUG_MSG(KERN_INFO "\n %2d", viaparinfo->chip_info->tmds_chip_info.tmds_chip_name); DEBUG_MSG(KERN_INFO "\n %2d", viaparinfo->chip_info->tmds_chip_info.i2c_port); return true; } else { viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_2C; if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) { tmds_register_write(0x08, 0x3b); DEBUG_MSG(KERN_INFO "\n VT1632 TMDS ! \n"); DEBUG_MSG(KERN_INFO "\n %2d", viaparinfo->chip_info-> tmds_chip_info.tmds_chip_name); DEBUG_MSG(KERN_INFO "\n %2d", viaparinfo->chip_info-> tmds_chip_info.i2c_port); return true; } } viaparinfo->chip_info->tmds_chip_info.tmds_chip_name = INTEGRATED_TMDS; if ((viaparinfo->chip_info->gfx_chip_name == UNICHROME_CX700) && ((viafb_display_hardware_layout == HW_LAYOUT_DVI_ONLY) || (viafb_display_hardware_layout == HW_LAYOUT_LCD_DVI))) { DEBUG_MSG(KERN_INFO "\n Integrated TMDS ! \n"); return true; } switch (viaparinfo->chip_info->gfx_chip_name) { case UNICHROME_K8M890: viafb_write_reg(SR2A, VIASR, sr2a); break; case UNICHROME_P4M900: case UNICHROME_P4M890: viafb_write_reg(SR2A, VIASR, sr2a); viafb_write_reg(SR1E, VIASR, sr1e); break; default: viafb_write_reg(SR1E, VIASR, sr1e); viafb_write_reg(SR3E, VIASR, sr3e); break; } viaparinfo->chip_info-> tmds_chip_info.tmds_chip_name = NON_TMDS_TRANSMITTER; viaparinfo->chip_info->tmds_chip_info. tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR; return false; }