Exemplo n.º 1
0
static void gfb_free_framebuffer_work(struct work_struct *work)
{
	struct gfb_data *data = container_of(work, struct gfb_data,
                                             free_framebuffer_work.work);
	struct fb_info *info = data->fb_info;
	/* int node = info->node; */

	unregister_framebuffer(info);

	if (info->cmap.len != 0)
		fb_dealloc_cmap(&info->cmap);
	if (info->monspecs.modedb)
		fb_destroy_modedb(info->monspecs.modedb);
	if (info->screen_base)
		vfree(info->screen_base);

	fb_destroy_modelist(&info->modelist);
        fb_deferred_io_cleanup(info);

	usb_free_urb(data->fb_urb);

	vfree(data->fb_bitmap);
	kfree(data->fb_vbitmap);
	
	framebuffer_release(info);

        kfree(data);
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
0
static ssize_t bmi_video_dvi_edid_show(struct device *dev, 
				    struct device_attribute *attr, char *buf)
{
    struct bmi_video *video = dev_get_drvdata(dev);
	struct fb_monspecs monspecs;	/* Current Monitor specs */
	if(video->dvi_monitor_edid) {
		ssize_t len = 0;
		fb_edid_to_monspecs( video->dvi_monitor_edid, &monspecs);
		len = fb_edid_show(&monspecs, buf, PAGE_SIZE, 5);
		fb_destroy_modedb(monspecs.modedb);
		return len; 
	}
	
	return snprintf(buf,PAGE_SIZE,"(none)\n");
}