static int __init lcd_edid_init(void) { int ret; lcdedid = kzalloc(sizeof(struct lcd_edid), GFP_KERNEL); if (!lcdedid) { pr_err("lcd_edid: Unable to allocate memory!\n"); return -ENOMEM; } lcdedid->specs = kzalloc(sizeof(struct fb_monspecs), GFP_KERNEL); if (!lcdedid->specs) { kfree(lcdedid); pr_err("lcd_edid: Unable to allocate memory!\n"); return -ENOMEM; } lcdedid->bus = 2; lcdedid->edid = tegra_edid_create(lcdedid->bus); if (!lcdedid->edid) { pr_err("lcd_edid: can't create edid\n"); } ret = tegra_edid_get_monspecs(lcdedid->edid, lcdedid->specs); if (ret < 0) { // pr_err("error reading edid\n"); } return 0; }
static int tegra_dc_rgb_init(struct tegra_dc *dc) { struct tegra_edid *edid; struct tegra_dc_edid *dc_edid; struct fb_monspecs specs; int err; if (dc->out == NULL || dc->out->dcc_bus < 0) return 0; edid = tegra_edid_create(dc->out->dcc_bus); if (IS_ERR_OR_NULL(edid)) { dev_err(&dc->ndev->dev, "rgb: can't create edid\n"); return PTR_ERR(edid); } err = tegra_edid_get_monspecs(edid, &specs); if (err < 0) { dev_err(&dc->ndev->dev, "error reading edid\n"); return err; } if (dc->pdata->default_out->n_modes > 0) { dc->mode.h_sync_width = specs.modedb->hsync_len; dc->mode.v_sync_width = specs.modedb->vsync_len; dc->mode.h_back_porch = specs.modedb->left_margin; dc->mode.v_back_porch = specs.modedb->upper_margin; dc->mode.h_active = specs.modedb->xres; dc->mode.v_active = specs.modedb->yres; dc->mode.h_front_porch = specs.modedb->right_margin; if (!machine_is_avalon() && !machine_is_titan()) dc->mode.pclk = PICOS2KHZ(specs.modedb->pixclock) * 1000; if (!machine_is_avalon()) dc->mode.v_front_porch = specs.modedb->lower_margin; } if (dc->pdata->fb) { dc->pdata->fb->xres = specs.modedb->xres; dc->pdata->fb->yres = specs.modedb->yres; } dc_edid = tegra_edid_get_data(edid); if (IS_ERR_OR_NULL(dc_edid)) return PTR_ERR(dc_edid); dc->out->width = dc_edid->buf[DTD_H_SIZE]; dc->out->height = dc_edid->buf[DTD_V_SIZE]; tegra_edid_put_data(dc_edid); if (specs.modedb->xres > specs.modedb->yres) { if (dc->out->width <= dc->out->height) dc->out->width += 0xFF; } else { if (dc->out->width > dc->out->height) dc->out->height += 0xFF; } fb_destroy_modedb(specs.modedb); return 0; }
static int tegra_dc_rgb_init(struct tegra_dc *dc) { struct tegra_edid *edid; struct fb_monspecs specs; int err; edid = tegra_edid_create(dc->out->dcc_bus); if (IS_ERR_OR_NULL(edid)) { dev_err(&dc->ndev->dev, "rgb: can't create edid\n"); err = PTR_ERR(edid); return err; } err = tegra_edid_get_monspecs(edid, &specs); if (err < 0) { dev_err(&dc->ndev->dev, "error reading edid\n"); return err; } if (dc->pdata->default_out->n_modes > 0) { dc->mode.pclk = PICOS2KHZ(specs.modedb->pixclock) * 1000; dc->mode.h_ref_to_sync = 1; dc->mode.v_ref_to_sync = 1; dc->mode.h_sync_width = specs.modedb->hsync_len; dc->mode.v_sync_width = specs.modedb->vsync_len; dc->mode.h_back_porch = specs.modedb->left_margin; dc->mode.v_back_porch = specs.modedb->upper_margin; dc->mode.h_active = specs.modedb->xres; dc->mode.v_active = specs.modedb->yres; dc->mode.h_front_porch = specs.modedb->right_margin; dc->mode.v_front_porch = specs.modedb->lower_margin; } if (dc->pdata->fb) { dc->pdata->fb->xres = specs.modedb->xres; dc->pdata->fb->yres = specs.modedb->yres; } dc->out->width = specs.max_x * 10; dc->out->height = specs.max_y * 10; return 0; }