From 772aec7ed7bf9bd4b7e57a8a776a2b605e77ed09 Mon Sep 17 00:00:00 2001 From: Matt Sealey Date: Fri, 21 Jan 2011 15:40:57 -0600 Subject: [PATCH] efikamx: remove redundant crap from display platform file --- arch/arm/mach-mx5/mx51_efikamx_display.c | 233 ----------------------- 1 file changed, 233 deletions(-) diff --git a/arch/arm/mach-mx5/mx51_efikamx_display.c b/arch/arm/mach-mx5/mx51_efikamx_display.c index 531ecb02a14..4728046e09a 100644 --- a/arch/arm/mach-mx5/mx51_efikamx_display.c +++ b/arch/arm/mach-mx5/mx51_efikamx_display.c @@ -98,239 +98,6 @@ static struct mxc_vpu_platform_data mxc_vpu_data = { .reset = mx5_vpu_reset, }; - -int mxcfb_read_edid2(struct i2c_adapter *adp, char *edid, u16 len, struct fb_var_screeninfo *einfo, int *dvi) -{ - int i; - u8 buf0[2] = {0, 0}; - int dat = 0; - u16 addr = 0x50; - struct i2c_msg msg[2] = { - { - .addr = addr, - .flags = 0, - .len = 1, - .buf = buf0, - }, { - .addr = addr, - .flags = I2C_M_RD, - .len = 128, - .buf = edid, - }, - }; - - printk("%s \n", __func__ ); - - if (adp == NULL || einfo == NULL) - return -EINVAL; - - buf0[0] = 0x00; - memset(edid, 0, len); - memset(einfo, 0, sizeof(struct fb_var_screeninfo)); - msg[1].len = len; - dat = i2c_transfer(adp, msg, 2); - - /* If 0x50 fails, try 0x37. */ - if (edid[1] == 0x00) { - msg[0].addr = msg[1].addr = 0x37; - dat = i2c_transfer(adp, msg, 2); - } - - if (edid[1] == 0x00) - return -ENOENT; - - *dvi = 0; - if ((edid[20] == 0x80) || (edid[20] == 0x88) || (edid[20] == 0)) - *dvi = 1; - - dat = fb_parse_edid(edid, einfo); - if (dat) - return -dat; - - /* This is valid for version 1.3 of the EDID */ - if ((edid[18] == 1) && (edid[19] == 3)) { - einfo->height = edid[21] * 10; - einfo->width = edid[22] * 10; - } - - for(i=0; i< len; i+=32) { - int j=0; - - for(j=0; j<32; j++) { - printk("%02x", edid[i+j] ); - } - printk("\n"); - } - - return 0; -} - -static int mxcfb_dump_mode( const char *func_char, const struct fb_videomode *mode) -{ - if ( mode == NULL ) - return -1; - - printk(KERN_INFO "%s geometry %u %u %u\n", - func_char, mode->xres, mode->yres, mode->pixclock); - printk(KERN_INFO "%s timings %u %u %u %u %u %u %u\n", - func_char, mode->pixclock, mode->left_margin, mode->right_margin, - mode->upper_margin, mode->lower_margin, mode->hsync_len, mode->vsync_len ); - printk(KERN_INFO "%s flag %u sync %u vmode %u %s\n", - func_char, mode->flag, mode->sync, mode->vmode, mode->flag & FB_MODE_IS_FIRST ? "preferred" : "" ); - - return 0; -} - - -void mxcfb_videomode_to_modelist(const struct fb_info *info, const struct fb_videomode *modedb, int num, - struct list_head *head) -{ - int i, del = 0; - INIT_LIST_HEAD(head); - - for (i = 0; i < num; i++) { - struct list_head *pos, *n; - struct fb_modelist *modelist; - - del = 0; - - if ( modedb[i].pixclock < PIXCLK_LIMIT ) { - printk(KERN_INFO "%ux%u%s%u pclk=%u removed (exceed limit)\n", - modedb[i].xres, modedb[i].yres, - (modedb[i].vmode & FB_VMODE_INTERLACED ) ? "i@" : "@", - modedb[i].refresh, - modedb[i].pixclock ); - continue; - } else if ( (modedb[i].vmode & FB_VMODE_INTERLACED) ) { - printk(KERN_INFO "%ux%u%s%u pclk=%u removed (interlaced)\n", - modedb[i].xres, modedb[i].yres, - (modedb[i].vmode & FB_VMODE_INTERLACED ) ? "i@" : "@", - modedb[i].refresh, - modedb[i].pixclock ); - continue; - } - - list_for_each_safe(pos, n, head) { - modelist = list_entry(pos, struct fb_modelist, list); - - if ( res_matches_refresh(modelist->mode, - modedb[i].xres, modedb[i].yres, modedb[i].refresh) ) { - - /* if candidate is a detail timing, delete existing one in modelist ! - * note: some TV has 1280x720@60 in standard timings but also has 1280x720 in detail timing block - * in this case, use detail timing ! - */ - if ( modedb[i].flag & FB_MODE_IS_DETAILED ) { - - printk(KERN_INFO "%ux%u%s%u pclk=%u removed (duplicate)\n", - modelist->mode.xres, modelist->mode.yres, - (modelist->mode.vmode & FB_VMODE_INTERLACED ) ? "i@" : "@", - modelist->mode.refresh, - modelist->mode.pixclock ); - list_del(pos); - kfree(pos); - del = 1; - } - } - } - - if ( del == 0 ) - fb_add_videomode(&modedb[i], head); - - } - -} - -void mxcfb_sanitize_modelist(const struct fb_info *info, const struct fb_videomode *modedb, int num, - struct list_head *head) -{ - struct fb_videomode *pmode; - int i; - - pmode = (struct fb_videomode *) fb_find_best_display(&info->monspecs, head); - if (pmode) - { - //fb_dump_mode("PREFERRED", pmode); - memcpy((void *) &preferred_mode, (const void *) pmode, sizeof(struct fb_videomode)); - } - - for (i = 0; i < num; i++) { - - struct list_head *pos, *n; - struct fb_modelist *modelist; - - list_for_each_safe(pos, n, head) { - modelist = list_entry(pos, struct fb_modelist, list); - BUG_ON(modelist->mode.pixclock == 0); - if (modelist->mode.pixclock == 0) { - printk(KERN_ERR "skipping mode %ux%u due to bad pclk", - modelist->mode.xres, modelist->mode.yres); - continue; - } - if (PICOS2KHZ(modelist->mode.pixclock) > 133000 ) { - printk(KERN_INFO "%ux%u%s%u pclk=%u removed (pixclk higher than %lu limit)\n", - modelist->mode.xres, modelist->mode.yres, - (modelist->mode.vmode & FB_VMODE_INTERLACED ) ? "i@" : "@", - modelist->mode.refresh, - modelist->mode.pixclock, KHZ2PICOS(133000) ); - - if (0 == memcmp((void *) &preferred_mode, (void *) &modelist->mode, sizeof(struct fb_videomode))) - { - printk(KERN_INFO "uh-oh! deleted preferred mode!\n"); - } - list_del(pos); - kfree(pos); - } - } - - } -} - -int mxcfb_handle_edid2(struct i2c_adapter *adp, char *buffer, u16 len) -{ - int err = 0; - int dvi = 0; - struct fb_var_screeninfo screeninfo; - - memset(&screeninfo, 0, sizeof(screeninfo)); - - err = mxcfb_read_edid2(adp, buffer, len, &screeninfo, &dvi); - - if ( err ) - printk("read_edid error!\n"); - - return err; -} - -void mxcfb_update_default_var(struct fb_var_screeninfo *var, - struct fb_info *info, - const struct fb_videomode *def_mode ) -{ - struct fb_monspecs *specs = &info->monspecs; - const struct fb_videomode *mode = NULL; - struct fb_var_screeninfo var_tmp; - - printk(KERN_INFO "%s fb_mode_option = \"%s\"\n", __func__ , fb_mode_option ); - - if ( specs->modedb ) { - - fb_videomode_to_var( &var_tmp, def_mode); - mode = fb_find_nearest_mode( def_mode, &info->modelist ); - - if ( mode ) { - fb_videomode_to_var(var, mode); - printk(KERN_INFO "%ux%u@%u pclk=%u nearest mode is %ux%u@%u pclk=%u\n", - def_mode->xres, def_mode->yres, def_mode->refresh, def_mode->pixclock, - mode->xres, mode->yres, mode->refresh, mode->pixclock ); - mxcfb_dump_mode( "nearest mode", mode); - } - } - - if ( mode == NULL ) { /* no best monitor support mode timing found, use def_video_mode timing ! */ - fb_videomode_to_var(var, def_mode); - } -} - void __init mx51_efikamx_init_display(void) { CONFIG_IOMUX(mx51_efikamx_display_iomux_pins);